1.1 --- a/epoc32/include/mw/ptilanguage.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/ptilanguage.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,336 @@
1.4 -ptilanguage.h
1.5 +/*
1.6 +* Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: PtiLanguage class definitions.
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +
1.29 +
1.30 +
1.31 +
1.32 +
1.33 +
1.34 +
1.35 +#ifndef _PTI_LANGUAGE_H
1.36 +#define _PTI_LANGUAGE_H
1.37 +
1.38 +// INCLUDES
1.39 +#include <e32base.h>
1.40 +#include <f32file.h>
1.41 +#include <barsc.h>
1.42 +#include <barsread.h>
1.43 +#include "PtiDefs.h"
1.44 +
1.45 +const TInt KMaxMultitapResourceFileName = 20;
1.46 +const TInt KMaxQwertyResourceFileName = 32;
1.47 +
1.48 +// FORWARD DECLARATIONS
1.49 +class MPtiKeyMappings;
1.50 +class MPtiCore;
1.51 +class CPtiCore;
1.52 +class CPtiKeyMapData;
1.53 +class CPtiKeyMapDataFactory;
1.54 +
1.55 +/**
1.56 +* An item in list used for binding a core object to input mode.
1.57 +*/
1.58 +class TPtiCoreBinding
1.59 + {
1.60 + public:
1.61 + TInt iInputMode;
1.62 + MPtiCore* iCore;
1.63 + };
1.64 +
1.65 +
1.66 +/*
1.67 +* Helper class for storing keymapping pointers.
1.68 +*/
1.69 +class TPtiKeyMappingsHolder
1.70 + {
1.71 + public:
1.72 + TPtiKeyMappingsHolder();
1.73 + ~TPtiKeyMappingsHolder();
1.74 +
1.75 + void Clear();
1.76 +
1.77 + MPtiKeyMappings* iKeyMappings;
1.78 + MPtiKeyMappings* iQwertyKeyMappings;
1.79 + MPtiKeyMappings* iHalfQwertyMappings;
1.80 + };
1.81 +
1.82 +
1.83 +/**
1.84 +* Client side interface for querying PtiEngine language related attributes.
1.85 +* All PtiEngine client side API methods related to handling languages access
1.86 +* languages through this interface class.
1.87 +*/
1.88 +class MPtiLanguage
1.89 + {
1.90 + public:
1.91 + /**
1.92 + * Returns a boolean value indicating whether this language supports
1.93 + * requested input mode.
1.94 + *
1.95 + * @param aMode A input mode to be queried.
1.96 + * @return ETrue if this language supports requested input mode.
1.97 + * EFalse otherwise.
1.98 + */
1.99 + virtual TBool HasInputMode(TPtiEngineInputMode aMode) const = 0;
1.100 +
1.101 + /**
1.102 + * Returns list of all inputmodes currently supported by this language.
1.103 + *
1.104 + * @param aResult List of supported input modes will be stored here.
1.105 + */
1.106 + virtual void GetAvailableInputModesL(CArrayFix<TInt>* aResult) = 0;
1.107 +
1.108 + /**
1.109 + * Returns Symbian OS language code for this language.
1.110 + *
1.111 + * @return Symbian OS language code.
1.112 + */
1.113 + virtual TInt LanguageCode() const = 0;
1.114 +
1.115 + /**
1.116 + * Returns localized name for this language.
1.117 + *
1.118 + * @return A constant pointer to localized language name.
1.119 + */
1.120 + virtual TPtrC LocalizedName() const = 0;
1.121 + };
1.122 +
1.123 +
1.124 +
1.125 +/**
1.126 +* Implementation class for a PtiEngine language. This class is used
1.127 +* mainly in PtiEngine and core objects code and it implements clients side
1.128 +* language interface class.
1.129 +* PtiEngine maintains language list containing instances of this class.
1.130 +* CPtiCoreLanguage class also maintains list of <core <-> input mode> bindings.
1.131 +*/
1.132 +NONSHARABLE_CLASS(CPtiCoreLanguage) : public CBase, public MPtiLanguage
1.133 + {
1.134 + public:
1.135 + IMPORT_C static CPtiCoreLanguage* NewL();
1.136 + IMPORT_C ~CPtiCoreLanguage();
1.137 +
1.138 + /**
1.139 + * Sets multitapping keymappings.
1.140 + *
1.141 + * @param aMappings Pointer to keymappings object to be set.
1.142 + */
1.143 + IMPORT_C void SetKeyMappings(MPtiKeyMappings* aMappings);
1.144 +
1.145 + /**
1.146 + * Sets qwerty keymappings.
1.147 + *
1.148 + * @param aMappings Pointer to keymappings object to be set.
1.149 + */
1.150 + IMPORT_C void SetQwertyKeyMappings(MPtiKeyMappings* aMappings);
1.151 +
1.152 + /**
1.153 + * Sets Symbian OS language code for this language.
1.154 + *
1.155 + * @param aCode Language code to be set.
1.156 + */
1.157 + IMPORT_C void SetLanguageCode(TInt aCode);
1.158 +
1.159 + /**
1.160 + * Returns pointer to multitapping keymappings object.
1.161 + *
1.162 + * @return Pointer to current multitapping keymappings.
1.163 + * NULL if no multitapping keymappings available.
1.164 + */
1.165 + IMPORT_C MPtiKeyMappings* GetKeymappings() const;
1.166 +
1.167 + /**
1.168 + * Returns pointer to qwerty keymappings object.
1.169 + *
1.170 + * @return Pointer to current qwerty keymappings.
1.171 + * NULL if no qwerty keymappings available.
1.172 + */
1.173 + IMPORT_C MPtiKeyMappings* GetQwertyKeymappings() const;
1.174 +
1.175 + /**
1.176 + * Resets current multitapping keymappings.
1.177 + */
1.178 + IMPORT_C void ClearMultitapping();
1.179 +
1.180 + /**
1.181 + * Resets current qwerty keymappings.
1.182 + */
1.183 + IMPORT_C void ClearQwerty();
1.184 +
1.185 + /**
1.186 + * Sets localized language name.
1.187 + *
1.188 + * @param aName Language name to be set.
1.189 + */
1.190 + IMPORT_C void SetLocalizedName(const TDesC& aName);
1.191 +
1.192 + /**
1.193 + * Returns descriptor pointing to localized language name.
1.194 + *
1.195 + * @return Localoized language name descriptor.
1.196 + */
1.197 + IMPORT_C TDes& LocalizedNameDes();
1.198 +
1.199 + /**
1.200 + * Returns core object for given input mode.
1.201 + *
1.202 + * @aMode Input mode to be queried.
1.203 + * @return Pointer to core object.
1.204 + * NULL if no core object is asigned to given input mode.
1.205 + */
1.206 + IMPORT_C MPtiCore* GetCore(TPtiEngineInputMode aMode);
1.207 +
1.208 + /**
1.209 + * Sets core object for given input mode. If input mode already
1.210 + * has a core object asigned to it, it will be replaced.
1.211 + *
1.212 + * @param aCore Pointer to core object
1.213 + * @param aMode Input mode for core object.
1.214 + */
1.215 + IMPORT_C void SetCore(MPtiCore *aCore, TPtiEngineInputMode aMode);
1.216 +
1.217 + /**
1.218 + * Returns an array of available input modes for this language object.
1.219 + *
1.220 + * @param aResult Resulting input mode list.
1.221 + */
1.222 + IMPORT_C void GetAvailableInputModesL(CArrayFix<TInt>* aResult);
1.223 +
1.224 + /**
1.225 + * Returns an array of available input modes for this language object.
1.226 + *
1.227 + * @param aResult Resulting input mode list.
1.228 + * @since 3.0
1.229 + */
1.230 + IMPORT_C void GetAvailableInputModesL(RArray<TInt>& aResult);
1.231 +
1.232 + /**
1.233 + * Returns a boolean value indicating whether this language
1.234 + * supports given input mode.
1.235 + *
1.236 + * @param aMode Input mode to be queried.
1.237 + * @return ETrue if input mode is supported.
1.238 + * EFalse otherwise.
1.239 + */
1.240 + IMPORT_C TBool HasInputMode(TPtiEngineInputMode aMode) const;
1.241 +
1.242 + /**
1.243 + * Returns Symbian OS language code for this language object.
1.244 + *
1.245 + * @return Language code
1.246 + */
1.247 + inline TInt LanguageCode() const;
1.248 +
1.249 + /**
1.250 + * Returns constant descriptor pointing to localized name for
1.251 + * this language.
1.252 + *
1.253 + * @return Localized language name.
1.254 + */
1.255 + inline TPtrC LocalizedName() const;
1.256 +
1.257 + /**
1.258 + * Returns a boolean value indicating whether given core object is
1.259 + * already asigned to some input mode for this language.
1.260 + *
1.261 + * @param aCore A core object to be queried.
1.262 + * @return ETrue if given core object is asigned to any input mode.
1.263 + * EFalse otherwise.
1.264 + */
1.265 + IMPORT_C TBool HasCore(MPtiCore* aCore) const;
1.266 +
1.267 + /**
1.268 + * Removes detachs given core object from all input modes it is attached to.
1.269 + *
1.270 + * @param aCore A core object to be detached.
1.271 + */
1.272 + IMPORT_C void RemoveCore(MPtiCore* aCore);
1.273 +
1.274 + /**
1.275 + * Returns pointer to half qwerty keymappings object.
1.276 + *
1.277 + * @return Pointer to half qwerty keymappings.
1.278 + * NULL if no half qwerty keymappings available.
1.279 + */
1.280 + IMPORT_C MPtiKeyMappings* GetHalfQwertyKeymappings() const;
1.281 +
1.282 + /**
1.283 + * Sets half qwerty keymappings.
1.284 + *
1.285 + * @param aMappings Pointer to keymappings object to be set.
1.286 + */
1.287 + IMPORT_C void SetHalfQwertyKeyMappings(MPtiKeyMappings* aMappings);
1.288 +
1.289 + /**
1.290 + * Resets current half qwerty keymappings.
1.291 + */
1.292 + IMPORT_C void ClearHalfQwerty();
1.293 +
1.294 + /**
1.295 + * Sets keymap data factory class.
1.296 + *
1.297 + * @since S60 5.0
1.298 + * @param aFactory A keymap data factory to be used.
1.299 + */
1.300 + void SetKeyMapDataFactory(CPtiKeyMapDataFactory* aFactory);
1.301 +
1.302 + /**
1.303 + * Returns active data factory.
1.304 + *
1.305 + * @since S60 5.0
1.306 + * @return A pointer to active data factory.
1.307 + */
1.308 + IMPORT_C CPtiKeyMapDataFactory* DataFactory() const;
1.309 +
1.310 + /**
1.311 + * Returns raw keymap data object.
1.312 + *
1.313 + * @since S60 5.0
1.314 + * @return A pointer to raw keymap data object.
1.315 + */
1.316 + IMPORT_C CPtiKeyMapData* RawKeyMapData() const;
1.317 +
1.318 + private:
1.319 + CPtiCoreLanguage();
1.320 + void ConstructL();
1.321 + void Clear();
1.322 + void LoadKeymappingsL() const;
1.323 + CPtiCore* GetCoreForNumericMode() const;
1.324 + void SetCoreLocal(MPtiCore *aCore, TPtiEngineInputMode aMode) const;
1.325 +
1.326 + private:
1.327 + TInt iLanguageCode;
1.328 + TPtiKeyMappingsHolder* iHolder;
1.329 + CPtiKeyMapDataFactory* iDataFactory; // Not owned
1.330 + TBuf<KMaxLanguageNameLength> iLocalizedName;
1.331 + mutable RArray<TPtiCoreBinding> iCores;
1.332 + mutable CPtiKeyMapData* iKeyMapData; // Owns
1.333 + };
1.334 +
1.335 +#include <PtiLanguage.inl>
1.336 +
1.337 +#endif // _PTI_LANGUAGE_H
1.338 +
1.339 +// End of file
1.340 +