|
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: split itu-t data manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <PtiEngine.h> |
|
20 #include <coemain.h> |
|
21 #include <AknUtils.h> |
|
22 #include <peninputsplititutnew.rsg> |
|
23 #include <peninputsplititutconfig_chinese.rsg> |
|
24 #include <peninputsplititutconfig_latin.rsg> |
|
25 #include <peninputsplititutconfig_hebrew.rsg> |
|
26 #include <peninputsplititutconfig_farsi.rsg> |
|
27 #include <AknFepGlobalEnums.h> |
|
28 #include <eikon.hrh> |
|
29 #include <bautils.h> |
|
30 #include <aknlayoutscalable_avkon.cdl.h> |
|
31 #include <peninputlayoutmultilineicf.h> |
|
32 #include <AknSettingCache.h> |
|
33 |
|
34 #include "peninputsplititutdatamgr.h" |
|
35 #include "peninputsplititutlayoutcontext.h" |
|
36 #include "peninputsplititutconverter.h" |
|
37 #include "peninputsplititutwindowmanager.h" |
|
38 |
|
39 #define LAF_MODIFY 1 |
|
40 _LIT(KItutCommonResFile, "z:\\resource\\plugins\\peninputsplititutnew.rsc"); |
|
41 _LIT(KConfigResourceFile, |
|
42 "z:\\resource\\plugins\\peninputsplititutconfig_"); |
|
43 _LIT(KResourceFileExtName, ".rsc"); |
|
44 |
|
45 _LIT(KAvkonResourceFile, "z:\\resource\\avkon.rsc"); |
|
46 |
|
47 const TInt KOnePageCandidateCount = 40; |
|
48 const TInt KMaxPredictCandCnt = 250; |
|
49 const TInt KInvalidResId = -1; |
|
50 const TInt KInvalidImMode = -1; |
|
51 const TInt KInvalidIndex = -1; |
|
52 const TUint16 KPlusChar = '+'; |
|
53 |
|
54 |
|
55 // ============================ MEMBER FUNCTIONS ============================= |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CSplitItutDataMgr::NewL |
|
59 // (other items were commented in a header) |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CSplitItutDataMgr* CSplitItutDataMgr::NewL(MSplitItutLayoutContext* aLayoutContext, |
|
63 CPtiEngine* aPtiEngine) |
|
64 { |
|
65 CSplitItutDataMgr* self = new (ELeave) CSplitItutDataMgr(aLayoutContext, aPtiEngine); |
|
66 CleanupStack::PushL(self); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop(self);//self |
|
69 return self; |
|
70 } |
|
71 |
|
72 /* |
|
73 // --------------------------------------------------------------------------- |
|
74 // CSplitItutDataMgr::ClearChnCandidates |
|
75 // (other items were commented in a header) |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CSplitItutDataMgr::ClearChnCandidates(TInt aCmd) |
|
79 { |
|
80 switch (aCmd) |
|
81 { |
|
82 case EItutCandidates: |
|
83 { |
|
84 iCandidates.ResetAndDestroy(); |
|
85 iCandidates.Close(); |
|
86 } |
|
87 break; |
|
88 case EItutPuncCandidates: |
|
89 { |
|
90 iPuncCandidates.ResetAndDestroy(); |
|
91 iPuncCandidates.Close(); |
|
92 } |
|
93 break; |
|
94 default: |
|
95 break; |
|
96 } |
|
97 } |
|
98 */ |
|
99 |
|
100 // ---------CSplitItutDataMgr---------------------------------------- |
|
101 // CSplitItutDataMgr::~CSplitItutDataMgr |
|
102 // (other items were commented in a header) |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 CSplitItutDataMgr::~CSplitItutDataMgr() |
|
106 { |
|
107 iSubscriberList.Close(); |
|
108 |
|
109 CCoeEnv::Static()->DeleteResourceFile(iAvkonResId); |
|
110 CCoeEnv::Static()->DeleteResourceFile(iCommonResId); |
|
111 |
|
112 if (iConfigResId) |
|
113 { |
|
114 CCoeEnv::Static()->DeleteResourceFile(iConfigResId); |
|
115 } |
|
116 |
|
117 // ClearChnCandidates(EItutCandidates); |
|
118 // ClearChnCandidates(EItutPuncCandidates); |
|
119 |
|
120 iKeypadCellRects.Close(); |
|
121 // iKeypadCellRectsCn.Close(); |
|
122 delete iNumericKeymapData; |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CSplitItutDataMgr::ConstructL |
|
127 // (other items were commented in a header) |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void CSplitItutDataMgr::ConstructL() |
|
131 { |
|
132 // initialize layout info of controls and layout |
|
133 ReadLafInfo(); |
|
134 TFileName resourceCommonName(KItutCommonResFile); |
|
135 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
136 BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceCommonName); |
|
137 iCommonResId = coeEnv->AddResourceFileL(resourceCommonName); |
|
138 |
|
139 TFileName resourceAvkonName(KAvkonResourceFile); |
|
140 BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceAvkonName); |
|
141 iAvkonResId = coeEnv->AddResourceFileL(resourceAvkonName); |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // CSplitItutDataMgr::ReadLafInfo |
|
146 // (other items were commented in a header) |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 void CSplitItutDataMgr::ReadLafInfo() |
|
150 { |
|
151 // Screen |
|
152 TRect rect, rectcn; |
|
153 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect); |
|
154 iScreenSize = rect.Size(); |
|
155 |
|
156 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, rect); |
|
157 |
|
158 // finger Layout |
|
159 TAknWindowLineLayout splitwnd, splitpane; |
|
160 TAknLayoutRect spliwndtrect, splitpanerect; |
|
161 |
|
162 // Get Split view rect |
|
163 splitwnd = AknLayoutScalable_Avkon::popup_fep_ituss_window(0).LayoutLine(); |
|
164 spliwndtrect.LayoutRect(rect, splitwnd); |
|
165 |
|
166 splitpane = AknLayoutScalable_Avkon::ituss_keypad_pane(0).LayoutLine(); |
|
167 splitpanerect.LayoutRect(spliwndtrect.Rect(), splitpane); |
|
168 |
|
169 iLayoutRect = spliwndtrect.Rect(); |
|
170 iLayoutOffset = spliwndtrect.Rect().iTl; |
|
171 iBackgroundRect = iLayoutRect; |
|
172 iBackgroundRect.Move(-iLayoutOffset); |
|
173 |
|
174 |
|
175 // Keypad |
|
176 TAknWindowLineLayout itucell, ituinnercell; |
|
177 TAknLayoutRect itucellrect, ituinnercellrect; |
|
178 |
|
179 iKeypadCellRects.Reset(); |
|
180 // iKeypadCellRectsCn.Reset(); |
|
181 |
|
182 itucell = AknLayoutScalable_Avkon::cell_ituss_key_pane(0).LayoutLine(); |
|
183 itucellrect.LayoutRect(splitpanerect.Rect(), itucell); |
|
184 ituinnercell = AknLayoutScalable_Avkon::bg_cell_ituss_key_g1(1).LayoutLine(); |
|
185 |
|
186 iKeypadRect = splitpanerect.Rect(); |
|
187 iKeypadRect.SetHeight(itucellrect.Rect().Height() * 4); |
|
188 iKeypadRect.Move(-iLayoutOffset); |
|
189 |
|
190 TRect cellrect = itucellrect.Rect(); |
|
191 cellrect.Move(-iLayoutOffset); |
|
192 cellrect.Move(-iKeypadRect.iTl); |
|
193 |
|
194 // keypad is 4 rows, 3 cols |
|
195 for (TInt i = 0; i < 4; i++) |
|
196 { |
|
197 for (TInt j = 0; j < 3; j++) |
|
198 { |
|
199 TRect keyrect = cellrect; |
|
200 keyrect.Move(itucellrect.Rect().Width() * j, itucellrect.Rect().Height() * i); |
|
201 |
|
202 ituinnercellrect.LayoutRect(keyrect, ituinnercell); |
|
203 iKeypadCellRects.Append(ituinnercellrect.Rect()); |
|
204 |
|
205 // read shift icon rect |
|
206 if( i == 3 && j == 2 ) |
|
207 { |
|
208 TAknWindowLineLayout shiftIcon = AknLayoutScalable_Avkon:: |
|
209 cell_ituss_key_pane_g2( 0 ).LayoutLine(); |
|
210 TAknLayoutRect shiftIconRect; |
|
211 shiftIconRect.LayoutRect( keyrect, shiftIcon ); |
|
212 iShiftIconRect = shiftIconRect.Rect(); |
|
213 } |
|
214 } |
|
215 } |
|
216 |
|
217 |
|
218 iVkNumText = AknLayoutScalable_Avkon::cell_ituss_key_t1(0).LayoutLine(); |
|
219 // Key text row 1 |
|
220 iVkAlphaText1 = AknLayoutScalable_Avkon::cell_ituss_key_t2(0).LayoutLine(); |
|
221 iVkAlphaText3 = AknLayoutScalable_Avkon::cell_ituss_key_t4(0).LayoutLine(); |
|
222 // Key text row 2 |
|
223 iVkAlphaText2 = AknLayoutScalable_Avkon::cell_ituss_key_t3(0).LayoutLine(); |
|
224 |
|
225 // close button |
|
226 TAknWindowLineLayout funcbtn, funcbtnbg, funcbtninner; |
|
227 TAknLayoutRect funcrect, funcbgrect, funcinnerrect, arrowleftinnerrect, arrowrightinnerrect; |
|
228 TAknLayoutRect optioninnerrect, backspaceinnerrect; |
|
229 |
|
230 funcbtn = AknLayoutScalable_Avkon::cell_ituss_key_pane(1).LayoutLine(); |
|
231 funcrect.LayoutRect(splitpanerect.Rect(), funcbtn); |
|
232 |
|
233 funcbtnbg = AknLayoutScalable_Avkon::bg_cell_ituss_key_g1(1).LayoutLine(); |
|
234 funcbgrect.LayoutRect(funcrect.Rect(), funcbtnbg); |
|
235 |
|
236 funcbtninner = AknLayoutScalable_Avkon::cell_ituss_key_pane_g1(0).LayoutLine(); |
|
237 funcinnerrect.LayoutRect(funcrect.Rect(), funcbtninner); |
|
238 |
|
239 TInt btnWidth = funcrect.Rect().Width(); |
|
240 // close button |
|
241 iCloseRect = funcbgrect.Rect(); |
|
242 iCloseRect.Move(0, funcrect.Rect().Height() * 4); |
|
243 iCloseRect.Move(-iLayoutOffset); |
|
244 |
|
245 iCloseInnerRect = funcinnerrect.Rect(); |
|
246 iCloseInnerRect.Move(0, iKeypadRect.iBr.iY ); |
|
247 iCloseInnerRect.Move(-iLayoutOffset); |
|
248 |
|
249 // arrow left button |
|
250 iArrowLeftRect = iCloseRect; |
|
251 iArrowLeftRect.Move(btnWidth, 0); |
|
252 arrowleftinnerrect.LayoutRect(iArrowLeftRect, funcbtninner); |
|
253 iArrowLeftInnerRect = arrowleftinnerrect.Rect(); |
|
254 |
|
255 // option button |
|
256 iOptionsRect = iArrowLeftRect; |
|
257 iOptionsRect.Move(btnWidth, 0); |
|
258 optioninnerrect.LayoutRect(iOptionsRect, funcbtninner); |
|
259 iOptionInnerRect = optioninnerrect.Rect(); |
|
260 |
|
261 // arrow right button |
|
262 iArrowRightRect = iOptionsRect; |
|
263 iArrowRightRect.Move(btnWidth, 0); |
|
264 arrowrightinnerrect.LayoutRect(iArrowRightRect, funcbtninner); |
|
265 iArrowRightInnerRect = arrowrightinnerrect.Rect(); |
|
266 |
|
267 // backspace button |
|
268 iBackspaceRect = iArrowRightRect; |
|
269 iBackspaceRect.Move(btnWidth, 0); |
|
270 backspaceinnerrect.LayoutRect(iBackspaceRect, funcbtninner); |
|
271 iBackspaceInnerRect = backspaceinnerrect.Rect(); |
|
272 |
|
273 |
|
274 // preview popup window |
|
275 TAknWindowLineLayout previewWnd, previewBackground, previewWndInner; |
|
276 TAknLayoutRect previewWndRect, previewBackgroundRect, previewWndInnerRect; |
|
277 TAknLayoutText previewWndText; |
|
278 previewWnd = AknLayoutScalable_Avkon::popup_fshwr2_char_preview_window(0).LayoutLine(); |
|
279 |
|
280 previewWndRect.LayoutRect( iLayoutRect, previewWnd ); |
|
281 previewBackground = AknLayoutScalable_Avkon::bg_popup_fep_char_preview_window_cp01().LayoutLine(); |
|
282 previewBackgroundRect.LayoutRect( previewWndRect.Rect(), previewBackground ); |
|
283 iPreviewWndRect = previewBackgroundRect.Rect(); |
|
284 |
|
285 previewWndInner = AknLayoutScalable_Avkon::bg_popup_fep_char_preview_window_g9().LayoutLine(); |
|
286 previewWndInnerRect.LayoutRect( previewBackgroundRect.Rect(), previewWndInner ); |
|
287 |
|
288 iPreviewWndInnerRect = previewWndInnerRect.Rect(); |
|
289 iPreviewWndText = |
|
290 AknLayoutScalable_Avkon::popup_fshwr2_char_preview_window_t1(0).LayoutLine(); |
|
291 previewWndText.LayoutText(previewWndRect.Rect(), iPreviewWndText); |
|
292 iBubbleFont = const_cast<CFont*>(previewWndText.Font()); |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CSplitItutDataMgr::ReadLafInfo |
|
297 // (other items were commented in a header) |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 void CSplitItutDataMgr::AddSubscriber(MItutPropertySubscriber* aSubscriber) |
|
301 { |
|
302 if (aSubscriber) |
|
303 { |
|
304 const TInt index = iSubscriberList.Find(aSubscriber); |
|
305 |
|
306 if (index == KErrNotFound) |
|
307 { |
|
308 iSubscriberList.Append(aSubscriber); |
|
309 } |
|
310 } |
|
311 } |
|
312 |
|
313 // --------------------------------------------------------------------------- |
|
314 // CSplitItutDataMgr::ReadLafInfo |
|
315 // (other items were commented in a header) |
|
316 // --------------------------------------------------------------------------- |
|
317 // |
|
318 void CSplitItutDataMgr::SetLanguageL(TInt aLanguage) |
|
319 { |
|
320 ASSERT( IsValidLanguage( aLanguage ) ); |
|
321 |
|
322 if (iLanguage != aLanguage) |
|
323 { |
|
324 if( IsValidLanguage( iLanguage ) ) |
|
325 iIsLangDirectionSwitch = IsRtoLLanguage( aLanguage ) ^ IsRtoLLanguage( iLanguage ); |
|
326 else |
|
327 //Check mirroring is needed when first setting language |
|
328 iIsLangDirectionSwitch = IsRtoLLanguage( aLanguage ); |
|
329 |
|
330 iLanguage = aLanguage; |
|
331 iInputMode = KInvalidImMode; |
|
332 |
|
333 //SetTextAlignment(); |
|
334 |
|
335 TInt scriptIdx = GetConfigResFileName(aLanguage); |
|
336 |
|
337 if (scriptIdx != iCurrentScriptIdx) |
|
338 { |
|
339 iCurrentScriptIdx = scriptIdx; |
|
340 |
|
341 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
342 |
|
343 if (iConfigResId) |
|
344 { |
|
345 coeEnv->DeleteResourceFile(iConfigResId); |
|
346 } |
|
347 |
|
348 TFileName resourceConfigName(iResourceFilename); |
|
349 BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceConfigName); |
|
350 iConfigResId = coeEnv->AddResourceFileL(resourceConfigName); |
|
351 |
|
352 if (IsChinese()) |
|
353 { |
|
354 iLayoutContext->UiManager()->CreateChineseSpecificCtrlsIfNeededL(); |
|
355 } |
|
356 |
|
357 NotifyChangeControlLayout(MItutPropertySubscriber::EItutPropertyKeypadResourceId, |
|
358 KeypadResourceId()); |
|
359 } |
|
360 } |
|
361 } |
|
362 |
|
363 // --------------------------------------------------------------------------- |
|
364 // CSplitItutDataMgr::ReadLafInfo |
|
365 // (other items were commented in a header) |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 void CSplitItutDataMgr::SetCase(TInt aCase) |
|
369 { |
|
370 if (iCase != aCase || iInputMode == ELatin) |
|
371 { |
|
372 iCase = aCase; |
|
373 NotifyChangeControlLayout(MItutPropertySubscriber::EItutPropertyKeypadResourceId, |
|
374 KeypadResourceId()); |
|
375 } |
|
376 } |
|
377 |
|
378 // --------------------------------------------------------------------------- |
|
379 // CSplitItutDataMgr::ReadLafInfo |
|
380 // (other items were commented in a header) |
|
381 // --------------------------------------------------------------------------- |
|
382 // |
|
383 void CSplitItutDataMgr::SetInputModeL(TInt aMode) |
|
384 { |
|
385 TInt engineMode = KInvalidImMode; |
|
386 |
|
387 switch (aMode) |
|
388 { |
|
389 case EPinyin: |
|
390 { |
|
391 engineMode = EPtiEnginePinyinByPhrase; |
|
392 } |
|
393 break; |
|
394 case EStroke: |
|
395 { |
|
396 engineMode = EPtiEngineStrokeByPhrase; |
|
397 } |
|
398 break; |
|
399 case EZhuyin: |
|
400 { |
|
401 engineMode = EPtiEngineZhuyinByPhrase; |
|
402 } |
|
403 break; |
|
404 case ELatin: |
|
405 case EHindi: |
|
406 case ENumber: |
|
407 case ENativeNumber: |
|
408 { |
|
409 iInputMode = aMode; |
|
410 NotifyChangeControlLayout(MItutPropertySubscriber::EItutPropertyKeypadResourceId, |
|
411 KeypadResourceId()); |
|
412 } |
|
413 break; |
|
414 case EZhuyinFind: |
|
415 { |
|
416 iInputMode = EZhuyin; |
|
417 |
|
418 return; |
|
419 } |
|
420 case EStrokeFind: |
|
421 { |
|
422 iInputMode = EStroke; |
|
423 |
|
424 return; |
|
425 } |
|
426 default: |
|
427 return; |
|
428 } |
|
429 |
|
430 if (IsChinese()) |
|
431 { |
|
432 TInt err = iPtiEngine->ActivateLanguageL(iLanguage, TPtiEngineInputMode(engineMode)); |
|
433 if (err == KErrNone) |
|
434 { |
|
435 iPtiEngine->SetCandidatePageLength(KOnePageCandidateCount); |
|
436 iInputMode = aMode; |
|
437 } |
|
438 } |
|
439 } |
|
440 |
|
441 |
|
442 // --------------------------------------------------------------------------- |
|
443 // CSplitItutDataMgr::RequestData |
|
444 // (other items were commented in a header) |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 TAny* CSplitItutDataMgr::RequestData(TInt aDataType) |
|
448 { |
|
449 switch ( aDataType ) |
|
450 { |
|
451 case EScreenSize: |
|
452 return &iScreenSize; |
|
453 case ELayoutOffset: |
|
454 return &iLayoutOffset; |
|
455 case ELayoutRect: |
|
456 return &iLayoutRect; |
|
457 case EBackgroundRect: |
|
458 return &iBackgroundRect; |
|
459 case EBackspaceRect: |
|
460 return IsChinese() ? &iBackspaceCnRect : &iBackspaceRect; |
|
461 case EKeypadRect: |
|
462 return &iKeypadRect; |
|
463 // return IsChinese() ? &iKeypadRectCn : &iKeypadRect; |
|
464 case EKeypadCellRects: |
|
465 return &iKeypadCellRects; |
|
466 // return IsChinese() ? &iKeypadCellRectsCn : &iKeypadCellRects; |
|
467 case EKeypadLeftTextLine: |
|
468 return &iVkNumText; |
|
469 case EKeypadRightTextLine1: |
|
470 return &iVkAlphaText1; |
|
471 case EKeypadRightTextLine2: |
|
472 return &iVkAlphaText2; |
|
473 case EKeypadRightTextLine3: |
|
474 return &iVkAlphaText3; |
|
475 /* |
|
476 case EDropdownlistUnitWidth: |
|
477 return &iCandsUnitWidth; |
|
478 case EDropdownlistUnitHeight: |
|
479 return &iCandsUnitHeight; |
|
480 case EDropdownlistHorizontalMargin: |
|
481 return &iCandsHorizontalMargin; |
|
482 case EDropdownlistVerticalMargin: |
|
483 return &iCandsVerticalMargin; |
|
484 case EDropdownListNaviWidth: |
|
485 return &iCandsNaviWidth; |
|
486 case EDropdownListSpinBtnHeight: |
|
487 return &iCandsSpinBtnHeight; |
|
488 case EDropdownListSpellLTPos: |
|
489 return &iCandsSpellLTPos; |
|
490 case EDropdownListCandsLTPos: |
|
491 return &iCandsLTPos; |
|
492 case EDropdownListPuncLTPos: |
|
493 return &iCandsPuncLTPos; |
|
494 case EDropdownListFont: |
|
495 return reinterpret_cast<TAny*>(iCandsFont); |
|
496 case EDropdownListTextMargin: |
|
497 return &iCandsTextMargin; |
|
498 case EDropdownListTextColor: |
|
499 return &iCandsTextColor; |
|
500 */ |
|
501 |
|
502 case ELanguage: |
|
503 return &iLanguage; |
|
504 case EInputMode: |
|
505 return &iInputMode; |
|
506 case ECase: |
|
507 return &iCase; |
|
508 /* |
|
509 case EChnCandidates: |
|
510 return &iCandidates; |
|
511 case EChnPuncCandidates: |
|
512 return &iPuncCandidates; |
|
513 */ |
|
514 case EArrowLeftRect: |
|
515 // case EItutPosArrowLeft: |
|
516 return IsChinese() ? &iArrowLeftCnRect : &iArrowLeftRect; |
|
517 case EArrowRightRect: |
|
518 // case EItutPosArrowRight: |
|
519 return IsChinese() ? &iArrowRightCnRect : &iArrowRightRect; |
|
520 case EArrowUpRect: |
|
521 // case EItutPosArrowUp: |
|
522 return &iArrowUpRect; |
|
523 case EArrowDownRect: |
|
524 // case EItutPosArrowDown: |
|
525 return &iArrowDownRect; |
|
526 case EOptionsRect: |
|
527 #ifdef LAF_MODIFY |
|
528 return IsChinese() ? &iOptionsRectCn : &iOptionsRect; |
|
529 #else |
|
530 return &iOptionsRect; |
|
531 #endif |
|
532 case ECloseRect: |
|
533 #ifdef LAF_MODIFY |
|
534 return IsChinese() ? &iCloseRectCn : &iCloseRect; |
|
535 #else |
|
536 return &iCloseRect; |
|
537 #endif |
|
538 case ELeftInnerRect: |
|
539 return IsChinese() ? &iArrowLeftInnerCnRect : &iArrowLeftInnerRect; |
|
540 case ERightInnerRect: |
|
541 return IsChinese() ? &iArrowRightInnerCnRect : &iArrowRightInnerRect; |
|
542 case EBackspaceInnerRect: |
|
543 return IsChinese() ? &iBackspaceInnerCnRect : &iBackspaceInnerRect; |
|
544 case EUpInnerRect: |
|
545 return &iArrowUpInnerRect; |
|
546 case EDownInnerRect: |
|
547 return &iArrowDownInnerRect; |
|
548 case ECloseInnerRect: |
|
549 #ifdef LAF_MODIFY |
|
550 return IsChinese() ? &iCloseInnerRectCn : &iCloseInnerRect; |
|
551 #else |
|
552 return &iCloseInnerRect; |
|
553 #endif |
|
554 case EOptionInnerRect: |
|
555 #ifdef LAF_MODIFY |
|
556 return IsChinese() ? &iOptionInnerRectCn : &iOptionInnerRect; |
|
557 #else |
|
558 return &iOptionInnerRect; |
|
559 #endif |
|
560 case ELatinOnly: |
|
561 return &iLatinOnly; |
|
562 case EPreviewBubbleRect: |
|
563 return &iPreviewWndRect; |
|
564 case EPreviewBubbleInnerRect: |
|
565 return &iPreviewWndInnerRect; |
|
566 case EPreviewBubbleTextlayout: |
|
567 return &iPreviewWndText; |
|
568 case EPreviewBubbleFont: |
|
569 return reinterpret_cast<TAny*>(iBubbleFont); |
|
570 default: |
|
571 break; |
|
572 } |
|
573 |
|
574 return NULL; |
|
575 } |
|
576 |
|
577 // --------------------------------------------------------------------------- |
|
578 // CSplitItutDataMgr::CSplitItutDataMgr |
|
579 // (other items were commented in a header) |
|
580 // --------------------------------------------------------------------------- |
|
581 // |
|
582 CSplitItutDataMgr::CSplitItutDataMgr(MSplitItutLayoutContext* aLayoutContext, |
|
583 CPtiEngine* aPtiEngine) |
|
584 : |
|
585 iPtiEngine( aPtiEngine ), |
|
586 iLanguage(ELangNone), |
|
587 iInputMode(KInvalidImMode), |
|
588 iCase(EAknEditorUpperCase), |
|
589 iConfigResId(0), |
|
590 iLayoutContext(aLayoutContext), |
|
591 iCurrentScriptIdx(KInvalidIndex) |
|
592 { |
|
593 } |
|
594 |
|
595 |
|
596 |
|
597 // --------------------------------------------------------------------------- |
|
598 // CSplitItutDataMgr::NotifySubscriber |
|
599 // (other items were commented in a header) |
|
600 // --------------------------------------------------------------------------- |
|
601 // |
|
602 void CSplitItutDataMgr::NotifySubscriber(MItutPropertySubscriber::TItutProperty aPropertyName, |
|
603 const TDesC& aValue) |
|
604 { |
|
605 for (TInt i = 0; i < iSubscriberList.Count(); i++) |
|
606 { |
|
607 TRAP_IGNORE(iSubscriberList[i]->SetPropertyL(aPropertyName, aValue)); |
|
608 } |
|
609 } |
|
610 |
|
611 // --------------------------------------------------------------------------- |
|
612 // CSplitItutDataMgr::NotifyChangeControlLayout |
|
613 // (other items were commented in a header) |
|
614 // --------------------------------------------------------------------------- |
|
615 // |
|
616 void CSplitItutDataMgr::NotifyChangeControlLayout( |
|
617 MItutPropertySubscriber::TItutProperty aPropertyName, TInt aCtrlResId) |
|
618 { |
|
619 TInt ctrlResId = KInvalidResId; |
|
620 |
|
621 switch (aPropertyName) |
|
622 { |
|
623 case MItutPropertySubscriber::EItutPropertyKeypadResourceId: |
|
624 { |
|
625 ctrlResId = iLayoutContext->Control(ECtrlIdStdItut)->ResourceId(); |
|
626 } |
|
627 break; |
|
628 case MItutPropertySubscriber::EItutPropertyCandidateListResourceId: |
|
629 { |
|
630 ctrlResId = iLayoutContext->Control(ECtrlIdStdCandsList)->ResourceId(); |
|
631 } |
|
632 break; |
|
633 default: |
|
634 break; |
|
635 } |
|
636 |
|
637 // since keypad resource divided by script, so maybe ctrlResId unchanged, |
|
638 // but it is actually changed in different script |
|
639 if ((ctrlResId != aCtrlResId) || |
|
640 (aPropertyName == MItutPropertySubscriber::EItutPropertyKeypadResourceId)) |
|
641 { |
|
642 TPtrC ptr(reinterpret_cast<TText*>(&aCtrlResId), sizeof(aCtrlResId)/sizeof(TText)); |
|
643 |
|
644 NotifySubscriber(aPropertyName, ptr); |
|
645 } |
|
646 } |
|
647 |
|
648 /* |
|
649 TInt CSplitItutDataMgr::GetNextPageCandidateL(RPointerArray<HBufC>& aList) |
|
650 { |
|
651 if (iPtiEngine && (iPtiEngine->NextCandidatePage())) |
|
652 { |
|
653 TItutDataConverter::ConvertChnPhraseCandidateL(iPtiEngine->CandidatePage(), aList); |
|
654 |
|
655 return KErrNone; |
|
656 } |
|
657 |
|
658 return KErrNotSupported; |
|
659 } |
|
660 |
|
661 TBool CSplitItutDataMgr::NextPageCandidateExist() |
|
662 { |
|
663 if (iPtiEngine) |
|
664 { |
|
665 return iPtiEngine->MoreCandidatePages(); |
|
666 } |
|
667 |
|
668 return EFalse; |
|
669 } |
|
670 */ |
|
671 |
|
672 |
|
673 // --------------------------------------------------------------------------- |
|
674 // CSplitItutDataMgr::KeypadResourceId |
|
675 // (other items were commented in a header) |
|
676 // --------------------------------------------------------------------------- |
|
677 // |
|
678 TInt CSplitItutDataMgr::KeypadResourceId() |
|
679 { |
|
680 if (iInputMode == ENumber ) |
|
681 { |
|
682 if( IsExistPlusChar() ) |
|
683 return R_FINGER_INPUT_KEYPAD_NUMBER_WITH_PLUS; |
|
684 else |
|
685 return R_FINGER_INPUT_KEYPAD_NUMBER; |
|
686 } |
|
687 if( iInputMode == ENativeNumber ) |
|
688 { |
|
689 if( IsExistPlusChar() ) |
|
690 return R_FINGER_INPUT_KEYPAD_NATIVE_NUMBER_WITH_PLUS; |
|
691 else |
|
692 return R_FINGER_INPUT_KEYPAD_NATIVE_NUMBER; |
|
693 } |
|
694 |
|
695 if ( iLatinOnly ) |
|
696 { |
|
697 if ( iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase ) |
|
698 { |
|
699 return R_FINGER_INPUT_KEYPAD_LATINONLY_UPPERCASE; |
|
700 } |
|
701 return R_FINGER_INPUT_KEYPAD_LATINONLY_LOWERCASE; |
|
702 } |
|
703 |
|
704 if (!iLangCaseSensitive ) |
|
705 { |
|
706 return R_FINGER_INPUT_KEYPAD_ABC; |
|
707 } |
|
708 if ( IsChinese() ) |
|
709 { |
|
710 return ChineseKeypadResourceId(); |
|
711 } |
|
712 if ( IsHindi() ) |
|
713 { |
|
714 return HindiKeypadResourceId(); |
|
715 } |
|
716 |
|
717 if (iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase) |
|
718 { |
|
719 return R_FINGER_INPUT_KEYPAD_ABC_UPPERCASE; |
|
720 } |
|
721 else |
|
722 { |
|
723 return R_FINGER_INPUT_KEYPAD_ABC_LOWERCASE; |
|
724 } |
|
725 } |
|
726 |
|
727 |
|
728 // --------------------------------------------------------------------------- |
|
729 // CSplitItutDataMgr::ChineseKeypadResourceId |
|
730 // (other items were commented in a header) |
|
731 // --------------------------------------------------------------------------- |
|
732 // |
|
733 TInt CSplitItutDataMgr::ChineseKeypadResourceId() |
|
734 { |
|
735 |
|
736 if (iInputMode == EZhuyin) |
|
737 { |
|
738 return R_FINGER_INPUT_KEYPAD_ZHUYIN_STANDBY_PREDICT; |
|
739 } |
|
740 if (iInputMode == EPinyin) |
|
741 { |
|
742 return R_FINGER_INPUT_KEYPAD_PINYIN_STANDBY_PREDICT; |
|
743 } |
|
744 if (iInputMode == EStroke) |
|
745 { |
|
746 TInt resID; |
|
747 if (InputLanguage() == ELangPrcChinese) |
|
748 { |
|
749 resID = R_FINGER_INPUT_KEYPAD_STROKE_STANDBY_PREDICT_PRC; |
|
750 } |
|
751 else |
|
752 { |
|
753 resID = R_FINGER_INPUT_KEYPAD_STROKE_STANDBY_PREDICT_TRA; |
|
754 } |
|
755 return resID; |
|
756 } |
|
757 |
|
758 if (iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase) |
|
759 { |
|
760 return R_FINGER_INPUT_KEYPAD_ABC_UPPERCASE_CHN; |
|
761 } |
|
762 else |
|
763 { |
|
764 return R_FINGER_INPUT_KEYPAD_ABC_LOWERCASE_CHN; |
|
765 } |
|
766 } |
|
767 |
|
768 |
|
769 // --------------------------------------------------------------------------- |
|
770 // CSplitItutDataMgr::HindiKeypadResourceId |
|
771 // (other items were commented in a header) |
|
772 // --------------------------------------------------------------------------- |
|
773 // |
|
774 TInt CSplitItutDataMgr::HindiKeypadResourceId() |
|
775 { |
|
776 if ( iInputMode == EHindi ) |
|
777 { |
|
778 return R_FINGER_INPUT_KEYPAD_ABC; |
|
779 } |
|
780 |
|
781 if (iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase) |
|
782 { |
|
783 return R_FINGER_INPUT_KEYPAD_LATINONLY_UPPERCASE; |
|
784 } |
|
785 else |
|
786 { |
|
787 return R_FINGER_INPUT_KEYPAD_LATINONLY_LOWERCASE; |
|
788 } |
|
789 } |
|
790 |
|
791 // --------------------------------------------------------------------------- |
|
792 // CSplitItutDataMgr::GetConfigResFileName |
|
793 // (other items were commented in a header) |
|
794 // --------------------------------------------------------------------------- |
|
795 // |
|
796 TInt CSplitItutDataMgr::GetConfigResFileName(TInt aLang) |
|
797 { |
|
798 iResourceFilename.Zero(); |
|
799 iResourceFilename = KConfigResourceFile(); |
|
800 |
|
801 for (TInt i = 0; i < sizeof(TScriptMapping) / sizeof(TScriptMapping[0]); i++) |
|
802 { |
|
803 TScriptInfo script = TScriptMapping[i]; |
|
804 |
|
805 if (FindLang(&(LangsArr[script.iStartIdx]), script.iEndIdx - script.iStartIdx, aLang) != |
|
806 KErrNotFound) |
|
807 { |
|
808 iResourceFilename.Append(ResFileExtByScriptIdx(script.iScriptExt)); |
|
809 iResourceFilename.Append(KResourceFileExtName); |
|
810 iLangCaseSensitive = script.iCaseSensitive; |
|
811 return i; |
|
812 } |
|
813 } |
|
814 |
|
815 // default resource file is latin |
|
816 iResourceFilename.Append(ResFileExtByScriptIdx(TScriptMapping[0].iScriptExt)); |
|
817 iResourceFilename.Append(KResourceFileExtName); |
|
818 iLangCaseSensitive = TScriptMapping[0].iCaseSensitive; |
|
819 return 0; |
|
820 } |
|
821 |
|
822 // --------------------------------------------------------------------------- |
|
823 // CSplitItutDataMgr::FindLang |
|
824 // (other items were commented in a header) |
|
825 // --------------------------------------------------------------------------- |
|
826 // |
|
827 TInt CSplitItutDataMgr::FindLang(const TInt* aArray, |
|
828 TInt aEndIdx, |
|
829 TInt aLang) |
|
830 { |
|
831 for (TInt i = 0; i <= aEndIdx; i++) |
|
832 { |
|
833 if (aLang == *aArray) |
|
834 { |
|
835 return i; |
|
836 } |
|
837 |
|
838 aArray++; |
|
839 } |
|
840 |
|
841 return KErrNotFound; |
|
842 } |
|
843 |
|
844 |
|
845 // --------------------------------------------------------------------------- |
|
846 // CSplitItutDataMgr::FindLang |
|
847 // (other items were commented in a header) |
|
848 // --------------------------------------------------------------------------- |
|
849 // |
|
850 TBool CSplitItutDataMgr::IsChinese() |
|
851 { |
|
852 return (iLanguage == ELangPrcChinese || iLanguage == ELangHongKongChinese |
|
853 || iLanguage == ELangTaiwanChinese); |
|
854 } |
|
855 |
|
856 // --------------------------------------------------------------------------- |
|
857 // CSplitItutDataMgr::IsHindi |
|
858 // (other items were commented in a header) |
|
859 // --------------------------------------------------------------------------- |
|
860 // |
|
861 TBool CSplitItutDataMgr::IsHindi() |
|
862 { |
|
863 return ( iLanguage == ELangHindi ); |
|
864 } |
|
865 |
|
866 // --------------------------------------------------------------------------- |
|
867 // CSplitItutDataMgr::IsThai |
|
868 // (other items were commented in a header) |
|
869 // --------------------------------------------------------------------------- |
|
870 // |
|
871 TBool CSplitItutDataMgr::IsThai() |
|
872 { |
|
873 return ( iLanguage == ELangThai ); |
|
874 } |
|
875 |
|
876 // --------------------------------------------------------------------------- |
|
877 // CSplitItutDataMgr::IsRtoLLanguage |
|
878 // (other items were commented in a header) |
|
879 // --------------------------------------------------------------------------- |
|
880 // |
|
881 TBool CSplitItutDataMgr::IsRtoLLanguage() |
|
882 { |
|
883 return ( iLanguage == ELangArabic || |
|
884 iLanguage == ELangHebrew || |
|
885 iLanguage == ELangFarsi || |
|
886 iLanguage == ELangUrdu ); |
|
887 } |
|
888 |
|
889 // --------------------------------------------------------------------------- |
|
890 // CSplitItutDataMgr::IsRtoLLanguage |
|
891 // (other items were commented in a header) |
|
892 // --------------------------------------------------------------------------- |
|
893 // |
|
894 TBool CSplitItutDataMgr::IsRtoLLanguage( TInt aLanguage ) |
|
895 { |
|
896 return ( aLanguage == ELangArabic || |
|
897 aLanguage == ELangHebrew || |
|
898 aLanguage == ELangFarsi || |
|
899 aLanguage == ELangUrdu ); |
|
900 } |
|
901 |
|
902 // --------------------------------------------------------------------------- |
|
903 // CSplitItutDataMgr::IsLangDirectionSwitch |
|
904 // (other items were commented in a header) |
|
905 // --------------------------------------------------------------------------- |
|
906 // |
|
907 TBool CSplitItutDataMgr::IsLangDirectionSwitch() const |
|
908 { |
|
909 return iIsLangDirectionSwitch; |
|
910 } |
|
911 |
|
912 // --------------------------------------------------------------------------- |
|
913 // CSplitItutDataMgr::ResFileExtByScriptIdx |
|
914 // (other items were commented in a header) |
|
915 // --------------------------------------------------------------------------- |
|
916 // |
|
917 const TDesC& CSplitItutDataMgr::ResFileExtByScriptIdx(const TScriptExtIndex aIndex) |
|
918 { |
|
919 switch (aIndex) |
|
920 { |
|
921 case ELatinExt: |
|
922 return KLatinExt; |
|
923 case ECyrillicExt: |
|
924 return KCyrillicExt; |
|
925 case EGreekExt: |
|
926 return KGreekExt; |
|
927 case EHebrewExt: |
|
928 return KHebrewExt; |
|
929 case EArabicExt: |
|
930 return KArabicExt; |
|
931 case EFarsiExt: |
|
932 return KFarsiExt; |
|
933 case EUrduExt: |
|
934 return KUrduExt; |
|
935 case EThaiExt: |
|
936 return KThaiExt; |
|
937 case EChnExt: |
|
938 return KChnExt; |
|
939 case EDevanagiriExt: |
|
940 return KDevanagiriExt; |
|
941 default: |
|
942 break; |
|
943 } |
|
944 |
|
945 return KNullDesC; |
|
946 } |
|
947 |
|
948 // --------------------------------------------------------------------------- |
|
949 // CSplitItutDataMgr::SetUpdate |
|
950 // (other items were commented in a header) |
|
951 // --------------------------------------------------------------------------- |
|
952 // |
|
953 void CSplitItutDataMgr::SetUpdate(TBool aNeedUpdate) |
|
954 { |
|
955 iNeedUpdate = aNeedUpdate; |
|
956 } |
|
957 |
|
958 // --------------------------------------------------------------------------- |
|
959 // CSplitItutDataMgr::IsUpdate |
|
960 // (other items were commented in a header) |
|
961 // --------------------------------------------------------------------------- |
|
962 // |
|
963 TBool CSplitItutDataMgr::IsUpdate() const |
|
964 { |
|
965 return iNeedUpdate; |
|
966 } |
|
967 |
|
968 // --------------------------------------------------------------------------- |
|
969 // CSplitItutDataMgr::SetNumericKeymap |
|
970 // (other items were commented in a header) |
|
971 // --------------------------------------------------------------------------- |
|
972 // |
|
973 void CSplitItutDataMgr::SetNumericKeymap( const TInt aKeymap ) |
|
974 { |
|
975 iNumericKeymap = aKeymap; |
|
976 } |
|
977 |
|
978 // --------------------------------------------------------------------------- |
|
979 // CSplitItutDataMgr::SetNumericKeymapData |
|
980 // (other items were commented in a header) |
|
981 // --------------------------------------------------------------------------- |
|
982 // |
|
983 void CSplitItutDataMgr::SetNumericKeymapData( TInt* aKeymapData ) |
|
984 { |
|
985 delete iNumericKeymapData; |
|
986 TInt* len = (TInt*)((TUint8*)aKeymapData - 4); |
|
987 TPtrC16 keymapRes((const TUint16*)aKeymapData, *len/2); |
|
988 iNumericKeymapData = keymapRes.Alloc(); |
|
989 } |
|
990 |
|
991 // --------------------------------------------------------------------------- |
|
992 // CSplitItutDataMgr::IsExistPlusChar |
|
993 // (other items were commented in a header) |
|
994 // --------------------------------------------------------------------------- |
|
995 // |
|
996 TBool CSplitItutDataMgr::IsExistPlusChar() |
|
997 { |
|
998 if( !IsNumericOnly() ) |
|
999 { |
|
1000 return EFalse; |
|
1001 } |
|
1002 if ( iNumericKeymap == EKeymapFromResource ) |
|
1003 { |
|
1004 HBufC* keyRes = iNumericKeymapData; |
|
1005 if( keyRes != NULL && keyRes->Locate( TChar( KPlusChar ) ) != KErrNotFound ) |
|
1006 { |
|
1007 return ETrue; |
|
1008 } |
|
1009 } |
|
1010 else if ( iNumericKeymap == EAknEditorStandardNumberModeKeymap |
|
1011 || iNumericKeymap == EAknEditorConverterNumberModeKeymap |
|
1012 || iNumericKeymap == EAknEditorCalculatorNumberModeKeymap |
|
1013 || iNumericKeymap == EAknEditorToFieldNumberModeKeymap |
|
1014 || iNumericKeymap == EAknEditorFixedDiallingNumberModeKeymap |
|
1015 || iNumericKeymap == EAknEditorSATNumberModeKeymap ) |
|
1016 { |
|
1017 return ETrue; |
|
1018 } |
|
1019 return EFalse; |
|
1020 } |
|
1021 |
|
1022 // End Of File |