|
1 /* |
|
2 * Copyright (c) 2002-2005 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_PENINPUTHWRENGINE_H |
|
20 #define C_PENINPUTHWRENGINE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32cmn.h> |
|
24 #include <eikon.hrh> |
|
25 #include <PtiEngine.h> |
|
26 |
|
27 class CPeninputHwrfscnDataStore; |
|
28 |
|
29 /** |
|
30 * CAknFepHwrEngine |
|
31 * |
|
32 * @lib peninputhwrfscn.lib |
|
33 * @since S60 v3.2 |
|
34 */ |
|
35 class CAknFepHwrEngine: public CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Symbian constructor. |
|
41 * |
|
42 * @since S60 v3.2 |
|
43 * @return Pointer to created CAknFepHwrEngine object |
|
44 */ |
|
45 static CAknFepHwrEngine* NewL( CPtiEngine* aPtiEngine, |
|
46 CPeninputHwrfscnDataStore* aOwner ); |
|
47 |
|
48 /** |
|
49 * destructor |
|
50 * |
|
51 * @since S60 v3.2 |
|
52 * @return None |
|
53 */ |
|
54 virtual ~CAknFepHwrEngine(); |
|
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 * Do predictive using trigger string |
|
69 * |
|
70 * @since S60 v3.2 |
|
71 * @param aTriggerStr The trigger string to do predictive. |
|
72 * @param aPredictives The candidates predictived. |
|
73 * @param aNextPage Whether it is to get next page |
|
74 * @return None |
|
75 */ |
|
76 void DoPredictiveL( const TDesC& aTriggerStr, |
|
77 RPointerArray<HBufC>& aPredictives, |
|
78 TBool aNextPage = EFalse ); |
|
79 |
|
80 |
|
81 /** |
|
82 * Do homophonic using trigger string |
|
83 * |
|
84 * @since S60 v3.2 |
|
85 * @param aTriggerStr The trigger string to do homophonic. |
|
86 * @param aHomophonic The homophonic candidates. |
|
87 * @return None |
|
88 */ |
|
89 void DoHomophonicL( const TDesC& aTriggerStr, |
|
90 RPointerArray<HBufC>& aHomophonic ); |
|
91 |
|
92 |
|
93 /** |
|
94 * Notify hwr engine to set primary range and auxiliary ranges |
|
95 * |
|
96 * @since S60 v3.2 |
|
97 * @param aPermittedRanges The permitted ranges and the first range is primary range. |
|
98 * @return None |
|
99 */ |
|
100 void SetRanges( const RArray<TInt>& aPermittedRanges ); |
|
101 |
|
102 /** |
|
103 * Set case |
|
104 * |
|
105 * @since S60 v3.2 |
|
106 * @param aCase The case |
|
107 * @return None |
|
108 */ |
|
109 void SetCase( TInt aCase ); |
|
110 |
|
111 /** |
|
112 * Set number mode |
|
113 * |
|
114 * @since S60 v3.2 |
|
115 * @param aNumberMode Given number mode |
|
116 * @return None |
|
117 */ |
|
118 void SetNumberMode( const TAknEditorNumericKeymap& aNumberMode ); |
|
119 |
|
120 /** |
|
121 * Get stroke end mark from hwr engine |
|
122 * |
|
123 * @since S60 v3.2 |
|
124 * @return Stroke end mark |
|
125 */ |
|
126 TPoint StrokeEndMark() const ; |
|
127 |
|
128 /** |
|
129 * Set primary candidate num that hwr engine should return each time |
|
130 * |
|
131 * @since S60 v3.2 |
|
132 * @param aNum The primary candidate num to be set |
|
133 * @return KErrNone if operation successfully,otherwise system wide error codes |
|
134 */ |
|
135 TInt SetPrimaryCandidateNum( TInt aNum ); |
|
136 |
|
137 /** |
|
138 * Set total candidate number that can be shown |
|
139 * |
|
140 * @since S60 v3.2 |
|
141 * @param aNum The total candidate number that should be shown |
|
142 * @return KErrNone if operation successfully,otherwise system wide error codes |
|
143 */ |
|
144 TInt SetCandidatesMaxCount( TInt aCount ); |
|
145 |
|
146 /** |
|
147 * Set aux candidate number that can be shown |
|
148 * |
|
149 * @since S60 v3.2 |
|
150 * @param aNum The aux candidate number that should be shown |
|
151 * @return KErrNone if operation successfully,otherwise system wide error codes |
|
152 */ |
|
153 TInt SetAuxCandidateNum( TInt aNum ); |
|
154 |
|
155 /** |
|
156 * Get aux candidate number that can be shown |
|
157 * |
|
158 * @since S60 v3.2 |
|
159 * @return aux candidate number if operation successfully,otherwise system wide error codes |
|
160 */ |
|
161 TInt GetAuxCandidateNum(); |
|
162 |
|
163 /** |
|
164 * Set language |
|
165 * |
|
166 * @since S60 v3.2 |
|
167 * @param aLanguage The language |
|
168 * @return None |
|
169 */ |
|
170 void SetLanguageL( TInt aLanguage ); |
|
171 |
|
172 /** |
|
173 * Set custom key mapping |
|
174 * |
|
175 * @since S60 v3.2 |
|
176 * @param aKeyMap The key mapping |
|
177 * @return None |
|
178 */ |
|
179 void SetCustomKeymapL( const TDesC& aKeyMap ); |
|
180 |
|
181 /** |
|
182 * Clear custom key mapping |
|
183 * |
|
184 * @since S60 v3.2 |
|
185 * @return None |
|
186 */ |
|
187 void ResetCustomKeyMap(); |
|
188 |
|
189 /** |
|
190 * Do background construct |
|
191 * |
|
192 * @since S60 v3.2 |
|
193 * @return None |
|
194 */ |
|
195 static TBool BackgroundTaskL( TAny* aPtr ); |
|
196 TInt SetInputAreaSize(TSize& aSize); |
|
197 TInt SetScreenSize(TSize& aSize); |
|
198 private: |
|
199 |
|
200 /** |
|
201 * C++ constructor |
|
202 * |
|
203 * @since S60 v3.2 |
|
204 * @return None |
|
205 */ |
|
206 CAknFepHwrEngine(); |
|
207 |
|
208 /** |
|
209 * Second phase constructor |
|
210 * |
|
211 * @since S60 v3.2 |
|
212 * @return None |
|
213 */ |
|
214 void ConstructL( CPtiEngine* aPtiEngine, CPeninputHwrfscnDataStore* aOwner ); |
|
215 |
|
216 /** |
|
217 * Notify hwr engine to set correct range by language |
|
218 * |
|
219 * @since S60 v3.2 |
|
220 * @param aRange Current range need to be set |
|
221 * @param aRecognitionRange Recognition range need to be set for hwr engine |
|
222 * @return None |
|
223 */ |
|
224 void SetRecognitionRange( const TInt aRange, TRecognitionRange& aRecognitionRange ); |
|
225 |
|
226 /** |
|
227 * Do background construct |
|
228 * |
|
229 * @since S60 v3.2 |
|
230 * @return None |
|
231 */ |
|
232 void DoIdleConstructL(); |
|
233 |
|
234 /** |
|
235 * Convert the stroke end mark of point array to another point |
|
236 * |
|
237 * @since S60 v3.2 |
|
238 * @param aTraceData Point array |
|
239 * @param aPnt1 Stroke end mark to be replaced |
|
240 * @param aPnt2 Stroke end mark to be used |
|
241 * @return None |
|
242 */ |
|
243 void ConvertStrokeEndMark( RArray<TPoint>& aTraceData, TPoint aPnt1, TPoint aPnt2 ); |
|
244 |
|
245 /** |
|
246 * Get homophonic or polyphonic candidates |
|
247 * |
|
248 * @since S60 v3.2 |
|
249 * @param aSpelling The spelling of the selected character |
|
250 * @param aHomophonic The homophonic or polyphonic candidates |
|
251 * @return None |
|
252 */ |
|
253 void GetHomophonicAndPolyphonic( TDes& aSpelling, RPointerArray<HBufC>& aHomophonic ); |
|
254 |
|
255 /** |
|
256 * Reorder secondary range in writing candidates |
|
257 * |
|
258 * @since S60 v3.2 |
|
259 * @param aCandidates The writing candidates |
|
260 * @return None |
|
261 */ |
|
262 void ReorderSecondaryRange( RPointerArray<HBufC>& aCandidates ); |
|
263 |
|
264 /** |
|
265 * Do recongition when the ragnge is only number |
|
266 * |
|
267 * @since S60 v5.0 |
|
268 * @param aTraceData The trace data. |
|
269 * @param aCandidates The candidates recognized. |
|
270 * @return None |
|
271 */ |
|
272 void DoRecognizeOfNumberOnly( const RArray<TPoint>& aTraceData, |
|
273 RPointerArray<HBufC>& aCandidates ); |
|
274 |
|
275 private: //data |
|
276 |
|
277 /** |
|
278 * Engine |
|
279 * Ownership is determined by flag |
|
280 */ |
|
281 CPtiEngine* iPtiEngine; |
|
282 |
|
283 /** |
|
284 * iPtiEngine ownership flag |
|
285 */ |
|
286 TBool iOwnPtiEngine; |
|
287 |
|
288 /** |
|
289 * Hwr recognizer (Now own) |
|
290 */ |
|
291 MPtiHwrRecognizer* iRecognizer; |
|
292 |
|
293 /** |
|
294 * Total candidate number that can be shown |
|
295 */ |
|
296 TInt iTotalCandidateNum; |
|
297 |
|
298 /** |
|
299 * Current case |
|
300 */ |
|
301 TInt iCase; |
|
302 |
|
303 /** |
|
304 * Current language |
|
305 */ |
|
306 TInt iLanguage; |
|
307 |
|
308 /** |
|
309 * Range count |
|
310 */ |
|
311 TInt iRangeCount; |
|
312 |
|
313 /** |
|
314 * Premary range |
|
315 */ |
|
316 TInt iPremaryRange; |
|
317 |
|
318 /** |
|
319 * Custom key mapping |
|
320 */ |
|
321 HBufC* iCustomKeymap; |
|
322 |
|
323 /** |
|
324 * Idle (own) |
|
325 */ |
|
326 CIdle* iIdle; |
|
327 |
|
328 /** |
|
329 * Data store (Not own) |
|
330 */ |
|
331 CPeninputHwrfscnDataStore* iOwner; |
|
332 |
|
333 /** |
|
334 * Set number mode flag |
|
335 */ |
|
336 TBool iNeedSetNumberMode; |
|
337 |
|
338 /** |
|
339 * Set case flag |
|
340 */ |
|
341 TBool iNeedSetCase; |
|
342 |
|
343 /** |
|
344 * Set range flag |
|
345 */ |
|
346 TBool iNeedSetRange; |
|
347 |
|
348 /** |
|
349 * Permitted range array |
|
350 */ |
|
351 RArray<TInt> iNeedPermittedRanges; |
|
352 |
|
353 /** |
|
354 * The number mode |
|
355 */ |
|
356 TInt iNumberMode; |
|
357 }; |
|
358 |
|
359 #endif //C_PENINPUTHWRENGINE_H |
|
360 |
|
361 //End Of File |