|
1 /* |
|
2 * Copyright (c) 2005-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: Implementation for arabic peninput finger hwr |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_PENINPUTFINGERHWRARDATASTORE_H |
|
20 #define C_PENINPUTFINGERHWRARDATASTORE_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 |
|
34 //USER INCLUDES |
|
35 #include "peninputfingerhwrarstoreconstants.h" |
|
36 #include "peninputfingerhwrar.hrh" |
|
37 //CONSTANTS |
|
38 const TInt KLanguageStringLength = 10; |
|
39 |
|
40 //FOWWARD CLASS |
|
41 class CPeninputFingerHwrArLayout; |
|
42 class CRepository; |
|
43 class CPeninputFingerHwrArEngine; |
|
44 class CPtiEngine; |
|
45 |
|
46 |
|
47 /** |
|
48 * CPeninputFingerHwrArDataStore |
|
49 * |
|
50 * @lib peninputfingerhwr.lib |
|
51 * @since S60 v5.0 |
|
52 */ |
|
53 class CPeninputFingerHwrArDataStore : public CBase |
|
54 { |
|
55 public: |
|
56 /** |
|
57 * Symbian constructor. |
|
58 * |
|
59 * @since S60 v5.0 |
|
60 * @param aPtiEngine The PtiEngine |
|
61 * @param aLayout The Finger HWR layout |
|
62 * @return Pointer to created CPeninputFingerHwrArDataStore object |
|
63 */ |
|
64 static CPeninputFingerHwrArDataStore* NewL( CPtiEngine* aPtiEngine, |
|
65 CPeninputFingerHwrArLayout* aLayout ); |
|
66 |
|
67 /** |
|
68 * destructor |
|
69 * |
|
70 * @since S60 v5.0 |
|
71 * @return None |
|
72 */ |
|
73 virtual ~CPeninputFingerHwrArDataStore(); |
|
74 |
|
75 |
|
76 public: |
|
77 /** |
|
78 * Is valid candidate |
|
79 * |
|
80 * @since S60 v5.0 |
|
81 * @param aCandidateIndex The index the candidate in list. |
|
82 * @return ETrue if candidate is not empty; otherwise EFalse |
|
83 */ |
|
84 TBool IsValidCandidate( TInt aCandidateIndex ) const; |
|
85 |
|
86 |
|
87 /** |
|
88 * Is English letter |
|
89 * |
|
90 * @since S60 v5.0 |
|
91 * @param aLetter The recognize character. |
|
92 * @return ETrue if the character is English letter; otherwise EFalse |
|
93 */ |
|
94 TBool IsEnglishLetter( const TDesC& aLetter); |
|
95 |
|
96 /** |
|
97 * Do recoginize by engine |
|
98 * |
|
99 * @since S60 v5.0 |
|
100 * @param aTraceData The trace data. |
|
101 * @return None |
|
102 */ |
|
103 void DoRecognizeL( const RArray<TPoint>& aTraceData ); |
|
104 |
|
105 |
|
106 /** |
|
107 * Set Chinese symbol to writing candidate list |
|
108 * |
|
109 * @since S60 v5.0 |
|
110 * @return None |
|
111 */ |
|
112 void SetArabicSymbolL(); |
|
113 |
|
114 |
|
115 /** |
|
116 * Set fixed English symbol |
|
117 * |
|
118 * @since S60 v5.0 |
|
119 * @param aRowCount The flag to confirm which row |
|
120 * @return None |
|
121 */ |
|
122 void SetFixEnglishSymbolL(TRowCount aRowCount = ERowOne); |
|
123 |
|
124 |
|
125 |
|
126 /** |
|
127 * Set permitted ranges |
|
128 * |
|
129 * @since S60 v5.0 |
|
130 * @param aPermittedRanges The permitted ranges. |
|
131 * @return None |
|
132 */ |
|
133 void SetPermittedRanges( TInt aPermittedRanges ); |
|
134 |
|
135 /** |
|
136 * Set permitted ranges |
|
137 * |
|
138 * @since S60 v5.0 |
|
139 * @param aPermittedRanges The permitted ranges. |
|
140 * @return None |
|
141 */ |
|
142 void SetPermittedCases( TInt aPermittedCases ); |
|
143 |
|
144 |
|
145 /** |
|
146 * Set Primary range |
|
147 * |
|
148 * @since S60 v5.0 |
|
149 * @param aPrimaryRange The Primary range |
|
150 * @return None |
|
151 */ |
|
152 void SetPrimaryRange( TInt aPrimaryRange ); |
|
153 |
|
154 /** |
|
155 * Get Primary range |
|
156 * |
|
157 * @since S60 v5.0 |
|
158 * @return Primary range. |
|
159 */ |
|
160 TInt PrimaryRange(); |
|
161 |
|
162 /** |
|
163 * Get current range |
|
164 * |
|
165 * @since S60 v5.0 |
|
166 * @return Current range. |
|
167 */ |
|
168 TFingerHwrRange CurrentRange(); |
|
169 |
|
170 |
|
171 /** |
|
172 * Set case |
|
173 * |
|
174 * @since S60 v5.0 |
|
175 * @param aCase The case |
|
176 * @return None |
|
177 */ |
|
178 void SetCase( TInt aCase ); |
|
179 |
|
180 /** |
|
181 * Set language |
|
182 * |
|
183 * @since S60 v5.0 |
|
184 * @param aLanguage The language |
|
185 * @return None |
|
186 */ |
|
187 void SetLanguageL( TInt aLanguage ); |
|
188 |
|
189 |
|
190 /** |
|
191 * Set auto complete candidate list. |
|
192 * |
|
193 * @since S60 v5.0 |
|
194 * @param aIsFirstStroke The first stroke flag |
|
195 * @return None |
|
196 */ |
|
197 void SetFirstStroke( const TBool aIsFirstStroke); |
|
198 |
|
199 /** |
|
200 * Set auto complete candidate list. |
|
201 * |
|
202 * @since S60 v5.0 |
|
203 * @return ETrue if it's the first stroke |
|
204 */ |
|
205 TBool FirstStroke(); |
|
206 |
|
207 |
|
208 /** |
|
209 * Get the candidate. |
|
210 * |
|
211 * @since S60 v5.0 |
|
212 * @param aIndex The index of candidate |
|
213 * @param aCharCode The result candidate |
|
214 * @return Candidate char code |
|
215 */ |
|
216 const RPointerArray<HBufC>& Candidate() const; |
|
217 |
|
218 |
|
219 /** |
|
220 * Set number mode |
|
221 * |
|
222 * @since S60 v5.0 |
|
223 * @param aNumberMode Given number mode |
|
224 * @return None |
|
225 */ |
|
226 void SetNumberMode( const TAknEditorNumericKeymap aNumberMode ); |
|
227 |
|
228 /** |
|
229 * Set number mode |
|
230 * |
|
231 * @since S60 v5.0 |
|
232 * @param aCustomMode The customized number key mapping, 0-9 |
|
233 * are not included. |
|
234 * @return None |
|
235 */ |
|
236 void SetCustomNumberModeL( const TDesC& aCustomMode ); |
|
237 |
|
238 /** |
|
239 * Set the screen mode. |
|
240 * |
|
241 * @since S60 v5.0 |
|
242 * @param aRange The range |
|
243 * @return None |
|
244 */ |
|
245 void SaveRange( TInt aRange ); |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 /** |
|
251 * Set stroke end mark to stroke end mark control |
|
252 * |
|
253 * @since S60 v5.0 |
|
254 * @return None |
|
255 */ |
|
256 void SetStrokeEndMark(); |
|
257 |
|
258 /** |
|
259 * Get the stroke end mark. |
|
260 * |
|
261 * @since S60 v5.0 |
|
262 * @return TPoint |
|
263 */ |
|
264 TPoint StrokeEndMark(); |
|
265 |
|
266 /** |
|
267 * Get stroke end mark from control which handle it |
|
268 * |
|
269 * @since S60 v5.0 |
|
270 * @return None |
|
271 */ |
|
272 TPoint StrokeEndMarkFromControl(); |
|
273 |
|
274 /** |
|
275 * Get number keymapping string |
|
276 * |
|
277 * @since S60 v5.0 |
|
278 * @param aKeyMappingId Keymapping id |
|
279 * @return Pointer to keymapping string |
|
280 */ |
|
281 HBufC* KeyMappingStringL() const; |
|
282 |
|
283 /** |
|
284 * Check if the char is the special display char |
|
285 * |
|
286 * @since S60 v5.0 |
|
287 * @param aChar The checked char |
|
288 * @return TBool Wheater or not the input char is the special display char |
|
289 */ |
|
290 TBool IsSpecialDisplayChars( const TDesC& aChar ) const; |
|
291 |
|
292 /** |
|
293 * Check if the char is need to be sent to app directly which not need to be shown in candidate window. |
|
294 * |
|
295 * @since S60 v5.0 |
|
296 * @param aChar The checked char |
|
297 * @return TBool Wheater or not the input char is the directly sent char |
|
298 */ |
|
299 TBool IsDirectlySentCandidate( const TDesC& aChar ) const; |
|
300 |
|
301 /** |
|
302 * Convert the special display char to the keycode. |
|
303 * |
|
304 * @since S60 v5.0 |
|
305 * @param aChar The special display char. |
|
306 * @return HBufC* The converted keycode char. |
|
307 */ |
|
308 HBufC* ConvertDisplayChars( const TDesC& aChar ) const; |
|
309 |
|
310 /** |
|
311 * Get start writing char flag |
|
312 * |
|
313 * @since S60 v5.0 |
|
314 * @return ETrue If begine writing. |
|
315 */ |
|
316 TBool StartCharacter(); |
|
317 |
|
318 /** |
|
319 * Set start writing char flag |
|
320 * |
|
321 * @since S60 v5.0 |
|
322 * @param aStartCharacter The start writing flag |
|
323 * @return ETrue If begine writing. |
|
324 */ |
|
325 void SetStartCharacter(const TBool aStartCharacter); |
|
326 |
|
327 /** |
|
328 * Set input area size to engine for recognize |
|
329 * |
|
330 * @since S60 v5.0 |
|
331 * @param aStartCharacter The start writing flag |
|
332 * @return ETrue If begine writing. |
|
333 */ |
|
334 TInt SetInputAreaSize(TSize& aSize); |
|
335 |
|
336 /** |
|
337 * Set screen size to engine for recognize |
|
338 * |
|
339 * @since S60 v5.0 |
|
340 * @param aStartCharacter The start writing flag |
|
341 * @return ETrue If begine writing. |
|
342 */ |
|
343 TInt SetScreenSize(TSize& aSize); |
|
344 |
|
345 |
|
346 /** |
|
347 * Set high light flag for candidate list |
|
348 * |
|
349 * @since S60 v5.0 |
|
350 * @param aIsHighlight The flag to decide highlight default cell or not |
|
351 * @return None |
|
352 */ |
|
353 void SetHighlight(const TBool aIsHighlight); |
|
354 |
|
355 /** |
|
356 * Get high light flag for candidate list |
|
357 * |
|
358 * @since S60 v5.0 |
|
359 * @return ETrue If highlight the default cell to candidate list |
|
360 */ |
|
361 TBool Highlight(); |
|
362 |
|
363 /** |
|
364 * Remove duplicate candidate from predictive candidate list |
|
365 * |
|
366 * @since S60 v5.0 |
|
367 * @param aSrc The punctuation candidate list |
|
368 * @param aTgt The predicative candidate list |
|
369 * @param aSrcStartIdx |
|
370 * @param aTgtStartIdx |
|
371 * @return last overlap index |
|
372 */ |
|
373 TInt RemoveDuplicateCand(const RPointerArray<HBufC>& aSrc, |
|
374 RPointerArray<HBufC>& aTgt, |
|
375 TInt aSrcStartIdx, |
|
376 TInt aTgtStartIdx); |
|
377 |
|
378 /** |
|
379 * Reset key board type |
|
380 * |
|
381 * @since S60 v5.0 |
|
382 */ |
|
383 void ResetKeyboardType(); |
|
384 |
|
385 /** |
|
386 * Set key board type to qwerty |
|
387 * |
|
388 * @since S60 v5.0 |
|
389 */ |
|
390 void SetKeyboardToQwerty(); |
|
391 |
|
392 /** |
|
393 * Get key board type |
|
394 * |
|
395 * @since S60 v5.0 |
|
396 */ |
|
397 void GetKeyboardType(); |
|
398 |
|
399 /** |
|
400 * Get top guide line from hwr engine |
|
401 * |
|
402 * @since S60 v5.0 |
|
403 */ |
|
404 void GetTopGuideLinePos(TInt& aPos); |
|
405 |
|
406 /** |
|
407 * Get bottom guide line from hwr engine |
|
408 * |
|
409 * @since S60 v5.0 |
|
410 */ |
|
411 void GetBottomGuideLinePos(TInt& aPos); |
|
412 |
|
413 /** |
|
414 * Set first candidate type according to editor's text in cursor. |
|
415 * @since s60 v5.2 |
|
416 */ |
|
417 void SetFirstCandidateType(TFirstCandidateType aFirstCandType); |
|
418 |
|
419 /** |
|
420 * Check if the passed char is latin number |
|
421 * |
|
422 * @since s60 v5.2 |
|
423 * @param aChar The passed unicode |
|
424 * @return ETrue if it is, EFalse otherwise |
|
425 */ |
|
426 TBool IsLatinNumber(TUint16 aChar); |
|
427 |
|
428 /** |
|
429 * Check if the passed char is latin char |
|
430 * |
|
431 * @since s60 v5.2 |
|
432 * @param aChar The passed unicode |
|
433 * @return ETrue if it is, EFalse otherwise |
|
434 */ |
|
435 TBool IsLatinChar(TUint16 aChar); |
|
436 |
|
437 /** |
|
438 * Check if the passed char is arabic number |
|
439 * |
|
440 * @since s60 v5.2 |
|
441 * @param aChar The passed unicode |
|
442 * @return ETrue if it is, EFalse otherwise |
|
443 */ |
|
444 TBool IsArabicNumber(TUint16 aChar); |
|
445 |
|
446 /** |
|
447 * Check if the passed char is arabic character |
|
448 * |
|
449 * @since s60 v5.2 |
|
450 * @param aChar The passed unicode |
|
451 * @return ETrue if it is, EFalse otherwise |
|
452 */ |
|
453 TBool IsArabicChar(TUint16 aChar); |
|
454 |
|
455 /** |
|
456 * Check if the passed char is arabic symbols |
|
457 * |
|
458 * @since s60 v5.2 |
|
459 * @param aChar The passed unicode |
|
460 * @return ETrue if it is, EFalse otherwise |
|
461 */ |
|
462 TBool IsArabicSymbol(TUint16 aChar); |
|
463 |
|
464 private: |
|
465 |
|
466 /** |
|
467 * C++ constructor |
|
468 * |
|
469 * @since S60 v5.0 |
|
470 * @return None |
|
471 */ |
|
472 CPeninputFingerHwrArDataStore(CPeninputFingerHwrArLayout* aLayout); |
|
473 |
|
474 /** |
|
475 * Second phase constructor |
|
476 * |
|
477 * @since S60 v5.0 |
|
478 * @return None |
|
479 */ |
|
480 void ConstructL( CPtiEngine* aPtiEngine ); |
|
481 |
|
482 /** |
|
483 * Initialize the key mapping list |
|
484 * |
|
485 * @since S60 v5.0 |
|
486 * @return None |
|
487 */ |
|
488 void InitKeyMappingListL(); |
|
489 |
|
490 |
|
491 /** |
|
492 * Judge if a language is Arabic |
|
493 * |
|
494 * @since S60 v5.0 |
|
495 * @param aLanguage Given language code |
|
496 * @return ETrue if aLanguage is Chinese, otherwise EFalse |
|
497 */ |
|
498 TBool IsArabicLanguage( TInt aLanguage ); |
|
499 |
|
500 /** |
|
501 * Set engine language |
|
502 * |
|
503 * @since S60 v5.0 |
|
504 * @param aLanguage Given language code |
|
505 * @return None |
|
506 */ |
|
507 void SetEngineLanguageL( TInt aLanguage ); |
|
508 |
|
509 /** |
|
510 * Set language show text |
|
511 * |
|
512 * @since S60 v5.0 |
|
513 * @param aLanguage language code |
|
514 * @return None |
|
515 */ |
|
516 void SetLanguageShowText( TInt aLanguage ); |
|
517 |
|
518 /** |
|
519 * Reorder candidate list according to pre character type in editor. |
|
520 * @since s60 v5.2 |
|
521 * @param None. |
|
522 * @return None. |
|
523 */ |
|
524 void ReorderCandidates(); |
|
525 |
|
526 private:// data |
|
527 |
|
528 |
|
529 /** |
|
530 * candidate list (Own) |
|
531 */ |
|
532 RPointerArray<HBufC> iCandidates; |
|
533 |
|
534 /** |
|
535 * The candidate range start index |
|
536 */ |
|
537 RArray<TInt> iRangeStartPos; |
|
538 |
|
539 /** |
|
540 * Permitted ranges |
|
541 */ |
|
542 RArray<TInt> iPermittedRanges; |
|
543 |
|
544 /** |
|
545 * Current range |
|
546 */ |
|
547 TFingerHwrRange iCurrentRange; |
|
548 |
|
549 /** |
|
550 * Permitted range in int format |
|
551 */ |
|
552 TInt iIntRange; |
|
553 |
|
554 /** |
|
555 * Current case |
|
556 */ |
|
557 TInt iCase; |
|
558 |
|
559 /** |
|
560 * Current language |
|
561 */ |
|
562 TInt iLanguage; |
|
563 |
|
564 /** |
|
565 * Pen size |
|
566 */ |
|
567 TSize iPenSize; |
|
568 |
|
569 /** |
|
570 * Pen color |
|
571 */ |
|
572 TRgb iPenColor; |
|
573 |
|
574 /** |
|
575 * The repository (Own); |
|
576 */ |
|
577 CRepository* iRepositoryFep; |
|
578 |
|
579 /** |
|
580 * The engine (Own); |
|
581 */ |
|
582 CPeninputFingerHwrArEngine* iHwrEngine; |
|
583 |
|
584 /** |
|
585 * The permited cases |
|
586 */ |
|
587 TInt iPermittedCases; |
|
588 |
|
589 /** |
|
590 * The current number key map |
|
591 */ |
|
592 TAknEditorNumericKeymap iCurrentNumberMode; |
|
593 |
|
594 /** |
|
595 * Keymapping id array |
|
596 */ |
|
597 RArray<TInt> iKeyMappingIdList; |
|
598 |
|
599 /** |
|
600 * Keymapping string array |
|
601 */ |
|
602 RPointerArray<HBufC> iKeyMappingStringList; |
|
603 |
|
604 /** |
|
605 * Language show text |
|
606 */ |
|
607 TBuf<KLanguageStringLength> iLanguageShowText; |
|
608 |
|
609 /** |
|
610 * User defined key mapping (Own) |
|
611 */ |
|
612 HBufC* iUserDefinedResource; |
|
613 |
|
614 /** |
|
615 * Finger hwr layout (not own) |
|
616 */ |
|
617 CPeninputFingerHwrArLayout* iLayout; |
|
618 |
|
619 /** |
|
620 * Start writing flag |
|
621 */ |
|
622 TBool iStartCharacter; |
|
623 |
|
624 /** |
|
625 * Highlight default writing candidate flag |
|
626 */ |
|
627 TBool iIsHighlightCell; |
|
628 |
|
629 /** |
|
630 * The first stroke flag |
|
631 */ |
|
632 TBool iIsFirstStroke; |
|
633 |
|
634 /** |
|
635 * default key mapping for normal editor(not number-only). |
|
636 * Own |
|
637 */ |
|
638 HBufC* iDefaultNumberMapping; |
|
639 |
|
640 /** |
|
641 * First candidate type. |
|
642 */ |
|
643 TFirstCandidateType iFirstCandidateType; |
|
644 }; |
|
645 |
|
646 |
|
647 #endif //C_PENINPUTFINGERHWRARDATASTORE_H |