|
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_CAKNFEPHWRENGINE_H |
|
20 #define C_CAKNFEPHWRENGINE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32cmn.h> |
|
24 #include <eikon.hrh> |
|
25 #include <PtiEngine.h> |
|
26 |
|
27 class CAknFepHwrBxDataStore; |
|
28 |
|
29 /** |
|
30 * CAknFepHwrEngine |
|
31 * |
|
32 * @lib peninputhwrboxcn.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, CAknFepHwrBxDataStore* aOwner); |
|
46 |
|
47 /** |
|
48 * destructor |
|
49 * |
|
50 * @since S60 v3.2 |
|
51 * @return None |
|
52 */ |
|
53 virtual ~CAknFepHwrEngine(); |
|
54 |
|
55 /** |
|
56 * Do recoginize by engine |
|
57 * |
|
58 * @since S60 v3.2 |
|
59 * @param aTraceData The trace data. |
|
60 * @param aCandidates The candidates recognized. |
|
61 * @param aRangeStartPos The range index of candidates. |
|
62 * @return None |
|
63 */ |
|
64 void DoRecognizeL(const RArray<TPoint>& aTraceData, RPointerArray<HBufC>& aCandidates); |
|
65 |
|
66 /** |
|
67 * Do predictive using trigger string |
|
68 * |
|
69 * @since S60 v3.2 |
|
70 * @param aTriggerStr The trigger string to do predictive. |
|
71 * @param aPredictives The candidates predictived. |
|
72 * @param aNextPage Whether it is to get next page |
|
73 * @return None |
|
74 */ |
|
75 void DoPredictiveL(const TDesC& aTriggerStr, |
|
76 RPointerArray<HBufC>& aPredictives, |
|
77 TBool aNextPage = EFalse); |
|
78 |
|
79 /** |
|
80 * Notify hwr engine to set primary range and auxiliary ranges |
|
81 * |
|
82 * @since S60 v3.2 |
|
83 * @param aPermittedRanges The permitted ranges and the first range is primary range. |
|
84 * @return None |
|
85 */ |
|
86 void SetRanges(const RArray<TInt>& aPermittedRanges); |
|
87 |
|
88 /** |
|
89 * Set case |
|
90 * |
|
91 * @since S60 v3.2 |
|
92 * @param aCase The case |
|
93 * @return None |
|
94 */ |
|
95 void SetCase(TInt aCase); |
|
96 |
|
97 /** |
|
98 * Set number mode |
|
99 * |
|
100 * @since S60 v3.2 |
|
101 * @param aNumberMode Given number mode |
|
102 * @return None |
|
103 */ |
|
104 void SetNumberMode(const TAknEditorNumericKeymap& aNumberMode); |
|
105 |
|
106 /** |
|
107 * Get stroke end mark from hwr engine |
|
108 * |
|
109 * @since S60 v3.2 |
|
110 * @return Stroke end mark |
|
111 */ |
|
112 TPoint StrokeEndMark() const ; |
|
113 |
|
114 /** |
|
115 * Set primary candidate num that hwr engine should return each time |
|
116 * |
|
117 * @since S60 v3.2 |
|
118 * @param aNum The primary candidate num to be set |
|
119 * @return KErrNone if operation successfully,otherwise system wide error codes |
|
120 */ |
|
121 TInt SetPrimaryCandidateNum(TInt aNum); |
|
122 |
|
123 /** |
|
124 * Set total candidate number that can be shown |
|
125 * |
|
126 * @since S60 v3.2 |
|
127 * @param aNum The total candidate number that should be shown |
|
128 * @return KErrNone if operation successfully,otherwise system wide error codes |
|
129 */ |
|
130 TInt SetCandidateNum(TInt aNum); |
|
131 |
|
132 /** |
|
133 * Set aux candidate number that can be shown |
|
134 * |
|
135 * @since S60 v3.2 |
|
136 * @param aNum The aux candidate number that should be shown |
|
137 * @return KErrNone if operation successfully,otherwise system wide error codes |
|
138 */ |
|
139 TInt SetAuxCandidateNum(TInt aNum); |
|
140 |
|
141 /** |
|
142 * Get aux candidate number that can be shown |
|
143 * |
|
144 * @since S60 v3.2 |
|
145 * @return aux candidate number if operation successfully,otherwise system wide error codes |
|
146 */ |
|
147 TInt GetAuxCandidateNum(); |
|
148 |
|
149 /** |
|
150 * Set language |
|
151 * |
|
152 * @since S60 v3.2 |
|
153 * @param aLanguage The language |
|
154 * @return None |
|
155 */ |
|
156 void SetLanguageL(TInt aLanguage); |
|
157 |
|
158 /** |
|
159 * Set custom key mapping |
|
160 * |
|
161 * @since S60 v3.2 |
|
162 * @param aKeyMap The key mapping |
|
163 * @return None |
|
164 */ |
|
165 void SetCustomKeymapL(const TDesC& aKeyMap); |
|
166 |
|
167 /** |
|
168 * Clear custom key mapping |
|
169 * |
|
170 * @since S60 v3.2 |
|
171 * @return None |
|
172 */ |
|
173 void ResetCustomKeyMap(); |
|
174 |
|
175 /** |
|
176 * Judge if candidate existed in given index |
|
177 * |
|
178 * @since S60 v3.2 |
|
179 * @param aIndex Given index |
|
180 * @return ETrue if candidate exist, otherwise EFalse |
|
181 */ |
|
182 TBool CandidateExisted(); |
|
183 |
|
184 static TInt BackgroundTaskL(TAny* aPtr); |
|
185 TInt SetInputAreaSize(TSize& aSize); |
|
186 TInt SetScreenSize(TSize& aSize); |
|
187 private: |
|
188 |
|
189 /** |
|
190 * C++ constructor |
|
191 * |
|
192 * @since S60 v3.2 |
|
193 * @return None |
|
194 */ |
|
195 CAknFepHwrEngine(); |
|
196 |
|
197 /** |
|
198 * Second phase constructor |
|
199 * |
|
200 * @since S60 v3.2 |
|
201 * @return None |
|
202 */ |
|
203 void ConstructL(CPtiEngine* aPtiEngine, CAknFepHwrBxDataStore* 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 void DoIdleConstructL(); |
|
216 |
|
217 /** |
|
218 * Convert the stroke end mark of point array to another point |
|
219 * |
|
220 * @since S60 v3.2 |
|
221 * @param aTraceData Point array |
|
222 * @param aPnt1 Stroke end mark to be replaced |
|
223 * @param aPnt2 Stroke end mark to be used |
|
224 * @return None |
|
225 */ |
|
226 void ConvertStrokeEndMark(RArray<TPoint>& aTraceData, TPoint aPnt1, TPoint aPnt2); |
|
227 |
|
228 private: //data |
|
229 |
|
230 /** |
|
231 * Engine |
|
232 * Ownership is determined by flag |
|
233 */ |
|
234 CPtiEngine* iPtiEngine; |
|
235 |
|
236 /** |
|
237 * iPtiEngine ownership flag |
|
238 */ |
|
239 TBool iOwnPtiEngine; |
|
240 |
|
241 /** |
|
242 * Hwr recognizer (Now own) |
|
243 */ |
|
244 MPtiHwrRecognizer* iRecognizer; |
|
245 |
|
246 /** |
|
247 * Total candidate number that can be shown |
|
248 */ |
|
249 TInt iTotalCandidateNum; |
|
250 |
|
251 /** |
|
252 * Current case |
|
253 */ |
|
254 TInt iCase; |
|
255 |
|
256 /** |
|
257 * Current language |
|
258 */ |
|
259 TInt iLanguage; |
|
260 |
|
261 /** |
|
262 * Range count |
|
263 */ |
|
264 TInt iRangeCount; |
|
265 |
|
266 /** |
|
267 * Premary range |
|
268 */ |
|
269 TInt iPremaryRange; |
|
270 |
|
271 /** |
|
272 * Custom key mapping |
|
273 */ |
|
274 HBufC* iCustomKeymap; |
|
275 |
|
276 CIdle* iIdle; |
|
277 TBool iRecognizerInited; |
|
278 |
|
279 /** |
|
280 * Data store (Not own) |
|
281 */ |
|
282 CAknFepHwrBxDataStore* iOwner; |
|
283 |
|
284 TBool iNeedSetNumberMode; |
|
285 |
|
286 TBool iNeedSetCase; |
|
287 |
|
288 TBool iNeedSetRange; |
|
289 |
|
290 RArray<TInt> iPermittedRanges; |
|
291 |
|
292 TInt iNumberMode; |
|
293 }; |
|
294 |
|
295 #endif //C_CAKNFEPHWRENGINE_H |
|
296 |
|
297 //End Of File |