textinput/ptienginev2/src/PtiKeyMappings.cpp
changeset 0 eb1f2e154e89
child 9 e6a39382bb9c
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     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:   PtiKeyMappings class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "PtiKeyMappings.h"
       
    20 #include <PtiKeyMapData.h>
       
    21 
       
    22 // CONSTANTS
       
    23 #ifdef _DEBUG
       
    24 _LIT(KPtiNoKeyMapDataPanic, "PtiEngine: No ITU-T keymap data set.");
       
    25 #endif
       
    26 
       
    27 //
       
    28 // CPtiMappings
       
    29 //
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // CPtiMappings::CPtiMappings
       
    33 // 
       
    34 // ---------------------------------------------------------------------------
       
    35 // 
       
    36 CPtiMappings::CPtiMappings()
       
    37 	{
       
    38 	}
       
    39 	
       
    40 	
       
    41 // ---------------------------------------------------------------------------
       
    42 // CPtiMappings::CPtiMappings
       
    43 // 
       
    44 // ---------------------------------------------------------------------------
       
    45 // 	
       
    46 CPtiMappings::CPtiMappings(CPtiKeyMapData* aData) : iKeyMapData(aData)
       
    47 	{	
       
    48 	}
       
    49 
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CPtiMappings::~CPtiMappings
       
    53 // 
       
    54 // ---------------------------------------------------------------------------
       
    55 // 
       
    56 CPtiMappings::~CPtiMappings()
       
    57 	{
       
    58 	iReplacedMappings.Close();
       
    59 	}
       
    60 
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CPtiMappings::FindReplacedMapping
       
    64 // 
       
    65 // ---------------------------------------------------------------------------
       
    66 // 
       
    67 TInt CPtiMappings::FindReplacedMapping(TPtiKey aKey, TPtiTextCase aCase,
       
    68                                        TPtiEngineInputMode aMode) const
       
    69 	{
       
    70 	for (TInt i = 0; i < iReplacedMappings.Count(); i++)
       
    71 		{
       
    72 		if (iReplacedMappings[i].iKey == aKey &&
       
    73 		    iReplacedMappings[i].iCase == aCase &&
       
    74 		    iReplacedMappings[i].iMode == aMode &&
       
    75 		    iReplacedMappings[i].iKeyboardType == iKeyboardType)
       
    76 			{
       
    77 			return i;
       
    78 			}		
       
    79 		}
       
    80 		
       
    81 	return KErrNotFound;
       
    82 	}
       
    83 
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // CPtiMappings::ReplaceKeyMapLocalL
       
    87 // 
       
    88 // ---------------------------------------------------------------------------
       
    89 // 
       
    90 void CPtiMappings::ReplaceKeyMapLocalL(TPtiKey aKey, TDesC& aMap, 
       
    91                                        TPtiTextCase aCase, TPtiEngineInputMode aMode)
       
    92 	{
       
    93 	TInt i = FindReplacedMapping(aKey, aCase, aMode);
       
    94 	if (i != KErrNotFound)	
       
    95 		{
       
    96 		iReplacedMappings.Remove(i);
       
    97 		}
       
    98 	
       
    99 	TPtiReplacedMapping newMapping;
       
   100 	newMapping.iKey = aKey;
       
   101 	newMapping.iCase = aCase;
       
   102 	newMapping.iMode = aMode;
       
   103 	newMapping.iKeyboardType = iKeyboardType;
       
   104 	
       
   105 	for (i = 0; i < KMaxReplacedMappingCharacters && i < aMap.Length(); i++)	
       
   106 		{
       
   107 		newMapping.iChrs[i] = aMap[i];
       
   108 		}
       
   109 	newMapping.iNumChars = i;	
       
   110 		
       
   111 	User::LeaveIfError(iReplacedMappings.Append(newMapping));	
       
   112 	}
       
   113 
       
   114 
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CPtiMappings::DataForKeyLocal
       
   118 // 
       
   119 // ---------------------------------------------------------------------------
       
   120 // 	
       
   121 TPtrC CPtiMappings::DataForKeyLocal(TPtiKey aKey, TPtiTextCase aCase, TPtiEngineInputMode aMode) const
       
   122 	{
       
   123 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   124 		
       
   125 	if ((aCase == EPtiCaseChrLower) && (iKeyboardType != EPtiKeyboardHalfQwerty))
       
   126 		{
       
   127 		aCase = EPtiCaseLower;		
       
   128 		}
       
   129 	else if ((aCase == EPtiCaseChrUpper) && (iKeyboardType != EPtiKeyboardHalfQwerty))
       
   130 		{
       
   131 		aCase = EPtiCaseUpper;		
       
   132 		}
       
   133 				
       
   134 	TInt replaced = FindReplacedMapping(aKey, aCase, aMode);
       
   135 	if (replaced != KErrNotFound)
       
   136 		{		
       
   137 		if (iReplacedMappings[replaced].iNumChars > 0)		
       
   138 			{
       
   139 			return TPtrC(iReplacedMappings[replaced].iChrs,
       
   140 			             iReplacedMappings[replaced].iNumChars);  
       
   141 			}
       
   142 		return TPtrC();	
       
   143 		}
       
   144 	
       
   145     return iKeyMapData->DataForKey(iKeyboardType, aKey, aCase);	
       
   146 	}	
       
   147 
       
   148 
       
   149 // ---------------------------------------------------------------------------
       
   150 // CPtiMappings::WriteData (DEPRECATED)
       
   151 // 
       
   152 // ---------------------------------------------------------------------------
       
   153 // 	
       
   154 TInt CPtiMappings::WriteData(TInt16*)   
       
   155 	{
       
   156 	return 0;
       
   157 	}
       
   158 
       
   159 
       
   160 // ---------------------------------------------------------------------------
       
   161 // CPtiMappings::ChunkDataSize (DEPRECATED)
       
   162 // 
       
   163 // ---------------------------------------------------------------------------
       
   164 // 	
       
   165 TInt CPtiMappings::ChunkDataSize() const
       
   166 	{
       
   167 	return 0;		
       
   168 	}
       
   169 
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // CPtiMappings::KeyboardType
       
   173 // 
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 EXPORT_C TPtiKeyboardType CPtiMappings::KeyboardType() const
       
   177     {
       
   178     return iKeyboardType;
       
   179     }	
       
   180 
       
   181 
       
   182 //
       
   183 // CPtiKeyMappings
       
   184 //
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // CPtiKeyMappings::NewL
       
   188 // 
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 EXPORT_C CPtiKeyMappings* CPtiKeyMappings::NewL(TDesC& /*aData*/)
       
   192 	{
       
   193 	// DEPRECATED
       
   194 	User::Leave(KErrNotSupported);
       
   195 	return NULL;	
       
   196 	}
       
   197 
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // CPtiKeyMappings::NewL
       
   201 // 
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 EXPORT_C CPtiKeyMappings* CPtiKeyMappings::NewL(TInt16* /*aData*/)
       
   205 	{
       
   206 	// DEPRECATED
       
   207 	User::Leave(KErrNotSupported);
       
   208 	return NULL;
       
   209 	}
       
   210 
       
   211 
       
   212 // ---------------------------------------------------------------------------
       
   213 // CPtiKeyMappings::NewL
       
   214 // 
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 EXPORT_C CPtiKeyMappings* CPtiKeyMappings::NewL(CPtiKeyMapData* aData)
       
   218 	{
       
   219 	CPtiKeyMappings* maps = new (ELeave) CPtiKeyMappings(aData);
       
   220 	return maps; 	
       
   221 	}
       
   222 		
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // CPtiKeyMappings::CPtiKeyMappings
       
   226 // 
       
   227 // ---------------------------------------------------------------------------
       
   228 //
       
   229 CPtiKeyMappings::CPtiKeyMappings()
       
   230 	{
       
   231     iKeyboardType = EPtiKeyboard12Key;      
       
   232 	}
       
   233 
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // CPtiKeyMappings::CPtiKeyMappings
       
   237 // 
       
   238 // ---------------------------------------------------------------------------
       
   239 //
       
   240 CPtiKeyMappings::CPtiKeyMappings(CPtiKeyMapData* aData) : CPtiMappings(aData)
       
   241 	{
       
   242     iKeyboardType = EPtiKeyboard12Key; 		
       
   243 	}
       
   244 
       
   245 
       
   246 // ---------------------------------------------------------------------------
       
   247 // CPtiKeyMappings::~CPtiKeyMappings
       
   248 // 
       
   249 // ---------------------------------------------------------------------------
       
   250 //
       
   251 EXPORT_C CPtiKeyMappings::~CPtiKeyMappings()
       
   252 	{
       
   253 	}
       
   254 
       
   255 
       
   256 // ---------------------------------------------------------------------------
       
   257 // CPtiKeyMappings::StartMapping
       
   258 // 
       
   259 // ---------------------------------------------------------------------------
       
   260 //
       
   261 EXPORT_C TUint16 CPtiKeyMappings::StartMapping(TPtiKey aKey, TPtiTextCase aCase,
       
   262                                                TPtiEngineInputMode aMode)
       
   263 	{
       
   264 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   265 	
       
   266 	DeQwertyfyCaseValue(aCase);
       
   267 	
       
   268 	KeyCodeToInternal(aKey);
       
   269 
       
   270     iCurrentMode = aMode;
       
   271 	iCurrentChar = 0;
       
   272     
       
   273 	TPtrC keyData = DataForKeyLocal(aKey, aCase, iCurrentMode);	
       
   274 	if (keyData.Length() > 0)
       
   275 	    {
       
   276 	    return keyData[0];	
       
   277 	    }        
       
   278 	           			
       
   279 	return 0;
       
   280 	}  
       
   281 
       
   282 
       
   283 // ---------------------------------------------------------------------------
       
   284 // CPtiKeyMappings::NextChar
       
   285 // 
       
   286 // ---------------------------------------------------------------------------
       
   287 //
       
   288 TUint16 CPtiKeyMappings::NextChar(TPtiTextCase aCase)
       
   289 	{
       
   290 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   291 	
       
   292 	iCurrentChar++;
       
   293 	
       
   294 	DeQwertyfyCaseValue(aCase);
       
   295 		
       
   296 	TPtrC keyData = DataForKeyLocal(iCurrentKey, aCase, iCurrentMode);
       
   297 	if (iCurrentChar >= keyData.Length())
       
   298 		{
       
   299 		iCurrentChar = 0;
       
   300 		}
       
   301 	
       
   302 	if (keyData.Length())
       
   303 		{
       
   304 		return keyData[iCurrentChar];
       
   305 		}
       
   306 
       
   307 	return 0;	
       
   308 	}
       
   309 
       
   310 
       
   311 // ---------------------------------------------------------------------------
       
   312 // CPtiKeyMappings::ReplaceKeyMapL
       
   313 // 
       
   314 // ---------------------------------------------------------------------------
       
   315 //
       
   316 EXPORT_C TInt CPtiKeyMappings::ReplaceKeyMapL(TPtiKey aKey, TDesC& aMap,
       
   317                                               TPtiTextCase aCase)                                                                                            
       
   318 	{
       
   319 	if (iCurrentKey == aKey)
       
   320 		{		
       
   321 		iCurrentKey = EPtiKeyNone;
       
   322 		iCurrentChar = 0;
       
   323 		}	
       
   324 		
       
   325 	DeQwertyfyCaseValue(aCase);		
       
   326 	
       
   327 	ReplaceKeyMapLocalL(aKey, aMap, aCase, EPtiEngineMultitapping);
       
   328 	
       
   329 	return KErrNone;
       
   330 	}
       
   331 
       
   332 
       
   333 // ---------------------------------------------------------------------------
       
   334 // CPtiKeyMappings::NextKey
       
   335 // 
       
   336 // ---------------------------------------------------------------------------
       
   337 //	
       
   338 EXPORT_C TUint16 CPtiKeyMappings::NextKey(TPtiKey aKey, TBool &aAppend,
       
   339                                           TPtiTextCase aCase)
       
   340 	{
       
   341 	if (CurrentKey() == aKey)
       
   342 		{
       
   343 		aAppend = EFalse;
       
   344 		return NextChar(aCase);	
       
   345 		}
       
   346 
       
   347 	return StartMapping(aKey, aCase);
       
   348 	}
       
   349 
       
   350 
       
   351 // ---------------------------------------------------------------------------
       
   352 // CPtiKeyMappings::KeyForCharacter
       
   353 // 
       
   354 // ---------------------------------------------------------------------------
       
   355 //
       
   356 EXPORT_C TPtiKey CPtiKeyMappings::KeyForCharacter(TUint16 aChar)
       
   357 	{
       
   358 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   359 	
       
   360 	TInt numBindItems = 0;
       
   361 	const TPtiKeyBinding* bindings = iKeyMapData->KeyBindingTable(iKeyboardType, numBindItems);
       
   362     TInt dataSize = 0;
       
   363 	const TUint16* mtData = iKeyMapData->KeyData(iKeyboardType, dataSize);  
       
   364 	
       
   365 	TPtiTextCase textCase;
       
   366 	TPtiKey key;
       
   367 	for (TInt i = 0; i < numBindItems; i++)
       
   368 		{
       
   369 		key = iKeyMapData->KeyForBindingTableIndex(iKeyboardType, i, textCase);
       
   370 		if (key != EPtiKeyNone)
       
   371 			{
       
   372 			TPtrC keyData = DataForKeyLocal(key, textCase, EPtiEngineMultitapping);
       
   373 			if (keyData.Locate(aChar) != KErrNotFound)
       
   374 				{
       
   375 				return key;
       
   376 				}			
       
   377 			}
       
   378 		}
       
   379 			 
       
   380 	return EPtiKeyNone;	
       
   381 	}
       
   382 
       
   383 
       
   384 // ---------------------------------------------------------------------------
       
   385 // CPtiKeyMappings::GetDataForKey
       
   386 // 
       
   387 // ---------------------------------------------------------------------------
       
   388 //
       
   389 EXPORT_C void CPtiKeyMappings::GetDataForKey(TPtiKey aKey, TDes& aResult, 
       
   390                                              TPtiTextCase aCase)
       
   391 	{
       
   392 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   393 
       
   394 	DeQwertyfyCaseValue(aCase);
       
   395 
       
   396 	aResult.Copy(DataForKeyLocal(aKey, aCase, EPtiEngineMultitapping).Left(aResult.MaxLength()));	
       
   397 	}
       
   398 
       
   399 
       
   400 // ---------------------------------------------------------------------------
       
   401 // CPtiKeyMappings::GetAll
       
   402 // 
       
   403 // ---------------------------------------------------------------------------
       
   404 //
       
   405 TPtrC CPtiKeyMappings::GetAll(TPtiTextCase aCase)
       
   406 	{
       
   407 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   408 	
       
   409 	DeQwertyfyCaseValue(aCase);	
       
   410 	
       
   411 	TPtrC keyData = DataForKeyLocal(iCurrentKey, aCase, EPtiEngineMultitapping);	
       
   412 	if (keyData.Length() > 1)	
       
   413 		{
       
   414 		// Return characters excluding the control char.
       
   415 		return keyData.Mid(1);		
       
   416 		}
       
   417 	
       
   418 	return TPtrC();	
       
   419 	}
       
   420 	
       
   421 //
       
   422 // CPtiHalfQwertyKeyMappings
       
   423 // 
       
   424 
       
   425 // ---------------------------------------------------------------------------
       
   426 // CPtiHalfQwertyKeyMappings::NewL
       
   427 // 
       
   428 // ---------------------------------------------------------------------------
       
   429 //
       
   430 EXPORT_C CPtiHalfQwertyKeyMappings* CPtiHalfQwertyKeyMappings::NewL(CPtiKeyMapData* aData)
       
   431     {
       
   432     CPtiHalfQwertyKeyMappings* maps = new (ELeave) CPtiHalfQwertyKeyMappings(aData);
       
   433 	return maps;  
       
   434     }
       
   435 
       
   436 
       
   437 // ---------------------------------------------------------------------------
       
   438 // CPtiHalfQwertyKeyMappings::::CPtiHalfQwertyKeyMappings
       
   439 // 
       
   440 // ---------------------------------------------------------------------------
       
   441 //
       
   442 CPtiHalfQwertyKeyMappings::CPtiHalfQwertyKeyMappings(CPtiKeyMapData* aData) : CPtiKeyMappings(aData)
       
   443     { 
       
   444     iKeyboardType = EPtiKeyboardHalfQwerty;      
       
   445     }
       
   446 
       
   447 
       
   448 // ---------------------------------------------------------------------------
       
   449 // CPtiHalfQwertyKeyMappings::~CPtiHalfQwertyKeyMappings
       
   450 // 
       
   451 // ---------------------------------------------------------------------------
       
   452 //	    
       
   453 EXPORT_C CPtiHalfQwertyKeyMappings::~CPtiHalfQwertyKeyMappings()
       
   454     {    
       
   455     }
       
   456 
       
   457 // ---------------------------------------------------------------------------
       
   458 // CPtiHalfQwertyKeyMappings::StartMapping
       
   459 // 
       
   460 // ---------------------------------------------------------------------------
       
   461 //
       
   462 EXPORT_C TUint16 CPtiHalfQwertyKeyMappings::StartMapping(TPtiKey aKey, TPtiTextCase aCase,
       
   463                                                TPtiEngineInputMode aMode)
       
   464 	{
       
   465 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   466 	
       
   467 	//DeQwertyfyCaseValue(aCase);
       
   468 	
       
   469 	KeyCodeToInternal(aKey);
       
   470 
       
   471     iCurrentMode = aMode;
       
   472 	iCurrentChar = 0;
       
   473     
       
   474 	TPtrC keyData = DataForKeyLocal(aKey, aCase, iCurrentMode);	
       
   475 	if (keyData.Length() > 0)
       
   476 	    {
       
   477 	    return keyData[0];	
       
   478 	    }        
       
   479 	    
       
   480 	           			
       
   481 	return 0;
       
   482 	}
       
   483 
       
   484 // ---------------------------------------------------------------------------
       
   485 // CPtiHalfQwertyKeyMappings::NextKey
       
   486 // 
       
   487 // ---------------------------------------------------------------------------
       
   488 // 
       
   489 EXPORT_C TUint16 CPtiHalfQwertyKeyMappings::NextKey(TPtiKey aKey, TBool &aAppend,
       
   490                                                 TPtiTextCase aCase)
       
   491 	{
       
   492 	if (CurrentKey() == aKey)
       
   493 		{
       
   494 		aAppend = EFalse;
       
   495 		return NextChar(aCase);	
       
   496 		}
       
   497 
       
   498 	return StartMapping(aKey, aCase);
       
   499 	}
       
   500 
       
   501 	
       
   502 // ---------------------------------------------------------------------------
       
   503 // TUint16 CPtiHalfQwertyKeyMappings::NextChar(TPtiTextCase aCase)
       
   504 // 
       
   505 // ---------------------------------------------------------------------------
       
   506 //        
       
   507 TUint16 CPtiHalfQwertyKeyMappings::NextChar(TPtiTextCase aCase)
       
   508 	{
       
   509 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   510 	
       
   511 	iCurrentChar++;
       
   512 	// we want to retain chr cases in half qwerty
       
   513 	//DeQwertyfyCaseValue(aCase);
       
   514 		
       
   515 	TPtrC keyData = DataForKeyLocal(iCurrentKey, aCase, iCurrentMode);
       
   516 	if (iCurrentChar >= keyData.Length())
       
   517 		{
       
   518 		iCurrentChar = 0;
       
   519 		}
       
   520 	
       
   521 	if (keyData.Length())
       
   522 		{
       
   523 		return keyData[iCurrentChar];
       
   524 		}
       
   525 
       
   526 	return 0;	
       
   527 	}
       
   528 // ---------------------------------------------------------------------------
       
   529 // CPtiHalfQwertyKeyMappings::ReplaceKeyMapL
       
   530 // 
       
   531 // ---------------------------------------------------------------------------
       
   532 //        
       
   533 EXPORT_C TInt CPtiHalfQwertyKeyMappings::ReplaceKeyMapL(TPtiKey aKey, TDesC& aMap, TPtiTextCase aCase)
       
   534     {
       
   535 	if (iCurrentKey == aKey)
       
   536 		{		
       
   537 		iCurrentKey = EPtiKeyNone;
       
   538 		iCurrentChar = 0;
       
   539 		}	
       
   540 		
       
   541 //	DeQwertyfyCaseValue(aCase);		
       
   542 	
       
   543 	ReplaceKeyMapLocalL(aKey, aMap, aCase, EPtiEngineHalfQwerty);
       
   544 	
       
   545 	return KErrNone;        
       
   546     }
       
   547      
       
   548  
       
   549 // ---------------------------------------------------------------------------
       
   550 // CPtiHalfQwertyKeyMappings::KeyForCharacter
       
   551 // 
       
   552 // ---------------------------------------------------------------------------
       
   553 //   
       
   554 EXPORT_C TPtiKey CPtiHalfQwertyKeyMappings::KeyForCharacter(TUint16 aChar)
       
   555     {
       
   556 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   557 	
       
   558 	TInt numBindItems = 0;
       
   559 	const TPtiKeyBinding* bindings = iKeyMapData->KeyBindingTable(iKeyboardType, numBindItems);
       
   560     TInt dataSize = 0;
       
   561 	const TUint16* mtData = iKeyMapData->KeyData(iKeyboardType, dataSize);  
       
   562 	
       
   563 	TPtiTextCase textCase;
       
   564 	TPtiKey key;
       
   565 	for (TInt i = 0; i < numBindItems; i++)
       
   566 		{
       
   567 		key = iKeyMapData->KeyForBindingTableIndex(iKeyboardType, i, textCase);
       
   568 		if (key != EPtiKeyNone)
       
   569 			{
       
   570 			TPtrC keyData = DataForKeyLocal(key, textCase, EPtiEngineHalfQwerty);
       
   571 			if (keyData.Locate(aChar) != KErrNotFound)
       
   572 				{
       
   573 				return key;
       
   574 				}			
       
   575 			}
       
   576 		}
       
   577 			 
       
   578 	return EPtiKeyNone;	    
       
   579     }
       
   580     
       
   581 
       
   582 // ---------------------------------------------------------------------------
       
   583 // CPtiHalfQwertyKeyMappings::GetAll
       
   584 // 
       
   585 // ---------------------------------------------------------------------------
       
   586 //    
       
   587 EXPORT_C TPtrC CPtiHalfQwertyKeyMappings::GetAll(TPtiTextCase aCase)
       
   588     {
       
   589 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   590 	
       
   591 //	DeQwertyfyCaseValue(aCase);	
       
   592 	
       
   593 	TPtrC keyData = DataForKeyLocal(iCurrentKey, aCase, EPtiEngineHalfQwerty);	
       
   594 	if (keyData.Length() > 1)	
       
   595 		{
       
   596 		// Return characters excluding the control char.
       
   597 		return keyData.Mid(1);		
       
   598 		}
       
   599 	
       
   600 	return TPtrC();	    
       
   601     }	
       
   602     
       
   603     
       
   604 // ---------------------------------------------------------------------------
       
   605 // CPtiHalfQwertyKeyMappings::GetNumericModeKeysFromDataL
       
   606 // 
       
   607 // ---------------------------------------------------------------------------
       
   608 // 
       
   609 void CPtiHalfQwertyKeyMappings::GetNumericModeKeysFromDataL(RArray<TPtiNumericKeyBinding>& aResult)
       
   610 	{
       
   611 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   612 	
       
   613 	TInt numEntries = 0;
       
   614 	const TPtiNumericKeyBinding* dataEntries = iKeyMapData->NumericModeKeysTable(iKeyboardType, 
       
   615 	                                                                             numEntries);
       
   616 	
       
   617 	for (TInt i = 0; i < numEntries; i++)
       
   618 		{
       
   619 		User::LeaveIfError(aResult.Append(dataEntries[i]));
       
   620 		}
       
   621 	}    
       
   622 	
       
   623 	
       
   624 // ---------------------------------------------------------------------------
       
   625 // CPtiQwertyKeyMappings::GetDataForKey
       
   626 // 
       
   627 // ---------------------------------------------------------------------------
       
   628 // 
       
   629 EXPORT_C void CPtiHalfQwertyKeyMappings::GetDataForKey(TPtiKey aKey, TDes& aResult,
       
   630                                                        TPtiTextCase aCase)
       
   631 	{
       
   632 	__ASSERT_DEBUG(iKeyMapData, User::Panic(KPtiNoKeyMapDataPanic, KErrCorrupt));
       
   633 
       
   634 	aResult.Copy(DataForKeyLocal(aKey, aCase, EPtiEngineHalfQwerty).Left(aResult.MaxLength()));
       
   635 	}
       
   636 		
       
   637 
       
   638 // End of file
       
   639 
       
   640