|
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: HWR Engine |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_PENINPUTFINGERHWRARENGINE_H |
|
20 #define C_PENINPUTFINGERHWRARENGINE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32cmn.h> |
|
24 #include <eikon.hrh> |
|
25 #include <PtiEngine.h> |
|
26 |
|
27 class CPeninputFingerHwrArDataStore; |
|
28 |
|
29 /** |
|
30 * CPeninputFingerHwrArEngine |
|
31 * |
|
32 * @lib peninputfingerhwrar.lib |
|
33 * @since S60 v3.2 |
|
34 */ |
|
35 class CPeninputFingerHwrArEngine: public CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Symbian constructor. |
|
41 * |
|
42 * @since S60 v3.2 |
|
43 * @return Pointer to created CPeninputFingerHwrArEngine object |
|
44 */ |
|
45 static CPeninputFingerHwrArEngine* NewL( CPtiEngine* aPtiEngine, |
|
46 CPeninputFingerHwrArDataStore* aOwner ); |
|
47 |
|
48 /** |
|
49 * destructor |
|
50 * |
|
51 * @since S60 v3.2 |
|
52 * @return None |
|
53 */ |
|
54 virtual ~CPeninputFingerHwrArEngine(); |
|
55 |
|
56 /** |
|
57 * Do recoginize by engine |
|
58 * |
|
59 * @since S60 v3.2 |
|
60 * @param aTraceData The trace data. |
|
61 * @param aCandidates The candidates recognized. |
|
62 * @param aRangeStartPos The range index of candidates. |
|
63 * @return None |
|
64 */ |
|
65 void DoRecognizeL( const RArray<TPoint>& aTraceData, RPointerArray<HBufC>& aCandidates ); |
|
66 |
|
67 |
|
68 |
|
69 /** |
|
70 * Notify hwr engine to set primary range and auxiliary ranges |
|
71 * |
|
72 * @since S60 v3.2 |
|
73 * @param aPermittedRanges The permitted ranges and the first range is primary range. |
|
74 * @return None |
|
75 */ |
|
76 void SetRanges( const RArray<TInt>& aPermittedRanges ); |
|
77 |
|
78 /** |
|
79 * Notify hwr engine to set primary range and auxiliary ranges |
|
80 * |
|
81 * @since S60 v3.2 |
|
82 * @param aPermittedRanges The permitted ranges and the first range is primary range. |
|
83 * @return None |
|
84 */ |
|
85 void SetRangesL( const RArray<TInt>& aPermittedRanges ); |
|
86 |
|
87 /** |
|
88 * Set case |
|
89 * |
|
90 * @since S60 v3.2 |
|
91 * @param aCase The case |
|
92 * @return None |
|
93 */ |
|
94 void SetCase( const TInt aCase ); |
|
95 |
|
96 /** |
|
97 * Set number mode |
|
98 * |
|
99 * @since S60 v3.2 |
|
100 * @param aNumberMode Given number mode |
|
101 * @return None |
|
102 */ |
|
103 void SetNumberMode( const TAknEditorNumericKeymap& aNumberMode ); |
|
104 |
|
105 /** |
|
106 * Get stroke end mark from hwr engine |
|
107 * |
|
108 * @since S60 v3.2 |
|
109 * @return Stroke end mark |
|
110 */ |
|
111 TPoint StrokeEndMark() const ; |
|
112 |
|
113 /** |
|
114 * Set primary candidate num that hwr engine should return each time |
|
115 * |
|
116 * @since S60 v3.2 |
|
117 * @param aNum The primary candidate num to be set |
|
118 * @return KErrNone if operation successfully,otherwise system wide error codes |
|
119 */ |
|
120 TInt SetPrimaryCandidateNum( const TInt aNum ); |
|
121 |
|
122 /** |
|
123 * Set total candidate number that can be shown |
|
124 * |
|
125 * @since S60 v3.2 |
|
126 * @param aNum The total candidate number that should be shown |
|
127 * @return None |
|
128 */ |
|
129 void SetCandidatesMaxCount( const TInt aCount ); |
|
130 |
|
131 /** |
|
132 * Set language |
|
133 * |
|
134 * @since S60 v3.2 |
|
135 * @param aLanguage The language |
|
136 * @return None |
|
137 */ |
|
138 void SetLanguageL( const TInt aLanguage ); |
|
139 |
|
140 /** |
|
141 * Set custom key mapping |
|
142 * |
|
143 * @since S60 v3.2 |
|
144 * @param aKeyMap The key mapping |
|
145 * @return None |
|
146 */ |
|
147 void SetCustomKeymapL( const TDesC& aKeyMap ); |
|
148 |
|
149 /** |
|
150 * Clear custom key mapping |
|
151 * |
|
152 * @since S60 v3.2 |
|
153 * @return None |
|
154 */ |
|
155 void ResetCustomKeyMap(); |
|
156 |
|
157 /** |
|
158 * Do background construct |
|
159 * |
|
160 * @since S60 v3.2 |
|
161 * @return None |
|
162 */ |
|
163 static TBool BackgroundTaskL( TAny* aPtr ); |
|
164 |
|
165 /** |
|
166 * Set hand writing area size |
|
167 * |
|
168 * @since S60 v3.2 |
|
169 * @param aSize The area size. |
|
170 * @return None |
|
171 */ |
|
172 TInt SetInputAreaSize(TSize& aSize); |
|
173 |
|
174 /** |
|
175 * Set hand screen size |
|
176 * |
|
177 * @since S60 v3.2 |
|
178 * @param aSize The screen size. |
|
179 * @return None |
|
180 */ |
|
181 TInt SetScreenSize(TSize& aSize); |
|
182 |
|
183 void GetTopGuideLinePos(TInt& aPos); |
|
184 |
|
185 void GetBottomGuideLinePos(TInt& aPos); |
|
186 |
|
187 private: |
|
188 |
|
189 /** |
|
190 * C++ constructor |
|
191 * |
|
192 * @since S60 v3.2 |
|
193 * @return None |
|
194 */ |
|
195 CPeninputFingerHwrArEngine(); |
|
196 |
|
197 /** |
|
198 * Second phase constructor |
|
199 * |
|
200 * @since S60 v3.2 |
|
201 * @return None |
|
202 */ |
|
203 void ConstructL( CPtiEngine* aPtiEngine, CPeninputFingerHwrArDataStore* aOwner ); |
|
204 |
|
205 /** |
|
206 * Notify hwr engine to set correct range by language |
|
207 * |
|
208 * @since S60 v3.2 |
|
209 * @param aRange Current range need to be set |
|
210 * @param aRecognitionRange Recognition range need to be set for hwr engine |
|
211 * @return None |
|
212 */ |
|
213 void SetRecognitionRange( const TInt aRange, TRecognitionRange& aRecognitionRange ); |
|
214 |
|
215 /** |
|
216 * Do background construct |
|
217 * |
|
218 * @since S60 v3.2 |
|
219 * @return None |
|
220 */ |
|
221 void DoIdleConstructL(); |
|
222 |
|
223 /** |
|
224 * Convert the stroke end mark of point array to another point |
|
225 * |
|
226 * @since S60 v3.2 |
|
227 * @param aTraceData Point array |
|
228 * @param aPnt1 Stroke end mark to be replaced |
|
229 * @param aPnt2 Stroke end mark to be used |
|
230 * @return None |
|
231 */ |
|
232 void ConvertStrokeEndMark( RArray<TPoint>& aTraceData, TPoint aPnt1, TPoint aPnt2 ); |
|
233 |
|
234 |
|
235 private: //data |
|
236 |
|
237 /** |
|
238 * Engine |
|
239 * Ownership is determined by flag |
|
240 */ |
|
241 CPtiEngine* iPtiEngine; |
|
242 |
|
243 /** |
|
244 * iPtiEngine ownership flag |
|
245 */ |
|
246 TBool iOwnPtiEngine; |
|
247 |
|
248 /** |
|
249 * Hwr recognizer (Now own) |
|
250 */ |
|
251 MPtiHwrRecognizer* iRecognizer; |
|
252 |
|
253 /** |
|
254 * Total candidate number that can be shown |
|
255 */ |
|
256 TInt iTotalCandidateNum; |
|
257 |
|
258 /** |
|
259 * Current case |
|
260 */ |
|
261 TInt iCase; |
|
262 |
|
263 /** |
|
264 * Current language |
|
265 */ |
|
266 TInt iLanguage; |
|
267 |
|
268 /** |
|
269 * Range count |
|
270 */ |
|
271 TInt iRangeCount; |
|
272 |
|
273 /** |
|
274 * Premary range |
|
275 */ |
|
276 TInt iPremaryRange; |
|
277 |
|
278 /** |
|
279 * Custom key mapping |
|
280 */ |
|
281 HBufC* iCustomKeymap; |
|
282 |
|
283 /** |
|
284 * Idle (own) |
|
285 */ |
|
286 CIdle* iIdle; |
|
287 |
|
288 /** |
|
289 * Data store (Not own) |
|
290 */ |
|
291 CPeninputFingerHwrArDataStore* iOwner; |
|
292 |
|
293 /** |
|
294 * Set number mode flag |
|
295 */ |
|
296 TBool iNeedSetNumberMode; |
|
297 |
|
298 /** |
|
299 * Set case flag |
|
300 */ |
|
301 TBool iNeedSetCase; |
|
302 |
|
303 /** |
|
304 * Set range flag |
|
305 */ |
|
306 TBool iNeedSetRange; |
|
307 |
|
308 /** |
|
309 * Permitted range array |
|
310 */ |
|
311 RArray<TInt> iNeedPermittedRanges; |
|
312 |
|
313 /** |
|
314 * The number mode |
|
315 */ |
|
316 TInt iNumberMode; |
|
317 |
|
318 }; |
|
319 |
|
320 #endif //C_PENINPUTFINGERHWRARENGINE_H |
|
321 |
|
322 //End Of File |