|
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 #ifndef __PENINPUTHWRFSCNDATASTORE_H__ |
|
20 #define __PENINPUTHWRFSCNDATASTORE_H__ |
|
21 |
|
22 //SYSTEM INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32def.h> |
|
25 #include <w32std.h> |
|
26 #include <eikon.hrh> |
|
27 #include <AknUtils.h> |
|
28 |
|
29 //FEP INCLUDES |
|
30 #include <PtiEngine.h> |
|
31 #include <peninputpluginutils.h> |
|
32 |
|
33 //USER INCLUDES |
|
34 #include "peninputhwrfscnpropertysubscriber.h" |
|
35 |
|
36 //CONSTANTS |
|
37 const TInt KLanguageStringLength = 10; |
|
38 |
|
39 //FOWWARD CLASS |
|
40 class CAknFepHwrTriggerStr; |
|
41 class CRepository; |
|
42 class CAknFepHwrEngine; |
|
43 class CPtiEngine; |
|
44 |
|
45 /** |
|
46 * CPeninputHwrfscnDataStore |
|
47 * |
|
48 * @lib peninputhwrfscn.lib |
|
49 * @since S60 v5.0 |
|
50 */ |
|
51 class CPeninputHwrfscnDataStore : public CBase |
|
52 { |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Symbian constructor. |
|
57 * |
|
58 * @since S60 v5.0 |
|
59 * @return Pointer to created CPeninputHwrfscnDataStore object |
|
60 */ |
|
61 static CPeninputHwrfscnDataStore* NewL( CPtiEngine* aPtiEngine ); |
|
62 |
|
63 /** |
|
64 * destructor |
|
65 * |
|
66 * @since S60 v5.0 |
|
67 * @return None |
|
68 */ |
|
69 virtual ~CPeninputHwrfscnDataStore(); |
|
70 |
|
71 public: |
|
72 /** |
|
73 * The writing speed. |
|
74 * |
|
75 *@since Series 60 5.0 |
|
76 */ |
|
77 enum TWritingSpeed |
|
78 { |
|
79 EWritingSpeedVeryFast = 1, |
|
80 EWritingSpeedFast, |
|
81 EWritingSpeedNormal, |
|
82 EWritingSpeedSlow, |
|
83 EWritingSpeedVerySlow |
|
84 }; |
|
85 |
|
86 public: |
|
87 /** |
|
88 * Is candidate in Chinese range |
|
89 * |
|
90 * @since S60 v5.0 |
|
91 * @param aCandidateIndex The index the candidate in list. |
|
92 * @return ETrue if candidate is in Chinese range; otherwise EFalse |
|
93 */ |
|
94 TBool IsChinese( TInt aCandidateIndex ) const; |
|
95 |
|
96 TBool IsValid( TInt aCandidateIndex ) const; |
|
97 /** |
|
98 * Do recoginize by engine |
|
99 * |
|
100 * @since S60 v5.0 |
|
101 * @param aTraceData The trace data. |
|
102 * @return None |
|
103 */ |
|
104 void DoRecognizeL( const RArray<TPoint>& aTraceData ); |
|
105 |
|
106 /** |
|
107 * Do predictive using trigger string |
|
108 * |
|
109 * @since S60 v5.0 |
|
110 * @return None |
|
111 */ |
|
112 void DoPredictiveL(); |
|
113 |
|
114 /** |
|
115 * Do homophonic using trigger string |
|
116 * |
|
117 * @since S60 v5.0 |
|
118 * @return None |
|
119 */ |
|
120 void DoHomophonicL( const TDesC& aString ); |
|
121 |
|
122 /** |
|
123 * Get the predictive count |
|
124 * |
|
125 * @since S60 v5.0 |
|
126 * @return The count of predictives |
|
127 */ |
|
128 TInt PredictiveCount() const; |
|
129 |
|
130 /** |
|
131 * Add property subscriber |
|
132 * |
|
133 * @since S60 v5.0 |
|
134 * @param aSubscriber The property subscriber. |
|
135 * @return None |
|
136 */ |
|
137 void AddSubscriber( MPeninputHwrfscnPropertySubscriber* aSubscriber ); |
|
138 |
|
139 /** |
|
140 * Get the trigger string |
|
141 * |
|
142 * @since S60 v5.0 |
|
143 * @return Pointer to CAknFepHwrTriggerStr object |
|
144 */ |
|
145 CAknFepHwrTriggerStr* TriggerStr() const; |
|
146 |
|
147 /** |
|
148 * Set permitted ranges |
|
149 * |
|
150 * @since S60 v5.0 |
|
151 * @param aPermittedRanges The permitted ranges. |
|
152 * @return None |
|
153 */ |
|
154 void SetPermittedRanges( TInt aPermittedRanges ); |
|
155 |
|
156 /** |
|
157 * Get the permitted ranges count |
|
158 * |
|
159 * @since S60 v5.0 |
|
160 * @return The permitted ranges array. |
|
161 */ |
|
162 const RArray<TInt>& PermittedRanges() const; |
|
163 |
|
164 /** |
|
165 * Set Primary range |
|
166 * |
|
167 * @since S60 v5.0 |
|
168 * @param aPrimaryRange The Primary range |
|
169 * @return None |
|
170 */ |
|
171 void SetPrimaryRange( TInt aPrimaryRange ); |
|
172 |
|
173 /** |
|
174 * Get Primary range |
|
175 * |
|
176 * @since S60 v5.0 |
|
177 * @return Primary range. |
|
178 */ |
|
179 TInt PrimaryRange(); |
|
180 |
|
181 /** |
|
182 * Check if the primary range is chinese |
|
183 * |
|
184 * @since S60 v5.0 |
|
185 * @return ETrue if the primary range is chinese, EFalse if otherwise |
|
186 */ |
|
187 TBool IsChinesePrimaryRange(); |
|
188 |
|
189 /** |
|
190 * Set case |
|
191 * |
|
192 * @since S60 v5.0 |
|
193 * @param aCase The case |
|
194 * @return None |
|
195 */ |
|
196 void SetCase( TInt aCase ); |
|
197 |
|
198 /** |
|
199 * Set language |
|
200 * |
|
201 * @since S60 v5.0 |
|
202 * @param aLanguage The language |
|
203 * @return None |
|
204 */ |
|
205 void SetLanguageL( TInt aLanguage ); |
|
206 |
|
207 /** |
|
208 * Get language |
|
209 * |
|
210 * @since S60 v5.0 |
|
211 * @return Current Language |
|
212 */ |
|
213 TInt CurLanguage(); |
|
214 |
|
215 /** |
|
216 * Set writting speed. |
|
217 * |
|
218 * @since S60 v5.0 |
|
219 * @param aCharDelay The submit character timer in micro seconds |
|
220 * @return None |
|
221 */ |
|
222 void SetWritingSpeed( TInt aWritingSpeed ); |
|
223 |
|
224 /** |
|
225 * Get writting speed. |
|
226 * |
|
227 * @since S60 v5.0 |
|
228 * @return The writing speed |
|
229 */ |
|
230 TTimeIntervalMicroSeconds32 WritingSpeed(); |
|
231 |
|
232 /** |
|
233 * Set trail drawing pen size. |
|
234 * |
|
235 * @since S60 v5.0 |
|
236 * @param aSize New pen size |
|
237 * @return None |
|
238 */ |
|
239 void SetBoxPenSize( const TSize& aSize ); |
|
240 |
|
241 /** |
|
242 * Get trail drawing pen size. |
|
243 * |
|
244 * @since S60 v5.0 |
|
245 * @return Pen size. |
|
246 */ |
|
247 TSize PenSize(); |
|
248 |
|
249 /** |
|
250 * Set trail drawing pen color. |
|
251 * |
|
252 * @since S60 v5.0 |
|
253 * @param aCol New pen color |
|
254 * @return None |
|
255 */ |
|
256 void SetBoxPenColor( const TRgb& aCol ); |
|
257 |
|
258 /** |
|
259 * Get trail drawing pen color. |
|
260 * |
|
261 * @since S60 v5.0 |
|
262 * @return The pen color |
|
263 */ |
|
264 TRgb& PenColor(); |
|
265 |
|
266 /** |
|
267 * Set the candidate list. |
|
268 * |
|
269 * @since S60 v5.0 |
|
270 * @return None |
|
271 */ |
|
272 void SetCandidatesL(); |
|
273 |
|
274 /** |
|
275 * Set homephonic candidates. |
|
276 * |
|
277 * |
|
278 */ |
|
279 void SetHomephonicCandidatesL(); |
|
280 |
|
281 /** |
|
282 * Set the predictive list. |
|
283 * |
|
284 * @since S60 v5.0 |
|
285 * @return None |
|
286 */ |
|
287 void SetPredictives(); |
|
288 |
|
289 /** |
|
290 * Add new predictives to list |
|
291 * |
|
292 * @since S60 v5.0 |
|
293 * @return None |
|
294 */ |
|
295 void AddPredictives(); |
|
296 |
|
297 /** |
|
298 * Get the candidate. |
|
299 * |
|
300 * @since S60 v5.0 |
|
301 * @param aIndex The index of candidate |
|
302 * @param aCharCode The result candidate |
|
303 * @return Candidate char code |
|
304 */ |
|
305 const RPointerArray<HBufC>& Candidate(); |
|
306 |
|
307 /** |
|
308 * Get the predictive. |
|
309 * |
|
310 * @since S60 v5.0 |
|
311 * @param aIndex The index of predictive |
|
312 * @param aCharCode The result predictive |
|
313 * @return Predictive char code |
|
314 */ |
|
315 const RPointerArray<HBufC>& Predictive(); |
|
316 |
|
317 /** |
|
318 * Set number mode |
|
319 * |
|
320 * @since S60 v5.0 |
|
321 * @param aNumberMode Given number mode |
|
322 * @return None |
|
323 */ |
|
324 void SetNumberMode( const TAknEditorNumericKeymap aNumberMode ); |
|
325 |
|
326 /** |
|
327 * Set number mode |
|
328 * |
|
329 * @since S60 v5.0 |
|
330 * @param aCustomMode The customized number key mapping, 0-9 |
|
331 * are not included. |
|
332 * @return None |
|
333 */ |
|
334 void SetNumberModeL( const TDesC& aCustomMode ); |
|
335 |
|
336 /** |
|
337 * Load and publish default repository values |
|
338 * |
|
339 * @since S60 v5.0 |
|
340 * @return None |
|
341 */ |
|
342 void LoadAndPublishDefaultL(); |
|
343 |
|
344 /** |
|
345 * Set the screen mode. |
|
346 * |
|
347 * @since S60 v5.0 |
|
348 * @param aRange The range |
|
349 * @return None |
|
350 */ |
|
351 void SaveRange( TInt aRange ); |
|
352 |
|
353 /** |
|
354 * Callback method to notify client about change. |
|
355 * |
|
356 * @since S60 v5.0 |
|
357 * @param aPtr The callback data |
|
358 * @return None |
|
359 */ |
|
360 static TInt HandleGSRepositoryCallBack( TAny* aPtr ); |
|
361 |
|
362 /** |
|
363 * Set permitted ranges |
|
364 * |
|
365 * @since S60 v5.0 |
|
366 * @param aPermittedRanges The permitted ranges. |
|
367 * @return None |
|
368 */ |
|
369 void SetPermittedCases( TInt aPermittedCases ); |
|
370 |
|
371 /** |
|
372 * Get next predictive page |
|
373 * |
|
374 * @since S60 v5.0 |
|
375 * @return None |
|
376 */ |
|
377 void GetNextPredictivePageL(); |
|
378 |
|
379 /** |
|
380 * Judge if next predictive candidate exist |
|
381 * |
|
382 * @since S60 v5.0 |
|
383 * @return ETrue if candidate exist, otherwise EFalse; |
|
384 */ |
|
385 TBool PredictiveCandidateExisted(); |
|
386 |
|
387 /** |
|
388 * Set stroke end mark to stroke end mark control |
|
389 * |
|
390 * @since S60 v5.0 |
|
391 * @return None |
|
392 */ |
|
393 void SetStrokeEndMark(); |
|
394 |
|
395 /** |
|
396 * Get the stroke end mark. |
|
397 * |
|
398 * @since S60 v5.0 |
|
399 * @return TPoint |
|
400 */ |
|
401 TPoint StrokeEndMark(); |
|
402 |
|
403 /** |
|
404 * Get stroke end mark from control which handle it |
|
405 * |
|
406 * @since S60 v5.0 |
|
407 * @return None |
|
408 */ |
|
409 TPoint StrokeEndMarkFromControl(); |
|
410 |
|
411 /** |
|
412 * Judge if current permitted range is only number range |
|
413 * |
|
414 * @since S60 v5.0 |
|
415 * @return ETrue f current permitted range is only number range |
|
416 */ |
|
417 TBool IsNumberOnly(); |
|
418 |
|
419 /** |
|
420 * Judge if a language is TW language or PRC language |
|
421 * |
|
422 * @since S60 v5.0 |
|
423 * @return ETrue if aLanguage is TW or PRC, otherwise EFalse |
|
424 */ |
|
425 TBool IsHomephonicLanguage(); |
|
426 |
|
427 /** |
|
428 * Get number keymapping string |
|
429 * |
|
430 * @since S60 v5.0 |
|
431 * @param aKeyMappingId Keymapping id |
|
432 * @return Pointer to keymapping string |
|
433 */ |
|
434 HBufC* KeyMappingStringL() const; |
|
435 |
|
436 /** |
|
437 * Check if the char is the special display char |
|
438 * |
|
439 * @since S60 v5.0 |
|
440 * @param aChar The checked char |
|
441 * @return TBool Wheater or not the input char is the special display char |
|
442 */ |
|
443 TBool IsSpecialDisplayChars( const TDesC& aChar ); |
|
444 |
|
445 /** |
|
446 * Check if the char is need to be sent to app directly which not need to be shown in candidate window. |
|
447 * |
|
448 * @since S60 v5.0 |
|
449 * @param aChar The checked char |
|
450 * @return TBool Wheater or not the input char is the directly sent char |
|
451 */ |
|
452 TBool IsDirectlySentCandidate( const TDesC& aChar ); |
|
453 |
|
454 /** |
|
455 * Convert the special display char to the keycode. |
|
456 * |
|
457 * @since S60 v5.0 |
|
458 * @param aChar The special display char. |
|
459 * @return HBufC* The converted keycode char. |
|
460 */ |
|
461 HBufC* ConvertDisplayChars( const TDesC& aChar ); |
|
462 |
|
463 /** |
|
464 * Get language show text |
|
465 * |
|
466 * @since S60 v5.0 |
|
467 * @return TDesC* language show text. |
|
468 */ |
|
469 const TDesC& LanguageShowText(); |
|
470 |
|
471 /** |
|
472 * Get pen trail color |
|
473 * |
|
474 * @since S60 v5.0 |
|
475 * @return TDesC* language show text. |
|
476 */ |
|
477 TInt GetPenTrailColor(); |
|
478 TInt SetInputAreaSize(TSize& aSize); |
|
479 TInt SetScreenSize(TSize& aSize); |
|
480 private: |
|
481 |
|
482 /** |
|
483 * C++ constructor |
|
484 * |
|
485 * @since S60 v5.0 |
|
486 * @return None |
|
487 */ |
|
488 CPeninputHwrfscnDataStore(); |
|
489 |
|
490 /** |
|
491 * Second phase constructor |
|
492 * |
|
493 * @since S60 v5.0 |
|
494 * @return None |
|
495 */ |
|
496 void ConstructL( CPtiEngine* aPtiEngine ); |
|
497 |
|
498 /** |
|
499 * Initialize the key mapping list |
|
500 * |
|
501 * @since S60 v5.0 |
|
502 * @return None |
|
503 */ |
|
504 void InitKeyMappingListL(); |
|
505 |
|
506 /** |
|
507 * Notify subscriber |
|
508 * |
|
509 * @since S60 v5.0 |
|
510 * @param aPropertyName The property name |
|
511 * @param aValue The new value |
|
512 * @return None |
|
513 */ |
|
514 void NotifySubscriber( MPeninputHwrfscnPropertySubscriber:: |
|
515 TPeninputHwrfscnProperty aPropertyName ); |
|
516 |
|
517 /** |
|
518 * Get new value from cenrep of aId. |
|
519 * |
|
520 * @since S60 v5.0 |
|
521 * @param aWatcher The watcher to read |
|
522 * @param aId The Uid |
|
523 * @return None |
|
524 */ |
|
525 TInt GetNewValue( CAknFepRepositoryWatcher* aWatcher, TInt aId ); |
|
526 |
|
527 /** |
|
528 * Judge if a language is Chinese |
|
529 * |
|
530 * @since S60 v5.0 |
|
531 * @param aLanguage Given language code |
|
532 * @return ETrue if aLanguage is Chinese, otherwise EFalse |
|
533 */ |
|
534 TBool LanguageIsChinese( TInt aLanguage ); |
|
535 |
|
536 /** |
|
537 * Set engine language |
|
538 * |
|
539 * @since S60 v5.0 |
|
540 * @param aLanguage Given language code |
|
541 * @return None |
|
542 */ |
|
543 void SetEngineLanguageL( TInt aLanguage ); |
|
544 |
|
545 /** |
|
546 * Set language show text |
|
547 * |
|
548 * @since S60 v5.0 |
|
549 * @param aLanguage language code |
|
550 * @return None |
|
551 */ |
|
552 void SetLanguageShowText( TInt aLanguage ); |
|
553 |
|
554 /** |
|
555 * Get predictives when the primary range is chinese |
|
556 * |
|
557 * @since S60 v5.0 |
|
558 * |
|
559 */ |
|
560 void GetPredictivesOfPriRangeAsChineseL(); |
|
561 |
|
562 /** |
|
563 * Get predictives when the primary range is number |
|
564 * |
|
565 * @since S60 v5.0 |
|
566 * |
|
567 */ |
|
568 void GetPredictivesOfPriRangeAsNumberL(); |
|
569 |
|
570 /** |
|
571 * Get predictives when the primary range is english |
|
572 * |
|
573 * @since S60 v5.0 |
|
574 */ |
|
575 void GetPredictivesOfPriRangeAsEnglishL(); |
|
576 |
|
577 private:// data |
|
578 |
|
579 /** |
|
580 * Subscriber List |
|
581 */ |
|
582 RPointerArray<MPeninputHwrfscnPropertySubscriber> iSubscriberList; |
|
583 |
|
584 /** |
|
585 * Trigger string (Own) |
|
586 */ |
|
587 CAknFepHwrTriggerStr* iTriggerStr; |
|
588 |
|
589 /** |
|
590 * predictive list |
|
591 */ |
|
592 RPointerArray<HBufC> iPredictives; |
|
593 |
|
594 /** |
|
595 * candidate list |
|
596 */ |
|
597 RPointerArray<HBufC> iCandidates; |
|
598 |
|
599 /** |
|
600 * The candidate range start index |
|
601 */ |
|
602 RArray<TInt> iRangeStartPos; |
|
603 |
|
604 /** |
|
605 * Permitted ranges |
|
606 */ |
|
607 RArray<TInt> iPermittedRanges; |
|
608 |
|
609 /** |
|
610 * Permitted range in int format |
|
611 */ |
|
612 TInt iIntRange; |
|
613 |
|
614 /** |
|
615 * Current case |
|
616 */ |
|
617 TInt iCase; |
|
618 |
|
619 /** |
|
620 * Current language |
|
621 */ |
|
622 TInt iLanguage; |
|
623 |
|
624 /** |
|
625 * Writing speed |
|
626 */ |
|
627 TInt iWritingSpeed; |
|
628 |
|
629 /** |
|
630 * Pen size |
|
631 */ |
|
632 TSize iPenSize; |
|
633 |
|
634 /** |
|
635 * Pen color |
|
636 */ |
|
637 TRgb iPenColor; |
|
638 |
|
639 /** |
|
640 * The repository (Own); |
|
641 */ |
|
642 CRepository* iRepositoryFep; |
|
643 |
|
644 /** |
|
645 * The repository (Own); |
|
646 */ |
|
647 CRepository* iRepositorySetting; |
|
648 |
|
649 /** |
|
650 * The engine (Own); |
|
651 */ |
|
652 CAknFepHwrEngine* iHwrEngine; |
|
653 |
|
654 /** |
|
655 * The repository watcher(Own); |
|
656 */ |
|
657 CAknFepRepositoryWatcher* iGSRepositoryWatcher; |
|
658 |
|
659 /** |
|
660 * The permited cases |
|
661 */ |
|
662 TInt iPermittedCases; |
|
663 |
|
664 /** |
|
665 * The storke control |
|
666 */ |
|
667 MPeninputHwrfscnPropertySubscriber* iStrokeControl; |
|
668 |
|
669 /** |
|
670 * The current number key map |
|
671 */ |
|
672 TAknEditorNumericKeymap iCurrentNumberMode; |
|
673 |
|
674 /** |
|
675 * Keymapping id array |
|
676 */ |
|
677 RArray<TInt> iKeyMappingIdList; |
|
678 |
|
679 /** |
|
680 * Keymapping string array |
|
681 */ |
|
682 RPointerArray<HBufC> iKeyMappingStringList; |
|
683 |
|
684 /** |
|
685 * Language show text |
|
686 */ |
|
687 TBuf<KLanguageStringLength> iLanguageShowText; |
|
688 |
|
689 /** |
|
690 * User defined key mapping (Own) |
|
691 */ |
|
692 HBufC* iUserDefinedResource; |
|
693 }; |
|
694 |
|
695 |
|
696 #endif //__PENINPUTHWRFSCNDATASTORE_H__ |