1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SAL_I18N_XKBDEXTENSION_HXX 29 #define _SAL_I18N_XKBDEXTENSION_HXX 30 31 #include <sal/types.h> 32 #include <vclpluginapi.h> 33 34 class VCLPLUG_GEN_PUBLIC SalI18N_KeyboardExtension 35 { 36 private: 37 38 sal_Bool mbUseExtension; 39 sal_uInt32 mnDefaultGroup; 40 sal_uInt32 mnGroup; 41 int mnEventBase; 42 int mnErrorBase; 43 Display* mpDisplay; 44 45 public: 46 47 SalI18N_KeyboardExtension( Display *pDisplay ); 48 inline ~SalI18N_KeyboardExtension(); 49 50 inline sal_Bool UseExtension() const ; // server and client support the 51 // extension 52 inline void UseExtension( sal_Bool bState );// used to disable the Extension 53 54 void Dispatch( XEvent *pEvent ); // keep track of group changes 55 56 sal_uInt32 LookupKeysymInGroup( sal_uInt32 nKeyCode, 57 sal_uInt32 nShiftState, 58 sal_uInt32 nGroup ) const ; 59 60 inline sal_uInt32 LookupKeysymInDefaultGroup( 61 sal_uInt32 nKeyCode, 62 sal_uInt32 nShiftState ) const ; 63 inline sal_uInt32 GetGroup() const ; // the current keyboard group 64 inline sal_uInt32 GetDefaultGroup() const ; // base group, usually group 1 65 inline int GetEventBase() const ; 66 67 protected: 68 69 SalI18N_KeyboardExtension(); // disabled 70 }; 71 72 inline 73 SalI18N_KeyboardExtension::~SalI18N_KeyboardExtension() 74 { 75 } 76 77 inline sal_Bool 78 SalI18N_KeyboardExtension::UseExtension() const 79 { 80 return mbUseExtension; 81 } 82 83 inline void 84 SalI18N_KeyboardExtension::UseExtension( sal_Bool bState ) 85 { 86 mbUseExtension = mbUseExtension && bState; 87 } 88 89 inline sal_uInt32 90 SalI18N_KeyboardExtension::LookupKeysymInDefaultGroup( sal_uInt32 nKeyCode, 91 sal_uInt32 nShiftState ) const 92 { 93 return LookupKeysymInGroup( nKeyCode, nShiftState, mnDefaultGroup ); 94 } 95 96 inline sal_uInt32 97 SalI18N_KeyboardExtension::GetGroup() const 98 { 99 return mnGroup; 100 } 101 102 inline sal_uInt32 103 SalI18N_KeyboardExtension::GetDefaultGroup() const 104 { 105 return mnDefaultGroup; 106 } 107 108 inline int 109 SalI18N_KeyboardExtension::GetEventBase() const 110 { 111 return mnEventBase; 112 } 113 114 #endif // _SAL_I18N_XKBDEXTENSION_HXX 115 116