|
1 /* |
|
2 * Copyright (c) 2009 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 #ifndef C_AKNFEPZHUYINKEYHANDLER_H |
|
21 #define C_AKNFEPZHUYINKEYHANDLER_H |
|
22 |
|
23 #include <e32base.h> // For CActive, link against: euser.lib |
|
24 #include <e32std.h> // For RTimer, link against: euser.lib |
|
25 #include <PtiDefs.h> |
|
26 #include "aknfepzhuyinkeyhandlerinterface.h" |
|
27 |
|
28 class ZhuyinKeyTable |
|
29 { |
|
30 public: |
|
31 /** |
|
32 * C++ constructor. |
|
33 * |
|
34 * @return state. |
|
35 */ |
|
36 ZhuyinKeyTable(); |
|
37 |
|
38 /** |
|
39 * Cancel and destroy |
|
40 * |
|
41 * @return state. |
|
42 */ |
|
43 ~ZhuyinKeyTable(); |
|
44 |
|
45 /** |
|
46 * Get butten loop length. |
|
47 * |
|
48 * @parameter aKey the input key. |
|
49 * @return loop length. |
|
50 */ |
|
51 static TInt GetBtLoopLength( TPtiKey aKey ); |
|
52 |
|
53 /** |
|
54 * Get zhuyin symbol. |
|
55 * |
|
56 * @parameter aKey the input key |
|
57 * @parameter aClkCount input key count |
|
58 * @parameter aOutput the zhuyin symbol |
|
59 * @return state. |
|
60 */ |
|
61 static TBool GetUnicode( TPtiKey aKey, TInt aClkCount, TDes& aOutput ); |
|
62 |
|
63 }; |
|
64 |
|
65 class CZhuyinKeyHandler : public CActive, public MZhuyinKeyHandler |
|
66 { |
|
67 public: |
|
68 |
|
69 /** |
|
70 * Cancel and destroy |
|
71 * |
|
72 * @return state. |
|
73 */ |
|
74 ~CZhuyinKeyHandler(); |
|
75 |
|
76 /** |
|
77 * Two-phased constructor. |
|
78 * |
|
79 * @return state. |
|
80 */ |
|
81 static CZhuyinKeyHandler* NewL(); |
|
82 |
|
83 /** |
|
84 * Two-phased constructor. |
|
85 * |
|
86 * @return state. |
|
87 */ |
|
88 static CZhuyinKeyHandler* NewLC(); |
|
89 |
|
90 public: |
|
91 |
|
92 /** |
|
93 * Function for making the initial request. |
|
94 * |
|
95 * @return state. |
|
96 */ |
|
97 void Start(); |
|
98 |
|
99 /** |
|
100 * Get Zhuyin symbol according to the input key. |
|
101 * |
|
102 * @param aKey. the input key. |
|
103 * @param aOutBuf. an output parameter which will receive the zhuyin symbol unicode. |
|
104 * @return 0 identify the output should replace the old symbol. |
|
105 * 1 identify the output is a new symbol. |
|
106 * -1 identify error |
|
107 */ |
|
108 TInt GetZhuyinSymbol( TPtiKey aKey, TDes& aOutBuf ); |
|
109 |
|
110 /** |
|
111 * Reset all the member variables. |
|
112 * @param None. |
|
113 * @return None. |
|
114 */ |
|
115 void Reset(); |
|
116 |
|
117 /** |
|
118 * Get tonemark according to symbol in front of cursor. |
|
119 * |
|
120 * @param. aBaseSymbol is the symbol in front of cursor. |
|
121 * @param. aOutBuf is the output buffer for rcving tonemark. |
|
122 * @return. 0 identify the output should replace symbol in front of cursor |
|
123 * 1 identify the output should be added. |
|
124 * -1 identify error |
|
125 */ |
|
126 TInt GetToneMark( const TDes& aBaseSymbol, TDes& aOutBuf ); |
|
127 |
|
128 /** |
|
129 * Set whether state change from entry to spelling editing is automatical. |
|
130 * |
|
131 * @param aState.1 for automatical, 0 for manual. |
|
132 * @return None. |
|
133 */ |
|
134 void SetState( TInt aState ); |
|
135 |
|
136 /** |
|
137 * Get state change states. |
|
138 * |
|
139 * @return state. |
|
140 */ |
|
141 TInt GetState(); |
|
142 |
|
143 /** |
|
144 * Set status change flag. |
|
145 * this function is used to deal with long press on Down key or Clear key. |
|
146 * |
|
147 * @param aChgFlag. |
|
148 * @return None. |
|
149 */ |
|
150 void SetStatusChgFlag( TStatusChgFlag aChgFlag ); |
|
151 |
|
152 /** |
|
153 * Get the status change flag. |
|
154 * @prama None. |
|
155 * @return. |
|
156 */ |
|
157 TStatusChgFlag GetStatusChgFlag(); |
|
158 |
|
159 private: |
|
160 |
|
161 /** |
|
162 * C++ constructor. |
|
163 * @prama None. |
|
164 * @return. |
|
165 */ |
|
166 CZhuyinKeyHandler(); |
|
167 |
|
168 /** |
|
169 * Second-phase constructor. |
|
170 * @prama None. |
|
171 * @return. |
|
172 */ |
|
173 void ConstructL(); |
|
174 |
|
175 private: |
|
176 |
|
177 /** |
|
178 * From CActive Handle completion. |
|
179 * @prama None. |
|
180 * @return. |
|
181 */ |
|
182 void RunL(); |
|
183 |
|
184 /** |
|
185 * How to cancel me. |
|
186 * @prama None. |
|
187 * @return. |
|
188 */ |
|
189 void DoCancel(); |
|
190 |
|
191 /** |
|
192 * Override to handle leaves from RunL(). Default implementation causes. |
|
193 * the active scheduler to panic. |
|
194 * @prama None. |
|
195 * @return. |
|
196 */ |
|
197 TInt RunError( TInt aError ); |
|
198 |
|
199 private: |
|
200 |
|
201 /** |
|
202 * Provides async timing service |
|
203 */ |
|
204 RTimer iTimer; |
|
205 |
|
206 /** |
|
207 * Last pressed key. |
|
208 */ |
|
209 TPtiKey iLastKey; |
|
210 |
|
211 /** |
|
212 * if ETrue, it identify you don't touch any key in the specified time. |
|
213 */ |
|
214 TBool iTimeOut; |
|
215 /** |
|
216 * the times you pressed current key. |
|
217 */ |
|
218 TInt iBtClickNum; |
|
219 |
|
220 /** |
|
221 * the max loop length for pressed key. |
|
222 */ |
|
223 TInt iBtLoopLength; |
|
224 |
|
225 /** |
|
226 * whether the state change from entry to spelling editing is automatical. |
|
227 */ |
|
228 TInt iState; |
|
229 |
|
230 /** |
|
231 * state change flag.used to handle long press on down key and clear key currently. |
|
232 */ |
|
233 TStatusChgFlag iStatusChgFlag; |
|
234 |
|
235 }; |
|
236 |
|
237 #endif // C_AKNFEPZHUYINKEYHANDLER_H |
|
238 |
|
239 // End of file |
|
240 |