2 * Copyright (c) 2003-2006 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.
14 * Description: PtiLanguage class definitions.
31 #ifndef _PTI_LANGUAGE_H
32 #define _PTI_LANGUAGE_H
41 const TInt KMaxMultitapResourceFileName = 20;
42 const TInt KMaxQwertyResourceFileName = 32;
44 // FORWARD DECLARATIONS
45 class MPtiKeyMappings;
49 class CPtiKeyMapDataFactory;
52 * An item in list used for binding a core object to input mode.
63 * Helper class for storing keymapping pointers.
65 class TPtiKeyMappingsHolder
68 TPtiKeyMappingsHolder();
69 ~TPtiKeyMappingsHolder();
73 MPtiKeyMappings* iKeyMappings;
74 MPtiKeyMappings* iQwertyKeyMappings;
75 MPtiKeyMappings* iHalfQwertyMappings;
80 * Client side interface for querying PtiEngine language related attributes.
81 * All PtiEngine client side API methods related to handling languages access
82 * languages through this interface class.
88 * Returns a boolean value indicating whether this language supports
89 * requested input mode.
91 * @param aMode A input mode to be queried.
92 * @return ETrue if this language supports requested input mode.
95 virtual TBool HasInputMode(TPtiEngineInputMode aMode) const = 0;
98 * Returns list of all inputmodes currently supported by this language.
100 * @param aResult List of supported input modes will be stored here.
102 virtual void GetAvailableInputModesL(CArrayFix<TInt>* aResult) = 0;
105 * Returns Symbian OS language code for this language.
107 * @return Symbian OS language code.
109 virtual TInt LanguageCode() const = 0;
112 * Returns localized name for this language.
114 * @return A constant pointer to localized language name.
116 virtual TPtrC LocalizedName() const = 0;
122 * Implementation class for a PtiEngine language. This class is used
123 * mainly in PtiEngine and core objects code and it implements clients side
124 * language interface class.
125 * PtiEngine maintains language list containing instances of this class.
126 * CPtiCoreLanguage class also maintains list of <core <-> input mode> bindings.
128 NONSHARABLE_CLASS(CPtiCoreLanguage) : public CBase, public MPtiLanguage
131 IMPORT_C static CPtiCoreLanguage* NewL();
132 IMPORT_C ~CPtiCoreLanguage();
135 * Sets multitapping keymappings.
137 * @param aMappings Pointer to keymappings object to be set.
139 IMPORT_C void SetKeyMappings(MPtiKeyMappings* aMappings);
142 * Sets qwerty keymappings.
144 * @param aMappings Pointer to keymappings object to be set.
146 IMPORT_C void SetQwertyKeyMappings(MPtiKeyMappings* aMappings);
149 * Sets Symbian OS language code for this language.
151 * @param aCode Language code to be set.
153 IMPORT_C void SetLanguageCode(TInt aCode);
156 * Returns pointer to multitapping keymappings object.
158 * @return Pointer to current multitapping keymappings.
159 * NULL if no multitapping keymappings available.
161 IMPORT_C MPtiKeyMappings* GetKeymappings() const;
164 * Returns pointer to qwerty keymappings object.
166 * @return Pointer to current qwerty keymappings.
167 * NULL if no qwerty keymappings available.
169 IMPORT_C MPtiKeyMappings* GetQwertyKeymappings() const;
172 * Resets current multitapping keymappings.
174 IMPORT_C void ClearMultitapping();
177 * Resets current qwerty keymappings.
179 IMPORT_C void ClearQwerty();
182 * Sets localized language name.
184 * @param aName Language name to be set.
186 IMPORT_C void SetLocalizedName(const TDesC& aName);
189 * Returns descriptor pointing to localized language name.
191 * @return Localoized language name descriptor.
193 IMPORT_C TDes& LocalizedNameDes();
196 * Returns core object for given input mode.
198 * @aMode Input mode to be queried.
199 * @return Pointer to core object.
200 * NULL if no core object is asigned to given input mode.
202 IMPORT_C MPtiCore* GetCore(TPtiEngineInputMode aMode);
205 * Sets core object for given input mode. If input mode already
206 * has a core object asigned to it, it will be replaced.
208 * @param aCore Pointer to core object
209 * @param aMode Input mode for core object.
211 IMPORT_C void SetCore(MPtiCore *aCore, TPtiEngineInputMode aMode);
214 * Returns an array of available input modes for this language object.
216 * @param aResult Resulting input mode list.
218 IMPORT_C void GetAvailableInputModesL(CArrayFix<TInt>* aResult);
221 * Returns an array of available input modes for this language object.
223 * @param aResult Resulting input mode list.
226 IMPORT_C void GetAvailableInputModesL(RArray<TInt>& aResult);
229 * Returns a boolean value indicating whether this language
230 * supports given input mode.
232 * @param aMode Input mode to be queried.
233 * @return ETrue if input mode is supported.
236 IMPORT_C TBool HasInputMode(TPtiEngineInputMode aMode) const;
239 * Returns Symbian OS language code for this language object.
241 * @return Language code
243 inline TInt LanguageCode() const;
246 * Returns constant descriptor pointing to localized name for
249 * @return Localized language name.
251 inline TPtrC LocalizedName() const;
254 * Returns a boolean value indicating whether given core object is
255 * already asigned to some input mode for this language.
257 * @param aCore A core object to be queried.
258 * @return ETrue if given core object is asigned to any input mode.
261 IMPORT_C TBool HasCore(MPtiCore* aCore) const;
264 * Removes detachs given core object from all input modes it is attached to.
266 * @param aCore A core object to be detached.
268 IMPORT_C void RemoveCore(MPtiCore* aCore);
271 * Returns pointer to half qwerty keymappings object.
273 * @return Pointer to half qwerty keymappings.
274 * NULL if no half qwerty keymappings available.
276 IMPORT_C MPtiKeyMappings* GetHalfQwertyKeymappings() const;
279 * Sets half qwerty keymappings.
281 * @param aMappings Pointer to keymappings object to be set.
283 IMPORT_C void SetHalfQwertyKeyMappings(MPtiKeyMappings* aMappings);
286 * Resets current half qwerty keymappings.
288 IMPORT_C void ClearHalfQwerty();
291 * Sets keymap data factory class.
294 * @param aFactory A keymap data factory to be used.
296 void SetKeyMapDataFactory(CPtiKeyMapDataFactory* aFactory);
299 * Returns active data factory.
302 * @return A pointer to active data factory.
304 IMPORT_C CPtiKeyMapDataFactory* DataFactory() const;
307 * Returns raw keymap data object.
310 * @return A pointer to raw keymap data object.
312 IMPORT_C CPtiKeyMapData* RawKeyMapData() const;
318 void LoadKeymappingsL() const;
319 CPtiCore* GetCoreForNumericMode() const;
320 void SetCoreLocal(MPtiCore *aCore, TPtiEngineInputMode aMode) const;
324 TPtiKeyMappingsHolder* iHolder;
325 CPtiKeyMapDataFactory* iDataFactory; // Not owned
326 TBuf<KMaxLanguageNameLength> iLocalizedName;
327 mutable RArray<TPtiCoreBinding> iCores;
328 mutable CPtiKeyMapData* iKeyMapData; // Owns
331 #include <PtiLanguage.inl>
333 #endif // _PTI_LANGUAGE_H