|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 #ifndef _AKNFEP_CASE_MANAGER_H__ |
|
30 #define _AKNFEP_CASE_MANAGER_H__ |
|
31 |
|
32 #include "AknFepManager.h" |
|
33 |
|
34 #include <e32base.h> |
|
35 |
|
36 class CAknEdwinState; |
|
37 class CAknPictographInterface; |
|
38 |
|
39 |
|
40 class CAknFepCaseManager : public CBase |
|
41 { |
|
42 private: |
|
43 enum AknFepCaseManagerConsts |
|
44 { |
|
45 ETextCaseCharactersBufferMaxSize =16 |
|
46 }; |
|
47 |
|
48 public: |
|
49 /** |
|
50 * Two phase constructor for this class |
|
51 */ |
|
52 static CAknFepCaseManager* NewL(CAknFepManager& aFep); |
|
53 |
|
54 /** |
|
55 * C++ Destructor |
|
56 */ |
|
57 ~CAknFepCaseManager(); |
|
58 |
|
59 public: |
|
60 /** |
|
61 * Configure the current case state of the system based on the current |
|
62 * editor state |
|
63 */ |
|
64 void ConfigureCaseStateFromEditorState(); |
|
65 |
|
66 /** |
|
67 * Start an automatic case update - determines the case of the next |
|
68 * character based on the rules governing auto case update and applies |
|
69 * this change accordingly |
|
70 * |
|
71 * @param aNaviEvent the type of event which prompted the case update |
|
72 * (affects the final cursor position) |
|
73 */ |
|
74 void UpdateCase(TWesternNaviEvent aNaviEvent); |
|
75 |
|
76 /** |
|
77 * Starts a manual case update |
|
78 */ |
|
79 void ManualCaseUpdate(); |
|
80 |
|
81 /** |
|
82 * Reverts the case of text input to the previous one in order to |
|
83 * back out unneccasary case changes |
|
84 */ |
|
85 void RevertCaseChange(); |
|
86 |
|
87 /** |
|
88 * Set the case of text input |
|
89 * |
|
90 * @param aCase the case of the next character |
|
91 * @param aOverrideNumericTest Isn't used in most cases, but if set, handles |
|
92 * numeric mode as normal mode. Needed for selection |
|
93 * style hash key loop implementation. |
|
94 */ |
|
95 void SetCurrentCase(TInt aCase, TBool aOverrideNumericTest = EFalse); |
|
96 |
|
97 /** |
|
98 * Return the current case of text input |
|
99 * |
|
100 * @return integer representing an enumerated value of the current case |
|
101 */ |
|
102 TInt CurrentCase() const; |
|
103 |
|
104 /** |
|
105 * check whether case can be changed |
|
106 * |
|
107 * @return Eture if case can be changed |
|
108 */ |
|
109 TBool IsAbleChangeCase() const; |
|
110 |
|
111 TInt PluginPermittedCases(); |
|
112 |
|
113 TBool CapsLockRequired(TInt aCurrentCase); |
|
114 /* Teleca change begin, 18.08.2009 ssal */ |
|
115 /** |
|
116 * Determines whether a character is one of Korean characters |
|
117 * @param aChar the charcter to be checked |
|
118 * @return ETrue if aChar is Korean character |
|
119 */ |
|
120 TBool IsKoreanCharacter( TChar aChar ) const; |
|
121 /* Teleca change end, 18.08.2009 ssal */ |
|
122 private: |
|
123 /** |
|
124 * C++ Constructor |
|
125 */ |
|
126 CAknFepCaseManager(CAknFepManager& aFep); |
|
127 |
|
128 /** |
|
129 * Second phase constructor for this class |
|
130 */ |
|
131 void ConstructL(); |
|
132 |
|
133 /** |
|
134 * Determines the position the cursor will be in when a navigation event is |
|
135 * complete. This is used to determine the required case at that position. |
|
136 * |
|
137 * @param aNaviEvent the type of event after which the case will be updated |
|
138 * @return The position in the document of the cursor when aNaviEvent is |
|
139 * complete |
|
140 */ |
|
141 TInt FindCursorPositionAtCaseCheck(TWesternNaviEvent aNaviEvent); |
|
142 |
|
143 /** |
|
144 * Determines, based on the case rules, whether text case needs to be |
|
145 * applied for text input i.e. whether the next character needs |
|
146 * to be entered in upper case and subsequent characters in lower case |
|
147 * |
|
148 * @return ETrue if text case needs to be applied for the next |
|
149 * character |
|
150 */ |
|
151 TBool TextCaseRequired(TInt aCursorPos); |
|
152 |
|
153 /** |
|
154 * Determines, based on the case rules, whether or not caps lock input style |
|
155 * needs to be applied i.e. if the current case is upper and we should stay |
|
156 * in upper following the entry of the next character |
|
157 * |
|
158 * @return ETrue if caps lock input style is to be applied |
|
159 */ |
|
160 TBool CapsLockRequired(TInt aCursorPos, TInt aCurCase); |
|
161 |
|
162 /** |
|
163 * Determines the case of text input based on the rules governing |
|
164 * case updates atarted by the user and applies this change accordingly |
|
165 */ |
|
166 void DoManualCaseUpdate(); |
|
167 |
|
168 /** |
|
169 * Applies the case change in the ptiengine (via the engine interface) and |
|
170 * updates the edit state indicators accordingly |
|
171 */ |
|
172 void ApplyCase(); |
|
173 |
|
174 /** |
|
175 * Sets the system to be in fixed case. No case updates are permitted |
|
176 * in this state |
|
177 * |
|
178 * @param aFixedCase if ETrue then no case updates are subsequently |
|
179 * permitted |
|
180 */ |
|
181 void SetFixedCase(TBool aFixedCase); |
|
182 |
|
183 /** |
|
184 * Determines if the current editor has the fixed case flag set |
|
185 * |
|
186 * @return ETrue if the fixed case flag is set on the current editor |
|
187 */ |
|
188 TBool CurrentEditorIsFixedCase() const; |
|
189 |
|
190 /** |
|
191 * Determines if a case is one which is allowed in the current editor |
|
192 * based on the editor's configuration |
|
193 * |
|
194 * @param aCase the case to be checked |
|
195 * @return ETrue if aCase is permitted by the current editor |
|
196 */ |
|
197 TBool IsCasePermitted(TInt aCase) const; |
|
198 |
|
199 /** |
|
200 * |
|
201 * |
|
202 * |
|
203 * @param aChar the charcter to be checke |
|
204 * @return ETrue |
|
205 */ |
|
206 TBool IsTextCaseCharacter(TChar aChar) const; |
|
207 |
|
208 /** |
|
209 * |
|
210 * |
|
211 * |
|
212 * @param aChar the charcter to be checked |
|
213 * @return ETrue if aChar is full or half alphabet |
|
214 */ |
|
215 TBool IsAlpha(TChar aChar) const; |
|
216 |
|
217 /** |
|
218 * Determines whether a character is one of Japanese characters |
|
219 * Japanese character is included as below: |
|
220 * - Hiragana/Kanji |
|
221 * - Katakana (Both half and full) |
|
222 * - Symbol (Full-width only) |
|
223 * (including Full-width Full-Stop) |
|
224 * |
|
225 * @since S60 v3.1 |
|
226 * @param aChar the charcter to be checked |
|
227 * @return ETrue if aChar is Japanese character |
|
228 */ |
|
229 TBool IsJapaneseCharacter(TChar aChar) const; |
|
230 |
|
231 /* Teleca change begin, 18.08.2009 ssal */ |
|
232 /** |
|
233 * Determines whether a character is one of Korean hangul syllable |
|
234 * @param aChar the charcter to be checked |
|
235 * @return ETrue if aChar is korean character |
|
236 */ |
|
237 TBool IsHangulSyllable(TChar aChar) const; |
|
238 |
|
239 /** |
|
240 * Determines whether a character is one of Korean hangul compatibility Jamo Syllable |
|
241 * @param aChar the charcter to be checked |
|
242 * @return ETrue if aChar is Korean character |
|
243 */ |
|
244 TBool IsHangulCompatibilityJamo(TChar aChar) const; |
|
245 /* Teleca change begin, 18.08.2009 ssal */ |
|
246 |
|
247 public: |
|
248 /** |
|
249 * Calls to ManulaCaseUpdate() in lower case situation will switch to |
|
250 * upper case even if text case would be normally selected. |
|
251 */ |
|
252 inline void SetForceUpperCase(); |
|
253 |
|
254 /** |
|
255 * Clear force upper case flag (see SetForceUpperCase()). |
|
256 */ |
|
257 inline void ClearForceUpperCase(); |
|
258 |
|
259 inline TBool IsInverseCase() const; |
|
260 inline void SetInverseCase( TBool aVal ); |
|
261 |
|
262 private: |
|
263 CAknFepManager& iFep; //not owned |
|
264 CAknPictographInterface* iPictoInterface; //owned |
|
265 |
|
266 TInt iCurrentCase; |
|
267 TInt iPreviousCase; |
|
268 TBool iFixedCase; |
|
269 TBool iForceUpperCase; |
|
270 TBool iInverseCase; |
|
271 TBufC<ETextCaseCharactersBufferMaxSize> iTextCaseCharacters; |
|
272 }; |
|
273 |
|
274 inline void CAknFepCaseManager::SetForceUpperCase() |
|
275 { |
|
276 iForceUpperCase = ETrue; |
|
277 } |
|
278 |
|
279 |
|
280 inline void CAknFepCaseManager::ClearForceUpperCase() |
|
281 { |
|
282 iForceUpperCase = EFalse; |
|
283 } |
|
284 |
|
285 inline TBool CAknFepCaseManager::IsInverseCase() const |
|
286 { |
|
287 return iInverseCase; |
|
288 } |
|
289 |
|
290 inline void CAknFepCaseManager::SetInverseCase( TBool aVal ) |
|
291 { |
|
292 iInverseCase = aVal; |
|
293 } |
|
294 |
|
295 #endif //_AKNFEP_CASE_MANAGER_H__ |