|
1 /* |
|
2 * Copyright (c) 2007 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: Predective text input engine API header |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_TRUIPTIENGINE_H |
|
21 #define C_TRUIPTIENGINE_H |
|
22 |
|
23 // system includes |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include <f32file.h> |
|
27 |
|
28 // user includes |
|
29 #include "PtiHwrRecognizer.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CSymbolList; |
|
33 class THwrUdmRange; |
|
34 class RFs; |
|
35 |
|
36 |
|
37 class CTruiPtiEngine : public CBase, public MTruiEngine |
|
38 { |
|
39 |
|
40 public: |
|
41 /** |
|
42 * Two phase constructor. |
|
43 * |
|
44 * @param aHwrEngine |
|
45 * @return |
|
46 */ |
|
47 static CTruiPtiEngine* NewL( CHwrRecognizer* aHwrEngine ); |
|
48 |
|
49 /** |
|
50 * Two phase constructor. |
|
51 * |
|
52 * @param aHwrEngine |
|
53 * @return |
|
54 */ |
|
55 static CTruiPtiEngine* NewLC( CHwrRecognizer* aHwrEngine ); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CTruiPtiEngine(); |
|
61 |
|
62 // from base class MTruiEngine |
|
63 |
|
64 /** |
|
65 * Set current trained character's Language Script |
|
66 * |
|
67 * @param aLanguageScript current trained character's Language Script |
|
68 */ |
|
69 void SetLanguageScriptL( TInt aLanguageScript ); |
|
70 |
|
71 /** |
|
72 * Check if character has model |
|
73 * |
|
74 * @param aChar The character which is checked |
|
75 * @return TBool True means this character has model |
|
76 * False means this character doesn't has model yet |
|
77 */ |
|
78 TBool CharacterModelExist( const TDesC& aChar ); |
|
79 |
|
80 /** |
|
81 * Get character model |
|
82 * |
|
83 * @param aChar Get this character's model |
|
84 * @param aModel Array of points where the character's model is stored. |
|
85 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
86 */ |
|
87 void GetCharacterModelL( const TDesC& aChar, RArray<TPoint>& aModel ); |
|
88 |
|
89 /** |
|
90 * Set character model |
|
91 * |
|
92 * @param aChar Set model to this character |
|
93 * @param aModel Array of points where the character's model is stored. |
|
94 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
95 */ |
|
96 void SetCharacterModelL( const TDesC& aChar, RArray<TPoint>& aModel, TInt aSubRange, TDes& aSimilarChar ); |
|
97 |
|
98 /** |
|
99 * Delete character model |
|
100 * |
|
101 * @param aChar Delete this character's model |
|
102 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
103 */ |
|
104 TInt DeleteCharacterModel( const TDesC& aChar ); |
|
105 |
|
106 /** |
|
107 * Get text list of all the shortcuts |
|
108 * |
|
109 * @param aShortcutTextList The text list. |
|
110 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
111 */ |
|
112 void GetShortcutTextListL( RPointerArray<HBufC>& aShortcutTextList ); |
|
113 |
|
114 /** |
|
115 * Check if shortcut has model |
|
116 * |
|
117 * @param aText The shortcut which is checked |
|
118 * @return TBool True means this shortcut has model |
|
119 * False means this shortcut doesn't has model yet |
|
120 */ |
|
121 TBool CheckShortcutModel( const TDesC& aText ); |
|
122 |
|
123 /** |
|
124 * Get Shortcut model |
|
125 * |
|
126 * @param aText Get this Shortcut's model |
|
127 * @param aModel Array of points where the Shortcut's model is stored. |
|
128 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
129 */ |
|
130 void GetShortcutModelL( const TDesC& aText, RArray<TPoint>& aModel, TUint& aUnicode ); |
|
131 |
|
132 /** |
|
133 * Set Shortcut model |
|
134 * |
|
135 * @param aText Set model to this Shortcut |
|
136 * @param aModel Array of points where the Shortcut's model is stored. |
|
137 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
138 */ |
|
139 void SetShortcutModelL( const TDesC& aText, RArray<TPoint>& aModel, TDes& aSimilarText ); |
|
140 |
|
141 /** |
|
142 * Delete Shortcut model |
|
143 * |
|
144 * @param aText Delete this Shortcut's model |
|
145 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
146 */ |
|
147 TInt DeleteShortcutModel( const TDesC& aText ); |
|
148 |
|
149 /** |
|
150 * Change the text of an existing shortcut |
|
151 * |
|
152 * @param aOldText The text of an existing shortcut |
|
153 * @param aNewText The new text of the shortcut |
|
154 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
155 */ |
|
156 void ChangeShortcutTextL( const TDesC& aOldText, const TDesC& aNewText ); |
|
157 |
|
158 /** |
|
159 * Get guiding line pos |
|
160 * |
|
161 * |
|
162 * @param aTop The vertical coordinate of top guiding line |
|
163 * @param aBottom The vertical coordinate of bottom guiding line |
|
164 * @return TInt Error value. If no error occurred, KErrNone is returned |
|
165 */ |
|
166 TInt GetGuidingLinePos( const TSize& aSize, TInt& aTop , TInt& aBottom); |
|
167 |
|
168 /** |
|
169 * Get the number of the maximum of shortcuts |
|
170 * |
|
171 * @return TInt The number of the maximum of shortcuts |
|
172 */ |
|
173 TInt MaxShortCutLength(); |
|
174 |
|
175 /** |
|
176 * Save preset shortcuts. |
|
177 * |
|
178 * @param aUnicode The assigned preset text. |
|
179 * @param aShortcut The shortcut to be save. |
|
180 */ |
|
181 void SavePresetShortcutL( TUint aUnicode, const TDesC& aShortcut ) ; |
|
182 |
|
183 /** |
|
184 * Return all unicodes of preset text stored in PTI engine |
|
185 * |
|
186 * @param aPresets All preset text's unicodes are stored in this array. |
|
187 */ |
|
188 void GetAllPresetSymbolsL( RArray<TUint>& aPresets ) ; |
|
189 |
|
190 /** |
|
191 * Get trails assigned to a preset text. |
|
192 * |
|
193 * @param aUnicode The unicode of the preset text. |
|
194 * @param aModel Store trails of the preset text. |
|
195 * @param aShortcut Indicate whether the preset text has been assigned to a shortcut text. |
|
196 * If KNullDesC, it is not in use. |
|
197 */ |
|
198 void GetPresetSymbolByUnicodeL( TUint aUnicode, RArray<TPoint>& aModel, TDes& aShortcut ) ; |
|
199 |
|
200 //======== own public functions for derived hwr core only ================= |
|
201 /** |
|
202 * Load the aType models to memory. |
|
203 * |
|
204 * @param aType Shall set the value of TUdmType |
|
205 * @return none |
|
206 */ |
|
207 void LoadUdmL( TUdmType aType ); |
|
208 |
|
209 /** |
|
210 * UnLoad the aType models to memory. |
|
211 * |
|
212 * @param aType Shall set the value of TUdmType |
|
213 * @return none |
|
214 */ |
|
215 void UnLoadUdm( TUdmType aType ); |
|
216 |
|
217 /** |
|
218 * Get the indexes of the symbol modles spcified by aRange. |
|
219 * |
|
220 * @param aType Shall set the value of TUdmType |
|
221 * @param aList Store the indexed of the found symbol models. |
|
222 * @param aRange Udm Range |
|
223 * @return none |
|
224 */ |
|
225 void GetModelIndexListL( TUdmType aType, RArray<TInt>& aList, const THwrUdmRange& aRange ); |
|
226 |
|
227 /** |
|
228 * Get the model properties of the specified index |
|
229 * |
|
230 * @param aType Shall set the value of TUdmType |
|
231 * @param aList Store the indexed of the found symbol models. |
|
232 * @param aRange Udm Range |
|
233 * @return none |
|
234 */ |
|
235 void GetSymbolModelL( TUdmType aType, TInt aIndex, TPtrC& aSymbolName,RArray<TPoint>& aModel, TInt& aHelpLine, TInt& aBaseLine ); |
|
236 |
|
237 private: |
|
238 |
|
239 CTruiPtiEngine(); |
|
240 |
|
241 void ConstructL( CHwrRecognizer* aHwrEngine ); |
|
242 |
|
243 /** |
|
244 * Change the query strategy. |
|
245 * |
|
246 * @param aRange The range to change |
|
247 * @return none |
|
248 */ |
|
249 void ConvertUdmRange( THwrUdmRange& aRange ); |
|
250 private: // data |
|
251 |
|
252 TFixedArray<CSymbolList*,EUdmMax> iSymboList; |
|
253 |
|
254 TInt iScript; |
|
255 |
|
256 TInt iHl; |
|
257 |
|
258 TInt iBl; |
|
259 |
|
260 CHwrRecognizer* iHwrEngine; |
|
261 |
|
262 CSymbolList* iPreSetList; |
|
263 |
|
264 RFs iFsSession; |
|
265 }; |
|
266 |
|
267 |
|
268 #endif // C_TRUIPTIENGINE_H |