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