epoc32/include/mw/ptikeymappings.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.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_KEY_MAPPINGS_H
    32 #define _PTI_KEY_MAPPINGS_H
    33 
    34 #include <e32base.h>
    35 #include "PtiDefs.h"
    36 
    37 
    38 const TInt KPtiKeyDataDeadKeySeparator = 0xffff;
    39 const TInt KPtiPinyinMarker = 0x2460;
    40 const TInt KPtiStrokeMarker = 0x2461;
    41 const TInt KPtiZhuyinMarker = 0x2462;
    42 const TInt KPtiCangjieMarker = 0x2463;
    43 const TInt KPtiGetAllMarker = 0x2464;
    44 
    45 // FORWARD DECLARATIONS
    46 class CPtiKeyMapData;
    47 
    48 // 
    49 // CPtiQwertyKeymappingsExtension
    50 //
    51 
    52 NONSHARABLE_CLASS(CPtiQwertyKeymappingsExtension) : public CBase
    53 	{
    54 	public:
    55 		static CPtiQwertyKeymappingsExtension* NewL();
    56 		~CPtiQwertyKeymappingsExtension();		
    57 	
    58 	private:
    59 		CPtiQwertyKeymappingsExtension();
    60 	
    61 	public:
    62 		TUint16 iLastChar;	       // for Vietnamese 			
    63 		TInt16 iLastTone;          // for Vietnamese
    64 		TUint16 iReplaced;	       // for Vietnamese
    65 		TPtiTextCase iVowelCase;   // for Vietnamese
    66 		TPtiKey iLastToneKey;      // for Vietnamese			
    67 	};
    68 
    69 
    70 //
    71 // TPtiKeyMapping
    72 //
    73 
    74 class TPtiKeyMapping  
    75 	{
    76 	public:	
    77 		TInt iIndex;
    78 		TInt iNumChars;
    79 	};
    80 	
    81 
    82 //
    83 // TPtiReplacedMapping
    84 //
    85 	
    86 const TInt KMaxReplacedMappingCharacters = 5;		
    87 class TPtiReplacedMapping
    88 	{
    89 	public:
    90 		TPtiKey iKey;
    91 		TPtiTextCase iCase;	
    92 		TPtiEngineInputMode iMode;
    93 		TPtiKeyboardType iKeyboardType;
    94 		TInt iNumChars;
    95 		TUint16 iChrs[KMaxReplacedMappingCharacters];
    96 	};	
    97 
    98 
    99 /**
   100 * MPtiKeyMappings
   101 *
   102 * Interface class for PtiEngine keymapping functionality.
   103 */
   104 class MPtiKeyMappings
   105 	{
   106 	public:
   107 		virtual ~MPtiKeyMappings() {}
   108 		
   109 		/**
   110 		* Starts mapping new key. Will return first character bound to given
   111 		* key in given text case. 		
   112 		*
   113 		* @param aKey   A key to be mapped.
   114 		* @param aCase  Text case for mapping operation.
   115 		* @param aMode  Input mode for mapping. This is needed if keymapping data contains
   116 		*               characters for several input modes (used mainly with Chinese
   117 		*               modes). This value will be matched to possible input mode control
   118 		*               characters in keymapping data.
   119 		* @return       First character bound to requested key.
   120 		*/
   121 		virtual TUint16 StartMapping(TPtiKey aKey,
   122 			                         TPtiTextCase aCase,
   123 									 TPtiEngineInputMode aMode = EPtiEngineInputModeNone) = 0;
   124 							 
   125 		/**
   126 		* Continues keymapping sequence. This method should be called when key event
   127 		* comes in while multitapping timer is active. Takes care of cycling through
   128 		* multitapping candidates associated for given key. 
   129 		*
   130 		* @since 2.6
   131 		* @param aKey A key to be mapped.
   132 		* @param aAppend Refernce to boolen variable. This will be set to ETrue if current character in
   133 		*                editor should be replaced (new multitapping candidate was found) and
   134 		*                to EFalse if new character should inserted instead.
   135 		* @param aCase Text case for mapping operation.
   136 		* @return Next character assosiated to given key or the first character if aKey
   137 		*              was different key than previous key press.
   138 		*/									 
   139 		virtual TUint16 NextKey(TPtiKey aKey, TBool &aAppend, TPtiTextCase aCase) = 0;
   140 		
   141 		/**
   142 		* Returns PtiEngine key code for last StartMapping() call.		
   143 		*
   144 		* @since 2.6
   145 		* @return PtiEngine key code for last StartMapping() call.
   146 		*/
   147 		virtual TPtiKey CurrentKey() = 0;
   148 		
   149 		/**
   150 		* Replaces keymapping data for given key and case. 
   151 		*
   152 		* @since 2.6
   153 		* @param aKey A key to be replaced.
   154 		* @param aMap New keymapping data for aKey,
   155 		* @param aCase Text case for replaced data.
   156 		* @return KErrNone or system wide error code.
   157 		*/
   158 		virtual TInt ReplaceKeyMapL(TPtiKey aKey, TDesC& aMap, TPtiTextCase aCase) = 0;
   159 		
   160 		/**
   161 		* Returns key code for key which produces given unicode character (if found).
   162 		*
   163 		* @since 2.6
   164 		* @param aChar A character to be queried.
   165 		* @return Key code for aChar. EPtiKeyNone, if not found.
   166 		*/				
   167 		virtual TPtiKey KeyForCharacter(TUint16 aChar) = 0;
   168 		
   169 		/**
   170 		* Returns all keymapping data for current key, excluding first character
   171 		* (which is expected to be "get all"-control character).
   172 		* 
   173 		* @param aCase  Text case for which data will be returned.
   174 		* @return Constant descriptor pointing to keymap data.
   175 		* @since 3.0
   176 		*/		
   177 		virtual TPtrC GetAll(TPtiTextCase aCase) = 0;					
   178 	};
   179 
   180 
   181 /**
   182 * CPtiMappings
   183 *
   184 * Base class for keymapping implementation classes.
   185 * Handles locally replaced keymappings.
   186 */
   187 class CPtiMappings : public CBase
   188 	{
   189 	public:
   190 		CPtiMappings();
   191 		CPtiMappings(CPtiKeyMapData* aData);
   192 		~CPtiMappings();
   193 		inline CPtiKeyMapData* KeyMapData() const;
   194 		
   195 		// DEPRECATED
   196 		virtual TInt WriteData(TInt16*);   
   197 		// DEPRECATED		     
   198 		virtual TInt ChunkDataSize() const;
   199 		
   200 		IMPORT_C TPtiKeyboardType KeyboardType() const;				
   201 		
   202 	protected:	
   203 		TInt FindReplacedMapping(TPtiKey aKey, TPtiTextCase aCase, TPtiEngineInputMode aMode) const;
   204 		void ReplaceKeyMapLocalL(TPtiKey aKey, TDesC& aMap, TPtiTextCase aCase, TPtiEngineInputMode aMode);
   205 		
   206     public:		
   207 		TPtrC DataForKeyLocal(TPtiKey aKey, TPtiTextCase aCase, TPtiEngineInputMode aMode) const;	
   208 						
   209 	protected:
   210 		TPtiKey iCurrentKey;	
   211 		TPtiEngineInputMode iCurrentMode;
   212 		TInt iCurrentChar;
   213 		RArray<TPtiReplacedMapping> iReplacedMappings;
   214 		CPtiKeyMapData* iKeyMapData;          // Not owned
   215 		TPtiKeyboardType iKeyboardType;
   216 	};
   217 
   218 
   219 /**
   220 * CPtiKeyMappings
   221 * 
   222 * Keymappings implementation class for itu-t keyboard 
   223 */
   224 NONSHARABLE_CLASS(CPtiKeyMappings) : public CPtiMappings, public MPtiKeyMappings
   225 	{
   226 	public:	
   227 		/**
   228 		* DEPRECATED. Leaves with KErrNotSupported.
   229 		*/
   230 		IMPORT_C static CPtiKeyMappings* NewL(TDesC& aData);
   231 		
   232 		/**
   233 		* DEPRECATED. Leaves with KErrNotSupported.
   234 		*/
   235 		IMPORT_C static CPtiKeyMappings* NewL(TInt16* aData);		
   236 		
   237 		/**
   238 		* Constructor.
   239 		*/
   240 		IMPORT_C static CPtiKeyMappings* NewL(CPtiKeyMapData* aData);
   241 		
   242 		IMPORT_C ~CPtiKeyMappings();
   243 		
   244 		/**
   245 		* Start mapping for given key.
   246 		*
   247 		* @param aKey  Key code for key.
   248 		* @param aCase Cuurrent text case.
   249 		* @param aMode Current input mode. Default value works for most cases.
   250 		* @return First character for given key. 
   251 		*/
   252 		IMPORT_C virtual TUint16 StartMapping(TPtiKey aKey,
   253 			                         TPtiTextCase aCase,
   254 									 TPtiEngineInputMode aMode = EPtiEngineInputModeNone);										 
   255 									 
   256 		/**
   257 		* Continues keymapping sequence. This method should be called when key event
   258 		* comes in while multitapping timer is active. Takes care of cycling through
   259 		* multitapping candidates associated for given key. 
   260 		*
   261 		* @since S60 V2.6
   262 		* @param aKey A key to be mapped.
   263 		* @param Refernce to boolen variable. This will be set to ETrue if current character in
   264 		*        editor should be replaced (new multitapping candidate was found) and
   265 		*        to EFalse if new character should inserted instead.
   266 		* @param aCase Text case for mapping operation.
   267 		* @return Next character assosiated to given key or the first character if aKey
   268 		*              was different key than previous key press.
   269 		*/									 								 
   270 		IMPORT_C TUint16 NextKey(TPtiKey aKey, TBool &aAppend, TPtiTextCase aCase);
   271 		
   272 		/**
   273 		* Returns key code for key currently being mapped (relates to StartMapping and NextKey).
   274 		*
   275 		* @return Key code for key currently being mapped.
   276 		*/
   277 		inline TPtiKey CurrentKey();
   278 		
   279 		/**
   280 		* Replaces keymapping data for given key.
   281 		*		
   282 		* @param  aKey  Key code for key to be replaced.
   283 		* @param  aMap  New keymapping data for aKey.
   284 		* @param  aCase Text case.
   285 		* @return KErrNone if succesfull
   286 		*         Otherwise system wide error code.
   287 		*/
   288 		IMPORT_C TInt ReplaceKeyMapL(TPtiKey aKey, TDesC& aMap, TPtiTextCase aCase);
   289 		
   290 		/**
   291 		* Scans through keymapping data and returns key code for given character.
   292 		*
   293 		* @param  aChar A character to be queried.
   294 		* @return Key code for mtaching key.
   295 		*         EPtiKeyNone if no matching keys found.
   296 		*/
   297 		IMPORT_C TPtiKey KeyForCharacter(TUint16 aChar);
   298 		
   299 		/**
   300 		* Returns keymapping data for given key.
   301 		*
   302 		* @param aKey    A key to be queried.
   303 		* @param aResult Descritor where resulting data is stored.
   304 		* @param aCase   Text case		 
   305 		*/
   306 		IMPORT_C void GetDataForKey(TPtiKey aKey, TDes& aResult, TPtiTextCase aCase);
   307 								
   308 		/**
   309 		* Returns all keymapping data for current key, excluding first character
   310 		* (which is expected to be "get all"-control character).
   311 		* 
   312 		* @param aCase  Text case for which data will be returned.
   313 		* @return Constant descriptor pointing to keymap data.
   314 		* @since S60 V3.0
   315 		*/		
   316 		TPtrC GetAll(TPtiTextCase aCase);							
   317 
   318 	protected:		
   319 		CPtiKeyMappings();
   320 		CPtiKeyMappings(CPtiKeyMapData* aData);
   321 		TUint16 NextChar(TPtiTextCase aCase);
   322 		inline void KeyCodeToInternal(TPtiKey aKey);
   323 		inline void DeQwertyfyCaseValue(TPtiTextCase& aCase);		
   324 	};
   325 
   326 
   327 /**
   328 * CPtiQwertyKeyMappings
   329 * 
   330 * Keymappings implementation class for qwerty keyboard.
   331 */
   332 NONSHARABLE_CLASS(CPtiQwertyKeyMappings) : public CPtiMappings, public MPtiKeyMappings
   333 	{
   334 	public:	 
   335 		/**
   336 		* DEPRECATED. Will leave with KErrNotSupported.
   337 		*/
   338 		IMPORT_C static CPtiQwertyKeyMappings* NewL(TDesC& aData);
   339 		
   340 		/**
   341 		* DEPRECATED. Will leave with KErrNotSupported.
   342 		*/
   343 		IMPORT_C static CPtiQwertyKeyMappings* NewL(TInt16* aData);
   344 		
   345 		/**
   346 		* Constructor.
   347 		*/
   348 		IMPORT_C static CPtiQwertyKeyMappings* NewL(CPtiKeyMapData* aData);				
   349 		
   350 		IMPORT_C ~CPtiQwertyKeyMappings();
   351 		
   352 		/**
   353 		* Start mapping for given key.
   354 		*
   355 		* @param aKey  Key code for key.
   356 		* @param aCase Cuurrent text case.
   357 		* @param aMode Current input mode. Default value works for most cases.
   358 		* @return First character for given key. 
   359 		*/		
   360 		IMPORT_C TUint16 StartMapping(TPtiKey aKey,
   361 			                          TPtiTextCase aCase,
   362 									  TPtiEngineInputMode aMode = EPtiEngineInputModeNone);
   363 									  
   364 		/**
   365 		* Continues keymapping sequence. This method should be called when key event
   366 		* comes in while multitapping timer is active. Takes care of cycling through
   367 		* multitapping candidates associated for given key. 
   368 		*
   369 		* @since S60 V2.6
   370 		* @param aKey A key to be mapped.
   371 		* @param aAppend Refernce to boolen variable. This will be set to ETrue if current character in
   372 		*                editor should be replaced (new chr-case character was found) and
   373 		*                to EFalse if new character should inserted instead.
   374 		* @param aCase Text case for mapping operation.
   375 		* @return Next character assosiated to given key or the first character if aKey
   376 		*              was different key than previous key press.
   377 		*/									 					  
   378 		IMPORT_C TUint16 NextKey(TPtiKey aKey, TBool &aAppend, TPtiTextCase aCase);
   379 		
   380 		/**
   381 		* Returns key code for key currently being mapped (relates to StartMapping and NextKey).
   382 		*
   383 		* @return Key code for key currently being mapped.
   384 		*/		
   385 		inline TPtiKey CurrentKey();
   386 		
   387 		/**
   388 		* Replaces keymapping data for given key.
   389 		*		
   390 		* @param  aKey  Key code for key to be replaced.
   391 		* @param  aMap  New keymapping data for aKey.
   392 		* @param  aCase Text case.
   393 		* @return KErrNone if succesfull
   394 		*         Otherwise system wide error code.
   395 		*/		
   396 		IMPORT_C TInt ReplaceKeyMapL(TPtiKey aKey, TDesC& aMap, TPtiTextCase aCase);
   397 		
   398 		/**
   399 		* Scans through keymapping data and returns key code for given character.
   400 		*
   401 		* @param  aChar A character to be queried.
   402 		* @return Key code for mtaching key.
   403 		*         EPtiKeyNone if no matching keys found.
   404 		*/		
   405 		IMPORT_C TPtiKey KeyForCharacter(TUint16 aChar);
   406 		
   407 		/**
   408 		* Returns keymapping data for given key.
   409 		*
   410 		* @param aKey    A key to be queried.
   411 		* @param aResult Descritor where resulting data is stored.
   412 		* @param aCase   Text case		 
   413 		*/		
   414 		IMPORT_C void GetDataForKey(TPtiKey aKey, TDes& aResult, TPtiTextCase aCase);
   415 		
   416 		/** DEPRECATED */
   417 		TInt WriteData(TInt16* aDest);
   418 		
   419 		/** DEPRECATED */
   420 		TInt ChunkDataSize() const;
   421 		
   422 		/** Internal */		
   423 		inline TBool DeadKeyRootFlag() const;
   424 		
   425 		/** Internal */				
   426 		inline TUint16 DeadKeyRootChar() const;
   427 		
   428 		/** Internal */				
   429 		inline TBool VowelSequenceFlag() const;
   430 		
   431 		/** Internal */				
   432 		inline TUint16 VowelSequenceResult() const;
   433 		
   434 		/** Internal */				
   435 		inline void ClearVowelSequence();
   436 		
   437 		/** Internal */				
   438 		inline TInt16 DeadKey() const;
   439 		
   440 		/** Internal */				
   441 		inline void ClearDeadKey();
   442 		
   443 		/** Internal */				
   444 		inline void ClearLastChar();
   445 		
   446 		/** Internal */					
   447 		inline void SetLastChar(TInt aLastChar);
   448 		
   449 		/** Internal */				
   450 		inline TInt GetLastChar() const;
   451 		
   452 		/** Internal */				
   453 		inline TUint16 ReplacedCharacter();
   454 		
   455 		/** Internal */				
   456 		inline void SetLastKey(TPtiKey aKey);
   457 		
   458 		/** Internal */				
   459 		inline TPtiTextCase VowelCase() const;
   460 		
   461 		/** Internal */				
   462 		inline void ResetVietnameseVowelSequenceAndToneMarks();
   463 		
   464 		/** Internal */				
   465 		inline TPtiKey LastKey() const;
   466 
   467 		/**
   468 		* Returns all keymapping data for current key, excluding first character
   469 		* (which is expected to be "get all"-control character).
   470 		* 
   471 		* @param aCase  Text case for which data will be returned.
   472 		* @return Constant descriptor pointing to keymap data.
   473 		* @since S60 V3.0
   474 		*/		
   475 		TPtrC GetAll(TPtiTextCase aCase);							
   476 		
   477 		/** Internal */	
   478 		inline void SetFlag(TInt aFlag);
   479 		
   480 		/** Internal */			
   481 		inline void ResetFlag(TInt aFlag);	
   482 		
   483 		/**
   484 		* Fills given array with numeric mode mappings defined in keymap data file.
   485 		* Resultin array contains those mappings that are given with "numeric_mode_key"
   486 		* tag in keymap data file.
   487 		*
   488 		* @since S60 V3.2
   489 		* @param aResult An array to be filled with numeric mode mappings.
   490 		*/
   491 		void GetNumericModeKeysFromDataL(RArray<TPtiNumericKeyBinding>& aResult);
   492 		
   493 		/**
   494 		* Set keyboard type to be used with qwerty keymappings. Default
   495 		* type is EPtiKeyboardStandard4x12 (Nokia E70 style).
   496 		*
   497 		* @param aKeyboardType Keyboard type to be set.
   498 		* @return KErrNone if keyboard type was set.
   499 		*         EErrNotSupported if mapping data does not have block for given keyboard type.
   500 		*/				
   501 		IMPORT_C TInt SetKeyboardType(TPtiKeyboardType aKeyboardType);	
   502 		
   503 		/**
   504 		* Returns a boolean value indicating whether there is data block available for
   505 		* given keyboard type.
   506 		*
   507 		* @param  aKeyboardType Keyboard type.
   508 		* @return ETrue if there is data block for given keyboard type.
   509 		*         EFalse otherwise
   510 		*/
   511 		IMPORT_C TBool HasDataBlockForKeyboardType(TPtiKeyboardType aKeyboardType) const;			
   512 
   513 	public:
   514 		enum
   515 			{
   516 			EDeadKeyRootFlag = 0x01,
   517 			EVowelSeqFlag    = 0x02,
   518 			EPrevKeyInUpperCase = 0x04,
   519 			ETrackVietnameseToneMarksAndVowels = 0x08
   520 			};
   521 						
   522 	private:			
   523 		CPtiQwertyKeyMappings();	
   524 		CPtiQwertyKeyMappings(CPtiKeyMapData* aData);
   525 		void ConstructL();
   526 	
   527 		TUint16 NextChar(TPtiTextCase aCase);
   528 		void KeyCodeToInternal(TPtiKey aKey);
   529 		TUint16 GetDeadKeyChar(TPtiKey aKey, TPtiTextCase aCase);
   530 		inline TInt DeadKeyIndex(TUint16 aDeadKeyUnicode);
   531 		inline TBool IsDeadKeyCode(TUint16 aChar) const;
   532 		inline TBool IsModeControlChar(TUint16 aChar) const;
   533         TUint16 GetCharForMode(TPtiEngineInputMode aMode, TPtrC aChars, TBool aSkipFirst);
   534 		TBool DoesModeCharMatchToInputMode(TUint16 aChar, TPtiEngineInputMode aMode) const;
   535 		TUint16 VowelSequence(TPtiKey aKey1, TPtiKey aKey2, TPtiTextCase aCase) const;	
   536 		TUint16 VietnameseToneMark(TUint16 aPrevChar, TPtiKey aKey);
   537 		TUint16 RepeatingVowelSequence(TPtiKey aKey);
   538 		TPtiKey VowelSeqRootKey(TUint16 aChar);
   539 		inline TBool ChineseChrModeConversionNeeded(TPtiTextCase aCase, TPtiEngineInputMode aMode) const;
   540 		inline TBool IsChnSpecialCharKey(TPtiKey aKey) const;
   541 
   542 	private:
   543 		RArray<TPtiKeyMapping> iReservedArray;  		
   544 		TAny* iReservedPtr;
   545 		TUint16 iDeadKey;
   546 		TUint16 iDeadKeyRootChar;
   547 		TUint16 iVowelSeqResult;
   548 		TPtiKey iLastKey;
   549 		TInt iFlags;
   550 		CPtiQwertyKeymappingsExtension* iExtension;
   551 	};
   552 
   553 
   554 /**
   555 * CPtiHalfQwertyKeyMappings
   556 * 
   557 * Keymappings implementation class for half qwerty keyboard 
   558 */
   559 
   560 NONSHARABLE_CLASS(CPtiHalfQwertyKeyMappings) : public CPtiKeyMappings
   561     {
   562     public:
   563 	    IMPORT_C static CPtiHalfQwertyKeyMappings* NewL(CPtiKeyMapData* aData);
   564         IMPORT_C ~CPtiHalfQwertyKeyMappings();	    
   565         
   566     public: // From MPtiKeyMappings
   567 		IMPORT_C TInt ReplaceKeyMapL(TPtiKey aKey, TDesC& aMap, TPtiTextCase aCase);
   568 		IMPORT_C TPtiKey KeyForCharacter(TUint16 aChar);
   569 		IMPORT_C TPtrC GetAll(TPtiTextCase aCase);	  
   570 		
   571         /**
   572 		* Fills given array with numeric mode mappings defined in keymap data file.
   573 		* Resultin array contains those mappings that are given with "numeric_mode_key"
   574 		* tag in keymap data file.
   575 		*
   576 		* @since S60 V5.0
   577 		* @param aResult An array to be filled with numeric mode mappings.
   578 		*/
   579 		void GetNumericModeKeysFromDataL(RArray<TPtiNumericKeyBinding>& aResult);
   580 		
   581 	    /**
   582 		* Returns keymapping data for given key.
   583 		*
   584 		* @since S60 V5.0		
   585 		* @param aKey    A key to be queried.
   586 		* @param aResult Descritor where resulting data is stored.
   587 		* @param aCase   Text case		 
   588 		*/		
   589 		IMPORT_C void GetDataForKey(TPtiKey aKey, TDes& aResult, TPtiTextCase aCase);				
   590 		/**
   591 		* Starts mapping new key. Will return first character bound to given
   592 		* key in given text case. 		
   593 		*
   594 		* @param aKey   A key to be mapped.
   595 		* @param aCase  Text case for mapping operation.
   596 		* @param aMode  Input mode for mapping. This is needed if keymapping data contains
   597 		*               characters for several input modes (used mainly with Chinese
   598 		*               modes). This value will be matched to possible input mode control
   599 		*               characters in keymapping data.
   600 		* @return       First character bound to requested key.
   601 		*/
   602 		IMPORT_C TUint16 StartMapping(TPtiKey aKey, TPtiTextCase aCase,
   603                                                TPtiEngineInputMode aMode = EPtiEngineInputModeNone);
   604 
   605         /**
   606 		* Continues keymapping sequence. This method should be called when key event
   607 		* comes in while multitapping timer is active. Takes care of cycling through
   608 		* multitapping candidates associated for given key. 
   609 		*
   610 		* @since S60 V5.0
   611 		* @param aKey A key to be mapped.
   612 		* @param aAppend Refernce to boolen variable. This will be set to ETrue if current character in
   613 		*                editor should be replaced (new chr-case character was found) and
   614 		*                to EFalse if new character should inserted instead.
   615 		* @param aCase Text case for mapping operation.
   616 		* @return Next character assosiated to given key or the first character if aKey
   617 		*              was different key than previous key press.
   618 		*/									 					  
   619 		IMPORT_C TUint16 NextKey(TPtiKey aKey, TBool &aAppend, TPtiTextCase aCase);
   620 	protected:	
   621 		TUint16 NextChar(TPtiTextCase aCase);
   622 
   623     private:
   624         CPtiHalfQwertyKeyMappings(CPtiKeyMapData* aData);		  
   625     };
   626 
   627 // ---------------------------------------------------------------------------
   628 // CPtiKeyMappings::CurrentKey
   629 // 
   630 // ---------------------------------------------------------------------------
   631 // 
   632 inline TPtiKey CPtiKeyMappings::CurrentKey()
   633 	{
   634 	return iCurrentKey;
   635 	}
   636 
   637 // ---------------------------------------------------------------------------
   638 // CPtiQwertyKeyMappings::CurrentKey
   639 // 
   640 // ---------------------------------------------------------------------------
   641 // 
   642 inline TPtiKey CPtiQwertyKeyMappings::CurrentKey()
   643 	{
   644 	return iCurrentKey;
   645 	}
   646 
   647 // ---------------------------------------------------------------------------
   648 // CPtiQwertyKeyMappings::DeadKeyIndex
   649 // 
   650 // ---------------------------------------------------------------------------
   651 // 
   652 inline TInt CPtiQwertyKeyMappings::DeadKeyIndex(TUint16 aDeadKeyUnicode)
   653 	{
   654 	return (aDeadKeyUnicode & 0x00ff);
   655 	}
   656 
   657 // ---------------------------------------------------------------------------
   658 // CPtiQwertyKeyMappings::IsDeadKeyCode
   659 // 
   660 // ---------------------------------------------------------------------------
   661 // 
   662 inline TBool CPtiQwertyKeyMappings::IsDeadKeyCode(TUint16 aChar) const
   663 	{
   664 	if (((aChar & 0xff00) == 0xf000) &&
   665 	    ((aChar & 0xff) <= 5))
   666 		{
   667 		return ETrue;	
   668 		}
   669 		
   670 	return EFalse;	
   671 	}
   672 
   673 // ---------------------------------------------------------------------------
   674 // CPtiQwertyKeyMappings::DeadKeyRootFlag
   675 // 
   676 // ---------------------------------------------------------------------------
   677 // 
   678 inline TBool CPtiQwertyKeyMappings::DeadKeyRootFlag() const
   679 	{
   680 	return (iFlags & EDeadKeyRootFlag) != 0;		
   681 	}
   682 
   683 // ---------------------------------------------------------------------------
   684 // CPtiQwertyKeyMappings::IsModeControlChar
   685 // 
   686 // ---------------------------------------------------------------------------
   687 // 
   688 inline TBool CPtiQwertyKeyMappings::IsModeControlChar(TUint16 aChar) const
   689 	{
   690 	if ((aChar == KPtiPinyinMarker) ||
   691 		(aChar == KPtiStrokeMarker) ||
   692 		(aChar == KPtiZhuyinMarker) ||
   693 		(aChar == KPtiCangjieMarker))
   694 		{	
   695 		return ETrue;
   696 		}
   697 
   698 	return EFalse;
   699 	}
   700 
   701 // ---------------------------------------------------------------------------
   702 // CPtiQwertyKeyMappings::VowelSequenceFlag
   703 // 
   704 // ---------------------------------------------------------------------------
   705 // 
   706 inline TBool CPtiQwertyKeyMappings::VowelSequenceFlag() const
   707 	{
   708 	return (iFlags & EVowelSeqFlag) != 0;
   709 	}
   710 
   711 // ---------------------------------------------------------------------------
   712 // CPtiQwertyKeyMappings::SetFlag
   713 // 
   714 // ---------------------------------------------------------------------------
   715 // 
   716 inline void CPtiQwertyKeyMappings::SetFlag(TInt aFlag)
   717 	{
   718 	iFlags |= aFlag;	
   719 	}
   720 
   721 // ---------------------------------------------------------------------------
   722 // CPtiQwertyKeyMappings::ResertFlag
   723 // 
   724 // ---------------------------------------------------------------------------
   725 // 
   726 inline void CPtiQwertyKeyMappings::ResetFlag(TInt aFlag)
   727 	{	
   728 	iFlags &= ~aFlag;	
   729 	}
   730 
   731 // ---------------------------------------------------------------------------
   732 // CPtiQwertyKeyMappings::VowelSequenceResult
   733 // 
   734 // ---------------------------------------------------------------------------
   735 // 
   736 inline TUint16 CPtiQwertyKeyMappings::VowelSequenceResult() const
   737 	{
   738 	return iVowelSeqResult;
   739 	}
   740 
   741 // ---------------------------------------------------------------------------
   742 // CPtiQwertyKeyMappings::ClearVowelSequence
   743 // 
   744 // ---------------------------------------------------------------------------
   745 // 
   746 inline void CPtiQwertyKeyMappings::ClearVowelSequence()
   747 	{
   748 	iLastKey = EPtiKeyNone;
   749 	}
   750 	
   751 // ---------------------------------------------------------------------------
   752 // CPtiQwertyKeyMappings::DeadKeyRootChar
   753 // 
   754 // ---------------------------------------------------------------------------
   755 // 		
   756 inline TUint16 CPtiQwertyKeyMappings::DeadKeyRootChar() const
   757 	{
   758 	return iDeadKeyRootChar;	
   759 	}
   760 		
   761 // ---------------------------------------------------------------------------
   762 // CPtiQwertyKeyMappings::DeadKey
   763 // 
   764 // ---------------------------------------------------------------------------
   765 // 	
   766 inline TInt16 CPtiQwertyKeyMappings::DeadKey() const
   767 	{
   768 	return iDeadKey;	
   769 	}	
   770 
   771 // ---------------------------------------------------------------------------
   772 // CPtiQwertyKeyMappings::ClearDeadKey
   773 // 
   774 // ---------------------------------------------------------------------------
   775 // 
   776 inline void CPtiQwertyKeyMappings::ClearDeadKey()
   777 	{
   778 	iDeadKey = 0;
   779 	}
   780 		
   781 // ---------------------------------------------------------------------------
   782 // CPtiQwertyKeyMappings::ClearLastChar
   783 // 
   784 // ---------------------------------------------------------------------------
   785 // 	
   786 inline void CPtiQwertyKeyMappings::ClearLastChar()
   787 	{
   788 	iExtension->iLastChar = 0;
   789 	}
   790 
   791 // ---------------------------------------------------------------------------
   792 // CPtiQwertyKeyMappings::SetLastChar
   793 // 
   794 // ---------------------------------------------------------------------------
   795 // 	
   796 inline void CPtiQwertyKeyMappings::SetLastChar(TInt aLastChar)
   797 	{
   798 	iExtension->iLastChar = (TUint16)aLastChar;
   799 	}
   800 	
   801 // ---------------------------------------------------------------------------
   802 // CPtiQwertyKeyMappings::GetLastChar
   803 // 
   804 // ---------------------------------------------------------------------------
   805 // 	
   806 inline TInt CPtiQwertyKeyMappings::GetLastChar() const
   807 	{
   808 	return iExtension->iLastChar;
   809 	}
   810 		
   811 // ---------------------------------------------------------------------------
   812 // CPtiQwertyKeyMappings::ReplacedCharacter
   813 // 
   814 // ---------------------------------------------------------------------------
   815 // 	
   816 inline TUint16 CPtiQwertyKeyMappings::ReplacedCharacter()
   817 	{	
   818 	return iExtension->iReplaced;
   819 	}
   820 
   821 // ---------------------------------------------------------------------------
   822 // CPtiQwertyKeyMappings::SetLastKey
   823 // 
   824 // ---------------------------------------------------------------------------
   825 // 		
   826 inline void CPtiQwertyKeyMappings::SetLastKey(TPtiKey aKey)
   827 	{
   828 	iLastKey = aKey;	
   829 	}
   830 		
   831 // ---------------------------------------------------------------------------
   832 // CPtiQwertyKeyMappings::KeyCodeToInternal
   833 // 
   834 // ---------------------------------------------------------------------------
   835 // 				
   836 inline void CPtiKeyMappings::KeyCodeToInternal(TPtiKey aKey)
   837 	{
   838 	iCurrentKey = aKey;
   839 	}
   840 
   841 // ---------------------------------------------------------------------------
   842 // CPtiQwertyKeyMappings::VowelCase
   843 // 
   844 // ---------------------------------------------------------------------------
   845 // 
   846 inline TPtiTextCase CPtiQwertyKeyMappings::VowelCase() const
   847 	{
   848 	return iExtension->iVowelCase;
   849 	}
   850 
   851 // ---------------------------------------------------------------------------
   852 // CPtiQwertyKeyMappings::ResetVietnameseVowelSequenceAndToneMarks
   853 // 
   854 // ---------------------------------------------------------------------------
   855 // 
   856 inline void CPtiQwertyKeyMappings::ResetVietnameseVowelSequenceAndToneMarks()
   857 	{
   858 	iExtension->iLastChar = 0;
   859 	iExtension->iReplaced = 0;
   860 	iExtension->iLastTone = 0;
   861 	iVowelSeqResult = 0;
   862 	iLastKey = EPtiKeyNone;
   863 	ResetFlag(EVowelSeqFlag);
   864 	}
   865 	
   866 // ---------------------------------------------------------------------------
   867 // CPtiQwertyKeyMappings::LastKey
   868 // 
   869 // ---------------------------------------------------------------------------
   870 // 
   871 inline TPtiKey CPtiQwertyKeyMappings::LastKey() const
   872 	{
   873 	return iLastKey;
   874 	}
   875 	
   876 // ---------------------------------------------------------------------------
   877 // CPtiQwertyKeyMappings::ChineseChrModeConversionNeeded
   878 // 
   879 // ---------------------------------------------------------------------------
   880 // 
   881 inline TBool CPtiQwertyKeyMappings::ChineseChrModeConversionNeeded(TPtiTextCase aCase, 
   882                                                          TPtiEngineInputMode aMode) const
   883 	{
   884 	if (aCase == EPtiCaseChrLower &&
   885        (aMode == EPtiEnginePinyinQwerty  || aMode ==  EPtiEnginePinyinPhraseQwerty ||
   886         aMode == EPtiEngineStrokeQwerty  || aMode ==EPtiEngineNormalCangjieQwerty  ||
   887         aMode == EPtiEngineZhuyinQwerty  || aMode == EPtiEngineZhuyinPhraseQwerty  ||
   888         aMode == EPtiEngineStrokePhraseQwerty))
   889 		{
   890 		return ETrue;
   891 		}
   892 	
   893 	return EFalse;
   894 	}
   895 	
   896 // ---------------------------------------------------------------------------
   897 // CPtiKeyMappings::DeQwertyfyCaseValue
   898 // 
   899 // ---------------------------------------------------------------------------
   900 // 	
   901 inline void CPtiKeyMappings::DeQwertyfyCaseValue(TPtiTextCase& aCase)
   902 	{
   903 	if (aCase == EPtiCaseChrLower)
   904 		{
   905 		aCase = EPtiCaseLower;
   906 		}
   907 	else if (aCase == EPtiCaseChrUpper)
   908 		{
   909 		aCase = EPtiCaseUpper;
   910 		}		
   911 	}
   912 	
   913 // ---------------------------------------------------------------------------
   914 // CPtiKeyMappings::KeyMapData
   915 // 
   916 // ---------------------------------------------------------------------------
   917 // 		
   918 inline CPtiKeyMapData* CPtiMappings::KeyMapData() const
   919 	{
   920 	return iKeyMapData;
   921 	}
   922 	
   923 // ---------------------------------------------------------------------------
   924 // CPtiKeyMappings::IsChnSpecialCharKey
   925 // 
   926 // ---------------------------------------------------------------------------
   927 // 		
   928 inline TBool CPtiQwertyKeyMappings::IsChnSpecialCharKey(TPtiKey aKey) const
   929 	{
   930 	if (aKey == EPtiKeyQwertyPlus  ||
   931     	aKey == EPtiKeyQwertyMinus ||
   932         aKey == EPtiKeyQwertyComma ||
   933         aKey == EPtiKeyQwertySemicolon ||
   934     	aKey == EPtiKeyQwertyFullstop ||
   935     	aKey == EPtiKeyQwertyHash     ||
   936     	aKey == EPtiKeyQwertySlash    ||
   937         aKey == EPtiKeyQwertyApostrophe)
   938 		{
   939 		return ETrue;
   940 		}
   941 		
   942 	return EFalse;	
   943 	}
   944 			
   945 #endif // _PTI_KEY_MAPPINGS_H
   946 
   947 // End of file