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