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