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