|
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: Implementation of the vkb data manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // system includes |
|
20 #include <aknfeppeninputenums.h> |
|
21 #include <PtiEngine.h> |
|
22 #include <centralrepository.h> |
|
23 #include <AknFepInternalCRKeys.h> |
|
24 #include <settingsinternalcrkeys.h> |
|
25 #include <peninputvkbcn.rsg> |
|
26 #include <AknLayoutDef.h> |
|
27 #include <AknUtils.h> |
|
28 #include <aknlayoutscalable_avkon.cdl.h> |
|
29 |
|
30 // user includes |
|
31 #include "peninputvkb.hrh" |
|
32 #include "peninputvkbdatamgr.h" |
|
33 #include "peninputvkbdataprovider.h" |
|
34 #include "peninputvkbevent.h" |
|
35 #include "peninputvkblayoutcontext.h" |
|
36 #include "peninputvkblayout.h" |
|
37 #include "peninputvkbcnlafdatamgr.h" |
|
38 const TUint16 KSegment = 0x0020; |
|
39 const TInt K1PageCandCount = 36; |
|
40 |
|
41 // ======== MEMBER FUNCTIONS ======== |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CAknFepVkbDataMgr::CAknFepVkbDataMgr |
|
45 // (other items were commented in a header). |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CAknFepVkbDataMgr::CAknFepVkbDataMgr(MAknFepVkbLayoutContext* aContext) |
|
49 :iInputLanguage(ELangPrcChinese), |
|
50 iImLayout(EAknFepVkbImLatin), |
|
51 iContext(aContext), |
|
52 iWindowPosition(0), |
|
53 iSizeChanging(EFalse), |
|
54 iUnitShadowSizeRead(EFalse) |
|
55 { |
|
56 iDefaultImLayout4HK = EAknFepVkbImCnStroke; |
|
57 iDefaultImLayout4PRC = EAknFepVkbImCnPinyin; |
|
58 iDefaultImLayout4TW = EAknFepVkbImCnZhuyin; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CAknFepVkbDataMgr::ConstructL |
|
63 // (other items were commented in a header). |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CAknFepVkbDataMgr::ConstructL(CPtiEngine* aPtiEngine) |
|
67 { |
|
68 /* |
|
69 TResourceReader reader; |
|
70 //Read imlayout from resource |
|
71 CCoeEnv::Static()->CreateResourceReaderLC(reader, R_AKN_FEP_VKB_LANG_STRING_LIST); |
|
72 |
|
73 const TInt count = reader.ReadInt16(); |
|
74 |
|
75 for (TInt i=0; i < count; i++) |
|
76 { |
|
77 SLanguageItem* item = new SLanguageItem(); |
|
78 item->iLangId = reader.ReadInt16(); |
|
79 item->iDisplayText = reader.ReadTPtrC(); |
|
80 iLangStringList.Append(item); |
|
81 } |
|
82 CleanupStack::PopAndDestroy(); // reader |
|
83 */ |
|
84 TInt ret = 0; |
|
85 |
|
86 TRAP(ret, iFepRepository = CRepository::NewL(KCRUidAknFep)); |
|
87 TRAP(ret, iGSRepository = CRepository::NewL(KCRUidPersonalizationSettings)); |
|
88 |
|
89 if (ret == KErrNone) |
|
90 { |
|
91 iGSRepositoryWatcher = CAknFepRepositoryWatcher::NewL( |
|
92 KCRUidPersonalizationSettings, |
|
93 TCallBack(HandleGSRepositoryCallBack, this), |
|
94 iGSRepository); |
|
95 } |
|
96 |
|
97 // Read peninput language from CenRep |
|
98 if (iGSRepository) |
|
99 { |
|
100 iGSRepository->Get(KSettingsPenInputLang, iInputLanguage); |
|
101 } |
|
102 |
|
103 // Read default imlayout of current peninput language from CenRep |
|
104 DefaultModeChangeNotification(); |
|
105 // Create engine |
|
106 iPtiEngine = aPtiEngine; |
|
107 if( !iPtiEngine ) |
|
108 { |
|
109 iPtiEngine = CPtiEngine::NewL(ETrue); |
|
110 iOwnPtiEngine = ETrue; |
|
111 } |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CAknFepVkbDataMgr::NewL |
|
116 // (other items were commented in a header). |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 CAknFepVkbDataMgr* CAknFepVkbDataMgr::NewL(MAknFepVkbLayoutContext* aContext, |
|
120 CPtiEngine* aPtiEngine) |
|
121 { |
|
122 CAknFepVkbDataMgr* self = NewLC(aContext, aPtiEngine); |
|
123 CleanupStack::Pop(); |
|
124 return self; |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CAknFepVkbDataMgr::NewLC |
|
129 // (other items were commented in a header). |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 CAknFepVkbDataMgr* CAknFepVkbDataMgr::NewLC(MAknFepVkbLayoutContext* aContext, |
|
133 CPtiEngine* aPtiEngine) |
|
134 { |
|
135 CAknFepVkbDataMgr* self = new(ELeave) CAknFepVkbDataMgr(aContext); |
|
136 CleanupStack::PushL(self); |
|
137 self->ConstructL(aPtiEngine); |
|
138 return self; |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // CAknFepVkbDataMgr::~CAknFepVkbDataMgr |
|
143 // (other items were commented in a header). |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 CAknFepVkbDataMgr::~CAknFepVkbDataMgr() |
|
147 { |
|
148 //iLangStringList.ResetAndDestroy(); |
|
149 //iLangStringList.Close(); |
|
150 |
|
151 iCandidates.ResetAndDestroy(); |
|
152 iCandidates.Close(); |
|
153 |
|
154 // Cen Rep |
|
155 delete iFepRepositoryWatcher; |
|
156 delete iGSRepositoryWatcher; |
|
157 delete iFepRepository; |
|
158 delete iGSRepository; |
|
159 delete iUserDefinedResource; |
|
160 // Delete engine |
|
161 if( iOwnPtiEngine ) |
|
162 { |
|
163 delete iPtiEngine; |
|
164 } |
|
165 |
|
166 iUnits.Close(); |
|
167 } |
|
168 // --------------------------------------------------------------------------- |
|
169 // CAknFepVkbDataMgr::GetCandidatesL |
|
170 // (other items were commented in a header). |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 TInt CAknFepVkbDataMgr::GetCandidatesL(const TDesC& aInputString, |
|
174 const TBool aIsPredictive, |
|
175 TBool aForNextPage) |
|
176 { |
|
177 if (aForNextPage) |
|
178 { |
|
179 if ( iCandidatesCount > KMaxPredictCandCnt ) |
|
180 { |
|
181 return iCandidatesCount; |
|
182 } |
|
183 |
|
184 if ((iPtiEngine) && (iPtiEngine->NextCandidatePage())) |
|
185 { |
|
186 TPtrC ptr = iPtiEngine->CandidatePage(); |
|
187 |
|
188 TInt start = 0; |
|
189 TInt length = 0; |
|
190 |
|
191 for (TInt i = 0; i <ptr.Length(); i++) |
|
192 { |
|
193 if (ptr[i] == KSegment) |
|
194 { |
|
195 TPtrC segment(ptr.Ptr() + start, length); |
|
196 TRAP_IGNORE(iCandidates.AppendL(segment.AllocL())); |
|
197 start += (length + 1); |
|
198 length = 0; |
|
199 } |
|
200 else |
|
201 { |
|
202 length++; |
|
203 } |
|
204 } |
|
205 |
|
206 if (length) |
|
207 { |
|
208 TPtrC segm(ptr.Ptr() + start, length); |
|
209 TRAP_IGNORE(iCandidates.AppendL(segm.AllocL())); |
|
210 } |
|
211 |
|
212 if ( iCandidates.Count() >= KMaxPredictCandCnt ) |
|
213 { |
|
214 for (TInt i = KMaxPredictCandCnt; i < iCandidates.Count(); i++) |
|
215 { |
|
216 delete iCandidates[KMaxPredictCandCnt]; |
|
217 iCandidates.Remove(KMaxPredictCandCnt); |
|
218 } |
|
219 } |
|
220 |
|
221 iContext->SendEventToVkbControl(EVkbEventGetNextPageCandidate,( |
|
222 CFepUiBaseCtrl*)&iCandidates); |
|
223 |
|
224 iCandidatesCount = iCandidates.Count(); |
|
225 |
|
226 return iCandidatesCount; |
|
227 } |
|
228 |
|
229 return KErrNotSupported; |
|
230 } |
|
231 |
|
232 if (aIsPredictive) |
|
233 { |
|
234 if( iPredictiveBuf.Length() + aInputString.Length() > KMaxLengthPredictiveString ) |
|
235 { |
|
236 iPredictiveBuf.Zero(); |
|
237 } |
|
238 |
|
239 if ( ( aInputString.Length() == 1) |
|
240 && (aInputString[0] == EKeyBackspace) ) |
|
241 { |
|
242 if ( iPredictiveBuf.Length() >= 1 ) |
|
243 { |
|
244 iPredictiveBuf.Delete(iPredictiveBuf.Length()-1,1); |
|
245 } |
|
246 } |
|
247 else |
|
248 { |
|
249 iPredictiveBuf.Append(aInputString); |
|
250 } |
|
251 } |
|
252 else |
|
253 { |
|
254 iPredictiveBuf.Zero(); |
|
255 } |
|
256 |
|
257 const HBufC* formatString = NULL; |
|
258 |
|
259 if (aIsPredictive && iPredictiveBuf.Length() == 0) |
|
260 { |
|
261 iCandidates.ResetAndDestroy(); |
|
262 } |
|
263 else |
|
264 { |
|
265 iPtiEngine->SetCandidatePageLength(K1PageCandCount); |
|
266 |
|
267 if(aIsPredictive) |
|
268 { |
|
269 DoPredictive(iPredictiveBuf, iCandidates); |
|
270 if(iCandidates.Count() == 0) |
|
271 { |
|
272 iPredictiveBuf.Delete(0, iPredictiveBuf.Length() - 1); |
|
273 DoPredictive(iPredictiveBuf, iCandidates); |
|
274 } |
|
275 } |
|
276 else |
|
277 { |
|
278 formatString = iPtiEngine->GetCandidatesByInputString(aInputString, |
|
279 iCandidates, |
|
280 aIsPredictive); |
|
281 } |
|
282 } |
|
283 |
|
284 if (!formatString && !aIsPredictive) |
|
285 { |
|
286 return 0; |
|
287 } |
|
288 |
|
289 if (!aIsPredictive) |
|
290 { |
|
291 iContext->SendEventToVkbControl(EVkbEventCompFieldAnalysisResponse,NULL,*formatString); |
|
292 } |
|
293 |
|
294 iContext->SendEventToVkbControl(EVkbEventCandidatesChanged,(CFepUiBaseCtrl*)&iCandidates); |
|
295 |
|
296 delete formatString; |
|
297 |
|
298 iCandidatesCount = iCandidates.Count(); |
|
299 |
|
300 return iCandidatesCount; |
|
301 } |
|
302 |
|
303 // --------------------------------------------------------------------------- |
|
304 // CAknFepVkbDataMgr::DoPredictive |
|
305 // (other items were commented in a header). |
|
306 // --------------------------------------------------------------------------- |
|
307 // |
|
308 void CAknFepVkbDataMgr::DoPredictive(const TDesC& aTriggerStr, |
|
309 RPointerArray<HBufC>& aPredictives) |
|
310 { |
|
311 aPredictives.ResetAndDestroy(); |
|
312 |
|
313 if(!iPtiEngine->SetPredictiveChineseChar(aTriggerStr)) |
|
314 { |
|
315 return; |
|
316 } |
|
317 TPtrC ptr = iPtiEngine->CandidatePage(); |
|
318 |
|
319 TInt start = 0; |
|
320 TInt length = 0; |
|
321 |
|
322 for (TInt i = 0; i <ptr.Length(); i++) |
|
323 { |
|
324 if (ptr[i] == KSegment) |
|
325 { |
|
326 TPtrC segment(ptr.Ptr() + start, length); |
|
327 TRAP_IGNORE(aPredictives.AppendL(segment.AllocL())); |
|
328 start += (length + 1); |
|
329 length = 0; |
|
330 } |
|
331 else |
|
332 { |
|
333 length++; |
|
334 } |
|
335 } |
|
336 |
|
337 if (length) |
|
338 { |
|
339 TPtrC segm(ptr.Ptr() + start, length); |
|
340 TRAP_IGNORE(aPredictives.AppendL(segm.AllocL())); |
|
341 } |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------------------------- |
|
345 // CAknFepVkbDataMgr::ClearTriggerString |
|
346 // (other items were commented in a header). |
|
347 // --------------------------------------------------------------------------- |
|
348 // |
|
349 void CAknFepVkbDataMgr::ClearTriggerString() |
|
350 { |
|
351 iPredictiveBuf.Zero(); |
|
352 } |
|
353 |
|
354 // --------------------------------------------------------------------------- |
|
355 // CAknFepVkbDataMgr::Reset |
|
356 // (other items were commented in a header). |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 void CAknFepVkbDataMgr::Reset() |
|
360 { |
|
361 // iCase = 0; |
|
362 |
|
363 // iEditorNumericKeymap = 0; |
|
364 |
|
365 // iPermittedRange = 0; |
|
366 |
|
367 // iImLayout = ERangeChinese; |
|
368 |
|
369 iCandidatesCount = 0; |
|
370 |
|
371 iShiftDown = EFalse; |
|
372 |
|
373 iCapslockDown = EFalse; |
|
374 |
|
375 iCandidates.ResetAndDestroy(); |
|
376 |
|
377 } |
|
378 |
|
379 // --------------------------------------------------------------------------- |
|
380 // CAknFepVkbDataMgr::Candidates |
|
381 // (other items were commented in a header). |
|
382 // --------------------------------------------------------------------------- |
|
383 // |
|
384 RPointerArray<HBufC> CAknFepVkbDataMgr::Candidates() |
|
385 { |
|
386 return iCandidates; |
|
387 } |
|
388 |
|
389 // --------------------------------------------------------------------------- |
|
390 // CAknFepVkbDataMgr::Case |
|
391 // (other items were commented in a header). |
|
392 // --------------------------------------------------------------------------- |
|
393 // |
|
394 TInt CAknFepVkbDataMgr::Case() |
|
395 { |
|
396 return iCase; |
|
397 } |
|
398 |
|
399 // --------------------------------------------------------------------------- |
|
400 // CAknFepVkbDataMgr::InputLanguage |
|
401 // (other items were commented in a header). |
|
402 // --------------------------------------------------------------------------- |
|
403 // |
|
404 TInt CAknFepVkbDataMgr::InputLanguage() |
|
405 { |
|
406 return iInputLanguage; |
|
407 } |
|
408 |
|
409 // --------------------------------------------------------------------------- |
|
410 // CAknFepVkbDataMgr::PermittedRange |
|
411 // (other items were commented in a header). |
|
412 // --------------------------------------------------------------------------- |
|
413 // |
|
414 TInt CAknFepVkbDataMgr::PermittedRange() |
|
415 { |
|
416 return iPermittedRange; |
|
417 } |
|
418 |
|
419 // --------------------------------------------------------------------------- |
|
420 // CAknFepVkbDataMgr::CurrentRange |
|
421 // (other items were commented in a header). |
|
422 // --------------------------------------------------------------------------- |
|
423 // |
|
424 TInt CAknFepVkbDataMgr::CurrentRange() |
|
425 { |
|
426 return iCurrentRange; |
|
427 } |
|
428 |
|
429 // --------------------------------------------------------------------------- |
|
430 // CAknFepVkbDataMgr::CurrentAccent |
|
431 // (other items were commented in a header). |
|
432 // --------------------------------------------------------------------------- |
|
433 // |
|
434 TInt CAknFepVkbDataMgr::CurrentAccent() |
|
435 { |
|
436 return iCurrentAccent; |
|
437 } |
|
438 |
|
439 // --------------------------------------------------------------------------- |
|
440 // CAknFepVkbDataMgr::EditorNumericKeymap |
|
441 // (other items were commented in a header). |
|
442 // --------------------------------------------------------------------------- |
|
443 // |
|
444 TInt CAknFepVkbDataMgr::EditorNumericKeymap() |
|
445 { |
|
446 return iEditorNumericKeymap; |
|
447 } |
|
448 |
|
449 // --------------------------------------------------------------------------- |
|
450 // CAknFepVkbDataMgr::IMLayout |
|
451 // (other items were commented in a header). |
|
452 // --------------------------------------------------------------------------- |
|
453 // |
|
454 TInt CAknFepVkbDataMgr::IMLayout() |
|
455 { |
|
456 return iImLayout; |
|
457 } |
|
458 |
|
459 // --------------------------------------------------------------------------- |
|
460 // CAknFepVkbDataMgr::ShiftDown |
|
461 // (other items were commented in a header). |
|
462 // --------------------------------------------------------------------------- |
|
463 // |
|
464 TBool CAknFepVkbDataMgr::ShiftDown() |
|
465 { |
|
466 return iShiftDown; |
|
467 } |
|
468 |
|
469 // --------------------------------------------------------------------------- |
|
470 // CAknFepVkbDataMgr::CapslockDown |
|
471 // (other items were commented in a header). |
|
472 // --------------------------------------------------------------------------- |
|
473 // |
|
474 TBool CAknFepVkbDataMgr::CapslockDown() |
|
475 { |
|
476 return iCapslockDown; |
|
477 } |
|
478 |
|
479 // --------------------------------------------------------------------------- |
|
480 // CAknFepVkbDataMgr::LengthWhenButtondownOnBack |
|
481 // (other items were commented in a header). |
|
482 // --------------------------------------------------------------------------- |
|
483 // |
|
484 TInt CAknFepVkbDataMgr::LengthWhenButtondownOnBack() |
|
485 { |
|
486 return iLengthWhenButtondownOnBack; |
|
487 } |
|
488 |
|
489 // --------------------------------------------------------------------------- |
|
490 // CAknFepVkbDataMgr::CandidatesCount |
|
491 // (other items were commented in a header). |
|
492 // --------------------------------------------------------------------------- |
|
493 // |
|
494 TInt CAknFepVkbDataMgr::CandidatesCount() |
|
495 { |
|
496 return iCandidatesCount; |
|
497 } |
|
498 |
|
499 // --------------------------------------------------------------------------- |
|
500 // CAknFepVkbDataMgr::WindowPosition |
|
501 // (other items were commented in a header). |
|
502 // --------------------------------------------------------------------------- |
|
503 // |
|
504 TInt CAknFepVkbDataMgr::WindowPosition() |
|
505 { |
|
506 return iWindowPosition; |
|
507 } |
|
508 |
|
509 // --------------------------------------------------------------------------- |
|
510 // CAknFepVkbDataMgr::SetWindowPosition |
|
511 // (other items were commented in a header). |
|
512 // --------------------------------------------------------------------------- |
|
513 // |
|
514 void CAknFepVkbDataMgr::SetWindowPosition(TInt aPosition) |
|
515 { |
|
516 iWindowPosition = aPosition; |
|
517 |
|
518 //Store it into CenRep |
|
519 WriteWindowPostion(iWindowPosition); |
|
520 } |
|
521 |
|
522 // --------------------------------------------------------------------------- |
|
523 // CAknFepVkbDataMgr::SetCase |
|
524 // (other items were commented in a header). |
|
525 // --------------------------------------------------------------------------- |
|
526 // |
|
527 void CAknFepVkbDataMgr::SetCase(TInt aCase) |
|
528 { |
|
529 iCase = aCase; |
|
530 } |
|
531 |
|
532 void CAknFepVkbDataMgr::SetPermittedCase(TInt aPermittedCase) |
|
533 { |
|
534 iPermittedCase = aPermittedCase; |
|
535 } |
|
536 |
|
537 TInt CAknFepVkbDataMgr::PermittedCase() |
|
538 { |
|
539 return iPermittedCase; |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------------------------- |
|
543 // CAknFepVkbDataMgr::NextCandidateExist |
|
544 // (other items were commented in a header). |
|
545 // --------------------------------------------------------------------------- |
|
546 // |
|
547 TBool CAknFepVkbDataMgr::NextCandidateExist() |
|
548 { |
|
549 if (iPtiEngine) |
|
550 { |
|
551 return iPtiEngine->MoreCandidatePages(); |
|
552 } |
|
553 |
|
554 return EFalse; |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // CAknFepVkbDataMgr::LanguageIsChinese |
|
559 // (other items were commented in a header). |
|
560 // --------------------------------------------------------------------------- |
|
561 // |
|
562 TBool CAknFepVkbDataMgr::LanguageIsChinese(TInt aLang) |
|
563 { |
|
564 if ((aLang == ELangPrcChinese) || |
|
565 (aLang == ELangHongKongChinese) || |
|
566 (aLang == ELangTaiwanChinese)) |
|
567 { |
|
568 return ETrue; |
|
569 } |
|
570 |
|
571 return EFalse; |
|
572 } |
|
573 |
|
574 // --------------------------------------------------------------------------- |
|
575 // CAknFepVkbDataMgr::SetEngineLanguage |
|
576 // (other items were commented in a header). |
|
577 // --------------------------------------------------------------------------- |
|
578 // |
|
579 void CAknFepVkbDataMgr::SetEngineLanguage(TInt aLang) |
|
580 { |
|
581 if (iPtiEngine) |
|
582 { |
|
583 switch (aLang) |
|
584 { |
|
585 case ELangHongKongChinese: |
|
586 TRAP_IGNORE(iPtiEngine->ActivateLanguageL(aLang, EPtiEngineStrokeVkb)); |
|
587 break; |
|
588 case ELangTaiwanChinese: |
|
589 TRAP_IGNORE(iPtiEngine->ActivateLanguageL(aLang, EPtiEngineZhuyinVkb)); |
|
590 break; |
|
591 case ELangPrcChinese: |
|
592 TRAP_IGNORE(iPtiEngine->ActivateLanguageL(aLang, EPtiEnginePinyinVkb)); |
|
593 break; |
|
594 default: |
|
595 break; |
|
596 } |
|
597 } |
|
598 } |
|
599 |
|
600 // --------------------------------------------------------------------------- |
|
601 // CAknFepVkbDataMgr::SetInputLanguage |
|
602 // (other items were commented in a header). |
|
603 // --------------------------------------------------------------------------- |
|
604 // |
|
605 TInt CAknFepVkbDataMgr::SetInputLanguage(TInt aInputLanguage) |
|
606 { |
|
607 /* |
|
608 if( aInputLanguage != -1 && aInputLanguage != iInputLanguage ) |
|
609 { |
|
610 iInputLanguage = aInputLanguage; |
|
611 |
|
612 if( iPtiEngine ) |
|
613 { |
|
614 switch (iInputLanguage) |
|
615 { |
|
616 case ELangHongKongChinese: |
|
617 TRAP_IGNORE(iPtiEngine->ActivateLanguageL(iInputLanguage, EPtiEngineStrokeVkb)); |
|
618 break; |
|
619 case ELangTaiwanChinese: |
|
620 TRAP_IGNORE(iPtiEngine->ActivateLanguageL(iInputLanguage, EPtiEngineZhuyinVkb)); |
|
621 break; |
|
622 case ELangPrcChinese: |
|
623 TRAP_IGNORE(iPtiEngine->ActivateLanguageL(iInputLanguage, EPtiEnginePinyinVkb)); |
|
624 break; |
|
625 default: |
|
626 break; |
|
627 } |
|
628 } |
|
629 } |
|
630 */ |
|
631 if (!LanguageIsChinese(aInputLanguage) && (aInputLanguage != ELangEnglish)) |
|
632 { |
|
633 return ELangNone; |
|
634 } |
|
635 |
|
636 if (aInputLanguage == ELangEnglish) |
|
637 { |
|
638 TLanguage displayLang = User::Language(); |
|
639 |
|
640 // set real language to a Chinese |
|
641 if (!LanguageIsChinese(iInputLanguage)) |
|
642 { |
|
643 // original language is not Chinese |
|
644 if (LanguageIsChinese(displayLang)) |
|
645 { |
|
646 iInputLanguage = displayLang; |
|
647 } |
|
648 else |
|
649 { |
|
650 iInputLanguage = ELangPrcChinese; |
|
651 } |
|
652 |
|
653 SetEngineLanguage(iInputLanguage); |
|
654 } |
|
655 |
|
656 return aInputLanguage; |
|
657 } |
|
658 else |
|
659 { |
|
660 // aInputLanguage is Chinese |
|
661 if (iInputLanguage != aInputLanguage) |
|
662 { |
|
663 iInputLanguage = aInputLanguage; |
|
664 |
|
665 SetEngineLanguage(iInputLanguage); |
|
666 } |
|
667 |
|
668 return iInputLanguage; |
|
669 } |
|
670 /* |
|
671 const SLanguageItem* item = GetItemByLangId(iInputLanguage); |
|
672 if ( item ) |
|
673 { |
|
674 return item->iDisplayText; |
|
675 } |
|
676 return KNullDesC; |
|
677 */ |
|
678 } |
|
679 |
|
680 // --------------------------------------------------------------------------- |
|
681 // CAknFepVkbDataMgr::SetPermittedRange |
|
682 // (other items were commented in a header). |
|
683 // --------------------------------------------------------------------------- |
|
684 // |
|
685 void CAknFepVkbDataMgr::SetPermittedRange(TInt aRange) |
|
686 { |
|
687 if ( aRange & ERangeNative ) |
|
688 { |
|
689 aRange = aRange | ERangeAccent; |
|
690 } |
|
691 |
|
692 if ( iPermittedRange != aRange ) |
|
693 { |
|
694 iPermittedRange = aRange; |
|
695 TPtr ptr((TUint16* ) &iPermittedRange,sizeof(TInt)); |
|
696 iContext->SendEventToVkbControl(EVkbEventSetPermittedRange,NULL,ptr); |
|
697 } |
|
698 } |
|
699 |
|
700 // --------------------------------------------------------------------------- |
|
701 // CAknFepVkbDataMgr::SetCurrentAccent |
|
702 // (other items were commented in a header). |
|
703 // --------------------------------------------------------------------------- |
|
704 // |
|
705 void CAknFepVkbDataMgr::SetCurrentAccent(TInt aAccent) |
|
706 { |
|
707 iCurrentAccent = aAccent; |
|
708 } |
|
709 |
|
710 // --------------------------------------------------------------------------- |
|
711 // CAknFepVkbDataMgr::SetCandidatesCount |
|
712 // (other items were commented in a header). |
|
713 // --------------------------------------------------------------------------- |
|
714 // |
|
715 void CAknFepVkbDataMgr::SetCandidatesCount(TInt aCandidatesCount) |
|
716 { |
|
717 iCandidatesCount = aCandidatesCount; |
|
718 } |
|
719 |
|
720 // --------------------------------------------------------------------------- |
|
721 // CAknFepVkbDataMgr::SetCurrentRange |
|
722 // (other items were commented in a header). |
|
723 // --------------------------------------------------------------------------- |
|
724 // |
|
725 void CAknFepVkbDataMgr::SetCurrentRange(TInt aRange) |
|
726 { |
|
727 iCurrentRange = aRange; |
|
728 if ( aRange == ERangeNative ) |
|
729 { |
|
730 //According to current input language, set IMLayout |
|
731 switch (iInputLanguage) |
|
732 { |
|
733 case ELangHongKongChinese: |
|
734 iImLayout = iDefaultImLayout4HK; |
|
735 break; |
|
736 case ELangTaiwanChinese: |
|
737 iImLayout = iDefaultImLayout4TW; |
|
738 break; |
|
739 case ELangPrcChinese: |
|
740 iImLayout = iDefaultImLayout4PRC; |
|
741 break; |
|
742 default: |
|
743 iImLayout = EAknFepVkbImLatin; |
|
744 break; |
|
745 } |
|
746 |
|
747 switch(iImLayout) |
|
748 { |
|
749 case EAknFepVkbImCnPinyin: |
|
750 iPtiEngine->SetInputMode(EPtiEnginePinyinVkb); |
|
751 break; |
|
752 case EAknFepVkbImCnZhuyin: |
|
753 iPtiEngine->SetInputMode(EPtiEngineZhuyinVkb); |
|
754 break; |
|
755 case EAknFepVkbImCnStroke: |
|
756 iPtiEngine->SetInputMode(EPtiEngineStrokeVkb); |
|
757 break; |
|
758 case EAknFepVkbImCnCangjie: |
|
759 { |
|
760 // here , Get general setting:). |
|
761 TInt subCangJieMode = ECangJieNormal; |
|
762 iFepRepository->Get( KAknFepCangJieMode, subCangJieMode ); |
|
763 switch( subCangJieMode ) |
|
764 { |
|
765 case ECangJieEasy: |
|
766 iPtiEngine->SetInputMode( EPtiEngineEasyCangjieVkb ); |
|
767 break; |
|
768 case ECangJieAdvanced: |
|
769 iPtiEngine->SetInputMode( EPtiEngineAdvCangjieVkb ); |
|
770 break; |
|
771 case ECangJieNormal: |
|
772 iPtiEngine->SetInputMode( EPtiEngineNormalCangjieVkb ); |
|
773 break; |
|
774 default: |
|
775 iPtiEngine->SetInputMode( EPtiEngineNormalCangjieVkb ); |
|
776 break; |
|
777 } |
|
778 } |
|
779 break; |
|
780 default: |
|
781 break; |
|
782 } |
|
783 } |
|
784 else if( aRange == ERangeNumber ) |
|
785 { |
|
786 if (iInputLanguage == ELangTaiwanChinese && iDefaultImLayout4TW != EAknFepVkbImCnStroke) |
|
787 { |
|
788 iImLayout = EAknFepVkbImNumberForZhuyin; |
|
789 } |
|
790 else |
|
791 { |
|
792 iImLayout = EAknFepVkbImNumber; |
|
793 } |
|
794 } |
|
795 else |
|
796 { |
|
797 if (iInputLanguage == ELangTaiwanChinese && iDefaultImLayout4TW != EAknFepVkbImCnStroke) |
|
798 { |
|
799 iImLayout = EAknFepVkbImLatinForZhuyin; |
|
800 } |
|
801 else |
|
802 { |
|
803 iImLayout = EAknFepVkbImLatin; |
|
804 } |
|
805 } |
|
806 } |
|
807 |
|
808 void CAknFepVkbDataMgr::SetDataQueryRect(const TRect& aRect) |
|
809 { |
|
810 iDataQueryRect = aRect; |
|
811 } |
|
812 |
|
813 // --------------------------------------------------------------------------- |
|
814 // CAknFepVkbDataMgr::SetEditorNumericKeymap |
|
815 // (other items were commented in a header). |
|
816 // --------------------------------------------------------------------------- |
|
817 // |
|
818 void CAknFepVkbDataMgr::SetEditorNumericKeymap(TInt aEditorNumericKeymap) |
|
819 { |
|
820 iEditorNumericKeymap = aEditorNumericKeymap; |
|
821 } |
|
822 |
|
823 // --------------------------------------------------------------------------- |
|
824 // CAknFepVkbDataMgr::SetImLayout |
|
825 // (other items were commented in a header). |
|
826 // --------------------------------------------------------------------------- |
|
827 // |
|
828 void CAknFepVkbDataMgr::SetImLayout(TInt aImLayout) |
|
829 { |
|
830 iImLayout = aImLayout; |
|
831 ResetUnitSize(); |
|
832 } |
|
833 |
|
834 // --------------------------------------------------------------------------- |
|
835 // CAknFepVkbDataMgr::ChangeShiftDown |
|
836 // (other items were commented in a header). |
|
837 // --------------------------------------------------------------------------- |
|
838 // |
|
839 TInt CAknFepVkbDataMgr::ChangeShiftDown() |
|
840 { |
|
841 iShiftDown = ! iShiftDown; |
|
842 return CalculateCase(); |
|
843 } |
|
844 |
|
845 // --------------------------------------------------------------------------- |
|
846 // CAknFepVkbDataMgr::ChangeCapslockDown |
|
847 // (other items were commented in a header). |
|
848 // --------------------------------------------------------------------------- |
|
849 // |
|
850 TInt CAknFepVkbDataMgr::ChangeCapslockDown() |
|
851 { |
|
852 iShiftDown = 0; |
|
853 iCapslockDown = ! iCapslockDown; |
|
854 return CalculateCase(); |
|
855 } |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // CAknFepVkbDataMgr::CalculateCase |
|
859 // (other items were commented in a header). |
|
860 // --------------------------------------------------------------------------- |
|
861 // |
|
862 TInt CAknFepVkbDataMgr::CalculateCase() |
|
863 { |
|
864 if (iShiftDown && iCapslockDown) |
|
865 return ECaseInverseText; |
|
866 else if (!iShiftDown && iCapslockDown) |
|
867 return ECaseUpper; |
|
868 else if (iShiftDown && !iCapslockDown) |
|
869 return ECaseText; |
|
870 else if (!iShiftDown && !iCapslockDown) |
|
871 return ECaseLower; |
|
872 else |
|
873 return ECaseLower; |
|
874 } |
|
875 |
|
876 // --------------------------------------------------------------------------- |
|
877 // CAknFepVkbDataMgr::SetShiftDown |
|
878 // (other items were commented in a header). |
|
879 // --------------------------------------------------------------------------- |
|
880 // |
|
881 void CAknFepVkbDataMgr::SetShiftDown(TBool aFlag) |
|
882 { |
|
883 iShiftDown = aFlag; |
|
884 } |
|
885 |
|
886 // --------------------------------------------------------------------------- |
|
887 // CAknFepVkbDataMgr::SetCapslockDown |
|
888 // (other items were commented in a header). |
|
889 // --------------------------------------------------------------------------- |
|
890 // |
|
891 void CAknFepVkbDataMgr::SetCapslockDown(TBool aFlag) |
|
892 { |
|
893 iCapslockDown = aFlag; |
|
894 } |
|
895 |
|
896 // --------------------------------------------------------------------------- |
|
897 // CAknFepVkbDataMgr::SetLengthWhenButtondownOnBack |
|
898 // (other items were commented in a header). |
|
899 // --------------------------------------------------------------------------- |
|
900 // |
|
901 void CAknFepVkbDataMgr::SetLengthWhenButtondownOnBack(TInt aLength) |
|
902 { |
|
903 iLengthWhenButtondownOnBack = aLength; |
|
904 } |
|
905 |
|
906 // --------------------------------------------------------------------------- |
|
907 // CAknFepVkbDataMgr::SetData |
|
908 // (other items were commented in a header). |
|
909 // --------------------------------------------------------------------------- |
|
910 // |
|
911 void CAknFepVkbDataMgr::SetData(TAknFepDataType aDataType,TInt aData) |
|
912 { |
|
913 switch (aDataType) |
|
914 { |
|
915 case EAknFepDataTypeCase: |
|
916 SetCase(aData); |
|
917 break; |
|
918 case EAknFepDataTypeInputLanguage: |
|
919 SetInputLanguage(aData); |
|
920 break; |
|
921 case EAknFepDataTypePermittedRange: |
|
922 SetPermittedRange(aData); |
|
923 break; |
|
924 case EAknFepDataTypeCurrentRange: |
|
925 SetCurrentRange(aData); |
|
926 break; |
|
927 case EAknFepDataTypeIMLayout: |
|
928 SetImLayout(aData); |
|
929 break; |
|
930 case EAknFepDataTypeNumericKeymap: |
|
931 SetEditorNumericKeymap((TAknEditorNumericKeymap)aData); |
|
932 break; |
|
933 case EAknFepDataTypeShfitDown: |
|
934 SetShiftDown(aData); |
|
935 break; |
|
936 case EAknFepDataTypeCapslockDown: |
|
937 SetCapslockDown(aData); |
|
938 break; |
|
939 case EAknFepDataTypeCurrentAccent: |
|
940 SetCurrentAccent(aData); |
|
941 break; |
|
942 case EAknFepDataTypeCandidateCount: |
|
943 SetCandidatesCount(aData); |
|
944 break; |
|
945 case EAknFepDataTypeLengthWhenButtondownOnBack: |
|
946 SetLengthWhenButtondownOnBack(aData); |
|
947 break; |
|
948 case EAknFepDataTypeWindowPosition: |
|
949 SetWindowPosition(aData); |
|
950 break; |
|
951 case EAknFepDataTypeUnitWidth: |
|
952 iUnitWidth = aData; |
|
953 break; |
|
954 case EAknFepDataTypeUnitHeight: |
|
955 iUnitHeight = aData; |
|
956 break; |
|
957 case EAknFepDataTypeUseDefinedResource: |
|
958 { |
|
959 delete iUserDefinedResource; |
|
960 TInt* len = (TInt*)(aData - 4); |
|
961 TPtrC16 keymapRes((const TUint16*)aData, *len/2); |
|
962 iUserDefinedResource = keymapRes.Alloc(); |
|
963 } |
|
964 break; |
|
965 case EAknFepDataTypeNeedBRJustify: |
|
966 iNeedBrJustify = aData; |
|
967 default: |
|
968 break; |
|
969 } |
|
970 } |
|
971 |
|
972 // --------------------------------------------------------------------------- |
|
973 // CAknFepVkbDataMgr::RequestData |
|
974 // (other items were commented in a header). |
|
975 // --------------------------------------------------------------------------- |
|
976 // |
|
977 TInt CAknFepVkbDataMgr::RequestData(TAknFepDataType aDataType) |
|
978 { |
|
979 switch (aDataType) |
|
980 { |
|
981 case EAknFepDataTypeCase: |
|
982 return iCase; |
|
983 case EAknFepDataTypeInputLanguage: |
|
984 return iInputLanguage; |
|
985 case EAknFepDataTypePermittedRange: |
|
986 return iPermittedRange; |
|
987 case EAknFepDataTypeCurrentRange: |
|
988 return iCurrentRange; |
|
989 case EAknFepDataTypeIMLayout: |
|
990 return iImLayout; |
|
991 case EAknFepDataTypeNumericKeymap: |
|
992 return iEditorNumericKeymap; |
|
993 case EAknFepDataTypeShfitDown: |
|
994 return iShiftDown; |
|
995 case EAknFepDataTypeCapslockDown: |
|
996 return iCapslockDown; |
|
997 case EAknFepDataTypeCurrentAccent: |
|
998 return iCurrentAccent; |
|
999 case EAknFepDataTypeCandidateCount: |
|
1000 return iCandidatesCount; |
|
1001 case EAknFepDataTypeLengthWhenButtondownOnBack: |
|
1002 return iLengthWhenButtondownOnBack; |
|
1003 case EAknFepDataTypeWindowPosition: |
|
1004 return iWindowPosition; |
|
1005 case EAknFepDataTypeUnitWidth: |
|
1006 return iUnitWidth; |
|
1007 case EAknFepDataTypeUnitHeight: |
|
1008 return iUnitHeight; |
|
1009 case EAknFepDataTypeScreenSize: |
|
1010 return iScreenMode.iPixelSize.iWidth | ( iScreenMode.iPixelSize.iHeight << 16); |
|
1011 case EAknFepDataTypeDataQueryRect: |
|
1012 return (TInt)&iDataQueryRect; |
|
1013 case EAknFepDataTypeUseDefinedResource: |
|
1014 return (TInt) iUserDefinedResource; |
|
1015 case EAknFepDataTypeShadowTlSize: |
|
1016 return (TInt)(&iShadowTl); |
|
1017 case EAknFepDataTypeShadowBrSize: |
|
1018 return (TInt)(&iShadowBr); |
|
1019 case EAknFepDataTypeMainPaneRect: |
|
1020 return (TInt)(&iMainPaneRect); |
|
1021 case EAknFepDataTypeIcfColumnNums: |
|
1022 { |
|
1023 TInt columNum = 7; |
|
1024 if( iDefaultImLayout4TW != EAknFepVkbImCnStroke && |
|
1025 iInputLanguage == ELangTaiwanChinese /* || |
|
1026 ( iCurrentRange == ERangeNumber && |
|
1027 static_cast<CAknFepVkbLayout*>(iContext)->PenInputType() == EPluginInputModeFSQ )*/ ) |
|
1028 { |
|
1029 columNum = 8; |
|
1030 } |
|
1031 return columNum; |
|
1032 } |
|
1033 case EAknFepDataTypeTitleBarHeight: |
|
1034 { |
|
1035 if( EAknFepVkbImCnZhuyin == iImLayout ) |
|
1036 { |
|
1037 return iUnitHeight; |
|
1038 } |
|
1039 else |
|
1040 { |
|
1041 return iUnitHeight*2; |
|
1042 } |
|
1043 } |
|
1044 case EAknFepDataTypeDefaultIMLayout: |
|
1045 return iDefaultImLayout4TW; |
|
1046 case EAknFepDataTypeNeedBRJustify: |
|
1047 return iNeedBrJustify; |
|
1048 default: |
|
1049 break; |
|
1050 } |
|
1051 return 0; |
|
1052 } |
|
1053 |
|
1054 // --------------------------------------------------------------------------- |
|
1055 // CAknFepVkbDataMgr::IsShiftPermitted |
|
1056 // (other items were commented in a header). |
|
1057 // --------------------------------------------------------------------------- |
|
1058 // |
|
1059 TBool CAknFepVkbDataMgr::IsShiftPermitted() |
|
1060 { |
|
1061 if ( ( iImLayout == EAknFepVkbImLatin ) || ( iImLayout == EAknFepVkbImNumber ) |
|
1062 || ( iImLayout == EAknFepVkbImLatinForZhuyin ) |
|
1063 || ( iImLayout == EAknFepVkbImNumberForZhuyin ) ) |
|
1064 { |
|
1065 return (iPermittedCase & ECaseText) || |
|
1066 (iPermittedCase & ECaseInverseText); |
|
1067 } |
|
1068 return EFalse; |
|
1069 } |
|
1070 |
|
1071 TBool CAknFepVkbDataMgr::IsCapsLockPermitted() |
|
1072 { |
|
1073 if ( ( iImLayout == EAknFepVkbImLatin ) || ( iImLayout == EAknFepVkbImNumber ) ) |
|
1074 { |
|
1075 return iPermittedCase & ECaseUpper; |
|
1076 } |
|
1077 return EFalse; |
|
1078 } |
|
1079 |
|
1080 // --------------------------------------------------------------------------- |
|
1081 // CAknFepVkbDataMgr::CAknFepVkbDataMgr::GetItemByLangId |
|
1082 // (other items were commented in a header). |
|
1083 // --------------------------------------------------------------------------- |
|
1084 // |
|
1085 /* |
|
1086 const CAknFepVkbDataMgr::SLanguageItem* CAknFepVkbDataMgr::GetItemByLangId(TInt aLangId) |
|
1087 { |
|
1088 for (TInt i=0;i<iLangStringList.Count();i++) |
|
1089 { |
|
1090 SLanguageItem* item = iLangStringList[i]; |
|
1091 if (item->iLangId == aLangId) |
|
1092 { |
|
1093 return item; |
|
1094 } |
|
1095 } |
|
1096 |
|
1097 return GetItemByLangId(0); |
|
1098 } |
|
1099 */ |
|
1100 |
|
1101 // --------------------------------------------------------------------------- |
|
1102 // CAknFepVkbDataMgr::HandleFepRepositoryCallBack |
|
1103 // (other items were commented in a header). |
|
1104 // --------------------------------------------------------------------------- |
|
1105 // |
|
1106 TInt CAknFepVkbDataMgr::HandleFepRepositoryCallBack(TAny* aPtr) |
|
1107 { |
|
1108 CAknFepVkbDataMgr *self = STATIC_CAST(CAknFepVkbDataMgr*, aPtr); |
|
1109 |
|
1110 CAknFepRepositoryWatcher* watcher = self->iFepRepositoryWatcher; |
|
1111 |
|
1112 if (watcher) |
|
1113 { |
|
1114 if ( (watcher->ChangedKey()) == self->iPositionSettingId ) |
|
1115 { |
|
1116 return self->PositionChangeNotification(); |
|
1117 } |
|
1118 } |
|
1119 return KErrNone; |
|
1120 } |
|
1121 |
|
1122 // --------------------------------------------------------------------------- |
|
1123 // CAknFepVkbDataMgr::HandleGSRepositoryCallBack |
|
1124 // (other items were commented in a header). |
|
1125 // --------------------------------------------------------------------------- |
|
1126 // |
|
1127 TInt CAknFepVkbDataMgr::HandleGSRepositoryCallBack(TAny* aPtr) |
|
1128 { |
|
1129 CAknFepVkbDataMgr *self = STATIC_CAST(CAknFepVkbDataMgr*, aPtr); |
|
1130 |
|
1131 CAknFepRepositoryWatcher* watcher = self->iGSRepositoryWatcher; |
|
1132 |
|
1133 if (watcher ) |
|
1134 { |
|
1135 if ( (watcher->ChangedKey() == KSettingsDefaultVkbPrc) |
|
1136 || (watcher->ChangedKey() == KSettingsDefaultVkbTw) |
|
1137 || (watcher->ChangedKey() == KSettingsDefaultVkbHk) ) |
|
1138 { |
|
1139 return self->DefaultModeChangeNotification(); |
|
1140 } |
|
1141 else if (watcher->ChangedKey() == KSettingsPenInputLang) |
|
1142 { |
|
1143 return self->PeninputlanguageChangeNotification(); |
|
1144 } |
|
1145 } |
|
1146 return KErrNone; |
|
1147 } |
|
1148 |
|
1149 // --------------------------------------------------------------------------- |
|
1150 // CAknFepVkbDataMgr::PositionChangeNotification |
|
1151 // (other items were commented in a header). |
|
1152 // --------------------------------------------------------------------------- |
|
1153 // |
|
1154 TInt CAknFepVkbDataMgr::PositionChangeNotification() |
|
1155 { |
|
1156 if (iFepRepository) |
|
1157 { |
|
1158 TInt newValue; |
|
1159 |
|
1160 iFepRepository->Get(iPositionSettingId, newValue); |
|
1161 |
|
1162 // if position have been changed, then notify window to change |
|
1163 if ( iWindowPosition != newValue ) |
|
1164 { |
|
1165 iWindowPosition = newValue; |
|
1166 |
|
1167 iContext->SendEventToVkbControl(EVkbEventPositionChanged,NULL); |
|
1168 } |
|
1169 } |
|
1170 return KErrNone; |
|
1171 } |
|
1172 |
|
1173 // --------------------------------------------------------------------------- |
|
1174 // CAknFepVkbDataMgr::DefaultModeChangeNotification |
|
1175 // (other items were commented in a header). |
|
1176 // --------------------------------------------------------------------------- |
|
1177 // |
|
1178 TInt CAknFepVkbDataMgr::DefaultModeChangeNotification() |
|
1179 { |
|
1180 //Read default mode again the peninput language |
|
1181 iGSRepository->Get(KSettingsDefaultVkbHk, iDefaultImLayout4HK); |
|
1182 |
|
1183 switch(iDefaultImLayout4HK) |
|
1184 { |
|
1185 case EAknFepVkbImCnStroke : |
|
1186 case EAknFepVkbImCnCangjie: |
|
1187 case EAknFepVkbImLatin: |
|
1188 break; |
|
1189 default: |
|
1190 iDefaultImLayout4HK = EAknFepVkbImCnStroke; |
|
1191 break; |
|
1192 } |
|
1193 |
|
1194 iGSRepository->Get(KSettingsDefaultVkbTw, iDefaultImLayout4TW); |
|
1195 switch(iDefaultImLayout4TW) |
|
1196 { |
|
1197 case EAknFepVkbImCnZhuyin : |
|
1198 case EAknFepVkbImCnStroke : |
|
1199 case EAknFepVkbImLatin : |
|
1200 break; |
|
1201 default: |
|
1202 iDefaultImLayout4TW = EAknFepVkbImCnZhuyin; |
|
1203 break; |
|
1204 } |
|
1205 |
|
1206 iGSRepository->Get(KSettingsDefaultVkbPrc, iDefaultImLayout4PRC); |
|
1207 switch(iDefaultImLayout4PRC) |
|
1208 { |
|
1209 case EAknFepVkbImCnPinyin: |
|
1210 case EAknFepVkbImCnStroke : |
|
1211 case EAknFepVkbImLatin : |
|
1212 break; |
|
1213 default: |
|
1214 iDefaultImLayout4PRC = EAknFepVkbImCnPinyin; |
|
1215 break; |
|
1216 } |
|
1217 |
|
1218 iNeedBrJustify = ETrue; |
|
1219 return KErrNone; |
|
1220 } |
|
1221 |
|
1222 // --------------------------------------------------------------------------- |
|
1223 // CAknFepVkbDataMgr::PeninputlanguageChangeNotification |
|
1224 // (other items were commented in a header). |
|
1225 // --------------------------------------------------------------------------- |
|
1226 // |
|
1227 TInt CAknFepVkbDataMgr::PeninputlanguageChangeNotification() |
|
1228 { |
|
1229 //Read peninput language again |
|
1230 |
|
1231 TInt value = 0; |
|
1232 if (iGSRepository) |
|
1233 { |
|
1234 iGSRepository->Get(KSettingsPenInputLang, value); |
|
1235 } |
|
1236 |
|
1237 //Call layout to change language |
|
1238 //const TDesC& showText = SetInputLanguage(value); |
|
1239 TInt switchDisplayLang = SetInputLanguage(value); |
|
1240 |
|
1241 TBuf<10> showText; |
|
1242 AknPenInputUtils::GetISOLanguageCode(TLanguage(switchDisplayLang), showText); |
|
1243 |
|
1244 iContext->SendEventToVkbControl(EVkbEventLanguageChanged,NULL,showText); |
|
1245 |
|
1246 return KErrNone; |
|
1247 } |
|
1248 |
|
1249 // --------------------------------------------------------------------------- |
|
1250 // CAknFepVkbDataMgr::WriteWindowPostion |
|
1251 // (other items were commented in a header). |
|
1252 // --------------------------------------------------------------------------- |
|
1253 // |
|
1254 void CAknFepVkbDataMgr::WriteWindowPostion(TInt aPosition) |
|
1255 { |
|
1256 if (iFepRepository) |
|
1257 { |
|
1258 iFepRepository->Set(iPositionSettingId, aPosition); |
|
1259 } |
|
1260 } |
|
1261 |
|
1262 // --------------------------------------------------------------------------- |
|
1263 // CAknFepVkbDataMgr::WriteLastUsedRange |
|
1264 // (other items were commented in a header). |
|
1265 // --------------------------------------------------------------------------- |
|
1266 // |
|
1267 void CAknFepVkbDataMgr::WriteLastUsedRange(TInt aLastUsedRange) |
|
1268 { |
|
1269 if (iFepRepository) |
|
1270 { |
|
1271 iFepRepository->Set(KAknFepLastUsedRange,aLastUsedRange); |
|
1272 } |
|
1273 } |
|
1274 |
|
1275 // --------------------------------------------------------------------------- |
|
1276 // CAknFepVkbDataMgr::SetScreenMode |
|
1277 // (other items were commented in a header). |
|
1278 // --------------------------------------------------------------------------- |
|
1279 // |
|
1280 void CAknFepVkbDataMgr::SetScreenMode(const TPixelsTwipsAndRotation& aScreenMode) |
|
1281 { |
|
1282 switch (aScreenMode.iRotation) |
|
1283 { |
|
1284 case CFbsBitGc::EGraphicsOrientationNormal: |
|
1285 { |
|
1286 iPositionSettingId = KAknFepHwrWindowPosition0; |
|
1287 break; |
|
1288 } |
|
1289 case CFbsBitGc::EGraphicsOrientationRotated90: |
|
1290 { |
|
1291 iPositionSettingId = KAknFepHwrWindowPosition1; |
|
1292 break; |
|
1293 } |
|
1294 case CFbsBitGc::EGraphicsOrientationRotated180: |
|
1295 { |
|
1296 iPositionSettingId = KAknFepHwrWindowPosition2; |
|
1297 break; |
|
1298 } |
|
1299 case CFbsBitGc::EGraphicsOrientationRotated270: |
|
1300 { |
|
1301 iPositionSettingId = KAknFepHwrWindowPosition3; |
|
1302 break; |
|
1303 } |
|
1304 default: |
|
1305 //User::Panic(KCategory, KErrArgument); |
|
1306 break; |
|
1307 } |
|
1308 |
|
1309 iScreenMode = aScreenMode; |
|
1310 |
|
1311 if (iFepRepository) |
|
1312 { |
|
1313 iFepRepository->Get(iPositionSettingId, iWindowPosition); |
|
1314 } |
|
1315 } |
|
1316 |
|
1317 // --------------------------------------------------------------------------- |
|
1318 // CAknFepVkbDataMgr::ReadUnitShadowSize |
|
1319 // (other items were commented in a header). |
|
1320 // --------------------------------------------------------------------------- |
|
1321 // |
|
1322 void CAknFepVkbDataMgr::ReadUnitShadowSize() |
|
1323 { |
|
1324 if (SizeChanging() || (!iUnitShadowSizeRead)) |
|
1325 { |
|
1326 iUnits.Reset(); |
|
1327 |
|
1328 TAknWindowLineLayout appWnd; |
|
1329 TAknWindowLineLayout mainPane; |
|
1330 // PSZ means pinyin(cangjie, latin), stroke, zhuyin respectively |
|
1331 TAknWindowLineLayout wndLayoutP, wndLayoutS, wndLayoutZ; |
|
1332 //TAknWindowLineLayout unitGridP, unitGridS, unitGridZ; |
|
1333 TAknLayoutRect mainPaneRect; |
|
1334 TAknLayoutRect wndRectP, wndRectS, wndRectZ; |
|
1335 //TAknLayoutRect unitRectP, unitRectS, unitRectZ; |
|
1336 |
|
1337 appWnd = AknLayoutScalable_Avkon::application_window( 0 ).LayoutLine(); |
|
1338 |
|
1339 if (appWnd.iW > appWnd.iH) |
|
1340 { |
|
1341 // landscape |
|
1342 mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine(); |
|
1343 } |
|
1344 else |
|
1345 { |
|
1346 // portrait |
|
1347 mainPane = AknLayoutScalable_Avkon::main_pane(1).LayoutLine(); |
|
1348 } |
|
1349 |
|
1350 mainPaneRect.LayoutRect(appWnd.Rect(), mainPane); |
|
1351 |
|
1352 iMainPaneRect = mainPaneRect.Rect(); |
|
1353 |
|
1354 wndLayoutP = AknLayoutScalable_Avkon::popup_fep_vkb_window(2).LayoutLine(); |
|
1355 wndRectP.LayoutRect(mainPaneRect.Rect(), wndLayoutP); |
|
1356 wndLayoutS = AknLayoutScalable_Avkon::popup_fep_vkb_window(1).LayoutLine(); |
|
1357 wndRectS.LayoutRect(mainPaneRect.Rect(), wndLayoutS); |
|
1358 wndLayoutZ = AknLayoutScalable_Avkon::popup_fep_vkb_window(3).LayoutLine(); |
|
1359 wndRectZ.LayoutRect(mainPaneRect.Rect(), wndLayoutZ); |
|
1360 |
|
1361 TAknWindowLineLayout shadowPane,shadowTl,shadowBr; |
|
1362 TAknLayoutRect shadowRect,tlRect,brRect; |
|
1363 |
|
1364 shadowPane = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane(1).LayoutLine(); |
|
1365 shadowRect.LayoutRect(wndRectP.Rect(), shadowPane); |
|
1366 |
|
1367 shadowTl = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g1().LayoutLine(); |
|
1368 tlRect.LayoutRect(shadowRect.Rect(), shadowTl); |
|
1369 |
|
1370 shadowBr = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g8().LayoutLine(); |
|
1371 brRect.LayoutRect(shadowRect.Rect(), shadowBr); |
|
1372 |
|
1373 iShadowTl = tlRect.Rect().Size(); |
|
1374 iShadowBr = brRect.Rect().Size(); |
|
1375 |
|
1376 /* unitGridP = AknLayoutScalable_Avkon::aid_size_cell_vkb(2).LayoutLine(); |
|
1377 unitRectP.LayoutRect(wndRectP.Rect(), unitGridP); |
|
1378 unitGridS = AknLayoutScalable_Avkon::aid_size_cell_vkb(3).LayoutLine(); |
|
1379 unitRectS.LayoutRect(wndRectP.Rect(), unitGridS); |
|
1380 unitGridZ = AknLayoutScalable_Avkon::aid_size_cell_vkb(4).LayoutLine(); |
|
1381 unitRectZ.LayoutRect(wndRectP.Rect(), unitGridZ); |
|
1382 |
|
1383 iUnits.Append(unitRectP.Rect().Size()); |
|
1384 iUnits.Append(unitRectS.Rect().Size()); |
|
1385 iUnits.Append(unitRectZ.Rect().Size()); |
|
1386 */ |
|
1387 //TSize unitGridP, unitGridS, unitGridZ, unitGridL, unitGridN; |
|
1388 TSize unit10x4, unit11x4; |
|
1389 if( static_cast<CAknFepVkbLayout*>(iContext)->PenInputType() == EPluginInputModeFSQ ) |
|
1390 { |
|
1391 unit10x4 = CPeninputCnGenericVkbLafMgr::GetCellSize( EVkbCangjieAndPinying_FSQ ); |
|
1392 unit11x4 = CPeninputCnGenericVkbLafMgr::GetCellSize( EVkbZhuyin_FSQ ); |
|
1393 } |
|
1394 else if( static_cast<CAknFepVkbLayout*>(iContext)->PenInputType() == EPluginInputModeVkb ) |
|
1395 { |
|
1396 unit10x4 = CPeninputCnGenericVkbLafMgr::GetCellSize( EVkbCangjieAndPinying ); |
|
1397 unit11x4 = CPeninputCnGenericVkbLafMgr::GetCellSize( EVkbZhuyin ); |
|
1398 } |
|
1399 |
|
1400 iUnits.Append( unit10x4 ); |
|
1401 iUnits.Append( unit11x4 ); |
|
1402 |
|
1403 iUnitShadowSizeRead = ETrue; |
|
1404 } |
|
1405 |
|
1406 ResetUnitSize(); |
|
1407 } |
|
1408 |
|
1409 // --------------------------------------------------------------------------- |
|
1410 // CAknFepVkbDataMgr::ResetUnitSize |
|
1411 // (other items were commented in a header). |
|
1412 // --------------------------------------------------------------------------- |
|
1413 // |
|
1414 void CAknFepVkbDataMgr::ResetUnitSize() |
|
1415 { |
|
1416 TInt index; |
|
1417 switch (iImLayout) |
|
1418 { |
|
1419 |
|
1420 case EAknFepVkbImCnPinyin: |
|
1421 case EAknFepVkbImCnStroke: |
|
1422 case EAknFepVkbImCnCangjie: |
|
1423 case EAknFepVkbImLatin: |
|
1424 case EAknFepVkbImNumber: |
|
1425 { |
|
1426 index = 0; |
|
1427 } |
|
1428 break; |
|
1429 |
|
1430 case EAknFepVkbImCnZhuyin: |
|
1431 case EAknFepVkbImLatinForZhuyin: |
|
1432 case EAknFepVkbImNumberForZhuyin: |
|
1433 { |
|
1434 if (iDefaultImLayout4TW == EAknFepVkbImCnStroke) |
|
1435 { |
|
1436 index = 0; |
|
1437 } |
|
1438 else |
|
1439 { |
|
1440 index = 1; |
|
1441 } |
|
1442 } |
|
1443 break; |
|
1444 default: |
|
1445 { |
|
1446 index = 0; |
|
1447 } |
|
1448 break; |
|
1449 } |
|
1450 |
|
1451 if (iUnits.Count() >= (index+1)) |
|
1452 { |
|
1453 TInt tempBtnWidth = iUnits[index].iWidth; |
|
1454 TInt tempBtnHeight = iUnits[index].iHeight; |
|
1455 |
|
1456 iUnitWidth = tempBtnWidth; |
|
1457 iUnitHeight = tempBtnHeight; |
|
1458 } |
|
1459 else |
|
1460 { |
|
1461 iUnitWidth = 0; |
|
1462 iUnitHeight = 0; |
|
1463 } |
|
1464 } |
|
1465 |
|
1466 // --------------------------------------------------------------------------- |
|
1467 // CAknFepVkbDataMgr::SetSizeChanging |
|
1468 // (other items were commented in a header). |
|
1469 // --------------------------------------------------------------------------- |
|
1470 // |
|
1471 void CAknFepVkbDataMgr::SetSizeChanging(TBool aFlag) |
|
1472 { |
|
1473 iSizeChanging = aFlag; |
|
1474 } |
|
1475 |
|
1476 // --------------------------------------------------------------------------- |
|
1477 // CAknFepVkbDataMgr::SizeChanging |
|
1478 // (other items were commented in a header). |
|
1479 // --------------------------------------------------------------------------- |
|
1480 // |
|
1481 TBool CAknFepVkbDataMgr::SizeChanging() |
|
1482 { |
|
1483 return iSizeChanging; |
|
1484 } |
|
1485 |
|
1486 // --------------------------------------------------------------------------- |
|
1487 // CAknFepVkbDataMgr::UnitShadowSizeSet |
|
1488 // (other items were commented in a header). |
|
1489 // --------------------------------------------------------------------------- |
|
1490 // |
|
1491 TBool CAknFepVkbDataMgr::UnitShadowSizeSet() |
|
1492 { |
|
1493 return iUnitShadowSizeRead; |
|
1494 } |
|
1495 |
|
1496 // End Of File |