|
1 /* |
|
2 * Copyright (c) 2008 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 * Provides the TZhuyinSymbolsMethods definition |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #ifndef T_AKNFEPZHUYINCONVERTION_H |
|
31 #define T_AKNFEPZHUYINCONVERTION_H |
|
32 |
|
33 #include <e32hashtab.h> |
|
34 #include <badesca.h> |
|
35 #include <PtiEngine.h> |
|
36 #include "AknFepZhuyinAnalyser.h" |
|
37 |
|
38 class TZhuyinSymbolsMethods |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Convert aArray to a descriptor outputed through aOutDes |
|
43 * |
|
44 * @param aArray. the converted array. |
|
45 * @param aOutDes. an output parameter for storing descriptor after converting. |
|
46 * @return. the converted number of elements for aArray. |
|
47 */ |
|
48 static TInt Convert2Des ( CDesCArrayFlat* aArray, TDes& aOutDes ); |
|
49 |
|
50 /** |
|
51 * Update the content in eep control. |
|
52 * |
|
53 * @since S60 v5.0 |
|
54 * @param aPtiengine. used for getting candidate list. |
|
55 * @param aAnylyser. used for analysing validity for zhuyin symbols. |
|
56 * @param aZhuyinSymbols. zhuyin symbols' array. |
|
57 * @param aChineseDisped. chinese characters' array. |
|
58 * @param aCandidateList. an output parameter which will receive updated candidates. |
|
59 * @param aOutDes. an output parameter for storing displayed text. |
|
60 * @param aPhraseCreation. an out put parameter, ETrue for phrase creation, EFalse phrase input |
|
61 * @return. whether zhuyin symbols is valid. ETrue for valid and EFalse for invalid. |
|
62 */ |
|
63 static TBool UpdateEEPContent( |
|
64 CPtiEngine* aPtiengine, |
|
65 CAknFepZhuyinAnalyser* aAnalyser, |
|
66 CDesCArrayFlat* aZhuyinSymbols, |
|
67 CDesCArrayFlat* aChineseDisped, |
|
68 CDesCArrayFlat* aCandidateList, |
|
69 TDes& aOutDes, |
|
70 TBool& aPhraseCreation); |
|
71 |
|
72 /** |
|
73 * Update the content in eep control. |
|
74 * |
|
75 * @since S60 v5.0 |
|
76 * @param aPtiengine. used for getting candidate list. |
|
77 * @param aAnylyser. used for analysing validity for zhuyin symbols. |
|
78 * @param aZhuyinSymbols. zhuyin symbols' array. |
|
79 * @param aChineseDisped. chinese characters' array. |
|
80 * @param aCandidateList. an output parameter which will receive updated candidates. |
|
81 * @param aOutDes. an output parameter for storing displayed text. |
|
82 * @param aPhraseCreation. an out put parameter, ETrue for phrase creation, EFalse phrase input |
|
83 * @return. whether zhuyin symbols is valid. ETrue for valid and EFalse for invalid. |
|
84 */ |
|
85 static TBool UpdateEEPContentL( |
|
86 CPtiEngine* aPtiengine, |
|
87 CAknFepZhuyinAnalyser* aAnalyser, |
|
88 CDesCArrayFlat* aZhuyinSymbols, |
|
89 CDesCArrayFlat* aChineseDisped, |
|
90 CDesCArrayFlat* aCandidateList, |
|
91 TDes& aOutDes, |
|
92 TBool& aPhraseCreation); |
|
93 |
|
94 /** |
|
95 * commit a chinese character from candidate list. |
|
96 * After appending, the CDesCArrayFlat parameters will be updated for accordance. |
|
97 * |
|
98 * @since S60 v5.0 |
|
99 * @param aChinese. the unicode for added chinese character. |
|
100 * @param aAnalyser. the analyser for cecking the validity of aZhuyinSymbols. |
|
101 * @param aZhuyinSymbols. the zhuyin symbols appeared in the eep control. |
|
102 * @param aChineseDisped. the chinese character array aChinese should be added into. |
|
103 * @param aZhuyinSymbolsForChinese. the corresponding symbols for chinese character array. |
|
104 * @return. ETrue there are already 7 characters in eep control after appending. |
|
105 * EFalse there are less than 7 characters in eep control. |
|
106 */ |
|
107 static TBool AppendChineseChar( |
|
108 const TDes& aChinese, |
|
109 CAknFepZhuyinAnalyser* aAnalyser, |
|
110 CDesCArrayFlat* aZhuyinSymbols, |
|
111 CDesCArrayFlat* aChineseDisped, |
|
112 CDesCArrayFlat* aZhuyinSymbolsForChinese ); |
|
113 |
|
114 /** |
|
115 * Delete a chinese character from aChineseDisped array |
|
116 * and update related array in the meantime. |
|
117 * |
|
118 * @since S60 v5.0 |
|
119 * @param aZhuyinSymbols.zhuyin symbols' array. |
|
120 * @param aInputBuf. zhuyin symbols' buf. |
|
121 * @return.ETrue for successful delete, EFalse for failed delete. |
|
122 */ |
|
123 static void GetZhuyinSymbolsL( |
|
124 CDesCArrayFlat* aZhuyinSymbols, |
|
125 const TDesC& aInputBuf ); |
|
126 |
|
127 /** |
|
128 * Delete a chinese character from aChineseDisped array |
|
129 * and update related array in the meantime. |
|
130 * |
|
131 * @since S60 v5.0 |
|
132 * @param aZhuyinSymbols.zhuyin symbols' array. |
|
133 * @param aChineseDisped. chinese caracters' array. |
|
134 * @param aZhuyinSymbolsForChinese. corresponding zhuyin symbol sequences for |
|
135 * chinese caracters stored in aChineseDisped. |
|
136 * @return.ETrue for successful delete, EFalse for failed delete. |
|
137 */ |
|
138 static TBool DeleteChineseChar( |
|
139 CDesCArrayFlat* aZhuyinSymbols, |
|
140 CDesCArrayFlat* aChineseDisped, |
|
141 CDesCArrayFlat* aZhuyinSymbolsForChinese ); |
|
142 |
|
143 /** |
|
144 * Delete a zhuyin symbol stored in aZhuyinSymbols array. |
|
145 * if the symbol after aKeyStroke is a tonemark, the tonemark should be deleted with zhuyin symbol. |
|
146 * |
|
147 * @since S60 v5.0 |
|
148 * @param aZhuyinSymbols.zhuyin symbols' array. |
|
149 * @param aKeyStroke. the key stroke position when deleting. |
|
150 * @return. ETrue for success. EFalse for failure. |
|
151 */ |
|
152 static TBool DeleteZhuyinSymbol( |
|
153 CDesCArrayFlat* aZhuyinSymbols, |
|
154 TInt aKeyStroke |
|
155 ); |
|
156 |
|
157 /** |
|
158 * Refresh the cursor position according to the input parameters. |
|
159 * |
|
160 * @since S60 v5.0 |
|
161 * @param aChineseNum. the number of chinese characters. |
|
162 * @param aZhuyinShown. the displayed content. |
|
163 * @param aKeyStrokePos. the key stroke position. |
|
164 * @return. the new cursor position for displayed content. |
|
165 */ |
|
166 static TInt RefreshCursorPos ( |
|
167 TInt aChineseNum, |
|
168 const TDes& aShownContent, |
|
169 TInt aKeyStrokePos ); |
|
170 |
|
171 /** |
|
172 * Get the number of zhuyin symbol group. |
|
173 * |
|
174 * @since S60 v5.0 |
|
175 * @param aShown. the displayed content. |
|
176 * @return. the number of zhuyin symbol group. |
|
177 */ |
|
178 static TInt GetChineseCount ( const TDes& aShown ); |
|
179 |
|
180 /** |
|
181 * Whether the aFirstPhrase is a Zhuyin symbol or not. |
|
182 * |
|
183 * @since S60 v5.0 |
|
184 * @param aFirstPhrase.Phrase content. |
|
185 * @return. ETrue for aFirstPhrase is Zhuyin symbol. EFalse for not. |
|
186 */ |
|
187 static TBool IsZhuyinSymbol( const TDesC& aFirstPhrase ); |
|
188 |
|
189 /** |
|
190 * Whether is a Zhuyin spelling or not. |
|
191 * |
|
192 * @since S60 v5.0 |
|
193 * @param aSymbol the first zhuyin symbol. |
|
194 * @param index the zhuyin symbol that index of zhuyin symbol array. |
|
195 * @return. ETrue the aSymbol and the symbol that index of zhuyin symbol |
|
196 * array is zhuyin spelling, EFalse others. |
|
197 */ |
|
198 static TBool IsZhuyinSpelling( |
|
199 const TDesC& aSymbol, |
|
200 const TInt index, |
|
201 CDesCArrayFlat* aZhuyinSymbols ); |
|
202 |
|
203 }; |
|
204 |
|
205 #endif /*T_AKNFEPZHUYINCONVERTION_H*/ |
|
206 |
|
207 //End of File |
|
208 |