|
1 /* |
|
2 * Copyright (c) 2008 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 TAknFepInputMiniQwertyZhuyinPhraseBase definition. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 // System includes |
|
31 #include <e32cmn.h> |
|
32 #include <PtiEngine.h> |
|
33 #include <PtiDefs.h> |
|
34 #include <avkon.rsg> |
|
35 #include <AknFep.rsg> |
|
36 #include <PtiUserDicEntry.h> |
|
37 #include <aknnotewrappers.h> //CAknWarningNote |
|
38 // User includes |
|
39 #include "AknFepUIManagerStateInterface.h" |
|
40 #include "AknFepUICtrlInputPane.h" |
|
41 #include "AknFepUICtrlPinyinPopup.h" //Pinyin phrase |
|
42 #include "aknfepuictrleditpane.h" //pinyin phrase creation |
|
43 #include "AknFepUICtrlCandidatePane.h" |
|
44 #include "AknFepManager.h" |
|
45 #include "aknfepuiinputminiqwertyzhuyinphrasebase.h" |
|
46 #include "aknfepinputstateminiqwertyzhuyinkeymap.h" |
|
47 |
|
48 const TInt KMaxPhraseCount = 100; |
|
49 const TInt KMaxBufLength = 150; |
|
50 const TInt KMaxPhraseCreationCount = 7; |
|
51 //KMaxPhraseNote means the max phrase is seven |
|
52 _LIT( KMaxPhraseNote,"\x8BCD\x7EC4\x6700\x957F\x4E3A\x4E03\x5B57" ); |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // TAknFepInputMiniQwertyZhuyinPhraseBase::TAknFepInputMiniQwertyZhuyinPhraseBase |
|
56 // C++ default constructor |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 TAknFepInputMiniQwertyZhuyinPhraseBase::TAknFepInputMiniQwertyZhuyinPhraseBase( |
|
60 MAknFepUIManagerStateInterface* aOwner, |
|
61 MAknFepUICtrlContainerChinese* aUIContainer) : |
|
62 TAknFepInputStateCandidateQwertyBaseChinesePhrase( aOwner, aUIContainer ) |
|
63 { |
|
64 if (iOwner->PtiEngine()->InputMode() != EPtiEngineZhuyinPhraseQwerty) |
|
65 { |
|
66 iOwner->PtiEngine()->SetInputMode( EPtiEngineZhuyinPhraseQwerty ); |
|
67 } |
|
68 iOwner->PtiEngine()->SetCandidatePageLength( KMaxPhraseCount ); |
|
69 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
70 uiContainer->SetLayout( MAknFepUICtrlContainerChinese::ELayoutPhraseCreation ); |
|
71 iOwner->PtiEngine()->SetCase(EPtiCaseLower); |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // TAknFepInputMiniQwertyZhuyinPhraseBase::HandleKeyL |
|
76 // Handle system key press event. |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 TBool TAknFepInputMiniQwertyZhuyinPhraseBase::HandleKeyL( |
|
80 TInt /*aKey*/ , |
|
81 TKeyPressLength /*aLength*/ ) |
|
82 { |
|
83 return ETrue; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // TAknFepInputMiniQwertyZhuyinPhraseBase::GetValidKeystroke |
|
88 // Get the valid keystroke. |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 TBool TAknFepInputMiniQwertyZhuyinPhraseBase::GetValidKeystroke() |
|
92 { |
|
93 TBool result = ETrue; |
|
94 TRAPD( ret, result = GetValidKeystrokeL() ); |
|
95 if ( KErrNone != ret ) |
|
96 { |
|
97 return EFalse; |
|
98 } |
|
99 return result; |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // TAknFepInputMiniQwertyZhuyinPhraseBase::RefreshEditPane |
|
104 // Refresh editing pane. |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 void TAknFepInputMiniQwertyZhuyinPhraseBase::RefreshEditPane() |
|
108 { |
|
109 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
110 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
111 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
112 CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
113 |
|
114 TInt validCount = editPane->GetEffictiveLength(); |
|
115 TInt underLineLen = 0; |
|
116 TBuf<KMaxBufLength> buf; |
|
117 |
|
118 for ( TInt i = 0; i < phrase->Count(); ++i ) |
|
119 { |
|
120 buf.Append( phrase->MdcaPoint( i ) ); |
|
121 } |
|
122 |
|
123 for ( TInt i = 0; i < keystroke->Count(); ++i ) |
|
124 { |
|
125 buf.Append( keystroke->MdcaPoint( i ) ); |
|
126 if ( i < validCount ) |
|
127 { |
|
128 underLineLen = underLineLen + keystroke->MdcaPoint( i ).Length(); |
|
129 } |
|
130 } |
|
131 editPane->SetCursorIndexOfKeystroke( validCount ); |
|
132 editPane->SetText( buf, phrase->Count() + underLineLen, ETrue ); |
|
133 if ( 0 == validCount ) |
|
134 { |
|
135 editPane->SetHighlight( phrase->Count(), buf.Length() ); |
|
136 } |
|
137 |
|
138 if ( EMiniQwertyEdit == iState ) |
|
139 { |
|
140 editPane->ActiveCursor(); |
|
141 editPane->EnableCursor(); |
|
142 } |
|
143 else if ( EZhuyinSpelling == iState ) |
|
144 { |
|
145 editPane->DeactiveCursor(); |
|
146 editPane->EnableCursor(); |
|
147 editPane->SetUnderline( phrase->Count(), phrase->Count() + underLineLen - 1 ); |
|
148 } |
|
149 else if ( EZhuyinCandidate == iState ) |
|
150 { |
|
151 editPane->DisableCursor(); |
|
152 editPane->SetUnderline( phrase->Count(), phrase->Count() + underLineLen - 1 ); |
|
153 } |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // TAknFepInputMiniQwertyZhuyinPhraseBase::RefreshSpellingPane |
|
158 // Refresh spelling pane. |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 void TAknFepInputMiniQwertyZhuyinPhraseBase::RefreshSpellingPane( TBool aClearSelection ) |
|
162 { |
|
163 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
164 MAknFepUICtrlPinyinPopup* popup = uiContainer->PinyinPopupWindow(); |
|
165 MAknFepUICtrlInputPane* inputPane = uiContainer->InputPane(); |
|
166 CDesCArrayFlat* spelling = popup->PhoneticSpellingArray(); |
|
167 TInt selection = 0; |
|
168 if ( !aClearSelection ) |
|
169 { |
|
170 selection = popup->CurrentSelection(); |
|
171 if ( selection >= spelling->Count() ) |
|
172 { |
|
173 selection = 0; |
|
174 } |
|
175 } |
|
176 popup->SplitPhraseSpellingIntoPages( ); |
|
177 if ( spelling->Count( ) == 0 ) |
|
178 { |
|
179 uiContainer->SetControlInVisible( EFalse ); |
|
180 } |
|
181 else |
|
182 { |
|
183 // set display page for delibrate selection |
|
184 inputPane->SetText( spelling->MdcaPoint( selection ) ); |
|
185 popup->SetDisplayPage( selection ); |
|
186 popup->SetPhraseItemTexts( ); |
|
187 popup->PopupSizeChanged( ); |
|
188 uiContainer->Enable( ETrue ); |
|
189 } |
|
190 |
|
191 if ( EMiniQwertyEdit == iState ) |
|
192 { |
|
193 //popup need to add none high lighted interface. |
|
194 popup->SetNoneHighlighted(); |
|
195 } |
|
196 popup->Enable( spelling->Count( ) > 0 ); |
|
197 uiContainer->Enable( ETrue ); |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // TAknFepInputMiniQwertyZhuyinPhraseBase::RefreshSpellingPane |
|
202 // Refresh spelling pane. |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 void TAknFepInputMiniQwertyZhuyinPhraseBase::RefreshCandidatePane( TBool aClearSelection ) |
|
206 { |
|
207 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
208 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
209 TInt validCount = editPane->ShowKeystrokeArray()->Count(); |
|
210 CDesCArrayFlat* candidateArray = |
|
211 uiContainer->CandidatePane()->CandidateArray(); |
|
212 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
213 // have valid keystroke. |
|
214 if ( validCount > 0 ) |
|
215 { |
|
216 // set display page for delibrate selection |
|
217 ClearDeliberateSelection(); |
|
218 GetCandidate( aClearSelection ); |
|
219 uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
220 uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
221 uiContainer->ShowVerticalScrollArrows( ETrue ); |
|
222 uiContainer->Enable( ETrue ); |
|
223 } |
|
224 else |
|
225 { |
|
226 candidateArray->Reset(); |
|
227 if ( KMaxPhraseCreationCount == phraseCount ) |
|
228 { |
|
229 TRAP_IGNORE( candidateArray->AppendL( KMaxPhraseNote ) ); |
|
230 } |
|
231 uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
232 uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
233 uiContainer->Enable( ETrue ); |
|
234 uiContainer->ShowHorizontalScrollArrows( EFalse ); |
|
235 uiContainer->ShowVerticalScrollArrows( EFalse ); |
|
236 } |
|
237 uiContainer->Enable(ETrue); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------- |
|
241 // TAknFepInputMiniQwertyZhuyinPhraseBase::UpdateIndicator |
|
242 // Update Indicator. |
|
243 // --------------------------------------------------------- |
|
244 // |
|
245 void TAknFepInputMiniQwertyZhuyinPhraseBase::UpdateIndicator() |
|
246 { |
|
247 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
248 MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane(); |
|
249 |
|
250 if (candidatePane->IsFirstPage()) |
|
251 { |
|
252 uiContainer->CandidatePane()->ShowUpScrollArrows(EFalse); |
|
253 } |
|
254 else |
|
255 { |
|
256 uiContainer->CandidatePane()->ShowUpScrollArrows(ETrue); |
|
257 } |
|
258 |
|
259 if (candidatePane->IsLastPage()) |
|
260 { |
|
261 uiContainer->CandidatePane()->ShowDownScrollArrows(EFalse); |
|
262 } |
|
263 else |
|
264 { |
|
265 uiContainer->CandidatePane()->ShowDownScrollArrows(ETrue); |
|
266 } |
|
267 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
268 if (iOwner->FepMan()->KeyboardLayout() == EPtiKeyboardQwerty4x10) |
|
269 { |
|
270 if (candidatePane->VisibleCandidateCount()==1) |
|
271 { |
|
272 uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
273 uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
274 } |
|
275 else |
|
276 { |
|
277 uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
278 uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
279 } |
|
280 } |
|
281 else |
|
282 { |
|
283 #endif |
|
284 if (candidatePane->SelectedIndex() == 0 |
|
285 && candidatePane->IsFirstPage() ) |
|
286 { |
|
287 uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
288 } |
|
289 else |
|
290 { |
|
291 uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
292 } |
|
293 |
|
294 if (candidatePane->IsLastPage() && (candidatePane->SelectedIndex() |
|
295 == candidatePane->VisibleCandidateCount() - 1)) |
|
296 { |
|
297 uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
298 } |
|
299 else |
|
300 { |
|
301 uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
302 } |
|
303 } |
|
304 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
305 } |
|
306 #endif |
|
307 |
|
308 // --------------------------------------------------------------------------- |
|
309 // TAknFepInputMiniQwertyZhuyinPhraseBase::ClearDeliberateSelection |
|
310 // clear selection. |
|
311 // --------------------------------------------------------------------------- |
|
312 // |
|
313 void TAknFepInputMiniQwertyZhuyinPhraseBase::ClearDeliberateSelection() |
|
314 { |
|
315 // we must have just deleted the last character, |
|
316 // or we are starting a new pinyin session, |
|
317 // so wipe the last deliberate selection |
|
318 TPtr oldDeliberateSelection = iOwner->GetLatestDeliberateSelection(); |
|
319 oldDeliberateSelection = KNullDesC; |
|
320 } |
|
321 |
|
322 // --------------------------------------------------------- |
|
323 // TAknFepInputMiniQwertyZhuyinPhraseBase::ClearPtiEngineKeystroke |
|
324 // clear the ptiengine keystroke. |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 void TAknFepInputMiniQwertyZhuyinPhraseBase::ClearPtiEngineKeystroke() |
|
328 { |
|
329 iOwner->PtiEngine()->ClearCurrentWord(); |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------- |
|
333 // TAknFepInputMiniQwertyZhuyinPhraseBase::GetCandidateL |
|
334 // Get the candidate info. |
|
335 // --------------------------------------------------------- |
|
336 // |
|
337 void TAknFepInputMiniQwertyZhuyinPhraseBase::GetCandidate( TBool aClearSelection ) |
|
338 { |
|
339 TRAP_IGNORE( GetCandidateL( aClearSelection ) ); |
|
340 } |
|
341 |
|
342 // --------------------------------------------------------- |
|
343 // TAknFepInputMiniQwertyZhuyinPhraseBase::SetWarningColor |
|
344 // Set warning color. |
|
345 // --------------------------------------------------------- |
|
346 // |
|
347 void TAknFepInputMiniQwertyZhuyinPhraseBase::ChangeCbaL() |
|
348 { |
|
349 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
350 MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
351 TInt candidateCount = UIContainer()->CandidatePane()->CandidateArray()->Count(); |
|
352 TInt keyStrokeCount = editPane->KeystrokeArray()->Count(); |
|
353 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
354 TInt currentCBAResId = editPane->GetCurrentCBAResID(); |
|
355 if ( ( candidateCount == 0 && keyStrokeCount != 0 ) || |
|
356 ( phraseCount == 1 && keyStrokeCount == 0 ) ) |
|
357 { |
|
358 if (R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY != currentCBAResId ) |
|
359 { |
|
360 fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
361 editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
362 } |
|
363 |
|
364 } |
|
365 else if ( keyStrokeCount == 0 ) |
|
366 { |
|
367 if ( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE != currentCBAResId ) |
|
368 { |
|
369 fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
370 editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
371 } |
|
372 } |
|
373 else if ( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL != currentCBAResId ) |
|
374 { |
|
375 fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
376 editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
377 } |
|
378 } |
|
379 |
|
380 // --------------------------------------------------------------------------- |
|
381 // TAknFepInputMiniQwertyZhuyinPhraseBase::CheckPhraseSpellingL |
|
382 // Check the spelling whether is phrase spelling. |
|
383 // --------------------------------------------------------------------------- |
|
384 // |
|
385 TBool TAknFepInputMiniQwertyZhuyinPhraseBase::CheckPhraseSpellingL() |
|
386 { |
|
387 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
388 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
389 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
390 CDesCArrayFlat* spelling = |
|
391 uiContainer->PinyinPopupWindow()->PhoneticSpellingArray(); |
|
392 CDesCArrayFlat* tmpArray = editPane->TempArray(); |
|
393 const TUint16 specZhuyin = 0x311D; |
|
394 _LIT( delimiter, "\x0027" ); |
|
395 TInt validSpellingCount = 0; |
|
396 tmpArray->Reset(); |
|
397 |
|
398 if ( 0 == ptiengine->GetPhoneticSpellingsL( *tmpArray ) ) |
|
399 { |
|
400 return EFalse; |
|
401 } |
|
402 |
|
403 for ( TInt i = 0; i < tmpArray->Count(); ++i ) |
|
404 { |
|
405 if ( ( KErrNotFound == tmpArray->MdcaPoint( i ).Find( delimiter ) ) && |
|
406 ( specZhuyin != tmpArray->MdcaPoint( i )[0] ) ) |
|
407 { |
|
408 validSpellingCount = validSpellingCount + 1; |
|
409 spelling->InsertL( 0, tmpArray->MdcaPoint( i ) ); |
|
410 } |
|
411 } |
|
412 |
|
413 if ( 0 == validSpellingCount ) |
|
414 { |
|
415 return EFalse; |
|
416 } |
|
417 |
|
418 return ETrue; |
|
419 } |
|
420 |
|
421 // --------------------------------------------------------------------------- |
|
422 // TAknFepInputMiniQwertyZhuyinPhraseBase::GetValidKeystroke |
|
423 // Get the valid keystroke. |
|
424 // --------------------------------------------------------------------------- |
|
425 // |
|
426 TBool TAknFepInputMiniQwertyZhuyinPhraseBase::GetValidKeystrokeL() |
|
427 { |
|
428 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
429 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
430 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
431 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
432 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
433 RArray<TInt>* keycodeArray = editPane->KeycodeArray(); |
|
434 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
435 CDesCArrayFlat* spelling = |
|
436 uiContainer->PinyinPopupWindow()->PhoneticSpellingArray(); |
|
437 TInt keyCode = 0; |
|
438 TInt stringBeforeLength = 0; |
|
439 TInt stringAfterLength = 0; |
|
440 |
|
441 spelling->Reset(); |
|
442 spelling->Compress(); |
|
443 showKeystroke->Reset(); |
|
444 showKeystroke->Compress(); |
|
445 |
|
446 editPane->SetEffictiveLength( 0 ); |
|
447 if ( KMaxPhraseCreationCount == phraseCount ) |
|
448 { |
|
449 if ( keystroke->Count() > 0 ) |
|
450 { |
|
451 keystroke->Reset(); |
|
452 } |
|
453 return EFalse; |
|
454 } |
|
455 |
|
456 if ( 0 == keystroke->Count() ) |
|
457 { |
|
458 return EFalse; |
|
459 } |
|
460 |
|
461 if ( 1 == keystroke->MdcaPoint( 0 ).Length() ) |
|
462 { |
|
463 return EFalse; |
|
464 } |
|
465 |
|
466 if ( CheckToneMarkBorderUpon() ) |
|
467 { |
|
468 return EFalse; |
|
469 } |
|
470 |
|
471 ClearPtiEngineKeystroke(); |
|
472 for ( TInt i = 0; ( i < keystroke->Count() ) && |
|
473 ( i < keycodeArray->Count() ); ++i ) |
|
474 { |
|
475 keyCode = (*keycodeArray)[i]; |
|
476 if ( keyCode == EPtiKeyQwertyE || |
|
477 keyCode == EPtiKeyQwertyR || |
|
478 keyCode == EPtiKeyQwertyY || |
|
479 keyCode == EPtiKeyQwertyU || |
|
480 keyCode == EStdKeySpace ) |
|
481 { |
|
482 if( ptiengine->SetToneMark( keyCode ) ) |
|
483 { |
|
484 if ( !CheckPhraseSpellingL() ) |
|
485 { |
|
486 break; |
|
487 } |
|
488 else |
|
489 { |
|
490 showKeystroke->AppendL( keystroke->MdcaPoint( i - 1 ) ); |
|
491 showKeystroke->AppendL( keystroke->MdcaPoint( i ) ); |
|
492 } |
|
493 } |
|
494 break; |
|
495 } |
|
496 else |
|
497 { |
|
498 stringBeforeLength = |
|
499 ptiengine->GetPhoneticSpelling(1).Length(); |
|
500 stringAfterLength = |
|
501 ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
|
502 if ( stringBeforeLength != stringAfterLength ) |
|
503 { |
|
504 if ( i + 1 < keystroke->Count() ) |
|
505 { |
|
506 if ( 1 != keystroke->MdcaPoint( i + 1 ).Length() ) |
|
507 { |
|
508 if ( !CheckPhraseSpellingL() ) |
|
509 { |
|
510 break; |
|
511 } |
|
512 showKeystroke->AppendL( keystroke->MdcaPoint( i ) ); |
|
513 } |
|
514 } |
|
515 else |
|
516 { |
|
517 if ( CheckPhraseSpellingL() ) |
|
518 { |
|
519 showKeystroke->AppendL( keystroke->MdcaPoint( i ) ); |
|
520 } |
|
521 } |
|
522 } |
|
523 else |
|
524 { |
|
525 break; |
|
526 } |
|
527 } |
|
528 } |
|
529 |
|
530 editPane->SetEffictiveLength( showKeystroke->Count() ); |
|
531 if ( 0 == showKeystroke->Count() ) |
|
532 { |
|
533 return EFalse; |
|
534 } |
|
535 |
|
536 return ETrue; |
|
537 } |
|
538 |
|
539 // --------------------------------------------------------------------------- |
|
540 // TAknFepInputMiniQwertyZhuyinPhraseBase::GetValidKeystroke |
|
541 // Get the valid keystroke. |
|
542 // --------------------------------------------------------------------------- |
|
543 // |
|
544 TBool TAknFepInputMiniQwertyZhuyinPhraseBase::CheckToneMarkBorderUpon() |
|
545 { |
|
546 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
547 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
548 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
549 |
|
550 if ( keystroke->Count() > 1 ) |
|
551 { |
|
552 for ( TInt i = 1; i < keystroke->Count(); ++i ) |
|
553 { |
|
554 if ( ( 1 == keystroke->MdcaPoint( i - 1 ).Length() ) && |
|
555 ( 1 == keystroke->MdcaPoint( i ).Length() ) ) |
|
556 { |
|
557 return ETrue; |
|
558 } |
|
559 } |
|
560 } |
|
561 |
|
562 return EFalse; |
|
563 } |
|
564 |
|
565 // --------------------------------------------------------------------------- |
|
566 // TAknFepInputMiniQwertyZhuyinPhraseBase::GetCandidateL |
|
567 // Get candidate info. |
|
568 // --------------------------------------------------------------------------- |
|
569 // |
|
570 void TAknFepInputMiniQwertyZhuyinPhraseBase::GetCandidateL( TBool aClearSelection ) |
|
571 { |
|
572 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
573 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
574 MAknFepUICtrlPinyinPopup* popup = uiContainer->PinyinPopupWindow(); |
|
575 MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane(); |
|
576 CDesCArrayFlat* spelling = popup->PhoneticSpellingArray(); |
|
577 CDesCArrayFlat* candidateArray = candidatePane->CandidateArray(); |
|
578 candidateArray->Reset(); |
|
579 candidateArray->Compress(); |
|
580 |
|
581 if ( 0 == spelling->Count() ) |
|
582 { |
|
583 return; |
|
584 } |
|
585 |
|
586 TInt selection = 0; |
|
587 if ( !aClearSelection ) |
|
588 { |
|
589 selection = popup->CurrentSelection(); |
|
590 if ( selection >= spelling->Count() ) |
|
591 { |
|
592 selection = 0; |
|
593 } |
|
594 } |
|
595 RPointerArray<HBufC> list; |
|
596 extern void CleanArray( TAny* aAny ); |
|
597 TCleanupItem cleanitem( CleanArray, &list ); |
|
598 CleanupStack::PushL( cleanitem ); |
|
599 HBufC* retString = ptiengine->GetCandidatesByInputString( |
|
600 spelling->MdcaPoint( selection ), |
|
601 list, |
|
602 EFalse ); |
|
603 |
|
604 delete retString; |
|
605 retString = NULL; |
|
606 |
|
607 for ( TInt i = 0; i < list.Count(); ++i ) |
|
608 { |
|
609 if ( 1 == spelling->MdcaPoint( selection ).Length() ) |
|
610 { |
|
611 if ( 0 != spelling->MdcaPoint( selection ).Compare( *(list[i]) ) ) |
|
612 { |
|
613 candidateArray->AppendL( *(list[i]) ); |
|
614 } |
|
615 } |
|
616 else |
|
617 { |
|
618 candidateArray->AppendL( *(list[i]) ); |
|
619 } |
|
620 } |
|
621 |
|
622 CleanupStack::PopAndDestroy(); // cleanitem |
|
623 } |
|
624 |
|
625 // End of file |