|
1 /* |
|
2 * Copyright (c) 2005-2006 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 for chinese peninput full screen hwr |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "peninputhwrfscnlayout.h" |
|
20 #include "peninputhwrfscnstatemanager.h" |
|
21 #include "peninputhwrfscndatastore.h" |
|
22 #include "peninputhwrfscnevent.h" |
|
23 #include "peninputhwrtriggerstr.h" |
|
24 #include "peninputhwrfscncandidatepanel.h" |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 // CPeninputHwrfscnStateManager class |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CPeninputHwrfscnStateManager::NewL() |
|
30 // . |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CPeninputHwrfscnStateManager* CPeninputHwrfscnStateManager::NewL( |
|
34 CPeninputHwrfscnLayout* aLayout ) |
|
35 { |
|
36 CPeninputHwrfscnStateManager* self = new( ELeave ) |
|
37 CPeninputHwrfscnStateManager( aLayout ); |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL(); |
|
40 CleanupStack::Pop(); |
|
41 return self; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CPeninputHwrfscnStateManager::CPeninputHwrfscnStateManager() |
|
46 // . |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CPeninputHwrfscnStateManager::CPeninputHwrfscnStateManager( |
|
50 CPeninputHwrfscnLayout* aLayout ) |
|
51 :iLayout( aLayout ) |
|
52 { |
|
53 |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CPeninputHwrfscnStateManager::~CPeninputHwrfscnStateManager() |
|
58 // . |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CPeninputHwrfscnStateManager::~CPeninputHwrfscnStateManager() |
|
62 { |
|
63 for( int i = 0; i < EPeninputHwrfscnStateCount; ++i ) |
|
64 { |
|
65 delete iStateHandlers[i]; |
|
66 } |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CPeninputHwrfscnStateManager::CosntructL() |
|
71 // . |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 void CPeninputHwrfscnStateManager::ConstructL() |
|
75 { |
|
76 TInt i = 0; |
|
77 |
|
78 iStates[i] = EPeninputHwrfscnStateStandby; |
|
79 iStateHandlers[i] = CPeninputHwrfscnStateHandlerStandby::NewL( *this ); |
|
80 |
|
81 iStates[++i] = EPeninputHwrfscnStateWriting; |
|
82 iStateHandlers[i] = CPeninputHwrfscnStateHandlerWriting::NewL( *this ); |
|
83 |
|
84 iStates[++i] = EPeninputHwrfscnStateCandidateSelecting; |
|
85 iStateHandlers[i] = |
|
86 CPeninputHwrfscnStateHandlerCandidateSelecting::NewL( *this ); |
|
87 |
|
88 iStates[++i] = EPeninputHwrfscnStateHomophonicSelecting; |
|
89 iStateHandlers[i] = |
|
90 CPeninputHwrfscnStateHandlerHomophonicSelecting::NewL( *this ); |
|
91 |
|
92 iStates[++i] = EPeninputHwrfscnStatePredictSelecting; |
|
93 iStateHandlers[i] = |
|
94 CPeninputHwrfscnStateHandlerPredictSelecting::NewL( *this ); |
|
95 |
|
96 iCurrentStateHandler = iStateHandlers[0]; |
|
97 iCurrentState = EPeninputHwrfscnStateStandby; |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CPeninputHwrfscnStateManager::SetState() |
|
102 // . |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CPeninputHwrfscnStateManager::SetState( TPeninputHwrfscnState aState ) |
|
106 { |
|
107 if( iCurrentState == aState ) |
|
108 { |
|
109 return; |
|
110 } |
|
111 |
|
112 CPeninputHwrfscnStateHandlerBase* newStateHandler = Find( aState ); |
|
113 if( newStateHandler ) |
|
114 { |
|
115 iCurrentState = aState; |
|
116 iCurrentStateHandler->OnExit(); |
|
117 iCurrentStateHandler = newStateHandler; |
|
118 iCurrentStateHandler->OnEntry(); |
|
119 } |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CPeninputHwrfscnStateManager::Find() |
|
124 // . |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 CPeninputHwrfscnStateHandlerBase* CPeninputHwrfscnStateManager::Find( |
|
128 TPeninputHwrfscnState aState ) |
|
129 { |
|
130 for( TInt i = 0; i < EPeninputHwrfscnStateCount; i++ ) |
|
131 { |
|
132 if( iStates[i] == aState ) |
|
133 { |
|
134 return iStateHandlers[i]; |
|
135 } |
|
136 } |
|
137 return NULL; |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CPeninputHwrfscnStateManager::HandleCommand() |
|
142 // . |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CPeninputHwrfscnStateManager::HandleCommand( |
|
146 TInt /*aCmd*/, TUint8* /*aData*/ ) |
|
147 { |
|
148 |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CPeninputHwrfscnStateManager::HandleEventL() |
|
153 // . |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 void CPeninputHwrfscnStateManager::HandleEventL( TInt aEventType, |
|
157 const TDesC& aEventData ) |
|
158 { |
|
159 iCurrentStateHandler->HandleEventL( aEventType, aEventData ); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CPeninputHwrfscnStateManager::HwrLayout() |
|
164 // . |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 CPeninputHwrfscnLayout& CPeninputHwrfscnStateManager::HwrLayout() |
|
168 { |
|
169 return *iLayout; |
|
170 } |
|
171 |
|
172 // ============================ MEMBER FUNCTIONS =============================== |
|
173 // CPeninputHwrfscnStateHandlerBase class |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CPeninputHwrfscnStateHandlerBase::CPeninputHwrfscnStateHandlerBase() |
|
176 // . |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 CPeninputHwrfscnStateHandlerBase::CPeninputHwrfscnStateHandlerBase( |
|
180 CPeninputHwrfscnStateManager& aStateManager ) |
|
181 :iStateManager( aStateManager ), |
|
182 iDataStore( aStateManager.HwrLayout().DataStore() ) |
|
183 { |
|
184 |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CPeninputHwrfscnStateHandlerBase::~CPeninputHwrfscnStateHandlerBase() |
|
189 // . |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 CPeninputHwrfscnStateHandlerBase::~CPeninputHwrfscnStateHandlerBase() |
|
193 { |
|
194 |
|
195 } |
|
196 |
|
197 // ============================ MEMBER FUNCTIONS =============================== |
|
198 // CPeninputHwrfscnStateHandlerStandby class |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CPeninputHwrfscnStateHandlerStandby::CPeninputHwrfscnStateHandlerStandby() |
|
201 // . |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 CPeninputHwrfscnStateHandlerStandby::CPeninputHwrfscnStateHandlerStandby( |
|
205 CPeninputHwrfscnStateManager& aStateManager ) |
|
206 :CPeninputHwrfscnStateHandlerBase( aStateManager ) |
|
207 { |
|
208 |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CPeninputHwrfscnStateHandlerStandby::NewL() |
|
213 // . |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 CPeninputHwrfscnStateHandlerStandby* CPeninputHwrfscnStateHandlerStandby::NewL( |
|
217 CPeninputHwrfscnStateManager& aStateManager ) |
|
218 { |
|
219 CPeninputHwrfscnStateHandlerStandby* self = new( ELeave ) |
|
220 CPeninputHwrfscnStateHandlerStandby( aStateManager ); |
|
221 |
|
222 return self; |
|
223 |
|
224 } |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CPeninputHwrfscnStateHandlerStandby::HandleCommand() |
|
228 // . |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 void CPeninputHwrfscnStateHandlerStandby:: |
|
232 HandleCommand( TInt /*aCmd*/, TUint8* /*aData*/ ) |
|
233 { |
|
234 |
|
235 } |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // CPeninputHwrfscnStateHandlerStandby::HandleEventL() |
|
239 // . |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 void CPeninputHwrfscnStateHandlerStandby::HandleEventL( TInt aEventType, |
|
243 const TDesC& /*aEventData*/ ) |
|
244 { |
|
245 switch( aEventType ) |
|
246 { |
|
247 case EHwrEventBeginWriting: |
|
248 { |
|
249 iStateManager.SetState( |
|
250 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateWriting ); |
|
251 } |
|
252 break; |
|
253 |
|
254 default: |
|
255 break; |
|
256 } |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CPeninputHwrfscnStateHandlerStandby::OnEntry() |
|
261 // . |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 void CPeninputHwrfscnStateHandlerStandby::OnEntry() |
|
265 { |
|
266 iStateManager.HwrLayout().CandidatePanel().Show( EFalse ); |
|
267 } |
|
268 |
|
269 // ----------------------------------------------------------------------------- |
|
270 // CPeninputHwrfscnStateHandlerStandby::OnExit() |
|
271 // . |
|
272 // ----------------------------------------------------------------------------- |
|
273 // |
|
274 void CPeninputHwrfscnStateHandlerStandby::OnExit() |
|
275 { |
|
276 |
|
277 } |
|
278 |
|
279 // ============================ MEMBER FUNCTIONS =============================== |
|
280 // CPeninputHwrfscnStateHandlerWriting class |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CPeninputHwrfscnStateHandlerWriting::CPeninputHwrfscnStateHandlerWriting() |
|
283 // . |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 CPeninputHwrfscnStateHandlerWriting::CPeninputHwrfscnStateHandlerWriting( |
|
287 CPeninputHwrfscnStateManager& aStateManager ) |
|
288 :CPeninputHwrfscnStateHandlerBase( aStateManager ) |
|
289 { |
|
290 |
|
291 } |
|
292 |
|
293 // ----------------------------------------------------------------------------- |
|
294 // CPeninputHwrfscnStateHandlerWriting::NewL() |
|
295 // . |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 CPeninputHwrfscnStateHandlerWriting* CPeninputHwrfscnStateHandlerWriting::NewL( |
|
299 CPeninputHwrfscnStateManager& aStateManager ) |
|
300 { |
|
301 CPeninputHwrfscnStateHandlerWriting* self = new( ELeave ) |
|
302 CPeninputHwrfscnStateHandlerWriting( aStateManager ); |
|
303 |
|
304 return self; |
|
305 |
|
306 } |
|
307 |
|
308 // ----------------------------------------------------------------------------- |
|
309 // CPeninputHwrfscnStateHandlerWriting::HandleCommand() |
|
310 // . |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 void CPeninputHwrfscnStateHandlerWriting::HandleCommand( |
|
314 TInt /*aCmd*/, TUint8* /*aData*/ ) |
|
315 { |
|
316 |
|
317 } |
|
318 |
|
319 // ----------------------------------------------------------------------------- |
|
320 // CPeninputHwrfscnStateHandlerWriting::HandleEventL() |
|
321 // . |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 void CPeninputHwrfscnStateHandlerWriting::HandleEventL( TInt aEventType, |
|
325 const TDesC& aEventData ) |
|
326 { |
|
327 switch( aEventType ) |
|
328 { |
|
329 case EHwrEventEndWriting: |
|
330 { |
|
331 OnEndWritingL( aEventData ); |
|
332 } |
|
333 break; |
|
334 |
|
335 case EHwrEventPointerOutsideWnd: |
|
336 { |
|
337 iStateManager.SetState( |
|
338 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateStandby ); |
|
339 } |
|
340 break; |
|
341 |
|
342 default: |
|
343 break; |
|
344 } |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CPeninputHwrfscnStateHandlerWriting::OnEndWriting() |
|
349 // . |
|
350 // ----------------------------------------------------------------------------- |
|
351 // |
|
352 void CPeninputHwrfscnStateHandlerWriting::OnEndWritingL( const TDesC& aEventData ) |
|
353 { |
|
354 const RArray<TPoint>* aTraceData = ( RArray<TPoint>* )aEventData.Ptr(); |
|
355 iDataStore.DoRecognizeL( *aTraceData ); |
|
356 RPointerArray<HBufC> candidates = iDataStore.Candidate(); |
|
357 if ( candidates.Count() > 0 ) |
|
358 { |
|
359 HBufC* defaultCandiate = candidates[0]; |
|
360 if( iDataStore.IsSpecialDisplayChars( *defaultCandiate ) ) |
|
361 { |
|
362 //allocte a new buf pointed by str |
|
363 HBufC* realCandidate = iDataStore.ConvertDisplayChars( *defaultCandiate ); |
|
364 iStateManager.HwrLayout().SubmitStringToFep( *realCandidate ); |
|
365 delete realCandidate; |
|
366 } |
|
367 else |
|
368 { |
|
369 iStateManager.HwrLayout().SubmitStringToFep( *defaultCandiate ); |
|
370 } |
|
371 //check if the default candidate is need to be sent directly |
|
372 if( iDataStore.IsDirectlySentCandidate( *defaultCandiate ) ) |
|
373 { |
|
374 iStateManager.SetState( |
|
375 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateStandby ); |
|
376 } |
|
377 else |
|
378 { |
|
379 iStateManager.SetState( |
|
380 CPeninputHwrfscnStateManager:: |
|
381 EPeninputHwrfscnStateCandidateSelecting ); |
|
382 } |
|
383 } |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CPeninputHwrfscnStateHandlerWriting::OnEntry() |
|
388 // . |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 void CPeninputHwrfscnStateHandlerWriting::OnEntry() |
|
392 { |
|
393 |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // CPeninputHwrfscnStateHandlerWriting::OnExit() |
|
398 // . |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 void CPeninputHwrfscnStateHandlerWriting::OnExit() |
|
402 { |
|
403 |
|
404 } |
|
405 |
|
406 // ============================ MEMBER FUNCTIONS =============================== |
|
407 // CPeninputHwrfscnStateHandlerCandidateSelecting class |
|
408 // ----------------------------------------------------------------------------- |
|
409 // CPeninputHwrfscnStateHandlerCandidateSelecting:: |
|
410 // CPeninputHwrfscnStateHandlerCandidateSelecting() |
|
411 // . |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 CPeninputHwrfscnStateHandlerCandidateSelecting:: |
|
415 CPeninputHwrfscnStateHandlerCandidateSelecting( |
|
416 CPeninputHwrfscnStateManager& aStateManager ) |
|
417 :CPeninputHwrfscnStateHandlerBase( aStateManager ) |
|
418 { |
|
419 |
|
420 } |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CPeninputHwrfscnStateHandlerCandidateSelecting::NewL() |
|
424 // . |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 CPeninputHwrfscnStateHandlerCandidateSelecting* |
|
428 CPeninputHwrfscnStateHandlerCandidateSelecting::NewL( |
|
429 CPeninputHwrfscnStateManager& aStateManager ) |
|
430 { |
|
431 CPeninputHwrfscnStateHandlerCandidateSelecting* self = new( ELeave ) |
|
432 CPeninputHwrfscnStateHandlerCandidateSelecting( aStateManager ); |
|
433 |
|
434 return self; |
|
435 } |
|
436 |
|
437 // ----------------------------------------------------------------------------- |
|
438 // CPeninputHwrfscnStateHandlerCandidateSelecting::HandleCommand() |
|
439 // . |
|
440 // ----------------------------------------------------------------------------- |
|
441 // |
|
442 void CPeninputHwrfscnStateHandlerCandidateSelecting::HandleCommand( TInt /*aCmd*/, |
|
443 TUint8* /*aData*/ ) |
|
444 { |
|
445 |
|
446 } |
|
447 |
|
448 // ----------------------------------------------------------------------------- |
|
449 // CPeninputHwrfscnStateHandlerCandidateSelecting::HandleEventL() |
|
450 // . |
|
451 // ----------------------------------------------------------------------------- |
|
452 // |
|
453 void CPeninputHwrfscnStateHandlerCandidateSelecting::HandleEventL( TInt aEventType, |
|
454 const TDesC& aEventData ) |
|
455 { |
|
456 switch( aEventType ) |
|
457 { |
|
458 case EHwrEventCandidateSelected: |
|
459 { |
|
460 OnSelectedCandidatesL( aEventData ); |
|
461 } |
|
462 break; |
|
463 |
|
464 case EHwrEventPredictiveSelected: |
|
465 { |
|
466 OnSelectedPredictivesL( aEventData ); |
|
467 } |
|
468 break; |
|
469 |
|
470 case EHwrEventPointerOutsideWnd: |
|
471 case EHwrEventBeginWriting: |
|
472 { |
|
473 iStateManager.SetState( CPeninputHwrfscnStateManager:: |
|
474 EPeninputHwrfscnStateStandby ); |
|
475 } |
|
476 break; |
|
477 |
|
478 default: |
|
479 break; |
|
480 } |
|
481 |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CPeninputHwrfscnStateHandlerCandidateSelecting::OnSelectedCandidatesL() |
|
486 // . |
|
487 // ----------------------------------------------------------------------------- |
|
488 // |
|
489 void CPeninputHwrfscnStateHandlerCandidateSelecting::OnSelectedCandidatesL( |
|
490 const TDesC& aEventData ) |
|
491 { |
|
492 //get the candidate index |
|
493 const TInt cellNo = aEventData[aEventData.Length()-1]; |
|
494 if (!iDataStore.IsValid( cellNo )) |
|
495 { |
|
496 iStateManager.SetState( |
|
497 CPeninputHwrfscnStateManager:: |
|
498 EPeninputHwrfscnStateCandidateSelecting ); |
|
499 return; |
|
500 } |
|
501 |
|
502 TPtrC ptr; |
|
503 ptr.Set( ( aEventData.Left( aEventData.Length() - 1 ) ) ); |
|
504 RPointerArray<HBufC> candidates = iDataStore.Candidate(); |
|
505 //the selected char is not same as default |
|
506 //replace the default candidate |
|
507 HBufC* defaultCandidate = candidates[0]; |
|
508 if( *defaultCandidate != ptr ) |
|
509 { |
|
510 //handle special display char |
|
511 if( iDataStore.IsSpecialDisplayChars( ptr ) ) |
|
512 { |
|
513 HBufC* realCandidate = iDataStore.ConvertDisplayChars( ptr ); |
|
514 iStateManager.HwrLayout().Replace( *defaultCandidate, |
|
515 *realCandidate ); |
|
516 delete realCandidate; |
|
517 } |
|
518 else |
|
519 { |
|
520 iStateManager.HwrLayout().Replace( *defaultCandidate, ptr ); |
|
521 } |
|
522 } |
|
523 |
|
524 //check if it is homophonic char when the chinese is primary range |
|
525 if( iDataStore.IsChinesePrimaryRange() |
|
526 && iDataStore.IsChinese( cellNo ) |
|
527 && iDataStore.IsHomephonicLanguage() ) |
|
528 { |
|
529 //get the homophonic candidates |
|
530 iDataStore.DoHomophonicL( ptr ); |
|
531 if( iDataStore.Candidate().Count() > 1 ) |
|
532 { |
|
533 iStateManager.SetState( |
|
534 CPeninputHwrfscnStateManager:: |
|
535 EPeninputHwrfscnStateHomophonicSelecting ); |
|
536 } |
|
537 else//enter the predictive state |
|
538 { |
|
539 OnSelectedPredictivesL( aEventData, EFalse ); |
|
540 } |
|
541 } |
|
542 else |
|
543 { |
|
544 OnSelectedPredictivesL( aEventData, EFalse ); |
|
545 } |
|
546 } |
|
547 |
|
548 // ----------------------------------------------------------------------------- |
|
549 // CPeninputHwrfscnStateHandlerCandidateSelecting::OnSelectedCandidatesL() |
|
550 // . |
|
551 // ----------------------------------------------------------------------------- |
|
552 // |
|
553 void CPeninputHwrfscnStateHandlerCandidateSelecting::OnSelectedPredictivesL( |
|
554 const TDesC& aEventData, |
|
555 TBool aAppend ) |
|
556 { |
|
557 TPtrC ptr; |
|
558 ptr.Set( aEventData.Left( aEventData.Length() - 1 ) ); |
|
559 // aAppend means we need append the prt to current trigger string and submit |
|
560 // ptr to forground app |
|
561 if( aAppend ) |
|
562 { |
|
563 if( iDataStore.IsSpecialDisplayChars( ptr ) ) |
|
564 { |
|
565 HBufC* str = iDataStore.ConvertDisplayChars( ptr ); |
|
566 iStateManager.HwrLayout().SubmitStringToFep( *str ); |
|
567 delete str; |
|
568 } |
|
569 else |
|
570 { |
|
571 iStateManager.HwrLayout().SubmitStringToFep( ptr ); |
|
572 } |
|
573 |
|
574 iDataStore.TriggerStr()->Append( ptr ); |
|
575 } |
|
576 else |
|
577 { |
|
578 iDataStore.TriggerStr()->Set( ptr ); |
|
579 } |
|
580 |
|
581 iDataStore.DoPredictiveL(); |
|
582 |
|
583 if( iDataStore.PredictiveCount() > 0 ) |
|
584 { |
|
585 iStateManager.SetState( |
|
586 CPeninputHwrfscnStateManager:: |
|
587 EPeninputHwrfscnStatePredictSelecting ); |
|
588 } |
|
589 else |
|
590 { |
|
591 iStateManager.SetState( |
|
592 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateStandby ); |
|
593 } |
|
594 |
|
595 } |
|
596 |
|
597 // ----------------------------------------------------------------------------- |
|
598 // CPeninputHwrfscnStateHandlerCandidateSelecting::OnEntry() |
|
599 // . |
|
600 // ----------------------------------------------------------------------------- |
|
601 // |
|
602 void CPeninputHwrfscnStateHandlerCandidateSelecting::OnEntry() |
|
603 { |
|
604 |
|
605 } |
|
606 |
|
607 // ----------------------------------------------------------------------------- |
|
608 // CPeninputHwrfscnStateHandlerCandidateSelecting::OnExit() |
|
609 // . |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 void CPeninputHwrfscnStateHandlerCandidateSelecting::OnExit() |
|
613 { |
|
614 |
|
615 } |
|
616 |
|
617 // ============================ MEMBER FUNCTIONS =============================== |
|
618 // CPeninputHwrfscnStateHandlerHomophonicSelecting class |
|
619 // ----------------------------------------------------------------------------- |
|
620 // CPeninputHwrfscnStateHandlerHomophonicSelecting:: |
|
621 // CPeninputHwrfscnStateHandlerHomophonicSelecting() |
|
622 // . |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 CPeninputHwrfscnStateHandlerHomophonicSelecting:: |
|
626 CPeninputHwrfscnStateHandlerHomophonicSelecting( |
|
627 CPeninputHwrfscnStateManager& aStateManager ) |
|
628 :CPeninputHwrfscnStateHandlerBase( aStateManager ) |
|
629 { |
|
630 |
|
631 } |
|
632 |
|
633 // ----------------------------------------------------------------------------- |
|
634 // CPeninputHwrfscnStateHandlerHomophonicSelecting::NewL() |
|
635 // . |
|
636 // ----------------------------------------------------------------------------- |
|
637 // |
|
638 CPeninputHwrfscnStateHandlerHomophonicSelecting* |
|
639 CPeninputHwrfscnStateHandlerHomophonicSelecting::NewL( |
|
640 CPeninputHwrfscnStateManager& aStateManager ) |
|
641 { |
|
642 CPeninputHwrfscnStateHandlerHomophonicSelecting* self = new( ELeave ) |
|
643 CPeninputHwrfscnStateHandlerHomophonicSelecting( aStateManager ); |
|
644 |
|
645 return self; |
|
646 |
|
647 } |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // CPeninputHwrfscnStateHandlerHomophonicSelecting::HandleCommand() |
|
651 // . |
|
652 // ----------------------------------------------------------------------------- |
|
653 // |
|
654 void CPeninputHwrfscnStateHandlerHomophonicSelecting::HandleCommand( TInt /*aCmd*/, |
|
655 TUint8* /*aData*/ ) |
|
656 { |
|
657 |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CPeninputHwrfscnStateHandlerHomophonicSelecting::HandleEventL() |
|
662 // . |
|
663 // ----------------------------------------------------------------------------- |
|
664 // |
|
665 void CPeninputHwrfscnStateHandlerHomophonicSelecting::HandleEventL( TInt aEventType, |
|
666 const TDesC& aEventData ) |
|
667 { |
|
668 switch( aEventType ) |
|
669 { |
|
670 case EHwrEventCandidateSelected: |
|
671 { |
|
672 OnSelectedCandidatesL( aEventData ); |
|
673 } |
|
674 break; |
|
675 |
|
676 case EHwrEventPredictiveSelected: |
|
677 { |
|
678 OnSelectedPredictivesL( aEventData ); |
|
679 } |
|
680 break; |
|
681 |
|
682 case EHwrEventPointerOutsideWnd: |
|
683 case EHwrEventBeginWriting: |
|
684 { |
|
685 iStateManager.SetState( |
|
686 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateStandby ); |
|
687 } |
|
688 break; |
|
689 |
|
690 default: |
|
691 break; |
|
692 } |
|
693 } |
|
694 |
|
695 // ----------------------------------------------------------------------------- |
|
696 // CPeninputHwrfscnStateHandlerHomophonicSelecting::OnSelectedCandidatesL() |
|
697 // . |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 void CPeninputHwrfscnStateHandlerHomophonicSelecting::OnSelectedCandidatesL( |
|
701 const TDesC& aEventData ) |
|
702 { |
|
703 TPtrC ptr; |
|
704 ptr.Set( ( aEventData.Left( aEventData.Length() - 1 ) ) ); |
|
705 RPointerArray<HBufC> candidates = iDataStore.Candidate(); |
|
706 HBufC* defaultCandidate = candidates[0]; |
|
707 iStateManager.HwrLayout().Replace( *defaultCandidate, ptr ); |
|
708 iDataStore.TriggerStr()->Set( ptr ); |
|
709 iDataStore.DoPredictiveL(); |
|
710 iStateManager.SetState( |
|
711 CPeninputHwrfscnStateManager::EPeninputHwrfscnStatePredictSelecting ); |
|
712 } |
|
713 |
|
714 // ----------------------------------------------------------------------------- |
|
715 // CPeninputHwrfscnStateHandlerHomophonicSelecting::OnSelectedCandidatesL() |
|
716 // . |
|
717 // ----------------------------------------------------------------------------- |
|
718 // |
|
719 void CPeninputHwrfscnStateHandlerHomophonicSelecting::OnSelectedPredictivesL( |
|
720 const TDesC& aEventData ) |
|
721 { |
|
722 TPtrC ptr; |
|
723 ptr.Set( aEventData.Left( aEventData.Length() - 1 ) ); |
|
724 iStateManager.HwrLayout().SubmitStringToFep( ptr ); |
|
725 |
|
726 iDataStore.TriggerStr()->Append( ptr ); |
|
727 iDataStore.DoPredictiveL(); |
|
728 if( iDataStore.PredictiveCount() > 0 ) |
|
729 { |
|
730 iStateManager.SetState( |
|
731 CPeninputHwrfscnStateManager::EPeninputHwrfscnStatePredictSelecting ); |
|
732 } |
|
733 else |
|
734 { |
|
735 iStateManager.SetState( |
|
736 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateStandby ); |
|
737 } |
|
738 |
|
739 } |
|
740 // ----------------------------------------------------------------------------- |
|
741 // CPeninputHwrfscnStateHandlerHomophonicSelecting::OnEntry() |
|
742 // . |
|
743 // ----------------------------------------------------------------------------- |
|
744 // |
|
745 void CPeninputHwrfscnStateHandlerHomophonicSelecting::OnEntry() |
|
746 { |
|
747 |
|
748 } |
|
749 |
|
750 // ----------------------------------------------------------------------------- |
|
751 // CPeninputHwrfscnStateHandlerHomophonicSelecting::OnExit() |
|
752 // . |
|
753 // ----------------------------------------------------------------------------- |
|
754 // |
|
755 void CPeninputHwrfscnStateHandlerHomophonicSelecting::OnExit() |
|
756 { |
|
757 |
|
758 } |
|
759 |
|
760 // ============================ MEMBER FUNCTIONS =============================== |
|
761 // CPeninputHwrfscnStateHandlerPredictSelecting class |
|
762 // ----------------------------------------------------------------------------- |
|
763 // CPeninputHwrfscnStateHandlerPredictSelecting:: |
|
764 // CPeninputHwrfscnStateHandlerPredictSelecting() |
|
765 // . |
|
766 // ----------------------------------------------------------------------------- |
|
767 // |
|
768 CPeninputHwrfscnStateHandlerPredictSelecting:: |
|
769 CPeninputHwrfscnStateHandlerPredictSelecting( |
|
770 CPeninputHwrfscnStateManager& aStateManager ) |
|
771 :CPeninputHwrfscnStateHandlerBase( aStateManager ) |
|
772 { |
|
773 |
|
774 } |
|
775 |
|
776 // ----------------------------------------------------------------------------- |
|
777 // CPeninputHwrfscnStateHandlerPredictSelecting::NewL() |
|
778 // . |
|
779 // ----------------------------------------------------------------------------- |
|
780 // |
|
781 CPeninputHwrfscnStateHandlerPredictSelecting* |
|
782 CPeninputHwrfscnStateHandlerPredictSelecting::NewL( |
|
783 CPeninputHwrfscnStateManager& aStateManager ) |
|
784 { |
|
785 CPeninputHwrfscnStateHandlerPredictSelecting* self = new( ELeave ) |
|
786 CPeninputHwrfscnStateHandlerPredictSelecting( aStateManager ); |
|
787 |
|
788 return self; |
|
789 |
|
790 } |
|
791 |
|
792 // ----------------------------------------------------------------------------- |
|
793 // CPeninputHwrfscnStateHandlerPredictSelecting::HandleCommand() |
|
794 // . |
|
795 // ----------------------------------------------------------------------------- |
|
796 // |
|
797 void CPeninputHwrfscnStateHandlerPredictSelecting::HandleCommand( TInt /*aCmd*/, |
|
798 TUint8* /*aData*/ ) |
|
799 { |
|
800 |
|
801 } |
|
802 |
|
803 // ----------------------------------------------------------------------------- |
|
804 // CPeninputHwrfscnStateHandlerPredictSelecting::HandleEventL() |
|
805 // . |
|
806 // ----------------------------------------------------------------------------- |
|
807 // |
|
808 void CPeninputHwrfscnStateHandlerPredictSelecting::HandleEventL( TInt aEventType, |
|
809 const TDesC& aEventData ) |
|
810 { |
|
811 switch( aEventType ) |
|
812 { |
|
813 case EHwrEventPredictiveSelected: |
|
814 { |
|
815 OnSelectedPredictivesL( aEventData ); |
|
816 } |
|
817 break; |
|
818 |
|
819 case EHwrEventPointerOutsideWnd: |
|
820 case EHwrEventBeginWriting: |
|
821 { |
|
822 iStateManager.SetState( |
|
823 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateStandby ); |
|
824 } |
|
825 break; |
|
826 |
|
827 default: |
|
828 break; |
|
829 } |
|
830 } |
|
831 |
|
832 // ----------------------------------------------------------------------------- |
|
833 // CPeninputHwrfscnStateHandlerPredictSelecting::OnSelectedCandidatesL() |
|
834 // . |
|
835 // ----------------------------------------------------------------------------- |
|
836 // |
|
837 void CPeninputHwrfscnStateHandlerPredictSelecting::OnSelectedPredictivesL( |
|
838 const TDesC& aEventData ) |
|
839 { |
|
840 TPtrC ptr; |
|
841 ptr.Set( aEventData.Left( aEventData.Length() - 1 ) ); |
|
842 if( iDataStore.IsSpecialDisplayChars( ptr ) ) |
|
843 { |
|
844 HBufC* str = iDataStore.ConvertDisplayChars( ptr ); |
|
845 iStateManager.HwrLayout().SubmitStringToFep( *str ); |
|
846 delete str; |
|
847 } |
|
848 else |
|
849 { |
|
850 iStateManager.HwrLayout().SubmitStringToFep( ptr ); |
|
851 } |
|
852 |
|
853 iDataStore.TriggerStr()->Append( ptr ); |
|
854 iDataStore.DoPredictiveL(); |
|
855 if( iDataStore.PredictiveCount() > 0 ) |
|
856 { |
|
857 iStateManager.SetState( |
|
858 CPeninputHwrfscnStateManager::EPeninputHwrfscnStatePredictSelecting ); |
|
859 } |
|
860 else |
|
861 { |
|
862 iStateManager.SetState( |
|
863 CPeninputHwrfscnStateManager::EPeninputHwrfscnStateStandby ); |
|
864 } |
|
865 |
|
866 } |
|
867 |
|
868 // ----------------------------------------------------------------------------- |
|
869 // CPeninputHwrfscnStateHandlerPredictSelecting::OnEntry() |
|
870 // . |
|
871 // ----------------------------------------------------------------------------- |
|
872 // |
|
873 void CPeninputHwrfscnStateHandlerPredictSelecting::OnEntry() |
|
874 { |
|
875 iStateManager.HwrLayout().CandidatePanel().ShowWritingCandidate( EFalse ); |
|
876 } |
|
877 |
|
878 // ----------------------------------------------------------------------------- |
|
879 // CPeninputHwrfscnStateHandlerPredictSelecting::OnExit() |
|
880 // . |
|
881 // ----------------------------------------------------------------------------- |
|
882 // |
|
883 void CPeninputHwrfscnStateHandlerPredictSelecting::OnExit() |
|
884 { |
|
885 |
|
886 } |
|
887 |
|
888 //End of file |