PtiLanguage.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name       : PtiLanguage.h
00004 *  Part of    : PtiEngine
00005 *  Description: PtiLanguage class definitions.
00006 *  Version:
00007 *
00008 *  Copyright © 2003-2006 Nokia Corporation.
00009 *  This material, including documentation and any related 
00010 *  computer programs, is protected by copyright controlled by 
00011 *  Nokia Corporation. All rights are reserved. Copying, 
00012 *  including reproducing, storing,  adapting or translating, any 
00013 *  or all of this material requires the prior written consent of 
00014 *  Nokia Corporation. This material also contains confidential 
00015 *  information which may not be disclosed to others without the 
00016 *  prior written consent of Nokia Corporation.
00017 * ============================================================================
00018 */
00019 #ifndef _PTI_LANGUAGE_H
00020 #define _PTI_LANGUAGE_H 
00021 
00022 // INCLUDES
00023 #include <e32base.h>
00024 #include <f32file.h>
00025 #include <barsc.h>
00026 #include <barsread.h>
00027 #include "PtiDefs.h"
00028 
00029 const TInt KMaxMultitapResourceFileName = 20;
00030 const TInt KMaxQwertyResourceFileName = 32;
00031 
00032 // FORWARD DECLARATIONS
00033 class MPtiKeyMappings;
00034 class MPtiCore;
00035 class CPtiCore;
00036 class CPtiKeyMapData;
00037 class CPtiKeyMapDataFactory;
00038 
00042 class TPtiCoreBinding
00043         {
00044         public:
00045                 TInt iInputMode;
00046                 MPtiCore* iCore;
00047         };
00048 
00049 
00050 /*
00051 * Helper class for storing keymapping pointers.
00052 */
00053 class TPtiKeyMappingsHolder
00054     {
00055     public:
00056         TPtiKeyMappingsHolder();
00057         ~TPtiKeyMappingsHolder();
00058         
00059         void Clear();
00060     
00061         MPtiKeyMappings* iKeyMappings;
00062             MPtiKeyMappings* iQwertyKeyMappings;
00063         MPtiKeyMappings* iHalfQwertyMappings;   
00064     };
00065 
00066 
00072 class MPtiLanguage
00073         {
00074         public:
00083                 virtual TBool HasInputMode(TPtiEngineInputMode aMode) const = 0;
00084                 
00090                 virtual void GetAvailableInputModesL(CArrayFix<TInt>* aResult) = 0;
00091                 
00097                 virtual TInt  LanguageCode() const = 0;
00098                 
00104                 virtual TPtrC LocalizedName() const = 0;
00105         };
00106 
00107 
00108 
00116 NONSHARABLE_CLASS(CPtiCoreLanguage) : public CBase, public MPtiLanguage
00117         {
00118         public:
00119                 IMPORT_C static CPtiCoreLanguage* NewL();
00120                 IMPORT_C ~CPtiCoreLanguage();
00121                 
00127                 IMPORT_C void SetKeyMappings(MPtiKeyMappings* aMappings);
00128                 
00134                 IMPORT_C void SetQwertyKeyMappings(MPtiKeyMappings* aMappings);
00135                 
00141                 IMPORT_C void SetLanguageCode(TInt aCode);
00142                 
00149                 IMPORT_C MPtiKeyMappings* GetKeymappings() const;
00150                 
00157                 IMPORT_C MPtiKeyMappings* GetQwertyKeymappings() const;
00158                 
00162                 IMPORT_C void ClearMultitapping();
00163                 
00167                 IMPORT_C void ClearQwerty();
00168                 
00174                 IMPORT_C void SetLocalizedName(const TDesC& aName);
00175                 
00181                 IMPORT_C TDes& LocalizedNameDes();
00182                 
00190                 IMPORT_C MPtiCore* GetCore(TPtiEngineInputMode aMode);
00191                 
00199                 IMPORT_C void SetCore(MPtiCore *aCore, TPtiEngineInputMode aMode);
00200 
00206                 IMPORT_C void GetAvailableInputModesL(CArrayFix<TInt>* aResult);
00207 
00214                 IMPORT_C void GetAvailableInputModesL(RArray<TInt>& aResult);
00215 
00224                 IMPORT_C TBool HasInputMode(TPtiEngineInputMode aMode) const;
00225                                 
00231                 inline TInt  LanguageCode() const;
00232                 
00239                 inline TPtrC LocalizedName() const;
00240                 
00249                 IMPORT_C TBool HasCore(MPtiCore* aCore) const;
00250                 
00256                 IMPORT_C void RemoveCore(MPtiCore* aCore);
00257                 
00264                 IMPORT_C MPtiKeyMappings* GetHalfQwertyKeymappings() const;                             
00265                 
00271                 IMPORT_C void SetHalfQwertyKeyMappings(MPtiKeyMappings* aMappings);             
00272                 
00276                 IMPORT_C void ClearHalfQwerty();
00277                 
00284         void SetKeyMapDataFactory(CPtiKeyMapDataFactory* aFactory);
00285         
00292         IMPORT_C CPtiKeyMapDataFactory* DataFactory() const;                            
00293         
00300         IMPORT_C CPtiKeyMapData* RawKeyMapData() const;         
00301         
00302         private:
00303                 CPtiCoreLanguage();
00304                 void ConstructL();
00305                 void Clear();
00306                 void LoadKeymappingsL() const;
00307                 CPtiCore* GetCoreForNumericMode() const;
00308                 void SetCoreLocal(MPtiCore *aCore, TPtiEngineInputMode aMode) const;
00309                                                                                 
00310         private:
00311                 TInt iLanguageCode;
00312                 TPtiKeyMappingsHolder* iHolder;
00313                 CPtiKeyMapDataFactory* iDataFactory;    // Not owned
00314                 TBuf<KMaxLanguageNameLength> iLocalizedName;
00315                 mutable RArray<TPtiCoreBinding> iCores;         
00316                 mutable CPtiKeyMapData* iKeyMapData;    // Owns
00317         };
00318 
00319 #include <PtiLanguage.inl>
00320 
00321 #endif // _PTI_LANGUAGE_H
00322 
00323 // End of file
00324 

Copyright © Nokia Corporation 2001-2007
Back to top