1 akninputlanguageinfo.h |
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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Interface class providing information on available input languages |
|
16 * This header is exported |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 #ifndef __AKNINPUTLANGUAGEINFO_H__ |
|
36 #define __AKNINPUTLANGUAGEINFO_H__ |
|
37 |
|
38 // INCLUDES |
|
39 |
|
40 #include <e32base.h> |
|
41 |
|
42 // For TBitFlags |
|
43 #include <eikdef.h> |
|
44 #include <bamdesca.h> |
|
45 |
|
46 #include <babitflags.h> |
|
47 |
|
48 // Typedefs |
|
49 typedef TBuf<32> TAknLanguageName; |
|
50 |
|
51 |
|
52 // CLASS DECLARATIONS |
|
53 |
|
54 /** |
|
55 * Input language capabilities |
|
56 * |
|
57 */ |
|
58 class TAknInputLanguageCapabilities |
|
59 { |
|
60 public: |
|
61 /** |
|
62 * These indices are used to set/clear capabilities. |
|
63 * Terms: |
|
64 * - multitap refers to capability to enter alphabetic chars by pressing the same key repeatedly |
|
65 * - predictive refers to the device matching (non-multitap) keypresses with potential words |
|
66 * in a dictionary. That is, what words would map to the current set of keypad presses |
|
67 * |
|
68 * |
|
69 */ |
|
70 enum TAknInputLanguageCapabilityIndex |
|
71 { |
|
72 EMultitap = 0x00000000, |
|
73 EPredictive = 0x00000001 |
|
74 }; |
|
75 |
|
76 /** |
|
77 * C++ Constructor. Initializes the internal state to "no capabilities" |
|
78 */ |
|
79 IMPORT_C TAknInputLanguageCapabilities(); |
|
80 |
|
81 /** |
|
82 * Sets the capability at a given index index to the logical value passed |
|
83 * |
|
84 * @param aCapability which capability to set |
|
85 * @param aSet ETrue - enable the capability; EFalse - disable the capability |
|
86 */ |
|
87 IMPORT_C void AssignCapability( TInt aCapabilityIndex, TBool aSet ); |
|
88 |
|
89 /** |
|
90 * Tests a capability |
|
91 * |
|
92 * @param aCapability which capability to test |
|
93 * @return EFalse if the capability is not present; not EFalse otherwise |
|
94 */ |
|
95 IMPORT_C TBool HasCapability( TInt aCapabilityIndex ) const; |
|
96 |
|
97 /** |
|
98 * Sets all capabilities (existing and potential) |
|
99 */ |
|
100 IMPORT_C void SetAllCapabilities(); |
|
101 |
|
102 IMPORT_C TAknInputLanguageCapabilities FilteredCapabilities( TAknInputLanguageCapabilities& aFilter) const; |
|
103 |
|
104 IMPORT_C TBool HasAnySupport() const; |
|
105 |
|
106 private: |
|
107 // Holds the internal state |
|
108 TBitFlags32 iCapabilities; |
|
109 }; |
|
110 |
|
111 |
|
112 /** |
|
113 * Input Language Item class. |
|
114 * |
|
115 * This object bring together Symbian language code, a language name, and its capabilities |
|
116 * |
|
117 * This method is not meant to be derived from. |
|
118 * |
|
119 */ |
|
120 NONSHARABLE_CLASS(CAknInputLanguageItem) : public CBase |
|
121 { |
|
122 public: |
|
123 /** |
|
124 * static 2-stage construction of the object. The language name descriptor is copied |
|
125 * by the time the method returns. |
|
126 * |
|
127 * Normally this is constructed by the class that supplies the language information. It would |
|
128 * not normally be called by clients who want to find out about system input languages |
|
129 * |
|
130 * @param aLanguageCode Symbian OS language code |
|
131 * @param aName Language name to be attached to code |
|
132 * @param aCapabilities Sets the capabilities |
|
133 * @return Fully constructed input language item |
|
134 */ |
|
135 static CAknInputLanguageItem* NewL( TLanguage aLanguageCode, const TDesC& aName, TAknInputLanguageCapabilities aCapabilities ); |
|
136 |
|
137 /** |
|
138 * C++ destructor |
|
139 * |
|
140 */ |
|
141 IMPORT_C ~CAknInputLanguageItem(); |
|
142 |
|
143 IMPORT_C TLanguage LanguageCode() const; |
|
144 IMPORT_C TPtrC LanguageName() const; |
|
145 IMPORT_C TAknInputLanguageCapabilities Capabilities() const; |
|
146 |
|
147 private: |
|
148 /** |
|
149 * Sets only the langauge code |
|
150 */ |
|
151 CAknInputLanguageItem( TLanguage aLanguageCode); |
|
152 /** |
|
153 * 2nd stage construction. This sets the name and the capabilies |
|
154 */ |
|
155 void ConstructL( const TDesC& aName, TAknInputLanguageCapabilities aCapabilities ); |
|
156 |
|
157 private: |
|
158 TLanguage iLanguageCode; |
|
159 HBufC* iLanguageName; // Owned |
|
160 TAknInputLanguageCapabilities iCapabilities; |
|
161 TInt iSpare; // for expansion |
|
162 }; |
|
163 |
|
164 /** |
|
165 * |
|
166 * Class to hold a list of CAknInputLanguageItem objects |
|
167 * |
|
168 */ |
|
169 class CAknInputLanguageList : public CArrayPtrFlat<CAknInputLanguageItem>, public MDesCArray |
|
170 { |
|
171 public: |
|
172 /** |
|
173 * C++ Constructor |
|
174 * |
|
175 */ |
|
176 IMPORT_C CAknInputLanguageList(TInt aGranularity); |
|
177 |
|
178 /** |
|
179 * Destructor |
|
180 * |
|
181 */ |
|
182 IMPORT_C ~CAknInputLanguageList(); |
|
183 |
|
184 public: // from MDesCArray |
|
185 IMPORT_C TInt MdcaCount() const; |
|
186 IMPORT_C TPtrC MdcaPoint(TInt aIndex) const; |
|
187 }; |
|
188 |
|
189 /** |
|
190 * |
|
191 * Input Language information interface. This object is instantiated to create a standard interface |
|
192 * to the native input language services. |
|
193 * |
|
194 */ |
|
195 class CAknInputLanguageInfo : public CBase |
|
196 { |
|
197 public: |
|
198 /** |
|
199 * This method returns the input capabilities of a language. The capability object can then |
|
200 * be queried to see what it is capable of. |
|
201 * |
|
202 * @param aLanguageId Symbian language code |
|
203 * @return a structure indicating what the language is capable of |
|
204 */ |
|
205 virtual TAknInputLanguageCapabilities LanguageCapabilitiesFromLanguage(TLanguage aLanguageId) = 0; |
|
206 |
|
207 /** |
|
208 * Get the language name that corresponds to the passed-in Symbian OS language code. |
|
209 * This name should be localized, or not, depending upon the policy decided for the product |
|
210 * |
|
211 * @param aLanguageCode - language code for the language whose name is required |
|
212 * @return TAknLanguageName - buffer containing |
|
213 */ |
|
214 virtual TAknLanguageName LanguageName( TLanguage aLanguageCode ) const = 0; |
|
215 |
|
216 /** |
|
217 * Provide a language list corresponding to the input list of SymbianOS language codes. |
|
218 * The order of the languages in the output list is that order implemented in the |
|
219 * interface object, and the order of the input list of language codes is ignored. |
|
220 * |
|
221 * @param aInputLanguageList Append to this list; |
|
222 * @param aLanguageCodeList Append only languages whose code is in this list. If Null is passed, then no language code filtering is done |
|
223 * @param aCapabilityFilter Append only languages with capabilities set in this filter. |
|
224 * If a filter with no capabilities whatsoever is passed, then all capabilities are included |
|
225 * |
|
226 */ |
|
227 virtual void AppendLanguagesL( |
|
228 CAknInputLanguageList* aInputLanguageList, |
|
229 CArrayFix<TInt>* aLanguageCodeList, |
|
230 TAknInputLanguageCapabilities& aCapabilityFilter ) = 0; |
|
231 |
|
232 /** |
|
233 * Appends to an externally owned array of CAknInputLanguageItem-s. These can be interrogated to provide |
|
234 * information upon return. |
|
235 * |
|
236 * @param aInputLanguageList Passed-in array is appended to by this method |
|
237 */ |
|
238 virtual void AppendAvailableLanguagesL( CAknInputLanguageList* aInputLanguageList ) = 0; |
|
239 |
|
240 /** |
|
241 * Return a langauge that is suitable in the product for a URL input language |
|
242 * |
|
243 * @return TLanguage A language code for the designated URL language |
|
244 */ |
|
245 virtual TLanguage UrlLanguage() const = 0; |
|
246 }; |
|
247 |
|
248 /** |
|
249 * This factory class exists to supply an available input language interface |
|
250 */ |
|
251 class AknInputLanguageInfoFactory |
|
252 { |
|
253 public: |
|
254 /** |
|
255 * Factory method to return a generic object from which information on available |
|
256 * languages can be obtained. |
|
257 * |
|
258 * @return a pointer to a fully constructed object conformant to CAknInputLanguageInfo |
|
259 */ |
|
260 IMPORT_C static CAknInputLanguageInfo* CreateInputLanguageInfoL(); |
|
261 }; |
|
262 |
|
263 #endif // __AKNINPUTLANGUAGEINFO_H__ |
|
264 |
|
265 // End of File |