2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Interface class providing information on available input languages
16 * This header is exported
35 #ifndef __AKNINPUTLANGUAGEINFO_H__
36 #define __AKNINPUTLANGUAGEINFO_H__
46 #include <babitflags.h>
49 typedef TBuf<32> TAknLanguageName;
55 * Input language capabilities
58 class TAknInputLanguageCapabilities
62 * These indices are used to set/clear capabilities.
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
70 enum TAknInputLanguageCapabilityIndex
72 EMultitap = 0x00000000,
73 EPredictive = 0x00000001
77 * C++ Constructor. Initializes the internal state to "no capabilities"
79 IMPORT_C TAknInputLanguageCapabilities();
82 * Sets the capability at a given index index to the logical value passed
84 * @param aCapability which capability to set
85 * @param aSet ETrue - enable the capability; EFalse - disable the capability
87 IMPORT_C void AssignCapability( TInt aCapabilityIndex, TBool aSet );
92 * @param aCapability which capability to test
93 * @return EFalse if the capability is not present; not EFalse otherwise
95 IMPORT_C TBool HasCapability( TInt aCapabilityIndex ) const;
98 * Sets all capabilities (existing and potential)
100 IMPORT_C void SetAllCapabilities();
102 IMPORT_C TAknInputLanguageCapabilities FilteredCapabilities( TAknInputLanguageCapabilities& aFilter) const;
104 IMPORT_C TBool HasAnySupport() const;
107 // Holds the internal state
108 TBitFlags32 iCapabilities;
113 * Input Language Item class.
115 * This object bring together Symbian language code, a language name, and its capabilities
117 * This method is not meant to be derived from.
120 NONSHARABLE_CLASS(CAknInputLanguageItem) : public CBase
124 * static 2-stage construction of the object. The language name descriptor is copied
125 * by the time the method returns.
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
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
135 static CAknInputLanguageItem* NewL( TLanguage aLanguageCode, const TDesC& aName, TAknInputLanguageCapabilities aCapabilities );
141 IMPORT_C ~CAknInputLanguageItem();
143 IMPORT_C TLanguage LanguageCode() const;
144 IMPORT_C TPtrC LanguageName() const;
145 IMPORT_C TAknInputLanguageCapabilities Capabilities() const;
149 * Sets only the langauge code
151 CAknInputLanguageItem( TLanguage aLanguageCode);
153 * 2nd stage construction. This sets the name and the capabilies
155 void ConstructL( const TDesC& aName, TAknInputLanguageCapabilities aCapabilities );
158 TLanguage iLanguageCode;
159 HBufC* iLanguageName; // Owned
160 TAknInputLanguageCapabilities iCapabilities;
161 TInt iSpare; // for expansion
166 * Class to hold a list of CAknInputLanguageItem objects
169 class CAknInputLanguageList : public CArrayPtrFlat<CAknInputLanguageItem>, public MDesCArray
176 IMPORT_C CAknInputLanguageList(TInt aGranularity);
182 IMPORT_C ~CAknInputLanguageList();
184 public: // from MDesCArray
185 IMPORT_C TInt MdcaCount() const;
186 IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
191 * Input Language information interface. This object is instantiated to create a standard interface
192 * to the native input language services.
195 class CAknInputLanguageInfo : public CBase
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.
202 * @param aLanguageId Symbian language code
203 * @return a structure indicating what the language is capable of
205 virtual TAknInputLanguageCapabilities LanguageCapabilitiesFromLanguage(TLanguage aLanguageId) = 0;
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
211 * @param aLanguageCode - language code for the language whose name is required
212 * @return TAknLanguageName - buffer containing
214 virtual TAknLanguageName LanguageName( TLanguage aLanguageCode ) const = 0;
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.
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
227 virtual void AppendLanguagesL(
228 CAknInputLanguageList* aInputLanguageList,
229 CArrayFix<TInt>* aLanguageCodeList,
230 TAknInputLanguageCapabilities& aCapabilityFilter ) = 0;
233 * Appends to an externally owned array of CAknInputLanguageItem-s. These can be interrogated to provide
234 * information upon return.
236 * @param aInputLanguageList Passed-in array is appended to by this method
238 virtual void AppendAvailableLanguagesL( CAknInputLanguageList* aInputLanguageList ) = 0;
241 * Return a langauge that is suitable in the product for a URL input language
243 * @return TLanguage A language code for the designated URL language
245 virtual TLanguage UrlLanguage() const = 0;
249 * This factory class exists to supply an available input language interface
251 class AknInputLanguageInfoFactory
255 * Factory method to return a generic object from which information on available
256 * languages can be obtained.
258 * @return a pointer to a fully constructed object conformant to CAknInputLanguageInfo
260 IMPORT_C static CAknInputLanguageInfo* CreateInputLanguageInfoL();
263 #endif // __AKNINPUTLANGUAGEINFO_H__