xref: /AOO41X/main/vcl/inc/unx/i18n_xkb.hxx (revision 161f4cd18255d886c4e915aa80ba7159d59cb848)
1*161f4cd1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*161f4cd1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*161f4cd1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*161f4cd1SAndrew Rist  * distributed with this work for additional information
6*161f4cd1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*161f4cd1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*161f4cd1SAndrew Rist  * "License"); you may not use this file except in compliance
9*161f4cd1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*161f4cd1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*161f4cd1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*161f4cd1SAndrew Rist  * software distributed under the License is distributed on an
15*161f4cd1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*161f4cd1SAndrew Rist  * KIND, either express or implied.  See the License for the
17*161f4cd1SAndrew Rist  * specific language governing permissions and limitations
18*161f4cd1SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*161f4cd1SAndrew Rist  *************************************************************/
21*161f4cd1SAndrew Rist 
22*161f4cd1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SAL_I18N_XKBDEXTENSION_HXX
25cdf0e10cSrcweir #define _SAL_I18N_XKBDEXTENSION_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sal/types.h>
28cdf0e10cSrcweir #include <vclpluginapi.h>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class VCLPLUG_GEN_PUBLIC SalI18N_KeyboardExtension
31cdf0e10cSrcweir {
32cdf0e10cSrcweir private:
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 	sal_Bool 			mbUseExtension;
35cdf0e10cSrcweir 	sal_uInt32			mnDefaultGroup;
36cdf0e10cSrcweir 	sal_uInt32			mnGroup;
37cdf0e10cSrcweir 	int  		        mnEventBase;
38cdf0e10cSrcweir 	int                 mnErrorBase;
39cdf0e10cSrcweir 	Display*   			mpDisplay;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir public:
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 						SalI18N_KeyboardExtension( Display *pDisplay );
44cdf0e10cSrcweir 	inline 				~SalI18N_KeyboardExtension();
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	inline sal_Bool		UseExtension() const ;		// server and client support the
47cdf0e10cSrcweir 													// extension
48cdf0e10cSrcweir 	inline void			UseExtension( sal_Bool bState );// used to disable the Extension
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	void				Dispatch( XEvent *pEvent ); // keep track of group changes
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	sal_uInt32			LookupKeysymInGroup( 	sal_uInt32 nKeyCode,
53cdf0e10cSrcweir 						 				 		sal_uInt32 nShiftState,
54cdf0e10cSrcweir 						 				 		sal_uInt32 nGroup ) const ;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	inline sal_uInt32 	LookupKeysymInDefaultGroup(
57cdf0e10cSrcweir 												sal_uInt32 nKeyCode,
58cdf0e10cSrcweir 												sal_uInt32 nShiftState ) const ;
59cdf0e10cSrcweir 	inline sal_uInt32 	GetGroup() const ;			// the current keyboard group
60cdf0e10cSrcweir 	inline sal_uInt32 	GetDefaultGroup() const ;	// base group, usually group 1
61cdf0e10cSrcweir 	inline int       	GetEventBase() const ;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir protected:
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 						SalI18N_KeyboardExtension(); // disabled
66cdf0e10cSrcweir };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir inline
~SalI18N_KeyboardExtension()69cdf0e10cSrcweir SalI18N_KeyboardExtension::~SalI18N_KeyboardExtension()
70cdf0e10cSrcweir {
71cdf0e10cSrcweir }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir inline sal_Bool
UseExtension() const74cdf0e10cSrcweir SalI18N_KeyboardExtension::UseExtension() const
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	return mbUseExtension;
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir inline void
UseExtension(sal_Bool bState)80cdf0e10cSrcweir SalI18N_KeyboardExtension::UseExtension( sal_Bool bState )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir 	mbUseExtension = mbUseExtension && bState;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir inline sal_uInt32
LookupKeysymInDefaultGroup(sal_uInt32 nKeyCode,sal_uInt32 nShiftState) const86cdf0e10cSrcweir SalI18N_KeyboardExtension::LookupKeysymInDefaultGroup( sal_uInt32 nKeyCode,
87cdf0e10cSrcweir 													   sal_uInt32 nShiftState ) const
88cdf0e10cSrcweir {
89cdf0e10cSrcweir 	return LookupKeysymInGroup( nKeyCode, nShiftState, mnDefaultGroup );
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir inline sal_uInt32
GetGroup() const93cdf0e10cSrcweir SalI18N_KeyboardExtension::GetGroup() const
94cdf0e10cSrcweir {
95cdf0e10cSrcweir 	return mnGroup;
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir inline sal_uInt32
GetDefaultGroup() const99cdf0e10cSrcweir SalI18N_KeyboardExtension::GetDefaultGroup() const
100cdf0e10cSrcweir {
101cdf0e10cSrcweir 	return mnDefaultGroup;
102cdf0e10cSrcweir }
103cdf0e10cSrcweir 
104cdf0e10cSrcweir inline int
GetEventBase() const105cdf0e10cSrcweir SalI18N_KeyboardExtension::GetEventBase() const
106cdf0e10cSrcweir {
107cdf0e10cSrcweir 	return mnEventBase;
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir #endif // _SAL_I18N_XKBDEXTENSION_HXX
111cdf0e10cSrcweir 
112