author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2003-2006 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: PtiLanguage class definitions. |
williamr@2 | 15 |
* |
williamr@2 | 16 |
*/ |
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 |
#ifndef _PTI_LANGUAGE_H |
williamr@2 | 32 |
#define _PTI_LANGUAGE_H |
williamr@2 | 33 |
|
williamr@2 | 34 |
// INCLUDES |
williamr@2 | 35 |
#include <e32base.h> |
williamr@2 | 36 |
#include <f32file.h> |
williamr@2 | 37 |
#include <barsc.h> |
williamr@2 | 38 |
#include <barsread.h> |
williamr@2 | 39 |
#include "PtiDefs.h" |
williamr@2 | 40 |
|
williamr@2 | 41 |
const TInt KMaxMultitapResourceFileName = 20; |
williamr@2 | 42 |
const TInt KMaxQwertyResourceFileName = 32; |
williamr@2 | 43 |
|
williamr@2 | 44 |
// FORWARD DECLARATIONS |
williamr@2 | 45 |
class MPtiKeyMappings; |
williamr@2 | 46 |
class MPtiCore; |
williamr@2 | 47 |
class CPtiCore; |
williamr@2 | 48 |
class CPtiKeyMapData; |
williamr@2 | 49 |
class CPtiKeyMapDataFactory; |
williamr@2 | 50 |
|
williamr@2 | 51 |
/** |
williamr@2 | 52 |
* An item in list used for binding a core object to input mode. |
williamr@2 | 53 |
*/ |
williamr@2 | 54 |
class TPtiCoreBinding |
williamr@2 | 55 |
{ |
williamr@2 | 56 |
public: |
williamr@2 | 57 |
TInt iInputMode; |
williamr@2 | 58 |
MPtiCore* iCore; |
williamr@2 | 59 |
}; |
williamr@2 | 60 |
|
williamr@2 | 61 |
|
williamr@2 | 62 |
/* |
williamr@2 | 63 |
* Helper class for storing keymapping pointers. |
williamr@2 | 64 |
*/ |
williamr@2 | 65 |
class TPtiKeyMappingsHolder |
williamr@2 | 66 |
{ |
williamr@2 | 67 |
public: |
williamr@2 | 68 |
TPtiKeyMappingsHolder(); |
williamr@2 | 69 |
~TPtiKeyMappingsHolder(); |
williamr@2 | 70 |
|
williamr@2 | 71 |
void Clear(); |
williamr@2 | 72 |
|
williamr@2 | 73 |
MPtiKeyMappings* iKeyMappings; |
williamr@2 | 74 |
MPtiKeyMappings* iQwertyKeyMappings; |
williamr@2 | 75 |
MPtiKeyMappings* iHalfQwertyMappings; |
williamr@2 | 76 |
}; |
williamr@2 | 77 |
|
williamr@2 | 78 |
|
williamr@2 | 79 |
/** |
williamr@2 | 80 |
* Client side interface for querying PtiEngine language related attributes. |
williamr@2 | 81 |
* All PtiEngine client side API methods related to handling languages access |
williamr@2 | 82 |
* languages through this interface class. |
williamr@2 | 83 |
*/ |
williamr@2 | 84 |
class MPtiLanguage |
williamr@2 | 85 |
{ |
williamr@2 | 86 |
public: |
williamr@2 | 87 |
/** |
williamr@2 | 88 |
* Returns a boolean value indicating whether this language supports |
williamr@2 | 89 |
* requested input mode. |
williamr@2 | 90 |
* |
williamr@2 | 91 |
* @param aMode A input mode to be queried. |
williamr@2 | 92 |
* @return ETrue if this language supports requested input mode. |
williamr@2 | 93 |
* EFalse otherwise. |
williamr@2 | 94 |
*/ |
williamr@2 | 95 |
virtual TBool HasInputMode(TPtiEngineInputMode aMode) const = 0; |
williamr@2 | 96 |
|
williamr@2 | 97 |
/** |
williamr@2 | 98 |
* Returns list of all inputmodes currently supported by this language. |
williamr@2 | 99 |
* |
williamr@2 | 100 |
* @param aResult List of supported input modes will be stored here. |
williamr@2 | 101 |
*/ |
williamr@2 | 102 |
virtual void GetAvailableInputModesL(CArrayFix<TInt>* aResult) = 0; |
williamr@2 | 103 |
|
williamr@2 | 104 |
/** |
williamr@2 | 105 |
* Returns Symbian OS language code for this language. |
williamr@2 | 106 |
* |
williamr@2 | 107 |
* @return Symbian OS language code. |
williamr@2 | 108 |
*/ |
williamr@2 | 109 |
virtual TInt LanguageCode() const = 0; |
williamr@2 | 110 |
|
williamr@2 | 111 |
/** |
williamr@2 | 112 |
* Returns localized name for this language. |
williamr@2 | 113 |
* |
williamr@2 | 114 |
* @return A constant pointer to localized language name. |
williamr@2 | 115 |
*/ |
williamr@2 | 116 |
virtual TPtrC LocalizedName() const = 0; |
williamr@2 | 117 |
}; |
williamr@2 | 118 |
|
williamr@2 | 119 |
|
williamr@2 | 120 |
|
williamr@2 | 121 |
/** |
williamr@2 | 122 |
* Implementation class for a PtiEngine language. This class is used |
williamr@2 | 123 |
* mainly in PtiEngine and core objects code and it implements clients side |
williamr@2 | 124 |
* language interface class. |
williamr@2 | 125 |
* PtiEngine maintains language list containing instances of this class. |
williamr@2 | 126 |
* CPtiCoreLanguage class also maintains list of <core <-> input mode> bindings. |
williamr@2 | 127 |
*/ |
williamr@2 | 128 |
NONSHARABLE_CLASS(CPtiCoreLanguage) : public CBase, public MPtiLanguage |
williamr@2 | 129 |
{ |
williamr@2 | 130 |
public: |
williamr@2 | 131 |
IMPORT_C static CPtiCoreLanguage* NewL(); |
williamr@2 | 132 |
IMPORT_C ~CPtiCoreLanguage(); |
williamr@2 | 133 |
|
williamr@2 | 134 |
/** |
williamr@2 | 135 |
* Sets multitapping keymappings. |
williamr@2 | 136 |
* |
williamr@2 | 137 |
* @param aMappings Pointer to keymappings object to be set. |
williamr@2 | 138 |
*/ |
williamr@2 | 139 |
IMPORT_C void SetKeyMappings(MPtiKeyMappings* aMappings); |
williamr@2 | 140 |
|
williamr@2 | 141 |
/** |
williamr@2 | 142 |
* Sets qwerty keymappings. |
williamr@2 | 143 |
* |
williamr@2 | 144 |
* @param aMappings Pointer to keymappings object to be set. |
williamr@2 | 145 |
*/ |
williamr@2 | 146 |
IMPORT_C void SetQwertyKeyMappings(MPtiKeyMappings* aMappings); |
williamr@2 | 147 |
|
williamr@2 | 148 |
/** |
williamr@2 | 149 |
* Sets Symbian OS language code for this language. |
williamr@2 | 150 |
* |
williamr@2 | 151 |
* @param aCode Language code to be set. |
williamr@2 | 152 |
*/ |
williamr@2 | 153 |
IMPORT_C void SetLanguageCode(TInt aCode); |
williamr@2 | 154 |
|
williamr@2 | 155 |
/** |
williamr@2 | 156 |
* Returns pointer to multitapping keymappings object. |
williamr@2 | 157 |
* |
williamr@2 | 158 |
* @return Pointer to current multitapping keymappings. |
williamr@2 | 159 |
* NULL if no multitapping keymappings available. |
williamr@2 | 160 |
*/ |
williamr@2 | 161 |
IMPORT_C MPtiKeyMappings* GetKeymappings() const; |
williamr@2 | 162 |
|
williamr@2 | 163 |
/** |
williamr@2 | 164 |
* Returns pointer to qwerty keymappings object. |
williamr@2 | 165 |
* |
williamr@2 | 166 |
* @return Pointer to current qwerty keymappings. |
williamr@2 | 167 |
* NULL if no qwerty keymappings available. |
williamr@2 | 168 |
*/ |
williamr@2 | 169 |
IMPORT_C MPtiKeyMappings* GetQwertyKeymappings() const; |
williamr@2 | 170 |
|
williamr@2 | 171 |
/** |
williamr@2 | 172 |
* Resets current multitapping keymappings. |
williamr@2 | 173 |
*/ |
williamr@2 | 174 |
IMPORT_C void ClearMultitapping(); |
williamr@2 | 175 |
|
williamr@2 | 176 |
/** |
williamr@2 | 177 |
* Resets current qwerty keymappings. |
williamr@2 | 178 |
*/ |
williamr@2 | 179 |
IMPORT_C void ClearQwerty(); |
williamr@2 | 180 |
|
williamr@2 | 181 |
/** |
williamr@2 | 182 |
* Sets localized language name. |
williamr@2 | 183 |
* |
williamr@2 | 184 |
* @param aName Language name to be set. |
williamr@2 | 185 |
*/ |
williamr@2 | 186 |
IMPORT_C void SetLocalizedName(const TDesC& aName); |
williamr@2 | 187 |
|
williamr@2 | 188 |
/** |
williamr@2 | 189 |
* Returns descriptor pointing to localized language name. |
williamr@2 | 190 |
* |
williamr@2 | 191 |
* @return Localoized language name descriptor. |
williamr@2 | 192 |
*/ |
williamr@2 | 193 |
IMPORT_C TDes& LocalizedNameDes(); |
williamr@2 | 194 |
|
williamr@2 | 195 |
/** |
williamr@2 | 196 |
* Returns core object for given input mode. |
williamr@2 | 197 |
* |
williamr@2 | 198 |
* @aMode Input mode to be queried. |
williamr@2 | 199 |
* @return Pointer to core object. |
williamr@2 | 200 |
* NULL if no core object is asigned to given input mode. |
williamr@2 | 201 |
*/ |
williamr@2 | 202 |
IMPORT_C MPtiCore* GetCore(TPtiEngineInputMode aMode); |
williamr@2 | 203 |
|
williamr@2 | 204 |
/** |
williamr@2 | 205 |
* Sets core object for given input mode. If input mode already |
williamr@2 | 206 |
* has a core object asigned to it, it will be replaced. |
williamr@2 | 207 |
* |
williamr@2 | 208 |
* @param aCore Pointer to core object |
williamr@2 | 209 |
* @param aMode Input mode for core object. |
williamr@2 | 210 |
*/ |
williamr@2 | 211 |
IMPORT_C void SetCore(MPtiCore *aCore, TPtiEngineInputMode aMode); |
williamr@2 | 212 |
|
williamr@2 | 213 |
/** |
williamr@2 | 214 |
* Returns an array of available input modes for this language object. |
williamr@2 | 215 |
* |
williamr@2 | 216 |
* @param aResult Resulting input mode list. |
williamr@2 | 217 |
*/ |
williamr@2 | 218 |
IMPORT_C void GetAvailableInputModesL(CArrayFix<TInt>* aResult); |
williamr@2 | 219 |
|
williamr@2 | 220 |
/** |
williamr@2 | 221 |
* Returns an array of available input modes for this language object. |
williamr@2 | 222 |
* |
williamr@2 | 223 |
* @param aResult Resulting input mode list. |
williamr@2 | 224 |
* @since 3.0 |
williamr@2 | 225 |
*/ |
williamr@2 | 226 |
IMPORT_C void GetAvailableInputModesL(RArray<TInt>& aResult); |
williamr@2 | 227 |
|
williamr@2 | 228 |
/** |
williamr@2 | 229 |
* Returns a boolean value indicating whether this language |
williamr@2 | 230 |
* supports given input mode. |
williamr@2 | 231 |
* |
williamr@2 | 232 |
* @param aMode Input mode to be queried. |
williamr@2 | 233 |
* @return ETrue if input mode is supported. |
williamr@2 | 234 |
* EFalse otherwise. |
williamr@2 | 235 |
*/ |
williamr@2 | 236 |
IMPORT_C TBool HasInputMode(TPtiEngineInputMode aMode) const; |
williamr@2 | 237 |
|
williamr@2 | 238 |
/** |
williamr@2 | 239 |
* Returns Symbian OS language code for this language object. |
williamr@2 | 240 |
* |
williamr@2 | 241 |
* @return Language code |
williamr@2 | 242 |
*/ |
williamr@2 | 243 |
inline TInt LanguageCode() const; |
williamr@2 | 244 |
|
williamr@2 | 245 |
/** |
williamr@2 | 246 |
* Returns constant descriptor pointing to localized name for |
williamr@2 | 247 |
* this language. |
williamr@2 | 248 |
* |
williamr@2 | 249 |
* @return Localized language name. |
williamr@2 | 250 |
*/ |
williamr@2 | 251 |
inline TPtrC LocalizedName() const; |
williamr@2 | 252 |
|
williamr@2 | 253 |
/** |
williamr@2 | 254 |
* Returns a boolean value indicating whether given core object is |
williamr@2 | 255 |
* already asigned to some input mode for this language. |
williamr@2 | 256 |
* |
williamr@2 | 257 |
* @param aCore A core object to be queried. |
williamr@2 | 258 |
* @return ETrue if given core object is asigned to any input mode. |
williamr@2 | 259 |
* EFalse otherwise. |
williamr@2 | 260 |
*/ |
williamr@2 | 261 |
IMPORT_C TBool HasCore(MPtiCore* aCore) const; |
williamr@2 | 262 |
|
williamr@2 | 263 |
/** |
williamr@2 | 264 |
* Removes detachs given core object from all input modes it is attached to. |
williamr@2 | 265 |
* |
williamr@2 | 266 |
* @param aCore A core object to be detached. |
williamr@2 | 267 |
*/ |
williamr@2 | 268 |
IMPORT_C void RemoveCore(MPtiCore* aCore); |
williamr@2 | 269 |
|
williamr@2 | 270 |
/** |
williamr@2 | 271 |
* Returns pointer to half qwerty keymappings object. |
williamr@2 | 272 |
* |
williamr@2 | 273 |
* @return Pointer to half qwerty keymappings. |
williamr@2 | 274 |
* NULL if no half qwerty keymappings available. |
williamr@2 | 275 |
*/ |
williamr@2 | 276 |
IMPORT_C MPtiKeyMappings* GetHalfQwertyKeymappings() const; |
williamr@2 | 277 |
|
williamr@2 | 278 |
/** |
williamr@2 | 279 |
* Sets half qwerty keymappings. |
williamr@2 | 280 |
* |
williamr@2 | 281 |
* @param aMappings Pointer to keymappings object to be set. |
williamr@2 | 282 |
*/ |
williamr@2 | 283 |
IMPORT_C void SetHalfQwertyKeyMappings(MPtiKeyMappings* aMappings); |
williamr@2 | 284 |
|
williamr@2 | 285 |
/** |
williamr@2 | 286 |
* Resets current half qwerty keymappings. |
williamr@2 | 287 |
*/ |
williamr@2 | 288 |
IMPORT_C void ClearHalfQwerty(); |
williamr@2 | 289 |
|
williamr@2 | 290 |
/** |
williamr@2 | 291 |
* Sets keymap data factory class. |
williamr@2 | 292 |
* |
williamr@2 | 293 |
* @since S60 5.0 |
williamr@2 | 294 |
* @param aFactory A keymap data factory to be used. |
williamr@2 | 295 |
*/ |
williamr@2 | 296 |
void SetKeyMapDataFactory(CPtiKeyMapDataFactory* aFactory); |
williamr@2 | 297 |
|
williamr@2 | 298 |
/** |
williamr@2 | 299 |
* Returns active data factory. |
williamr@2 | 300 |
* |
williamr@2 | 301 |
* @since S60 5.0 |
williamr@2 | 302 |
* @return A pointer to active data factory. |
williamr@2 | 303 |
*/ |
williamr@2 | 304 |
IMPORT_C CPtiKeyMapDataFactory* DataFactory() const; |
williamr@2 | 305 |
|
williamr@2 | 306 |
/** |
williamr@2 | 307 |
* Returns raw keymap data object. |
williamr@2 | 308 |
* |
williamr@2 | 309 |
* @since S60 5.0 |
williamr@2 | 310 |
* @return A pointer to raw keymap data object. |
williamr@2 | 311 |
*/ |
williamr@2 | 312 |
IMPORT_C CPtiKeyMapData* RawKeyMapData() const; |
williamr@2 | 313 |
|
williamr@2 | 314 |
private: |
williamr@2 | 315 |
CPtiCoreLanguage(); |
williamr@2 | 316 |
void ConstructL(); |
williamr@2 | 317 |
void Clear(); |
williamr@2 | 318 |
void LoadKeymappingsL() const; |
williamr@2 | 319 |
CPtiCore* GetCoreForNumericMode() const; |
williamr@2 | 320 |
void SetCoreLocal(MPtiCore *aCore, TPtiEngineInputMode aMode) const; |
williamr@2 | 321 |
|
williamr@2 | 322 |
private: |
williamr@2 | 323 |
TInt iLanguageCode; |
williamr@2 | 324 |
TPtiKeyMappingsHolder* iHolder; |
williamr@2 | 325 |
CPtiKeyMapDataFactory* iDataFactory; // Not owned |
williamr@2 | 326 |
TBuf<KMaxLanguageNameLength> iLocalizedName; |
williamr@2 | 327 |
mutable RArray<TPtiCoreBinding> iCores; |
williamr@2 | 328 |
mutable CPtiKeyMapData* iKeyMapData; // Owns |
williamr@2 | 329 |
}; |
williamr@2 | 330 |
|
williamr@2 | 331 |
#include <PtiLanguage.inl> |
williamr@2 | 332 |
|
williamr@2 | 333 |
#endif // _PTI_LANGUAGE_H |
williamr@2 | 334 |
|
williamr@2 | 335 |
// End of file |
williamr@2 | 336 |