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