xref: /trunk/main/vcl/inc/unx/i18n_ic.hxx (revision cdf0e10c)
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_INPUTCONTEXT_HXX
29 #define _SAL_I18N_INPUTCONTEXT_HXX
30 
31 #include <i18npool/lang.h>
32 #include "i18n_cb.hxx"
33 
34 class SalI18N_InputContext
35 {
36 
37 private:
38 
39 	Bool    mbUseable; // system supports current locale ?
40 	Bool    mbMultiLingual; // system supports iiimp ?
41 	XIC		maContext;
42 
43 	XIMStyle mnSupportedStatusStyle;
44 	XIMStyle mnSupportedPreeditStyle;
45 	XIMStyle mnStatusStyle;
46 	XIMStyle mnPreeditStyle;
47 
48 	preedit_data_t maClientData;
49 	XIMCallback maPreeditStartCallback;
50 	XIMCallback maPreeditDoneCallback;
51 	XIMCallback maPreeditDrawCallback;
52 	XIMCallback maPreeditCaretCallback;
53 	XIMCallback maCommitStringCallback;
54     XIMCallback maSwitchIMCallback;
55 	XIMCallback maDestroyCallback;
56 
57 	XVaNestedList mpAttributes;
58 	XVaNestedList mpStatusAttributes;
59 	XVaNestedList mpPreeditAttributes;
60 
61 	Bool 		 SupportInputMethodStyle( XIMStyles *pIMStyles );
62 	unsigned int GetWeightingOfIMStyle(   XIMStyle n_style ) const ;
63 	Bool 		 IsSupportedIMStyle(      XIMStyle n_style ) const ;
64 
65 public:
66 
67 	Bool UseContext() 		{ return mbUseable; }
68 	Bool IsMultiLingual() 	{ return mbMultiLingual; }
69 	Bool IsPreeditMode()	{ return maClientData.eState == ePreeditStatusActive; }
70 	XIC  GetContext() 		{ return maContext; }
71 
72 	void ExtendEventMask(  XLIB_Window aFocusWindow );
73 	void SetICFocus( SalFrame* pFocusFrame );
74 	void UnsetICFocus( SalFrame* pFrame );
75     void HandleDestroyIM();
76 
77 	int  HandleKeyEvent( XKeyEvent *pEvent, SalFrame *pFrame ); // unused
78 	void EndExtTextInput( sal_uInt16 nFlags );						// unused
79 	int  CommitStringCallback( sal_Unicode* pText, sal_Size nLength );
80     int  CommitKeyEvent( sal_Unicode* pText, sal_Size nLength );
81     int  UpdateSpotLocation();
82 
83 	void Map( SalFrame *pFrame );
84 	void Unmap( SalFrame* pFrame );
85 
86     void SetPreeditState(Bool aPreeditState);
87     void SetLanguage(LanguageType aInputLanguage);
88 
89 	SalI18N_InputContext( SalFrame *aFrame );
90 	~SalI18N_InputContext();
91 
92 private:
93 
94 	SalI18N_InputContext(); // do not use this
95 
96 };
97 
98 #endif // _SAL_I18N_INPUTCONTEXT_HXX
99 
100 
101