52 * Destructor |
54 * Destructor |
53 */ |
55 */ |
54 virtual ~CPcsKeyMap(); |
56 virtual ~CPcsKeyMap(); |
55 |
57 |
56 /** |
58 /** |
57 * Convert functions to get the key string from query and/or chars string |
59 * Converts the alphanumeric string to numeric string |
58 */ |
60 */ |
59 void GetMixedKeyStringForQueryL(CPsQuery& aSrcQuery, TDes& aDestStr) const; |
61 void GetNumericKeyString(const TDesC& alphaNumericStr, TDes& numericStr); |
60 void GetMixedKeyStringForDataL(CPsQuery& aSrcQuery, const TDesC& aSrcData, TDes& aDestStr) const; |
|
61 |
62 |
62 /** |
63 /** |
63 * Returns the numeric key id corresponding to a specific character |
64 * Returns the numeric key id corresponding to a specific character |
64 */ |
65 */ |
65 TPtiKey KeyForCharacter(TText aChar, TKeyboardModes aKbMode) const; |
66 TInt KeyForCharacter(const TChar& aChar); |
66 |
67 |
67 /** |
68 /** |
68 * Returns ETrue if this language is supported |
69 * Returns ETrue if this language is supported |
69 */ |
70 */ |
70 TBool IsLanguageSupportedL(const TUint32 aLanguage); |
71 TBool IsLanguageSupportedL(const TUint32 aLanguage); |
71 |
72 |
72 void ReconstructKeymapL(); |
73 void ReconstructKeymapL(); |
73 |
74 |
74 /** |
75 /** |
75 * Returns the pool Id for a key |
76 * Returns the pool Id for a Character |
76 */ |
77 */ |
77 TInt PoolIdForCharacter(TChar aChar, TKeyboardModes aKbMode ); |
78 TInt PoolIdForCharacter(TChar aChar); |
78 |
79 |
79 /** |
80 /** |
80 * Returns total number of pools |
81 * Returns total number of pools |
81 */ |
82 */ |
82 TInt PoolCount(); |
83 TInt PoolCount(); |
83 |
|
84 /** |
|
85 * Returns true if the characters "0" and " " are on the same key |
|
86 */ |
|
87 TBool GetSpaceAndZeroOnSameKey( TKeyboardModes aMode ); |
|
88 |
84 |
89 private: |
85 private: |
90 |
86 |
91 /** |
87 /** |
92 * Constructor |
88 * Constructor |
97 * Second phase constructor |
93 * Second phase constructor |
98 */ |
94 */ |
99 void ConstructL(CPcsAlgorithm2* aAlgorithm); |
95 void ConstructL(CPcsAlgorithm2* aAlgorithm); |
100 |
96 |
101 /** |
97 /** |
102 * Set flags to indicate if space and zero are on same key. |
|
103 * Keymappings must be constructed before calling this. |
|
104 */ |
|
105 void SetSpaceAndZeroOnSameKey(); |
|
106 |
|
107 /** |
|
108 * Helper function to construct keyboard specific mappings |
98 * Helper function to construct keyboard specific mappings |
109 */ |
99 */ |
110 void ConstructForItutKeyboardL(); |
100 void ContructForItutKeyboardL(TLanguage aLanguage); |
111 void ConstructForQwertyKeyboardL(TPtiKeyboardType aKbType); |
101 void ContructForHalfQwertyKeyboardL(TLanguage aLanguage); |
|
102 void ContructFor4x10QwertyKeyboardL(TLanguage aLanguage); |
112 |
103 |
113 /** |
104 /** |
114 * Helper function to populate Itut key mappings |
105 * Helper function to populate Itut key mappings |
115 */ |
106 */ |
116 void AddKeyMapforItutL(TLanguage aLanguage); |
107 void AddKeyMapforItutL(TLanguage aLanguage); |
117 |
108 |
118 void AddDataForItutKeyboardL(CPtiKeyMapData* aPtiKeyMapData, |
109 void AddDataForItutKeyboardL(CPtiKeyMappings* aPtiKeyMappings, |
119 TPtiKey aKey, TKeyMappingData& aKeyDataList); |
110 TPtiKey aKey, TKeyMappingData& aKeyDataList); |
120 /** |
111 /** |
121 * Helper function to populate 4x10 Qwerty Keyboard key mappings |
112 * Helper function to populate 4x10 Qwerty Keyboard key mappings |
122 */ |
113 */ |
123 void AddKeyMapForQwertyKeyboardL(TLanguage aLanguage, TPtiKeyboardType aKbType); |
114 void AddKeyMapfor4x10QwertyKeyboardL(TLanguage aLanguage); |
124 |
115 |
125 void AddDataForQwertyKeyboardL( |
116 void AddDataFor4x10QwertyKeyboardL( |
126 CPtiKeyMapData* aPtiKeyMapData, |
117 CPtiQwertyKeyMappings* aPtiKeyMappings, TPtiKey aKey, |
127 TPtiKeyboardType aKbType, |
|
128 TPtiKey aKey, |
|
129 TKeyMappingData& aKeyDataList); |
118 TKeyMappingData& aKeyDataList); |
130 |
119 |
|
120 #ifdef HACK_FOR_E72_J_KEY |
|
121 void AddDataFor4x10QwertyKeyboardE72HackL(); // Hack for E72 (J/# key) |
|
122 #endif // HACK_FOR_E72_J_KEY |
|
123 |
131 /** |
124 /** |
132 * Create list of PTI keys for the given keyboard type |
125 * Helper function to populate alfQwerty Keyboard key mappings |
133 */ |
126 */ |
134 void CreateKeyListFromKeyBindingTable( RArray<TPtiKey>& aKeyArray, TPtiKeyboardType aKbType ); |
127 void AddKeyMapforHalfQwertyKeyboardL(TLanguage aLanguage); |
|
128 |
|
129 void AddDataForHalfQwertyKeyboardL(CPtiHalfQwertyKeyMappings* aPtiKeyMappings, |
|
130 TPtiKey aKey, TKeyMappingData& aKeyDataList); |
135 |
131 |
136 void ResetKeyMap(); |
132 void ResetKeyMap(); |
137 |
|
138 /** |
133 /** |
139 * Function to construct key mappings for a particula language |
134 * Function to construct key mappings for a particula language |
140 * |
135 * |
141 */ |
136 */ |
142 void ConstructKeymapL(); |
137 void ConstructKeymapL(); |
143 |
138 |
144 /** |
139 /** |
145 * Select keyboard types according to available physical keyboard(s) |
140 * Get the current keyboard type. |
|
141 * @return current keyboard type. |
146 */ |
142 */ |
147 void SetupKeyboardTypesL(); |
143 TInt CurrentKeyBoardTypeL(); |
148 |
144 |
149 /** |
145 /** |
150 * |
146 * |
151 * Construct keymaps |
147 * Construct keymap by type and language |
|
148 * @ aKeyboardType, the current keyboard type. |
|
149 * @ aLanguage, the keymap construct language. |
152 */ |
150 */ |
153 void ConstructConcreteKeyMapL(); |
151 void ConstructConcreteKeyMapL( TInt aKeyboardType, TLanguage aLanguage ); |
154 |
152 |
155 /** |
153 /** |
156 * |
154 * |
157 * Add keymap for keyboard by type and language |
155 * Add keymap for keyboard by type and language |
158 * @ aKeyboardType, the current keyboard type. |
156 * @ aKeyboardType, the current keyboard type. |
159 * @ aLanguage, the keymap construct language. |
157 * @ aLanguage, the keymap construct language. |
160 */ |
158 */ |
161 void AddKeyMapforConcreteKeyboardL( TLanguage aLanguage ); |
159 void AddKeyMapforConcreteKeyboardL( TInt aKeyboardType, TLanguage aLanguage ); |
162 |
160 |
163 /** |
161 /** |
164 * In case the given character is a Chinese characer, give the first |
162 * In case the given character is a Chinese characer, give the first |
165 * character of it's first spelling using the current spelling mode. |
163 * character of it's first spelling using the current spelling mode. |
166 * Otherwise, the character is returned unmodified. |
164 * Otherwise, the character is returned unmodified. |
167 */ |
165 */ |
168 TChar FirstCharFromSpellingL( TChar aChar ) const; |
166 TChar FirstCharFromSpellingL( TChar aChar ) const; |
169 |
|
170 TInt PoolIdForKey(TPtiKey aKey, TKeyboardModes aKbMode) const; |
|
171 |
|
172 /** |
|
173 * Gets predictive keyboard mapping data for given match mode. |
|
174 * @param aMode Matching mode for which keymappings are asked. |
|
175 * @return Mapping table for the given mode. NULL if asked for non-predictive mode. |
|
176 */ |
|
177 const RPointerArray<TKeyMappingData>* KeyMappings( TKeyboardModes aMode ) const; |
|
178 |
167 |
179 /** |
|
180 * Resolve any ambiguity from the given keyboard mode. |
|
181 * Keyboard mode "predictive default keyboard" will be replaced by |
|
182 * "ITU-T predictive" or "QWERTY predictive", depending on the configuration |
|
183 * of the device. Predictive keyboard modes, which can't be supported |
|
184 * in this device, are replaced with "non-predictive" mode. |
|
185 */ |
|
186 TKeyboardModes ResolveKeyboardMode( TKeyboardModes aKbMode ) const; |
|
187 |
|
188 /** |
|
189 * Get the default charcter for the given key in given keyboard. |
|
190 * The default character is used to construct the compare string for |
|
191 * predictive mode. |
|
192 */ |
|
193 TText DefaultCharForKey( TPtiKey aKey, TKeyboardModes aKbMode ) const; |
|
194 |
|
195 private: |
168 private: |
196 /** |
|
197 * PTI engine istance. Owned. |
|
198 */ |
|
199 CPtiEngine* iPtiEngine; |
169 CPtiEngine* iPtiEngine; |
200 |
170 |
201 /** |
|
202 * Algorithm instacne pointer. NOT owned. |
|
203 */ |
|
204 CPcsAlgorithm2* iAlgorithm; |
171 CPcsAlgorithm2* iAlgorithm; |
205 |
|
206 /** |
172 /** |
207 * Array to hold the list of languages not supported |
173 * Array to hold the list of languages not supported |
208 */ |
174 */ |
209 RArray<TLanguage> iLanguageNotSupported; |
175 RArray<TLanguage> iLanguageNotSupported; |
210 |
176 |
211 /** |
177 /** |
212 * Type of keyboard used in ITU-T search mode. Typically this is standard ITU-T |
178 * Flag to indicate if Phone is Chinese variant |
213 * 12-key keypad. |
|
214 */ |
179 */ |
215 TPtiKeyboardType iItutKeyboardType; |
180 RArray<TPtiKey> iKeysForPoolFormation; |
216 |
181 |
217 /** |
182 /** |
218 * PTI keys of the ITU-T keyboard. |
183 * Contains all the keys and the characters mapped to each key |
|
184 * own |
219 */ |
185 */ |
220 RArray<TPtiKey> iItutKeys; |
186 RPointerArray<TKeyMappingData> iAllKeyMappingsPtrArr; |
221 |
|
222 /** |
|
223 * Contains all the ITU-T keys and the characters mapped to each key. Owned. |
|
224 */ |
|
225 RPointerArray<TKeyMappingData> iItutKeyMappings; |
|
226 |
|
227 /** |
|
228 * True if "0" and " " are on the same key in the ITU-T mode |
|
229 */ |
|
230 TBool iSpaceAndZeroOnSameKeyOnItut; |
|
231 |
187 |
232 /** |
|
233 * Type of keyboard used in QWERTY search mode. Typically this is either 3x11 or 4x10 QWERTY |
|
234 * or EPtiKeyboardNone if there's no any kind of QWERTY available. This may also be |
|
235 * half-QWERTY. |
|
236 */ |
|
237 TPtiKeyboardType iQwertyKeyboardType; |
|
238 |
|
239 /** |
|
240 * PTI keys of the QWERTY keyboard. |
|
241 */ |
|
242 RArray<TPtiKey> iQwertyKeys; |
|
243 |
|
244 /** |
|
245 * Contains all the QWERTY keys and the characters mapped to each key. Owned. |
|
246 */ |
|
247 RPointerArray<TKeyMappingData> iQwertyKeyMappings; |
|
248 |
|
249 /** |
|
250 * True if "0" and " " are on the same key in the QWERTY mode |
|
251 */ |
|
252 TBool iSpaceAndZeroOnSameKeyOnQwerty; |
|
253 |
|
254 /** |
|
255 * Flag to indicate if the default multi-matching mode is ITU-T or QWERTY mode. |
|
256 * ETrue, if ITU-T is defualt and EFalse if QWERTY is default. |
|
257 */ |
|
258 TBool iItutIsDefault; |
|
259 }; |
188 }; |
260 |
189 |
261 #endif // __CPCS_KEY_MAP_ALGORITHM_2_H__ |
190 #endif // __CPCS_KEY_MAP_ALGORITHM_2_H__ |
262 |
191 |
263 // End of file |
192 // End of file |