|
1 /* |
|
2 * Copyright (c) 2002-2004 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: |
|
15 * Provides the CAknFepUIManagerJapanese methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 // INCLUDE FILES |
|
31 #include <e32svr.h> // RDebug stuff... |
|
32 #include <txtfrmat.h> |
|
33 #include <e32keys.h> |
|
34 |
|
35 #include "AknFepGlobalEnums.h" |
|
36 #include "AknFepUiManagerBase.h" |
|
37 #include "AknFepUIManagerJapanese.h" |
|
38 #include "AknFepManagerInterface.h" // MAknFepManagerInterface |
|
39 #include "AknFepUIManagerStateInterface.h" // MAknFepUIManagerStateInterface |
|
40 #include "AknFepManagerUIInterface.h" |
|
41 #include "AknFepGlobalEnums.h" |
|
42 #include "AknFepCaseManager.h" |
|
43 |
|
44 #include "AknFepUiInputStateInitialHiraganaKanji.h" |
|
45 #include "AknFepUiInputStateInitialHiragana.h" |
|
46 #include "AknFepUiInputStateInitialKatakana.h" |
|
47 #include "AknFepUiInputStateInitialLatinJapanese.h" |
|
48 #include "AknFepUiInputStateInitialFullNumber.h" |
|
49 #include "AknFepUiInputStateEntryJapaneseMultitap.h" |
|
50 #include "AknFepUiInputStateEntryHiraganaKanji.h" |
|
51 #include "AknFepUiInputStateEntryKatakana.h" |
|
52 #include "AknFepUiInputStateEntryLatinJapanese.h" |
|
53 #include "AknFepUiInputStateConversionHiraganaKanji.h" |
|
54 #include "AknFepUiInputStateCandidateHiraganaKanji.h" |
|
55 #include "AknFepUiInputStateCompletionHiraganaKanji.h" |
|
56 #include "AknFepUiInputStateCompletionPredictiveHiraganaKanji.h" |
|
57 #include "AknFepUiInputStateCompletionJapaneseMultitap.h" |
|
58 #include "AknFepUiInputStateCompletionKatakana.h" |
|
59 #include "AknFepUiInputStateCompletionLatinJapanese.h" |
|
60 #include "AknFepUiInputStatePredictiveInputJapanese.h" |
|
61 #include "AknFepUiInputStateNextWordJapanesePredictive.h" |
|
62 #include "AknFepUICtrlContainerJapanese.h" |
|
63 #include "AknFepPanic.h" |
|
64 #include "AknFepUiInputStateCandidateRetroActive.h" |
|
65 |
|
66 #include <AknIndicatorContainer.h> // CAknIndicatorContainer::TIndicatorContext |
|
67 #include <PtiEngine.h> |
|
68 #include <PtiCompositionDataIF.h> // MPtiEngineCompositionDataInterface |
|
69 #include <PtiDefs.h> // keys |
|
70 |
|
71 // CONSTANTS |
|
72 |
|
73 // LOCAL FUNCTION PROTOTYPES |
|
74 static TBool IsNumericKey(TInt aKey); |
|
75 static TBool IsQwertyKey(TInt aKey); |
|
76 |
|
77 //============================ LOCAL FUNCTIONS ============================== |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // IsNumericKey |
|
81 // |
|
82 // Returns: ETrue is returned if aKey is number key |
|
83 // |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 static TBool IsNumericKey(const TInt aKey) |
|
87 { |
|
88 TBool response = EFalse; |
|
89 if (aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty9) |
|
90 { |
|
91 response = ETrue; |
|
92 } |
|
93 return response; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // IsQwertyKey |
|
98 // |
|
99 // Returns: ETrue is returned if aKey is qwerty key |
|
100 // |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 static TBool IsQwertyKey(const TInt aKey) |
|
104 { |
|
105 TBool response = EFalse; |
|
106 if ( (aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) || |
|
107 IsNumericKey( aKey ) || |
|
108 aKey == EStdKeySpace || |
|
109 aKey == EPtiKeyQwertyPlus || |
|
110 aKey == EPtiKeyQwertyMinus || |
|
111 aKey == EPtiKeyQwertyComma || |
|
112 aKey == EPtiKeyQwertySemicolon || |
|
113 aKey == EPtiKeyQwertyFullstop || |
|
114 aKey == EPtiKeyQwertyHash || |
|
115 aKey == EPtiKeyQwertySlash || |
|
116 aKey == EPtiKeyQwertyApostrophe) |
|
117 { |
|
118 response = ETrue; |
|
119 } |
|
120 return response; |
|
121 } |
|
122 |
|
123 /** |
|
124 * CAknFepUIManagerJapanese class. |
|
125 * |
|
126 */ |
|
127 //============================ MEMBER FUNCTIONS ============================== |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CAknFepUIManagerJapanese::NewL |
|
131 // |
|
132 // |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 CAknFepUIManagerJapanese* CAknFepUIManagerJapanese::NewL(MAknFepManagerUIInterface* aFepMan, |
|
136 CAknFepCaseManager* aCaseMan, |
|
137 TLanguage aLanguage) |
|
138 { |
|
139 CAknFepUIManagerJapanese* self = new(ELeave)CAknFepUIManagerJapanese(aFepMan, aCaseMan); |
|
140 CleanupStack::PushL(self); |
|
141 self->ConstructL(aLanguage); |
|
142 CleanupStack::Pop(self); |
|
143 return self; |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CAknFepUIManagerJapanese::~CAknFepUIManagerJapanese |
|
148 // |
|
149 // |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 CAknFepUIManagerJapanese::~CAknFepUIManagerJapanese() |
|
153 { |
|
154 delete iCandidateArray; |
|
155 delete iContainerPane; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CAknFepUIManagerJapanese::SetCase |
|
160 // |
|
161 // |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 void CAknFepUIManagerJapanese::SetCase(TCase aCase) |
|
165 { |
|
166 CAknFepUIManagerBase::SetCase(aCase); |
|
167 |
|
168 if (iMode != ENumber) |
|
169 { |
|
170 if (!iCaseMan->IsAbleChangeCase()) |
|
171 { |
|
172 if (iCaseMan->CurrentCase() == EAknEditorLowerCase) |
|
173 { |
|
174 TRAP_IGNORE(iPtiEngine->HandleCommandL(EPtiCommandUseLatinCaseLowerOnlyKeyMap)); |
|
175 } |
|
176 else if (iCaseMan->CurrentCase() == EAknEditorUpperCase) |
|
177 { |
|
178 TRAP_IGNORE(iPtiEngine->HandleCommandL(EPtiCommandUseLatinCaseUpperOnlyKeyMap)); |
|
179 } |
|
180 } |
|
181 else |
|
182 { |
|
183 TRAP_IGNORE(iPtiEngine->HandleCommandL(EPtiCommandUseLatinDefaultKeyMap)); |
|
184 } |
|
185 } |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------------------------- |
|
189 // CAknFepUIManagerJapanese::HandleKeyL |
|
190 // |
|
191 // |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 TBool CAknFepUIManagerJapanese::HandleKeyL(TInt aKey, TKeyPressLength aLength, TEventCode /*aEventCode*/) |
|
195 { |
|
196 TUIState currentState = iFepUiState.State(); |
|
197 if (aLength == EShortKeyPress) |
|
198 { |
|
199 iInitialFepUIState = currentState; |
|
200 } |
|
201 |
|
202 // If current input mode is Number or Hiragana, |
|
203 // numeric long keypress doesn't operate. |
|
204 if (iMode == ENumber || iMode == EHiragana) |
|
205 { |
|
206 if (IsNumericKey(aKey) && aLength == ELongKeyPress) |
|
207 { |
|
208 return ETrue; |
|
209 } |
|
210 } |
|
211 |
|
212 if (iMode == EHiragana) |
|
213 { |
|
214 if( aKey == EPtiKeyStar && aLength == ELongKeyPress) |
|
215 { |
|
216 return ETrue; |
|
217 } |
|
218 } |
|
219 // CBA keypress is valid when input state is Initial, Entry |
|
220 // Predictive input or NextWord. |
|
221 switch (aKey) |
|
222 { |
|
223 case EKeyCBA1: // ITU-T left softkey |
|
224 case EKeyCBA2: // ITU-T right softkey |
|
225 case EStdKeyDevice0: // Qwerty left softkey (=0xa4) |
|
226 case EStdKeyDevice1: // Qwerty right softkey(=0xa5) |
|
227 // In case of Latin and Number, all characters must be committed. |
|
228 if (iMode != EHiraganaKanji) |
|
229 { |
|
230 CloseUI(); |
|
231 } |
|
232 switch (iStatePtr->State()) |
|
233 { |
|
234 case EInitial: |
|
235 case EEntry: |
|
236 case EPredictiveInput: |
|
237 case ENextWord: |
|
238 return EFalse; |
|
239 default: |
|
240 return ETrue; |
|
241 } |
|
242 //break; not needed |
|
243 default: |
|
244 // move to next line |
|
245 break; |
|
246 } |
|
247 |
|
248 TPtiTextCase oldPtiCaseMode = iPtiEngine->Case(); |
|
249 TPtiTextCase caseMode = EPtiCaseLower; |
|
250 TPtiTextCase shiftedCase = caseMode; |
|
251 if (IsQwerty()) |
|
252 { |
|
253 caseMode = EPtiCaseLower; |
|
254 if (!FepMan()->IsOnlyNumericPermitted()) |
|
255 { |
|
256 caseMode = oldPtiCaseMode; |
|
257 if (iMode & (EHiraganaKanji|EHiragana|EKatakana)) |
|
258 { |
|
259 if (CaseMan()->CurrentCase() == EAknEditorTextCase |
|
260 && caseMode == EPtiCaseUpper |
|
261 && iStatePtr->State() == EInitial) |
|
262 { |
|
263 iPtiEngine->SetCase(EPtiCaseLower); |
|
264 caseMode = EPtiCaseLower; |
|
265 oldPtiCaseMode = EPtiCaseLower; |
|
266 } |
|
267 } |
|
268 else if (iMode == ELatin) |
|
269 { |
|
270 switch (CaseMan()->CurrentCase()) |
|
271 { |
|
272 case EAknEditorUpperCase: |
|
273 case EAknEditorTextCase: |
|
274 caseMode = EPtiCaseUpper; |
|
275 break; |
|
276 case EAknEditorLowerCase: |
|
277 default: |
|
278 caseMode = EPtiCaseLower; |
|
279 break; |
|
280 } |
|
281 } |
|
282 } |
|
283 shiftedCase = caseMode; |
|
284 if ( FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode) ) |
|
285 { |
|
286 // while pressing Shift key |
|
287 if ( aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ ) |
|
288 { |
|
289 shiftedCase = (caseMode != EPtiCaseUpper)? EPtiCaseUpper : EPtiCaseLower; |
|
290 } |
|
291 else |
|
292 { |
|
293 // except alpha key |
|
294 shiftedCase = EPtiCaseUpper; |
|
295 } |
|
296 } |
|
297 else if (!(aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ)) |
|
298 { |
|
299 // out of A-Z key |
|
300 shiftedCase = EPtiCaseLower; |
|
301 } |
|
302 |
|
303 if (shiftedCase != oldPtiCaseMode) |
|
304 { |
|
305 iPtiEngine->SetCase(shiftedCase); |
|
306 } |
|
307 } |
|
308 |
|
309 TBool ret = iStatePtr->HandleKeyL(aKey, aLength); |
|
310 // If the state was changed by keypress event and not handle keypress event, |
|
311 // changed state handle it keypress event. |
|
312 while (!ret && currentState != iFepUiState.State()) |
|
313 { |
|
314 // If editor was filled by characters, |
|
315 // don't handle no more numeric keypress or qwerty keypress |
|
316 if (iStatePtr->State() == EInitial |
|
317 && !FepMan()->EditorHasFreeSpace()) |
|
318 if (!IsQwerty() && IsNumericKey(aKey)) |
|
319 { |
|
320 return ETrue; |
|
321 } |
|
322 else if (IsQwerty() && IsQwertyKey(aKey)) |
|
323 { |
|
324 return ETrue; |
|
325 } |
|
326 |
|
327 if ( (IsQwerty()) |
|
328 && (iPtiEngine->Case() != shiftedCase) ) |
|
329 { |
|
330 iPtiEngine->SetCase(shiftedCase); |
|
331 } |
|
332 |
|
333 currentState = iFepUiState.State(); |
|
334 ret = iFepUiState.HandleKeyL(aKey, aLength); |
|
335 } |
|
336 |
|
337 if (IsQwerty()) |
|
338 { |
|
339 if (oldPtiCaseMode != iPtiEngine->Case()) |
|
340 { |
|
341 iPtiEngine->SetCase(oldPtiCaseMode); |
|
342 } |
|
343 } |
|
344 return ret; |
|
345 } |
|
346 |
|
347 // --------------------------------------------------------------------------- |
|
348 // CAknFepUIManagerJapanese::CloseUI |
|
349 // |
|
350 // |
|
351 // --------------------------------------------------------------------------- |
|
352 // |
|
353 void CAknFepUIManagerJapanese::CloseUI() |
|
354 { |
|
355 if (iStatePtr->State() != EInitial) |
|
356 { |
|
357 iStatePtr->CloseUI(); |
|
358 if (iStatePtr->State() == EMultiCompletion) |
|
359 { |
|
360 ChangeState(EInitial); |
|
361 } |
|
362 else |
|
363 { |
|
364 // Commit Uncommited string |
|
365 if (iStatePtr->State() != ENextWord) |
|
366 { |
|
367 ChangeState(EMultiCompletion); |
|
368 } |
|
369 TRAP_IGNORE(iStatePtr->HandleCommandL(EAknFepAllCompletion)); |
|
370 } |
|
371 } |
|
372 } |
|
373 |
|
374 // --------------------------------------------------------------------------- |
|
375 // CAknFepUIManagerJapanese::GetFormatOfFepInlineText |
|
376 // |
|
377 // |
|
378 // --------------------------------------------------------------------------- |
|
379 // |
|
380 void CAknFepUIManagerJapanese::GetFormatOfFepInlineText(TCharFormat& aFormat, |
|
381 TInt& aNumberOfCharactersWithSameFormat, |
|
382 TInt aPositionOfCharacter) const |
|
383 { |
|
384 TRgb highlightColor1 = AKN_LAF_COLOR_STATIC(244); |
|
385 TRgb highlightColor2 = AKN_LAF_COLOR_STATIC(210); |
|
386 TRgb textColor = AKN_LAF_COLOR_STATIC(0); |
|
387 if ((iFepUiState.State() == EEntry) |
|
388 || (iFepUiState.State() == EConversion) |
|
389 || (iFepUiState.State() == ECandidate) |
|
390 || (iFepUiState.State() == ECandidateRetroActive) |
|
391 || (iFepUiState.State() == EPredictiveInput)) |
|
392 { |
|
393 const MPtiEngineCompositionDataInterface* data = PtiEngine()->CompositionData(); |
|
394 TInt length = 0; |
|
395 TInt clauseCount = 0; |
|
396 TInt preLength = 0; |
|
397 TPtrC8 clauseChar = data->LengthOfPhrase(); |
|
398 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
399 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
400 if ( clauseChar.Length() ) |
|
401 { |
|
402 #endif //RD_INTELLIGENT_TEXT_INPUT |
|
403 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
404 for (; length < aPositionOfCharacter; ++clauseCount) |
|
405 { |
|
406 preLength = length; |
|
407 length += clauseChar[clauseCount]; |
|
408 } |
|
409 if (length == aPositionOfCharacter) |
|
410 aNumberOfCharactersWithSameFormat = clauseChar[clauseCount]; |
|
411 else |
|
412 { |
|
413 --clauseCount; |
|
414 aNumberOfCharactersWithSameFormat = clauseChar[clauseCount] |
|
415 + preLength |
|
416 - aPositionOfCharacter; |
|
417 } |
|
418 switch (data->AttributeOfPhrase()[clauseCount]) |
|
419 { |
|
420 //Input phase |
|
421 case MPtiEngineCompositionDataInterface::EPtiAttributeTransitoryInput: |
|
422 { |
|
423 if (iFlagInlineEditUnderline) |
|
424 { |
|
425 aFormat.iFontPresentation.iHighlightColor = highlightColor1; |
|
426 aFormat.iFontPresentation.iHighlightStyle = TFontPresentation:: |
|
427 EFontHighlightNormal; |
|
428 } |
|
429 else |
|
430 { |
|
431 } |
|
432 } |
|
433 break; |
|
434 // Conversion phase(no target phrase) |
|
435 case MPtiEngineCompositionDataInterface::EPtiAttributeNonTargetConvert: |
|
436 { |
|
437 aFormat.iFontPresentation.iHighlightColor = highlightColor1; |
|
438 aFormat.iFontPresentation.iHighlightStyle = TFontPresentation:: |
|
439 EFontHighlightNormal; |
|
440 } |
|
441 break; |
|
442 // Conversion phase(target Phrase) |
|
443 case MPtiEngineCompositionDataInterface::EPtiAttributeTargetConvert: |
|
444 { |
|
445 aFormat.iFontPresentation.iTextColor = textColor; |
|
446 aFormat.iFontPresentation.iHighlightColor = highlightColor2; |
|
447 aFormat.iFontPresentation.iHighlightStyle = TFontPresentation:: |
|
448 EFontHighlightNormal; |
|
449 } |
|
450 break; |
|
451 default: |
|
452 break; |
|
453 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
454 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
455 } |
|
456 #endif // RD_INTELLIGENT_TEXT_INPUT |
|
457 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
458 } |
|
459 } |
|
460 else if (iFepUiState.State() == EMultiCompletion) |
|
461 { |
|
462 const MPtiEngineCompositionDataInterface* data = PtiEngine()->CompositionData(); |
|
463 TInt length = data->CompletedString().Length(); |
|
464 // Panic in case (aNumberOfCharactersWithSameFormat < 1) |
|
465 if( !(length > 0) ) |
|
466 { |
|
467 length = 1; |
|
468 } |
|
469 |
|
470 aNumberOfCharactersWithSameFormat = length; |
|
471 } |
|
472 } |
|
473 |
|
474 // --------------------------------------------------------------------------- |
|
475 // CAknFepUIManagerJapanese::IsValidShiftKeyPress |
|
476 // |
|
477 // |
|
478 // --------------------------------------------------------------------------- |
|
479 // |
|
480 TBool CAknFepUIManagerJapanese::IsValidShiftKeyPress() const |
|
481 { |
|
482 TBool ret = ETrue; |
|
483 switch (iMode) |
|
484 { |
|
485 case EHiraganaKanji: |
|
486 // ITU-T has to check Edit-key(= Shift-key). If the state is Initial |
|
487 // or NextWord, Edit-key is valid, the other states are invalid. |
|
488 // However, in Qwerty input, shift-key is used for changing Case mode, |
|
489 // so, shift-key is always valid even if the statue is anything. |
|
490 if (!iQwerty) |
|
491 { |
|
492 if (iStatePtr->State() == EInitial || iStatePtr->State()== ENextWord) |
|
493 { |
|
494 ret = ETrue; |
|
495 } |
|
496 else |
|
497 { |
|
498 ret = EFalse; |
|
499 } |
|
500 } |
|
501 break; |
|
502 case EHiragana: |
|
503 ret = EFalse; |
|
504 break; |
|
505 case EKatakana: |
|
506 default: |
|
507 break; |
|
508 } |
|
509 |
|
510 return ret; |
|
511 } |
|
512 |
|
513 // --------------------------------------------------------------------------- |
|
514 // CAknFepUIManagerJapanese::ChangeState |
|
515 // |
|
516 // |
|
517 // --------------------------------------------------------------------------- |
|
518 // |
|
519 TUIState CAknFepUIManagerJapanese::ChangeState(TUIState aState) |
|
520 { |
|
521 switch(aState) |
|
522 { |
|
523 case EInitial: |
|
524 { |
|
525 switch(iMode) |
|
526 { |
|
527 case EHiragana: |
|
528 iFepUiState = TAknFepUiInputStateInitialHiragana(this, UIContainer()); |
|
529 break; |
|
530 case EHiraganaKanji: |
|
531 iFepUiState = TAknFepUiInputStateInitialHiraganaKanji(this, UIContainer()); |
|
532 break; |
|
533 case EKatakana: |
|
534 iFepUiState = TAknFepUiInputStateInitialKatakana(this, UIContainer()); |
|
535 break; |
|
536 case ELatin: |
|
537 { |
|
538 iFepUiState = TAknFepUiInputStateInitialLatinJapanese(this, UIContainer()); |
|
539 } |
|
540 break; |
|
541 case ENumber: |
|
542 iFepUiState = TAknFepUiInputStateInitialFullNumber(this, UIContainer()); |
|
543 break; |
|
544 default: |
|
545 AknFepPanic(EAknFepPanicBadInputState); |
|
546 break; |
|
547 } |
|
548 break; |
|
549 } |
|
550 case EEntry: |
|
551 { |
|
552 switch(iMode) |
|
553 { |
|
554 case EHiraganaKanji: |
|
555 iFepUiState = TAknFepUiInputStateEntryHiraganaKanji(this, UIContainer()); |
|
556 break; |
|
557 case EHiragana: |
|
558 case EKatakana: |
|
559 iFepUiState = TAknFepUiInputStateEntryKatakana(this, UIContainer()); |
|
560 break; |
|
561 case ELatin: |
|
562 iFepUiState = TAknFepUiInputStateEntryLatinJapanese(this, UIContainer()); |
|
563 break; |
|
564 case ENumber: |
|
565 iFepUiState = TAknFepUiInputStateEntryJapaneseMultitap(this, UIContainer()); |
|
566 break; |
|
567 default: |
|
568 AknFepPanic(EAknFepPanicBadInputState); |
|
569 break; |
|
570 } |
|
571 } |
|
572 break; |
|
573 case ECandidate: |
|
574 iFepUiState = TAknFepUiInputStateCandidateHiraganaKanji(this, UIContainer()); |
|
575 break; |
|
576 case EPredictiveInput: |
|
577 iFepUiState = TAknFepUiInputStatePredictiveInputJapanese(this, UIContainer()); |
|
578 break; |
|
579 case EConversion: |
|
580 iFepUiState = TAknFepUiInputStateConversionHiraganaKanji(this, UIContainer()); |
|
581 break; |
|
582 case EMultiCompletion: // Only Japanese version uses this flag. |
|
583 switch(iMode) |
|
584 { |
|
585 case EHiraganaKanji: |
|
586 if(iPredictive) |
|
587 { |
|
588 if(iFepUiState.State() == EPredictiveInput || |
|
589 iFepUiState.State() == ENextWord) |
|
590 { |
|
591 iFepUiState = TAknFepUiInputStateCompletionPredictiveHiraganaKanji(this, UIContainer()); |
|
592 } |
|
593 else |
|
594 { |
|
595 iFepUiState = TAknFepUiInputStateCompletionHiraganaKanji(this, UIContainer()); |
|
596 } |
|
597 } |
|
598 else |
|
599 { |
|
600 iFepUiState = TAknFepUiInputStateCompletionHiraganaKanji(this, UIContainer()); |
|
601 } |
|
602 break; |
|
603 case EHiragana: |
|
604 case EKatakana: |
|
605 { |
|
606 iFepUiState = TAknFepUiInputStateCompletionKatakana(this, UIContainer()); |
|
607 } |
|
608 break; |
|
609 case ENumber: |
|
610 iFepUiState = TAknFepUiInputStateCompletionJapaneseMultitap(this, UIContainer()); |
|
611 break; |
|
612 case ELatin: |
|
613 iFepUiState = TAknFepUiInputStateCompletionLatinJapanese(this, UIContainer()); |
|
614 break; |
|
615 default: |
|
616 AknFepPanic(EAknFepPanicBadInputState); |
|
617 break; |
|
618 } |
|
619 break; |
|
620 case ENextWord: // Only Japanese version uses this flag |
|
621 { |
|
622 switch(iMode) |
|
623 { |
|
624 case EHiraganaKanji: |
|
625 if(iPredictive) |
|
626 { |
|
627 iFepUiState = TAknFepUiInputStateNextWordJapanesePredictive(this, UIContainer()); |
|
628 break; |
|
629 } |
|
630 default: |
|
631 AknFepPanic(EAknFepPanicBadInputState); |
|
632 break; |
|
633 } |
|
634 } |
|
635 break; |
|
636 case ECandidateRetroActive: |
|
637 { |
|
638 switch(iMode) |
|
639 { |
|
640 case EHiraganaKanji: |
|
641 iFepUiState = TAknFepUiInputStateCandidateRetroActive(this, UIContainer()); |
|
642 break; |
|
643 default: |
|
644 AknFepPanic(EAknFepPanicBadInputState); |
|
645 break; |
|
646 } |
|
647 } |
|
648 break; |
|
649 default: |
|
650 AknFepPanic(EAknFepPanicBadInputState); |
|
651 } |
|
652 |
|
653 PtiEngine()->SetObserver(&iFepUiState); |
|
654 |
|
655 #ifdef _DEBUG |
|
656 RDebug::Print(_L("UI Manager: New State: %d"), iFepUiState.State()); |
|
657 #endif |
|
658 TRAPD(err, iStatePtr->InitializeStateL()); |
|
659 if (err != KErrNone) |
|
660 { |
|
661 #ifdef _DEBUG |
|
662 RDebug::Print(_L("UI Manager: Setup Error: Mode = %d, State = %d"), |
|
663 iMode, iStatePtr->State()); |
|
664 #endif |
|
665 CloseUI(); |
|
666 } |
|
667 return iStatePtr->State(); |
|
668 } |
|
669 |
|
670 // --------------------------------------------------------------------------- |
|
671 // CAknFepUIManagerJapanese::CandidateArray |
|
672 // |
|
673 // |
|
674 // --------------------------------------------------------------------------- |
|
675 // |
|
676 CDesCArrayFlat* CAknFepUIManagerJapanese::CandidateArray() |
|
677 { |
|
678 return iCandidateArray; |
|
679 } |
|
680 |
|
681 // --------------------------------------------------------------------------- |
|
682 // CAknFepUIManagerJapanese::IsPredictive |
|
683 // |
|
684 // |
|
685 // --------------------------------------------------------------------------- |
|
686 // |
|
687 TBool CAknFepUIManagerJapanese::IsPredictive() const |
|
688 { |
|
689 return iPredictive; |
|
690 } |
|
691 |
|
692 |
|
693 // --------------------------------------------------------------------------- |
|
694 // CAknFepUIManagerJapanese::SetInlineEditUnderlineVisibility |
|
695 // |
|
696 // |
|
697 // --------------------------------------------------------------------------- |
|
698 // |
|
699 void CAknFepUIManagerJapanese::SetInlineEditUnderlineVisibility(TBool aFlag) |
|
700 { |
|
701 iFlagInlineEditUnderline = aFlag; |
|
702 } |
|
703 |
|
704 |
|
705 // --------------------------------------------------------------------------- |
|
706 // CAknFepUIManagerBase::SetMode |
|
707 // |
|
708 // |
|
709 // --------------------------------------------------------------------------- |
|
710 // |
|
711 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
712 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
713 void CAknFepUIManagerJapanese::SetMode(TInt aMode, TBool aPredictive, TBool aQwertyInputMode, TInt aKeyboardType) |
|
714 #else |
|
715 void CAknFepUIManagerJapanese::SetMode(TInt aMode, TBool aPredictive, TBool aQwertyInputMode) |
|
716 #endif // RD_INTELLIGENT_TEXT_INPUT |
|
717 #else |
|
718 void CAknFepUIManagerJapanese::SetMode(TInt aMode, TBool aPredictive, TBool aQwertyInputMode) |
|
719 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
720 { |
|
721 iMode=aMode; |
|
722 iPredictive = aPredictive; |
|
723 iQwerty = aQwertyInputMode; |
|
724 ChangeState(EInitial); |
|
725 } |
|
726 |
|
727 |
|
728 // --------------------------------------------------------------------------- |
|
729 // CAknFepUIManagerJapanese::FepUIState |
|
730 // |
|
731 // |
|
732 // --------------------------------------------------------------------------- |
|
733 // |
|
734 TAknFepInputStateBase* CAknFepUIManagerJapanese::FepUIState() |
|
735 { |
|
736 return &iFepUiState; |
|
737 } |
|
738 |
|
739 // --------------------------------------------------------------------------- |
|
740 // CAknFepUIManagerJapanese::UIContainer |
|
741 // |
|
742 // |
|
743 // --------------------------------------------------------------------------- |
|
744 // |
|
745 MAknFepUICtrlContainerJapanese* CAknFepUIManagerJapanese::UIContainer() const |
|
746 { |
|
747 return iContainerPane; |
|
748 } |
|
749 |
|
750 // --------------------------------------------------------------------------- |
|
751 // CAknFepUIManagerJapanese::CAknFepUIManagerJapanese |
|
752 // |
|
753 // |
|
754 // --------------------------------------------------------------------------- |
|
755 // |
|
756 CAknFepUIManagerJapanese::CAknFepUIManagerJapanese(MAknFepManagerUIInterface* aFepMan, |
|
757 CAknFepCaseManager* aCaseMan) |
|
758 : CAknFepUIManagerBase(aFepMan, aCaseMan), |
|
759 iFepUiState(NULL,NULL), |
|
760 iFlagInlineEditUnderline(ETrue) |
|
761 { |
|
762 } |
|
763 |
|
764 // --------------------------------------------------------------------------- |
|
765 // CAknFepUIManagerJapanese::ConstructL |
|
766 // |
|
767 // |
|
768 // --------------------------------------------------------------------------- |
|
769 // |
|
770 void CAknFepUIManagerJapanese::ConstructL(TLanguage aLanguage) |
|
771 { |
|
772 CAknFepUIManagerBase::ConstructL(aLanguage); |
|
773 |
|
774 PtiEngine()->ActivateLanguageL(aLanguage, EPtiEngineInputModeNone); |
|
775 |
|
776 iCandidateArray = new(ELeave) CDesCArrayFlat(1); |
|
777 iContainerPane = FepMan()->UiInterface()->NewAknFepUICtrlContainerJapaneseL(this); |
|
778 } |
|
779 |
|
780 // --------------------------------------------------------------------------- |
|
781 // CAknFepUIManagerJapanese::IsQwerty |
|
782 // |
|
783 // |
|
784 // --------------------------------------------------------------------------- |
|
785 // |
|
786 TBool CAknFepUIManagerJapanese::IsQwerty() const |
|
787 { |
|
788 return iQwerty; |
|
789 } |
|
790 |
|
791 // --------------------------------------------------------------------------- |
|
792 // CAknFepUIManagerJapanese::HandleCommandL |
|
793 // |
|
794 // --------------------------------------------------------------------------- |
|
795 // |
|
796 void CAknFepUIManagerJapanese::HandleCommandL(TInt aCommandId) |
|
797 { |
|
798 switch (aCommandId) |
|
799 { |
|
800 case EAknFepSoftkeyCommit: |
|
801 case EAknFepSoftkeySelectCandidate: |
|
802 { |
|
803 TUIState currentState = iFepUiState.State(); |
|
804 iStatePtr->HandleCommandL(aCommandId); |
|
805 if (currentState != iFepUiState.State()) |
|
806 { |
|
807 if (iFepUiState.State() == EMultiCompletion) |
|
808 { |
|
809 iFepUiState.HandleKeyL(EKeyOK, EShortKeyPress); |
|
810 } |
|
811 } |
|
812 } |
|
813 break; |
|
814 case EAknFepSoftkeyPredictiveOn: |
|
815 { |
|
816 MAknFepManagerUIInterface* fepMan = FepMan(); |
|
817 CPtiEngine* ptiEngine = PtiEngine(); |
|
818 |
|
819 // Update of inline editing characters |
|
820 TPtiEngineInputMode inputmode = (IsQwerty())? |
|
821 EPtiEngineHiraganaKanjiPredictiveQwerty |
|
822 : EPtiEngineHiraganaKanjiPredictive; |
|
823 ptiEngine->SetInputMode(inputmode); |
|
824 const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData(); |
|
825 TPtrC text = data->CompletedString(); |
|
826 TPtrC text2 = data->ConvertingString(); |
|
827 if (text.Length() >0) |
|
828 { |
|
829 ChangeState(EMultiCompletion); |
|
830 fepMan->CommitInlineEditL(text, text.Length()); |
|
831 if (fepMan->EditorHasFreeSpace()) |
|
832 { |
|
833 ChangeState(ENextWord); |
|
834 } |
|
835 else |
|
836 { |
|
837 CloseUI(); |
|
838 ChangeState(EInitial); |
|
839 } |
|
840 } |
|
841 else if (text2.Length() > 0) |
|
842 { |
|
843 // Change to Predictive State |
|
844 ChangeState(EPredictiveInput); |
|
845 iPredictive = ETrue; |
|
846 iStatePtr->HandleCommandL(aCommandId); |
|
847 } |
|
848 } |
|
849 break; |
|
850 default: |
|
851 iStatePtr->HandleCommandL(aCommandId); |
|
852 break; |
|
853 } |
|
854 } |
|
855 |
|
856 // --------------------------------------------------------------------------- |
|
857 // CAknFepUIManagerBase::ResourceChanged |
|
858 // This API is called when FEP control handles the changing resource event. |
|
859 // --------------------------------------------------------------------------- |
|
860 // |
|
861 void CAknFepUIManagerJapanese::ResourceChanged(TInt /*aType*/) |
|
862 { |
|
863 TRAP_IGNORE( iStatePtr->HandleCommandL(EAknFepResourceChanged)); |
|
864 } |
|
865 |
|
866 // End of file |