|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: drop-down list control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_GENERICITUTDATAMGR_H |
|
20 #define C_GENERICITUTDATAMGR_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <PtiDefs.h> |
|
24 #include <AknLayout2Def.h> |
|
25 |
|
26 #include "peninputgenericitutpropertysubscriber.h" |
|
27 #include "peninputgenericitutdata.h" |
|
28 |
|
29 class CPtiEngine; |
|
30 class CFont; |
|
31 class MItutLayoutContext; |
|
32 class CGenericItutWindowManager; |
|
33 |
|
34 extern const TInt KInvalidResId; |
|
35 extern const TInt KMaxPredictCandCnt; |
|
36 extern const TInt KInvalidImMode; |
|
37 const TInt KMaxFileLength = 80; |
|
38 |
|
39 |
|
40 class CGenericItutDataMgr : public CBase |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * struct SItem |
|
45 * Choice list item data structure. |
|
46 * |
|
47 */ |
|
48 struct TMenuItem |
|
49 { |
|
50 /* |
|
51 * Command of choice list item. |
|
52 */ |
|
53 TInt iCommand; |
|
54 |
|
55 /* |
|
56 * Title of choice list item. |
|
57 */ |
|
58 TBuf<100> iText; |
|
59 }; |
|
60 public: |
|
61 static CGenericItutDataMgr* NewL(MItutLayoutContext* aLayoutContext, CPtiEngine* aPtiEngine ); |
|
62 |
|
63 ~CGenericItutDataMgr(); |
|
64 |
|
65 void AddSubscriber(MItutPropertySubscriber* aSubscriber); |
|
66 |
|
67 // should be called by owner when initialize data manager, and when SizeChanged |
|
68 void ReadLafInfo(); |
|
69 |
|
70 void SetLanguageL(TInt aLanguage); |
|
71 |
|
72 void SetInputModeL(TInt aMode); |
|
73 |
|
74 void SetCase(TInt aCase); |
|
75 |
|
76 TAny* RequestData(TInt aDataType); |
|
77 |
|
78 inline CPtiEngine* PtiEngine(); |
|
79 |
|
80 // if there is need to change keypad layout, aKeypadResId: new keypad resource id |
|
81 void NotifyChangeControlLayout(MItutPropertySubscriber::TItutProperty aPropertyName, |
|
82 TInt aCtrlResId); |
|
83 |
|
84 inline TInt InputLanguage(); |
|
85 inline TBool IsValidLanguage(TInt aLanguage); |
|
86 inline TInt InputMode(); |
|
87 |
|
88 inline TInt TextCase(); |
|
89 |
|
90 inline TBool IsLandScape(); |
|
91 |
|
92 inline TBool IsSpellMode(); |
|
93 |
|
94 TBool IsExistPlusChar(); |
|
95 inline void SetSpellMode(TBool aSpellMode); |
|
96 |
|
97 inline void SetIndicatorData(TFepIndicatorInfo &aIndicatorData); |
|
98 inline TFepIndicatorInfo IndicatorData(); |
|
99 |
|
100 |
|
101 inline void SetLatinOnly( TBool aLatinOnly ); |
|
102 |
|
103 void SetUpdate(TBool aNeedUpdate); |
|
104 TBool IsUpdate() const; |
|
105 // when user press navi-next button on dropdownlist, there is need to |
|
106 // retrieve next page candidate |
|
107 TInt GetNextPageCandidateL(RPointerArray<HBufC>& aList); |
|
108 |
|
109 TBool NextPageCandidateExist(); |
|
110 |
|
111 void ClearChnCandidates(TInt aCmd); |
|
112 |
|
113 TInt KeypadResourceId(); |
|
114 |
|
115 TBool IsChinese(); |
|
116 TBool IsKorean(); // tp teleca addon |
|
117 TBool IsHindi(); |
|
118 TBool IsThai(); |
|
119 |
|
120 // Is Right to Left language |
|
121 TBool IsRtoLLanguage(); |
|
122 TBool IsRtoLLanguage( TInt aLanguage ); |
|
123 TBool IsLangDirectionSwitch() const; |
|
124 inline void SetLangDirectionSwitch( TBool aIsChange ); |
|
125 |
|
126 void SetTextAlignment(); |
|
127 |
|
128 void SetIcfTextAlignment(TInt aAlignment); |
|
129 |
|
130 void SetNumericKeymap( const TInt aKeymap ); |
|
131 |
|
132 void SetNumericKeymapData( TInt* aKeymapData ); |
|
133 |
|
134 inline TBool IsCharFlagChanged(); |
|
135 |
|
136 inline void SetNumericOnly( TBool aIsNumberOnly ); |
|
137 |
|
138 inline TBool IsNumericOnly() const; |
|
139 |
|
140 TMenuItem* GetMenuItem(TInt aCommand); |
|
141 |
|
142 TPoint iSelectionTl; |
|
143 TSize iSelectionItemSize; |
|
144 TInt iSelectionItemMargin; |
|
145 TInt iSelectionHorMargin; |
|
146 TInt iSelectionVerMargin; |
|
147 TSize iSelectionNaviSize; |
|
148 TSize iSelectionNaviInnerSize; |
|
149 TAknTextLineLayout iSelectionTextLine; |
|
150 TAknTextLineLayout iSelectionPageTextLine; |
|
151 |
|
152 TInt iIcfTextLeftMargin; |
|
153 TInt iIcfTextRightMargin; |
|
154 TInt iIcfTextTopMargin; |
|
155 TInt iIcfTextBottomMargin; |
|
156 TInt iIcfTextLineSpaceMargin; |
|
157 TInt iIcfTextHeight; |
|
158 |
|
159 TInt iIcfTextLeftMarginCn; |
|
160 TInt iIcfTextRightMarginCn; |
|
161 TInt iIcfTextTopMarginCn; |
|
162 TInt iIcfTextBottomMarginCn; |
|
163 TInt iIcfTextLineSpaceMarginCn; |
|
164 TInt iIcfTextHeightCn; |
|
165 |
|
166 TRect iShiftIconRect; |
|
167 private: |
|
168 CGenericItutDataMgr(MItutLayoutContext* aLayoutContext, CPtiEngine* aPtiEngine ); |
|
169 |
|
170 void ConstructL(); |
|
171 |
|
172 void NotifySubscriber( MItutPropertySubscriber::TItutProperty aPropertyName, |
|
173 const TDesC& aValue); |
|
174 |
|
175 // return current script index |
|
176 TInt GetConfigResFileName(TInt aLang); |
|
177 |
|
178 // return index in aArray |
|
179 TInt FindLang(const TInt* aArray, TInt aEndIdx, TInt aLang); |
|
180 |
|
181 static const TDesC& ResFileExtByScriptIdx(const TScriptExtIndex aIndex); |
|
182 |
|
183 // whether both of aMode1 & aMode2 are chinese mode, or both of them are western mode |
|
184 |
|
185 void CalWesternIndicator(); |
|
186 |
|
187 TInt ChineseKeypadResourceId(); |
|
188 |
|
189 TInt HindiKeypadResourceId(); |
|
190 TInt KoreanKeypadResourceId(); |
|
191 |
|
192 private: // data member |
|
193 RPointerArray<MItutPropertySubscriber> iSubscriberList; |
|
194 CPtiEngine* iPtiEngine; |
|
195 TInt iLanguage; |
|
196 TInt iInputMode; |
|
197 TInt iCase; |
|
198 |
|
199 TSize iScreenSize; |
|
200 |
|
201 // offset of layout, compare to screen |
|
202 TPoint iLayoutOffset; |
|
203 TRect iLayoutRect; |
|
204 |
|
205 TRect iIcfWesRect; |
|
206 TRect iIcfChnRect; |
|
207 CFont* iIcfFont; |
|
208 CFont* iIcfFontCn; |
|
209 TInt iIcfTextAlignment; |
|
210 |
|
211 TRect iBackspaceRect; |
|
212 TRect iBackspaceInnerRect; |
|
213 TRect iBackspaceCnRect; |
|
214 TRect iBackspaceInnerCnRect; |
|
215 TRect iSwitchRect; |
|
216 TRect iSwitchInnerRect; |
|
217 TRect iSwitchCnRect; |
|
218 TRect iSwitchInnerCnRect; |
|
219 TRect iArrowLeftRect; |
|
220 TRect iArrowLeftInnerRect; |
|
221 TRect iArrowLeftCnRect; |
|
222 TRect iArrowLeftInnerCnRect; |
|
223 TRect iArrowRightRect; |
|
224 TRect iArrowRightInnerRect; |
|
225 TRect iArrowRightCnRect; |
|
226 TRect iArrowRightInnerCnRect; |
|
227 TRect iArrowUpRect; |
|
228 TRect iArrowDownRect; |
|
229 TRect iArrowUpInnerRect; |
|
230 TRect iArrowDownInnerRect; |
|
231 |
|
232 |
|
233 TRect iImIndicatorWesRect; |
|
234 TRect iCalindwesternRect; |
|
235 TRect iImIndiOuterRect; |
|
236 TRect iImIndiOuterRectCn; |
|
237 TRect iImIndicatorChnRect; |
|
238 |
|
239 TRect iSendRect; |
|
240 TRect iDisconnRect; |
|
241 |
|
242 TRect iKeypadRect; |
|
243 TRect iKeypadRectCn; |
|
244 TRect iKeypadRectQuery; |
|
245 RArray<TRect> iKeypadCellRects; |
|
246 RArray<TRect> iKeypadCellRectsCn; |
|
247 RArray<TRect> iKeypadCellRectsQuery; |
|
248 |
|
249 // properties of candidate list |
|
250 TInt iCandsUnitWidth; |
|
251 TInt iCandsUnitHeight; |
|
252 TInt iCandsHorizontalMargin; |
|
253 TInt iCandsVerticalMargin; |
|
254 TInt iCandsNaviWidth; |
|
255 TInt iCandsSpinBtnHeight; |
|
256 TPoint iCandsSpellLTPos; |
|
257 TPoint iCandsLTPos; |
|
258 TPoint iCandsPuncLTPos; |
|
259 CFont* iCandsFont; |
|
260 TInt iCandsTextMargin; |
|
261 TRgb iCandsTextColor; |
|
262 |
|
263 |
|
264 |
|
265 TRect iSpellRect; |
|
266 CFont* iSpellFont; |
|
267 TRgb iSpellTextColor; |
|
268 |
|
269 TAknTextLineLayout iVkAlphaText1; |
|
270 TAknTextLineLayout iVkAlphaText2; |
|
271 TAknTextLineLayout iVkAlphaText3; |
|
272 TAknTextLineLayout iVkNumText; |
|
273 |
|
274 // Layout for Thai |
|
275 TAknTextLineLayout iVkAlphaText1ForThai; |
|
276 TAknTextLineLayout iVkAlphaText2ForThai; |
|
277 TAknTextLineLayout iVkAlphaText3ForThai; |
|
278 |
|
279 // resource id for generic itut resource file |
|
280 TInt iCommonResId; |
|
281 TInt iConfigResId; |
|
282 |
|
283 TInt iAvkonResId; |
|
284 |
|
285 // not own |
|
286 MItutLayoutContext* iLayoutContext; |
|
287 |
|
288 // chinese related candidates |
|
289 RPointerArray<HBufC> iCandidates; |
|
290 RPointerArray<HBufC> iPuncCandidates; |
|
291 |
|
292 TRect iOptionsRect; |
|
293 TRect iCloseRect; |
|
294 TRect iCloseInnerRect; |
|
295 TRect iOptionInnerRect; |
|
296 TRect iSpellIndiRect; |
|
297 TRect iOptionsRectCn; |
|
298 TRect iCloseRectCn; |
|
299 TRect iCloseInnerRectCn; |
|
300 TRect iOptionInnerRectCn; |
|
301 |
|
302 // preview bubble |
|
303 TRect iPreviewWndRect; |
|
304 TRect iPreviewWndInnerRect; |
|
305 CFont* iBubbleFont; |
|
306 TAknTextLineLayout iPreviewWndText; |
|
307 |
|
308 TBuf<KMaxFileLength> iResourceFilename; |
|
309 TBool iLangCaseSensitive; |
|
310 TInt iCurrentScriptIdx; |
|
311 |
|
312 TBool iLandScape; |
|
313 TBool iSpellMode; |
|
314 |
|
315 // spell popup window data |
|
316 TRect iSpellQueryPaneRect; |
|
317 TRect iSpellICFRect; |
|
318 TRect iSpellClrRect; |
|
319 TRect iSpellClrInnerRect; |
|
320 TRect iOkRect; |
|
321 TRect iCancelRect; |
|
322 TRect iSpellEditIndicator; |
|
323 TAknTextLineLayout iBtnTextFormat; |
|
324 TAknTextLineLayout iBtnTextFormat1; |
|
325 TFepIndicatorInfo iIndicatorData; |
|
326 |
|
327 RPointerArray<TMenuItem> iMenuItemList; |
|
328 |
|
329 TBool iNeedUpdate; |
|
330 TBool iLatinOnly; |
|
331 |
|
332 TBool iIsLangDirectionSwitch; |
|
333 |
|
334 TInt iNumericKeymap; |
|
335 HBufC* iNumericKeymapData; |
|
336 TBool iExistPlusChar; |
|
337 TBool iPlusCharFlagChanged; |
|
338 TBool iNumberOnly; |
|
339 |
|
340 }; |
|
341 |
|
342 inline CPtiEngine* CGenericItutDataMgr::PtiEngine() |
|
343 { |
|
344 return iPtiEngine; |
|
345 } |
|
346 |
|
347 inline TInt CGenericItutDataMgr::InputMode() |
|
348 { |
|
349 return iInputMode; |
|
350 } |
|
351 |
|
352 inline TInt CGenericItutDataMgr::InputLanguage() |
|
353 { |
|
354 return iLanguage; |
|
355 } |
|
356 |
|
357 inline TInt CGenericItutDataMgr::TextCase() |
|
358 { |
|
359 return iCase; |
|
360 } |
|
361 |
|
362 inline TBool CGenericItutDataMgr::IsLandScape() |
|
363 { |
|
364 return iLandScape; |
|
365 } |
|
366 |
|
367 inline TBool CGenericItutDataMgr::IsSpellMode() |
|
368 { |
|
369 return iSpellMode; |
|
370 } |
|
371 |
|
372 inline void CGenericItutDataMgr::SetSpellMode(TBool aSpellMode) |
|
373 { |
|
374 iSpellMode = aSpellMode; |
|
375 } |
|
376 |
|
377 inline void CGenericItutDataMgr::SetIndicatorData(TFepIndicatorInfo &aIndicatorData) |
|
378 { |
|
379 iIndicatorData.iIndicatorImgID = aIndicatorData.iIndicatorImgID; |
|
380 iIndicatorData.iIndicatorMaskID = aIndicatorData.iIndicatorMaskID; |
|
381 iIndicatorData.iIndicatorTextImgID = aIndicatorData.iIndicatorTextImgID; |
|
382 iIndicatorData.iIndicatorTextMaskID = aIndicatorData.iIndicatorTextMaskID; |
|
383 } |
|
384 |
|
385 inline TFepIndicatorInfo CGenericItutDataMgr::IndicatorData() |
|
386 { |
|
387 return iIndicatorData; |
|
388 } |
|
389 |
|
390 |
|
391 inline void CGenericItutDataMgr::SetLatinOnly( TBool aLatinOnly ) |
|
392 { |
|
393 iLatinOnly = aLatinOnly; |
|
394 } |
|
395 |
|
396 inline TBool CGenericItutDataMgr::IsValidLanguage(TInt aLanguage) |
|
397 { |
|
398 return (aLanguage != ELangTest && aLanguage != ELangNone); |
|
399 } |
|
400 |
|
401 inline void CGenericItutDataMgr::SetLangDirectionSwitch( TBool aIsChange ) |
|
402 { |
|
403 iIsLangDirectionSwitch = aIsChange; |
|
404 } |
|
405 |
|
406 inline TBool CGenericItutDataMgr::IsCharFlagChanged() |
|
407 { |
|
408 if( iExistPlusChar != IsExistPlusChar() ) |
|
409 { |
|
410 iExistPlusChar = IsExistPlusChar(); |
|
411 iPlusCharFlagChanged = ETrue; |
|
412 } |
|
413 else |
|
414 { |
|
415 iPlusCharFlagChanged = EFalse; |
|
416 } |
|
417 return iPlusCharFlagChanged; |
|
418 } |
|
419 |
|
420 inline void CGenericItutDataMgr::SetNumericOnly( TBool aIsNumberOnly ) |
|
421 { |
|
422 iNumberOnly = aIsNumberOnly; |
|
423 } |
|
424 |
|
425 inline TBool CGenericItutDataMgr::IsNumericOnly() const |
|
426 { |
|
427 return iNumberOnly; |
|
428 } |
|
429 |
|
430 #endif // C_GENERICITUTDATAMGR_H |