textinput/ptienginev2/src/PtiDefaultCore.cpp
changeset 0 eb1f2e154e89
child 10 6defe5d1bd39
child 23 f043c81198e3
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2003-2007 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:   Default core for predective text input engine.
       
    15 *               Implements basic qwerty & multitapping input.  
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <e32property.h>
       
    21 #include "PtiDefaultCore.h"
       
    22 #include "PtiLanguage.h"
       
    23 #include "PtiEngine.h"
       
    24 #include "PtiKeyMappings.h"
       
    25 #include <PtiEngine.rsg>
       
    26 #include "PtiDefaultNumberModeMappingdata.h"
       
    27 
       
    28 #include <data_caging_path_literals.hrh> 
       
    29 
       
    30 // CONSTANTS
       
    31 const TInt KMultiTapTimeoutMS = 1000000;
       
    32 //const TInt KPtiKeymappingsDefaultImplementation = 0x10281897;
       
    33 
       
    34 _LIT(KDefaultCoreVendor, "Default core");
       
    35 
       
    36 #ifdef _DEBUG
       
    37 _LIT(KPtiEnginePanic, "CPtiDefaultCore");
       
    38 #endif
       
    39 
       
    40 // lam with alef ligatures are entered as one press but are actually two symbols
       
    41 // These four arabic characters are handled as a special case.
       
    42 const TUint16 KArarbicLigatureLamWithAlefWithMaddaAboveIsolatedForm = 0xFEF5;
       
    43 const TUint16 KArarbicLigatureLamWithAlefWithHamzaAboveIsolatedForm = 0xFEF7;
       
    44 const TUint16 KArarbicLigatureLamWithAlefWithHamzaBelowIsolatedForm = 0xFEF9;
       
    45 const TUint16 KArarbicLigatureLamWithAlefIsolatedForm               = 0xFEFB;
       
    46 
       
    47 _LIT(KArarbicLigatureLamWithAlefWithMaddaAboveIsolatedSequence, "\x0644\x622");
       
    48 _LIT(KArarbicLigatureLamWithAlefWithHamzaAboveIsolatedSequence, "\x0644\x623");
       
    49 _LIT(KArarbicLigatureLamWithAlefWithHamzaBelowIsolatedSequence, "\x0644\x625");
       
    50 _LIT(KArarbicLigatureLamWithAlefIsolatedSequence, "\x0644\x627");
       
    51 
       
    52 
       
    53 //
       
    54 // CMultiTapTimer
       
    55 //
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // CMultiTapTimer::NewL
       
    59 // 
       
    60 // ---------------------------------------------------------------------------
       
    61 // 
       
    62 CMultiTapTimer* CMultiTapTimer::NewL(TCallBack aCallback)
       
    63 	{
       
    64 	CMultiTapTimer* self = new(ELeave)CMultiTapTimer(aCallback);
       
    65 	CleanupStack::PushL(self);
       
    66 	self->ConstructL();
       
    67 	CleanupStack::Pop();	// self
       
    68 	return self;
       
    69 	}
       
    70 
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CMultiTapTimer::CMultitapTimer
       
    74 // 
       
    75 // ---------------------------------------------------------------------------
       
    76 // 
       
    77 CMultiTapTimer::CMultiTapTimer(TCallBack aCallback)
       
    78 :CTimer(EPriorityStandard), iCallback(aCallback)
       
    79 	{
       
    80 	}
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CMultiTapTimer::ConstructL
       
    84 // 
       
    85 // ---------------------------------------------------------------------------
       
    86 // 
       
    87 void CMultiTapTimer::ConstructL()
       
    88 	{
       
    89 	CTimer::ConstructL();
       
    90 	CActiveScheduler::Add(this);
       
    91 	}
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // CMultiTapTimer::After
       
    95 // 
       
    96 // ---------------------------------------------------------------------------
       
    97 // 
       
    98 void CMultiTapTimer::After(TTimeIntervalMicroSeconds32 aInterval)
       
    99 	{
       
   100 	if (IsActive())
       
   101 		{
       
   102 		Cancel();
       
   103 		}
       
   104 	CTimer::After(aInterval);
       
   105 	}
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CMultiTapTimer::RunL
       
   109 // 
       
   110 // ---------------------------------------------------------------------------
       
   111 // 
       
   112 void CMultiTapTimer::RunL()
       
   113 	{
       
   114 	iCallback.CallBack();
       
   115 	}
       
   116 
       
   117 
       
   118 //
       
   119 // CPtiDefaultCore
       
   120 //
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // CPtiDefaultCore::NewL
       
   124 // 
       
   125 // ---------------------------------------------------------------------------
       
   126 // 
       
   127 CPtiDefaultCore* CPtiDefaultCore::NewL(CPtiEngine* aOwner, TDes* aTextBuffer)
       
   128 	{
       
   129 	CPtiDefaultCore *core = new (ELeave) CPtiDefaultCore(aOwner, aTextBuffer);
       
   130 	CleanupStack::PushL( core );
       
   131 	core->ConstructL();
       
   132 	CleanupStack::Pop(); // core
       
   133 	return core;
       
   134 	}
       
   135 
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // CPtiDefaultCore::CPtiDefaultCore
       
   139 // .
       
   140 // ---------------------------------------------------------------------------
       
   141 // 
       
   142 CPtiDefaultCore::CPtiDefaultCore()
       
   143 	{
       
   144 	}
       
   145 
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // CPtiDefaultCore::CPtiDefaultCore
       
   149 // 
       
   150 // ---------------------------------------------------------------------------
       
   151 // 
       
   152 CPtiDefaultCore::CPtiDefaultCore(CPtiEngine* aOwner, TDes* aTextBuffer) : iOwner(aOwner), iTextBuffer(aTextBuffer)
       
   153 	{
       
   154 	}
       
   155 
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CPtiDefaultCore::~CPtiDefaultCore
       
   159 // 
       
   160 // ---------------------------------------------------------------------------
       
   161 // 
       
   162 CPtiDefaultCore::~CPtiDefaultCore()
       
   163 	{
       
   164 	if (iTimer)
       
   165 		{
       
   166 		iTimer->Cancel();
       
   167 		}
       
   168 		 
       
   169     ShutDownKeymapFactory();
       
   170     					
       
   171 	delete iTimer;	
       
   172 	delete iNumericMappings;
       
   173 	delete iNumericData;
       
   174 	    
       
   175     iFactoryBindings.Close();    	
       
   176 	}
       
   177 
       
   178 
       
   179 // ---------------------------------------------------------------------------
       
   180 // CPtiDefaultCore::ConstructL
       
   181 // 
       
   182 // ---------------------------------------------------------------------------
       
   183 // 
       
   184 void CPtiDefaultCore::ConstructL()
       
   185 	{
       
   186 	FillCoreInfo();
       
   187 	TCallBack timerExpire(TimerExpire, this);
       
   188 	iTimer = CMultiTapTimer::NewL(timerExpire);
       
   189 	iNumericData = CPtiNumberModeDataImpl::NewL();
       
   190 	iNumericMappings = CPtiKeyMappings::NewL(iNumericData);  
       
   191 	}
       
   192 
       
   193 
       
   194 // ---------------------------------------------------------------------------
       
   195 // CPtiDefaultCore::InitializeL
       
   196 // 
       
   197 // ---------------------------------------------------------------------------
       
   198 // 
       
   199 void CPtiDefaultCore::InitializeL(CPtiEngine* aOwner, TDes* aTextBuffer, CArrayPtrFlat<CPtiCoreLanguage>* aLanguageList, TBool /*aUseDefautUserDictionary*/)
       
   200 	{
       
   201 	iOwner = aOwner;
       
   202 	iTextBuffer = aTextBuffer;
       
   203     iLanguageList = aLanguageList;	
       
   204 	
       
   205     TInt count = 0;
       
   206     TInt err = RProperty::Get(KPtiEnginePSUid, EKeyMapPropertyCount, count);
       
   207     if (err == KErrNone && count > 0)
       
   208         {
       
   209         // PS key found, keymap implementation list has been created and can be read
       
   210         TBuf16<256> dataBuffer;
       
   211         err = RProperty::Get(KPtiEnginePSUid, EKeyMapPropertyData, dataBuffer);
       
   212                                              
       
   213         if( err == KErrNone )
       
   214             {
       
   215             TInt langId;
       
   216             TInt factoryUid;
       
   217             for(TInt i = 0; i < count; i++ )
       
   218                 {
       
   219                 langId = dataBuffer[3*i];
       
   220                 factoryUid = (dataBuffer[3*i+1] << 16) + dataBuffer[3*i+2];
       
   221             
       
   222                 CPtiCoreLanguage* language = CPtiCoreLanguage::NewL();
       
   223                 language->SetLanguageCode(langId);
       
   224 		        language->SetCore(this, EPtiEngineNumeric);	
       
   225 
       
   226 	            CleanupStack::PushL( language );     
       
   227 	       	    aLanguageList->AppendL( language );
       
   228 	            CleanupStack::Pop(); // language
       
   229              
       
   230                 TPtiDataFactoryBinding newBind(langId, factoryUid);
       
   231                 iFactoryBindings.AppendL(newBind);
       
   232                 }
       
   233             return;
       
   234             }
       
   235         }
       
   236 
       
   237     // PS key not defined or error, we need to fetch the data from dll:s
       
   238 	RArray<TInt> dataImpl;
       
   239 	CleanupClosePushL(dataImpl);
       
   240 	CPtiKeyMapDataFactory::ListImplementationsL(dataImpl);
       
   241    
       
   242 	for (TInt i = 0; i < dataImpl.Count(); i++)
       
   243 	    {
       
   244         ShutDownKeymapFactory();
       
   245 	    iKeyMapDataFactory = CPtiKeyMapDataFactory::CreateImplementationL(TUid::Uid(dataImpl[i]));	  	    	  	   
       
   246 	    ListDataFactoryLanguagesL(iKeyMapDataFactory, dataImpl[i], aLanguageList);	     
       
   247 	    }
       
   248 		
       
   249 	if (!iFactoryBindings.Count())
       
   250 	    {
       
   251 	    // Cannot function without keymapping data.
       
   252 	    User::Leave(KErrCorrupt);
       
   253 	    } 
       
   254                      
       
   255     // Write language->dll mapping data to P/S-key so we don't need to load every dll later
       
   256     TBuf16<256> dataBuffer;
       
   257     for(TInt i = 0; i < iFactoryBindings.Count(); i++)
       
   258        {
       
   259        dataBuffer.Append(iFactoryBindings[i].iLanguage); // Language id should fit in 16 bits
       
   260        dataBuffer.Append(iFactoryBindings[i].iFactoryImplUid >> 16); // 32-bit Uid is appended in two parts
       
   261        dataBuffer.Append(iFactoryBindings[i].iFactoryImplUid);
       
   262        }
       
   263     
       
   264     // If these fail, then they just fail.                  
       
   265     RProperty::Set(KPtiEnginePSUid, EKeyMapPropertyCount, iFactoryBindings.Count());  
       
   266     RProperty::Set(KPtiEnginePSUid, EKeyMapPropertyData, dataBuffer);        
       
   267                   
       
   268 	CleanupStack::PopAndDestroy(); // dataImpl    
       
   269 	}
       
   270 
       
   271 
       
   272 // ---------------------------------------------------------------------------
       
   273 // CPtiDefaultCore::OpenLanguageL
       
   274 // 
       
   275 // ---------------------------------------------------------------------------
       
   276 // 
       
   277 TInt CPtiDefaultCore::OpenLanguageL(CPtiCoreLanguage* aLanguage)
       
   278 	{		
       
   279 	TRAPD(err, LoadFactoryForLanguageL(aLanguage->LanguageCode()));
       
   280 	
       
   281 	ClearFlag(EPtiFlagVowelSeq);	
       
   282 
       
   283 	return err;
       
   284 	}
       
   285 
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CPtiDefaultCore::CloseLanguageL
       
   289 // 
       
   290 // ---------------------------------------------------------------------------
       
   291 // 
       
   292 TInt CPtiDefaultCore::CloseLanguageL()
       
   293 	{
       
   294 	if (iOwner->CurrentLanguage())
       
   295 	    {
       
   296 	    CPtiCoreLanguage* curLang = static_cast<CPtiCoreLanguage*>(iOwner->CurrentLanguage());
       
   297 	    curLang->SetKeyMapDataFactory(NULL);  
       
   298 	    }			
       
   299 	
       
   300 	ClearFlag(EPtiFlagVowelSeq);	
       
   301 	return KErrNone;
       
   302 	}
       
   303 
       
   304 
       
   305 // ---------------------------------------------------------------------------
       
   306 // CPtiDefaultCore::GetCurrentWord
       
   307 // 
       
   308 // ---------------------------------------------------------------------------
       
   309 // 
       
   310 TPtrC CPtiDefaultCore::GetCurrentWord() const
       
   311 	{
       
   312 	__ASSERT_DEBUG(iTextBuffer, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   313 		
       
   314 	return TPtrC(iTextBuffer->Ptr());
       
   315 	}
       
   316 
       
   317 
       
   318 // ---------------------------------------------------------------------------
       
   319 // CPtiDefaultCore::CommitCurrentWord
       
   320 // 
       
   321 // ---------------------------------------------------------------------------
       
   322 // 
       
   323 TInt CPtiDefaultCore::CommitCurrentWord()
       
   324 	{
       
   325 	ClearBuffer();
       
   326 	return KErrNone;
       
   327 	}
       
   328 
       
   329 
       
   330 // ---------------------------------------------------------------------------
       
   331 // CPtiDefaultCore::NumberOfCandidates
       
   332 // 
       
   333 // ---------------------------------------------------------------------------
       
   334 // 
       
   335 TInt CPtiDefaultCore::NumberOfCandidates()
       
   336 	{
       
   337 	__ASSERT_DEBUG(iTextBuffer, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   338 		
       
   339 	if (iTextBuffer->Length() == 0)
       
   340 		{
       
   341 		return 0;	
       
   342 		}
       
   343 
       
   344 	return 1;
       
   345 	}
       
   346 
       
   347 
       
   348 // ---------------------------------------------------------------------------
       
   349 // CPtiDefaultCore::FillCoreInfo
       
   350 // 
       
   351 // ---------------------------------------------------------------------------
       
   352 // 
       
   353 void CPtiDefaultCore::FillCoreInfo()
       
   354 	{
       
   355 	iCoreInfo.SetCapsBits(0);
       
   356 	iCoreInfo.SetMaxWordLength(KDefaulCoreMaximumWordLength);
       
   357 	iCoreInfo.SetVendorString( KDefaultCoreVendor );
       
   358 	iCoreInfo.SetMaxNumberOfCandidates(1);
       
   359 	iCoreInfo.SetUid(KDefaultCoreUid);
       
   360 	}
       
   361 
       
   362 
       
   363 // ---------------------------------------------------------------------------
       
   364 // CPtiDefaultCore::SetReordering
       
   365 // 
       
   366 // ---------------------------------------------------------------------------
       
   367 // 
       
   368 TInt CPtiDefaultCore::SetReordering(TBool aStatus)
       
   369 	{
       
   370 	if (aStatus)
       
   371 		{
       
   372 		return KErrNotSupported;
       
   373 		}
       
   374 
       
   375 	return KErrNone;
       
   376 	}
       
   377 
       
   378 
       
   379 // ---------------------------------------------------------------------------
       
   380 // CPtiDefaultCore::AppendKeyPress
       
   381 // 
       
   382 // ---------------------------------------------------------------------------
       
   383 // 
       
   384 void CPtiDefaultCore::AppendKeyPress(TPtiKey aKey)
       
   385 	{
       
   386 	__ASSERT_DEBUG(iOwner, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   387 
       
   388 	CPtiCoreLanguage* lang = static_cast<CPtiCoreLanguage*>(iOwner->CurrentLanguage());
       
   389 	const TPtiEngineInputMode inputMode = iOwner->InputMode();
       
   390 	const TBool qwerty = iOwner->IsQwertyBasedMode(inputMode);
       
   391 	TBool append = ETrue;
       
   392 	TUint16 overridingDeadKey = 0;
       
   393 	
       
   394 	ClearFlag(EPtiGetAllFlag);		
       
   395 	
       
   396 	__ASSERT_DEBUG(lang, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   397 
       
   398 	MPtiKeyMappings* maps = NULL;
       
   399 
       
   400 	if (inputMode == EPtiEngineNumeric)
       
   401 		{
       
   402 		maps = iNumericMappings;
       
   403 		}
       
   404     else if (inputMode == EPtiEngineHalfQwerty)		
       
   405         {
       
   406         if (lang->HasInputMode(EPtiEngineHalfQwerty))
       
   407             {
       
   408 	        maps = lang->GetHalfQwertyKeymappings();            
       
   409             }        
       
   410         }		
       
   411 	else if (qwerty)
       
   412 		{
       
   413 		if (lang->HasInputMode(EPtiEngineQwerty))
       
   414 			{
       
   415 			maps = lang->GetQwertyKeymappings();
       
   416 			}
       
   417 		}
       
   418 	else
       
   419 		{
       
   420 		if (lang->HasInputMode(EPtiEngineMultitapping))
       
   421 			{
       
   422 			maps = lang->GetKeymappings();
       
   423 			}
       
   424 		}
       
   425 
       
   426 	if (!maps)
       
   427 		{
       
   428 		iTimer->Cancel();
       
   429 		return;
       
   430 		}
       
   431 
       
   432 	if (iTimer->IsActive())
       
   433 		{
       
   434 		TUint16 chr = maps->NextKey(aKey, append, iOwner->Case());
       
   435 		if (chr && (!append) && (iTextBuffer->Length() > 0))
       
   436 			{
       
   437 			iTextBuffer->SetLength(iTextBuffer->Length() - 1);	
       
   438 			}
       
   439 		if (iTextBuffer->Length() < iTextBuffer->MaxLength())
       
   440 			{
       
   441 			if (chr)
       
   442 				{
       
   443 				iTextBuffer->Append(chr);
       
   444 				}
       
   445 			}
       
   446 		}
       
   447 	else
       
   448 		{
       
   449 		if (iTextBuffer->Length() < iTextBuffer->MaxLength())
       
   450 			{
       
   451 			if (qwerty)
       
   452 				{
       
   453 				CPtiQwertyKeyMappings* qmap = static_cast<CPtiQwertyKeyMappings*>(maps);		
       
   454 				if (lang->LanguageCode() == ELangVietnamese)
       
   455 					{
       
   456 					qmap->SetFlag(CPtiQwertyKeyMappings::ETrackVietnameseToneMarksAndVowels);
       
   457 					}
       
   458 				else
       
   459 					{
       
   460 					qmap->ResetFlag(CPtiQwertyKeyMappings::ETrackVietnameseToneMarksAndVowels);
       
   461 					}					
       
   462 										
       
   463 				if (qmap->DeadKey() && (aKey == qmap->CurrentKey()))
       
   464 					{
       
   465 					overridingDeadKey = qmap->DeadKeyRootChar();				
       
   466 					} 
       
   467 				}
       
   468 			
       
   469 			TUint16 chr = maps->StartMapping(aKey, iOwner->Case(), inputMode);
       
   470 			
       
   471 			if (chr == KPtiGetAllMarker) 
       
   472 				{
       
   473 				if (lang->LanguageCode() == ELangHindi)
       
   474 					{									
       
   475 					TPtrC ptr = maps->GetAll(iOwner->Case());				
       
   476 					iTextBuffer->Append(ptr.Left(iTextBuffer->MaxLength() - iTextBuffer->Length()));
       
   477 					SetFlag(EPtiGetAllFlag);		
       
   478 					}
       
   479 				}			
       
   480 			else if (chr)
       
   481 				{
       
   482                 switch (chr)
       
   483                 	{
       
   484           			case KArarbicLigatureLamWithAlefWithMaddaAboveIsolatedForm:
       
   485                  	     iTextBuffer->Append(KArarbicLigatureLamWithAlefWithMaddaAboveIsolatedSequence);
       
   486                  	     SetFlag(EPtiDoubleWideEntry);
       
   487                  	     break;
       
   488             		case KArarbicLigatureLamWithAlefWithHamzaAboveIsolatedForm:
       
   489                  	     iTextBuffer->Append(KArarbicLigatureLamWithAlefWithHamzaAboveIsolatedSequence);
       
   490                  	     SetFlag(EPtiDoubleWideEntry);                 
       
   491                  	     break;
       
   492             		case KArarbicLigatureLamWithAlefWithHamzaBelowIsolatedForm:
       
   493                  	     iTextBuffer->Append(KArarbicLigatureLamWithAlefWithHamzaBelowIsolatedSequence);
       
   494                          SetFlag(EPtiDoubleWideEntry);                 
       
   495                          break; 
       
   496                     case KArarbicLigatureLamWithAlefIsolatedForm:
       
   497                          iTextBuffer->Append(KArarbicLigatureLamWithAlefIsolatedSequence);      
       
   498                          SetFlag(EPtiDoubleWideEntry);                 
       
   499                          break;
       
   500                     default:       
       
   501                          iTextBuffer->Append(chr);    
       
   502                      }                
       
   503 				}
       
   504 				
       
   505 			if (qwerty)
       
   506 				{
       
   507 				// There was dead key press waiting, but last key press didn't
       
   508 				// contain dead key data, so both keys will be inserted.	
       
   509 				CPtiQwertyKeyMappings* qmap = static_cast<CPtiQwertyKeyMappings*>(maps);
       
   510 				
       
   511 				if (overridingDeadKey != 0) 
       
   512 					{				
       
   513 					qmap->ClearDeadKey();
       
   514 					}				
       
   515 				else if (qmap->DeadKeyRootFlag())
       
   516 					{
       
   517 					if (iTextBuffer->Length() < iTextBuffer->MaxLength())
       
   518 						{	
       
   519 						SetFlag(EPtiDeadKeyRootFlag); // This will indicate PtiEngine that extra character 
       
   520 						                             // was added to buffer.
       
   521 						iTextBuffer->Append(maps->StartMapping(aKey, iOwner->Case()));	
       
   522 						}
       
   523 					}
       
   524 				else if ((qmap->VowelSequenceFlag()) &&
       
   525 					     (lang->LanguageCode() == ELangVietnamese))
       
   526 					{
       
   527 					// This was Vietnamese vowel sequence, remove first vowel
       
   528 					// component from buffer.
       
   529 					TInt numRemove = (iTextBuffer->Length() > 1 ? 2 : 1);
       
   530 					iTextBuffer->SetLength(iTextBuffer->Length() - numRemove);
       
   531 					iTextBuffer->Append(qmap->VowelSequenceResult());						
       
   532 					SetFlag(EPtiFlagVowelSeq);					
       
   533 					}
       
   534 				}				
       
   535 			}
       
   536 		}
       
   537 		
       
   538 	const TPtiTextCase textCase = iOwner->Case();		
       
   539 // In Querty mode . default core always get called.
       
   540 // When Fn key is pressed its not in multitap its  not in multitapmode
       
   541 // multitap timer should be canceled.
       
   542 
       
   543 	if (qwerty &&			
       
   544 		((textCase == EPtiCaseLower) || (textCase == EPtiCaseUpper) ||(textCase == EPtiCaseFnLower) || (textCase == EPtiCaseFnUpper)||
       
   545 		 ((inputMode == EPtiEngineZhuyinQwerty || inputMode ==EPtiEnginePinyinQwerty ||
       
   546 		   inputMode == EPtiEngineStrokeQwerty ||inputMode == EPtiEngineZhuyinPhraseQwerty ||
       
   547 		   inputMode == EPtiEngineStrokePhraseQwerty ||inputMode == EPtiEnginePinyinPhraseQwerty ) && 
       
   548 		   (textCase == EPtiCaseChrUpper ||
       
   549 		 textCase == EPtiCaseChrLower)))) 
       
   550 		{
       
   551 		iTimer->Cancel();
       
   552 		}
       
   553 	else 
       
   554 		{
       
   555 		iTimer->After(KMultiTapTimeoutMS); 
       
   556 		}
       
   557 	}
       
   558 
       
   559 
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // CPtiDefaultCore::DeleteKeyPress
       
   563 // 
       
   564 // ---------------------------------------------------------------------------
       
   565 // 
       
   566 void CPtiDefaultCore::DeleteKeyPress()
       
   567 	{
       
   568 	__ASSERT_DEBUG(iOwner, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   569 
       
   570 	ClearFlag(EPtiGetAllFlag | EPtiFlagVowelSeq);		
       
   571 
       
   572 	if (iTimer->IsActive())
       
   573 		{
       
   574 		iTimer->Cancel();
       
   575 		}
       
   576 
       
   577 	if (iTextBuffer->Length() > 0)
       
   578 		{
       
   579 		// Delete last character.
       
   580 		iTextBuffer->SetLength(iTextBuffer->Length() - 1);	
       
   581 		}
       
   582 
       
   583 	ClearVowelSequence();
       
   584 	}
       
   585 
       
   586 
       
   587 // ---------------------------------------------------------------------------
       
   588 // CPtiDefaultCore::ClearBuffer
       
   589 // 
       
   590 // ---------------------------------------------------------------------------
       
   591 // 
       
   592 void CPtiDefaultCore::ClearBuffer()
       
   593 	{
       
   594 	__ASSERT_DEBUG(iTimer, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   595 	
       
   596 	iTimer->Cancel();	
       
   597 	}
       
   598 
       
   599 
       
   600 // ---------------------------------------------------------------------------
       
   601 // CPtiDefaultCore::ClearVowelSequence
       
   602 // 
       
   603 // ---------------------------------------------------------------------------
       
   604 // 
       
   605 void CPtiDefaultCore::ClearVowelSequence()
       
   606 	{
       
   607 	__ASSERT_DEBUG(iOwner, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   608 		
       
   609 	if (iOwner->IsQwertyBasedMode(iOwner->InputMode()))
       
   610 		{
       
   611 		CPtiCoreLanguage* lang = static_cast<CPtiCoreLanguage*>(iOwner->CurrentLanguage());
       
   612 		__ASSERT_DEBUG(lang, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   613 		CPtiQwertyKeyMappings* qMap = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());
       
   614 		if (qMap)
       
   615 			{
       
   616 			qMap->ClearVowelSequence();
       
   617 			qMap->ClearLastChar();
       
   618 			}
       
   619 		}
       
   620 	}
       
   621 
       
   622 
       
   623 // ---------------------------------------------------------------------------
       
   624 // CPtiDefaultCore::SetCurrentInputSequence
       
   625 // 
       
   626 // ---------------------------------------------------------------------------
       
   627 // 
       
   628 TInt CPtiDefaultCore::SetCurrentInputSequence(TPtrC8 /*aInput*/)
       
   629 	{
       
   630 	__ASSERT_DEBUG(iTimer, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   631 		
       
   632 	if (iTimer->IsActive())
       
   633 		{
       
   634 		iTimer->Cancel();
       
   635 		}	
       
   636 
       
   637 	ClearVowelSequence();
       
   638 
       
   639 	return KErrNone;
       
   640 	}
       
   641 
       
   642 
       
   643 // ---------------------------------------------------------------------------
       
   644 // CPtiDefaultCore::TimerExpire
       
   645 // 
       
   646 // ---------------------------------------------------------------------------
       
   647 //
       
   648 TInt CPtiDefaultCore::TimerExpire(TAny* aPtr)
       
   649 	{
       
   650 	return reinterpret_cast<CPtiDefaultCore*>(aPtr)->DoTimerExpire();
       
   651 	}
       
   652 
       
   653 
       
   654 // ---------------------------------------------------------------------------
       
   655 // CPtiDefaultCore::DoTimerExpire
       
   656 // 
       
   657 // ---------------------------------------------------------------------------
       
   658 //
       
   659 TInt CPtiDefaultCore::DoTimerExpire()
       
   660 	{
       
   661 	__ASSERT_DEBUG(iOwner, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   662 
       
   663 	if (iOwner->Observer())
       
   664 		{
       
   665 		iOwner->Observer()->KeyTimerExpired();
       
   666 		}
       
   667 	return KErrNone;
       
   668 	}
       
   669 
       
   670 
       
   671 // ---------------------------------------------------------------------------
       
   672 // CPtiDefaultCore::DropLanguages
       
   673 // 
       
   674 // ---------------------------------------------------------------------------
       
   675 //
       
   676 void CPtiDefaultCore::DropLanguages(CArrayPtrFlat<CPtiCoreLanguage>* aLanguageList)
       
   677 	{
       
   678 	for (TInt i = 0; i < aLanguageList->Count(); i++)
       
   679 		{
       
   680 		if (aLanguageList->At(i)->HasInputMode(EPtiEngineMultitapping))
       
   681 			{
       
   682 			aLanguageList->At(i)->ClearMultitapping();			
       
   683 			if (aLanguageList->At(i)->GetCore(EPtiEngineMultitapping) == this)
       
   684 			    {
       
   685 			    aLanguageList->At(i)->SetCore(NULL, EPtiEngineMultitapping);			    
       
   686 			    }
       
   687 			}
       
   688         if (aLanguageList->At(i)->HasInputMode(EPtiEngineQwerty))			
       
   689             {
       
   690 	        aLanguageList->At(i)->ClearQwerty(); 
       
   691 		    if (aLanguageList->At(i)->GetCore(EPtiEngineQwerty) == this)
       
   692 			    {
       
   693 			    aLanguageList->At(i)->SetCore(NULL, EPtiEngineQwerty);			    
       
   694 			    }	                   
       
   695             }
       
   696         if (aLanguageList->At(i)->HasInputMode(EPtiEngineHalfQwerty))			
       
   697             {
       
   698             aLanguageList->At(i)->ClearHalfQwerty();             
       
   699 		    if (aLanguageList->At(i)->GetCore(EPtiEngineHalfQwerty) == this)
       
   700 			    {
       
   701 			    aLanguageList->At(i)->SetCore(NULL, EPtiEngineHalfQwerty);			    
       
   702 			    }	                      
       
   703             }            
       
   704 		}
       
   705 	}
       
   706 
       
   707 
       
   708 // ---------------------------------------------------------------------------
       
   709 // CPtiDefaultCore::GetCoreInfo
       
   710 // 
       
   711 // ---------------------------------------------------------------------------
       
   712 //
       
   713 MPtiCoreInfo* CPtiDefaultCore::GetCoreInfo()
       
   714 	{
       
   715 	return &iCoreInfo;   
       
   716 	}
       
   717 
       
   718 
       
   719 // ---------------------------------------------------------------------------
       
   720 // CPtiDefaultCore::Convert
       
   721 // 
       
   722 // ---------------------------------------------------------------------------
       
   723 //
       
   724 TInt CPtiDefaultCore::Convert(TPtiCharConversion /*aType*/,
       
   725 							  TAny* /*aInput*/,
       
   726 							  TInt /*aInputLength*/,
       
   727 							  TAny* /*aOutput*/)
       
   728 	{
       
   729 	return KErrNotSupported;	
       
   730 	}
       
   731 
       
   732 
       
   733 // ---------------------------------------------------------------------------
       
   734 // CPtiDefaultCore::SetExternalKeyMapL
       
   735 // 
       
   736 // ---------------------------------------------------------------------------
       
   737 //
       
   738 TInt CPtiDefaultCore::SetExternalKeyMapL(TPtiEngineInputMode aMode,
       
   739 		                                 TPtiKey aKey,
       
   740 									     TDesC& aKeyMap,
       
   741 										 TPtiTextCase aCase)
       
   742 	{
       
   743 	if (aMode == EPtiEngineNumeric)
       
   744 		{
       
   745 		__ASSERT_DEBUG(iNumericMappings, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   746 
       
   747 		// Always available. Case doesn't apply for numeric mode,
       
   748 		// so both cases are always updated.
       
   749 		TInt ret = iNumericMappings->ReplaceKeyMapL(aKey, aKeyMap, EPtiCaseLower);
       
   750 		if (ret != KErrNone)
       
   751 			{
       
   752 			return ret;
       
   753 			} 
       
   754 		return iNumericMappings->ReplaceKeyMapL(aKey, aKeyMap, EPtiCaseUpper);
       
   755 		}
       
   756 	else
       
   757 		{		
       
   758 		__ASSERT_DEBUG(iOwner, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   759 				
       
   760 		CPtiCoreLanguage* lang = static_cast<CPtiCoreLanguage*>(iOwner->CurrentLanguage());
       
   761 		if (!lang)
       
   762 			{
       
   763 			return KErrCorrupt;
       
   764 			}
       
   765 		
       
   766 		MPtiKeyMappings* maps = NULL;
       
   767 	    if (aMode == EPtiEngineMultitapping)
       
   768 			{
       
   769 			maps = lang->GetKeymappings();
       
   770 			}
       
   771 		else if (aMode == EPtiEngineQwerty)
       
   772 			{
       
   773 			maps = lang->GetQwertyKeymappings();		
       
   774 			}		
       
   775         else if (aMode == EPtiEngineHalfQwerty)
       
   776             {
       
   777            	maps = lang->GetHalfQwertyKeymappings();	
       
   778             }
       
   779         						
       
   780 		if (maps)
       
   781 			{
       
   782 			return maps->ReplaceKeyMapL(aKey, aKeyMap, aCase);
       
   783 			}					
       
   784 		}		
       
   785 		
       
   786 
       
   787 	return KErrNotSupported;
       
   788 	}
       
   789 
       
   790 
       
   791 // ---------------------------------------------------------------------------
       
   792 // CPtiDefaultCore::GetSpelling
       
   793 // 
       
   794 // ---------------------------------------------------------------------------
       
   795 //
       
   796 TInt CPtiDefaultCore::GetSpelling(TUint16 /*aInput*/, TDes& /*aOutput*/, 
       
   797                                   TPtiSpelling /*aType*/)
       
   798 	{
       
   799 	return KErrNotSupported;
       
   800 	}
       
   801 
       
   802 
       
   803 // ---------------------------------------------------------------------------
       
   804 // CPtiDefaultCore::CancelTimerActivity
       
   805 // 
       
   806 // ---------------------------------------------------------------------------
       
   807 //
       
   808 TInt CPtiDefaultCore::CancelTimerActivity()
       
   809 	{
       
   810 	__ASSERT_DEBUG(iTimer, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   811 		
       
   812 	iTimer->Cancel();
       
   813 	return KErrNone;	
       
   814 	}
       
   815 
       
   816 
       
   817 // ---------------------------------------------------------------------------
       
   818 // CPtiDefaultCore::HandleCommandL
       
   819 // 
       
   820 // ---------------------------------------------------------------------------
       
   821 //
       
   822 TInt CPtiDefaultCore::HandleCommandL(TPtiEngineCommand aCommand, TAny* aParams)
       
   823 	{
       
   824 	__ASSERT_DEBUG(iOwner, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
   825 		
       
   826 	CPtiCoreLanguage* lang = static_cast<CPtiCoreLanguage*>(iOwner->CurrentLanguage());	
       
   827 	TBool qwerty = EFalse;
       
   828 	if (lang)
       
   829 		{
       
   830 		qwerty = lang->HasInputMode(EPtiEngineQwerty);
       
   831 		}
       
   832 	
       
   833 	switch (aCommand)
       
   834 		{
       
   835 		case EPtiCommandPollQwertyDeadKeyRootFlag:
       
   836 			{
       
   837 			if (IsFlagSet(EPtiDeadKeyRootFlag))
       
   838 				{
       
   839 				ClearFlag(EPtiDeadKeyRootFlag);	
       
   840 				return ETrue;
       
   841 				}
       
   842 
       
   843 			return EFalse;
       
   844 			}
       
   845 		case EPtiCommandGetAndClearDeadKeyRootChar:	
       
   846 			{
       
   847 			TUint16 ret = 0;
       
   848 		
       
   849 			if (lang && qwerty)
       
   850 				{
       
   851 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());	
       
   852 				if (maps->DeadKey())
       
   853 					{
       
   854 					maps->ClearDeadKey();	
       
   855 					ret = maps->DeadKeyRootChar();						
       
   856 					}								
       
   857 				}
       
   858 				
       
   859 			return ret;
       
   860 			}
       
   861 		case EPtiCommandDeadKeyWaiting:	
       
   862 			{
       
   863 			TUint16 ret = 0;
       
   864 		
       
   865 			if (lang && qwerty)
       
   866 				{
       
   867 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());	
       
   868 				if (maps->DeadKey())	
       
   869 					{
       
   870 					ret = 1;						
       
   871 					}								
       
   872 				}
       
   873 				
       
   874 			return ret;
       
   875 			}		
       
   876 	
       
   877 		case EPtiCommandQueryAndClearGetAllFlag:
       
   878 			{
       
   879 			TBool ret = IsFlagSet(EPtiGetAllFlag);
       
   880 			ClearFlag(EPtiGetAllFlag);				
       
   881 			return ret;	
       
   882 			}
       
   883 			
       
   884 		case EPtiCommandGetAndClearVowelSequence:
       
   885 			{
       
   886 			if (IsFlagSet(EPtiFlagVowelSeq))
       
   887 				{
       
   888 				if (lang && qwerty)
       
   889 					{
       
   890 					CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());	
       
   891 					ClearFlag(EPtiFlagVowelSeq);						
       
   892 					return maps->VowelSequenceResult();						
       
   893 					}								
       
   894 				}
       
   895 													
       
   896 			return 0;
       
   897 			}							
       
   898 		case EPtiCommandVowelSeqFlag:
       
   899              return IsFlagSet(EPtiFlagVowelSeq);			
       
   900 		case EPtiCommandClearVowelSeq:
       
   901 			 {					
       
   902 			 ClearFlag(EPtiFlagVowelSeq);
       
   903 		     if (lang && qwerty)
       
   904 			 	{
       
   905 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());							
       
   906 				if (maps)
       
   907 					{
       
   908 					maps->ClearVowelSequence();	
       
   909 					}
       
   910 				}					 
       
   911 			 }
       
   912 		     return 0; 		     
       
   913 		case EPtiCommandGetAndClearLastVietnameseChar:
       
   914 			 {					
       
   915 			 if (lang && qwerty)
       
   916 			 	{
       
   917 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());							
       
   918 				if (maps)
       
   919 					{
       
   920 					TInt ret = maps->GetLastChar();
       
   921 					maps->ClearLastChar();	
       
   922 					return ret;
       
   923 					}
       
   924 				}	 					
       
   925 			 }
       
   926 		     return 0;
       
   927 		case EPtiCommandSetVietnameseLastChar:
       
   928 	 		 {					
       
   929 		     if (lang && qwerty)
       
   930 			 	{
       
   931 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());							
       
   932 				if (maps)
       
   933 					{
       
   934 					maps->SetLastChar((TInt)aParams);	
       
   935 					}
       
   936 				}	 					
       
   937 			 }					 
       
   938 		     return 0;  
       
   939 		case EPtiCommandQueryReplacePrevious:
       
   940 			 {										 			 	 
       
   941 			if (lang && qwerty)
       
   942 			 	{
       
   943 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());							
       
   944 				if (maps)
       
   945 					{
       
   946 					TChar rep = maps->ReplacedCharacter();
       
   947 					if (maps->VowelCase() == EPtiCaseUpper ||
       
   948 					    maps->VowelCase() == EPtiCaseChrUpper)
       
   949 						{
       
   950 						rep.UpperCase();
       
   951 						}
       
   952 					else
       
   953 						{
       
   954 						rep.LowerCase();
       
   955 						}						
       
   956 					
       
   957 					return rep;	
       
   958 					}
       
   959 				}	 					
       
   960 			}				     
       
   961 		     return 0;     	     		     		     		     
       
   962 		case EPtiCommandSetLastKeyForVietnamese:
       
   963 			 {	 		 			 	 
       
   964 		     if (lang && qwerty)
       
   965 			 	{
       
   966 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());							
       
   967 				if (maps)
       
   968 					{					
       
   969 					TPtiKey key = (TPtiKey)((TInt)aParams);
       
   970 					maps->SetLastKey(key);	
       
   971 					}
       
   972 				}	 					
       
   973 		 	 }
       
   974 		 	 return 0;
       
   975 		 	 
       
   976 		case EPtiCommandResetVietnameseVowelSeqAndToneMark: 		  		     
       
   977 		     ClearFlag(EPtiFlagVowelSeq);
       
   978 			 if (lang && qwerty)
       
   979 			 	{
       
   980 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());							
       
   981 				if (maps)
       
   982 					{					
       
   983 					maps->ResetVietnameseVowelSequenceAndToneMarks();	
       
   984 					}
       
   985 				}
       
   986 			return 0;
       
   987 			
       
   988 		case EPtiCommandGetVietnameseLastKey:
       
   989 		 	 if ((lang) && (lang->HasInputMode(EPtiEngineQwerty)))
       
   990 			 	{
       
   991 				CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings());							
       
   992 				if (maps)
       
   993 					{					
       
   994 					return (TInt)maps->LastKey();	
       
   995 					}
       
   996 				}				 			
       
   997 		    return 0;
       
   998 		case EPtiCommandDoubleWideEntry:
       
   999 		    {
       
  1000 		    TInt ret = IsFlagSet(EPtiDoubleWideEntry);	
       
  1001 			ClearFlag(EPtiDoubleWideEntry);		    		
       
  1002             return ret;
       
  1003 		    }		    			 											
       
  1004 		default:
       
  1005 			break;
       
  1006 		}		
       
  1007 	
       
  1008 	return KErrNotSupported;
       
  1009 	}
       
  1010 	
       
  1011 	
       
  1012 // ---------------------------------------------------------------------------
       
  1013 // CPtiDefaultCore::ListDataFactoryLanguagesL
       
  1014 // 
       
  1015 // ---------------------------------------------------------------------------
       
  1016 //	
       
  1017 void CPtiDefaultCore::ListDataFactoryLanguagesL(CPtiKeyMapDataFactory* aDataFactory,
       
  1018                                                 TInt aImplUid,
       
  1019                                                 CArrayPtrFlat<CPtiCoreLanguage>* aLanguageList)
       
  1020     {
       
  1021 	__ASSERT_DEBUG(aDataFactory, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
  1022             
       
  1023     RArray<TInt> langs;
       
  1024     aDataFactory->ListLanguagesL(langs);    
       
  1025     CleanupClosePushL(langs);            
       
  1026                     
       
  1027     for (TInt i = 0; i < langs.Count(); i++)
       
  1028         {
       
  1029         CPtiCoreLanguage* language = NULL;        
       
  1030         
       
  1031         for (TInt j = 0; j < iFactoryBindings.Count(); j++)    
       
  1032             {
       
  1033             // Remove possible earlier bindings for this language (ie. 
       
  1034             // newly installed dlls will replace old languages).
       
  1035             if (iFactoryBindings[j].iLanguage == langs[i])
       
  1036                 {
       
  1037                 iFactoryBindings.Remove(j);
       
  1038                 break;
       
  1039                 }          
       
  1040             }
       
  1041             
       
  1042         if (!language)            
       
  1043             {
       
  1044             language = CPtiCoreLanguage::NewL();
       
  1045 	        CleanupStack::PushL( language );            
       
  1046 	       	aLanguageList->AppendL( language ); 
       
  1047 	        CleanupStack::Pop(); // language   	        
       
  1048             }
       
  1049             
       
  1050 		language->SetLanguageCode(langs[i]); 		
       
  1051 		language->SetCore(this, EPtiEngineNumeric);	
       
  1052 		language->SetKeyMapDataFactory(aDataFactory);
       
  1053 		language->GetKeymappings();  // Force core list to be updated.
       
  1054 		language->SetKeyMapDataFactory(NULL);		
       
  1055             
       
  1056         TPtiDataFactoryBinding newBind(langs[i], aImplUid);
       
  1057         iFactoryBindings.AppendL(newBind);                       
       
  1058         }
       
  1059     
       
  1060     CleanupStack::PopAndDestroy(); // langs    
       
  1061     }
       
  1062 		 	
       
  1063 			
       
  1064 // ---------------------------------------------------------------------------
       
  1065 // CPtiDefaultCore::LoadFactoryForLanguageL
       
  1066 // 
       
  1067 // ---------------------------------------------------------------------------
       
  1068 //		
       
  1069 void CPtiDefaultCore::LoadFactoryForLanguageL(TInt aLanguage)
       
  1070     {
       
  1071 	__ASSERT_DEBUG(iOwner, User::Panic(KPtiEnginePanic, KErrCorrupt));
       
  1072         
       
  1073     TInt currentUid = 0;    
       
  1074     if (iKeyMapDataFactory)    
       
  1075         {
       
  1076         currentUid = iKeyMapDataFactory->ImplementationUid();
       
  1077         }
       
  1078         
       
  1079     CPtiCoreLanguage* coreLang = static_cast<CPtiCoreLanguage*>(iOwner->GetLanguage(aLanguage));
       
  1080     if (!coreLang)        
       
  1081         {
       
  1082         User::Leave(KErrCorrupt);
       
  1083         }    
       
  1084             
       
  1085     coreLang->SetKeyMapDataFactory(NULL);            
       
  1086     for (TInt i = 0; i < iFactoryBindings.Count(); i++)    
       
  1087         {
       
  1088         if (iFactoryBindings[i].iLanguage == aLanguage)
       
  1089             {
       
  1090             if (iFactoryBindings[i].iFactoryImplUid == currentUid)
       
  1091                 {
       
  1092                 coreLang->SetKeyMapDataFactory(iKeyMapDataFactory);               
       
  1093                 return;
       
  1094                 }
       
  1095             
       
  1096             // Factory is about to change. Clear references to old one.
       
  1097             ShutDownKeymapFactory();
       
  1098             
       
  1099     	    iKeyMapDataFactory = CPtiKeyMapDataFactory::CreateImplementationL(TUid::Uid(iFactoryBindings[i].iFactoryImplUid));	  	    	  	   
       
  1100             coreLang->SetKeyMapDataFactory(iKeyMapDataFactory);       	    
       
  1101             
       
  1102             return;            
       
  1103             }
       
  1104         }
       
  1105         
       
  1106     User::Leave(KErrNotFound);
       
  1107     }
       
  1108     
       
  1109 
       
  1110 // ---------------------------------------------------------------------------
       
  1111 // CPtiDefaultCore::ShutDownKeymapFactory
       
  1112 // 
       
  1113 // ---------------------------------------------------------------------------
       
  1114 //	    
       
  1115 void CPtiDefaultCore::ShutDownKeymapFactory()
       
  1116     {
       
  1117     if (iLanguageList)
       
  1118         {    
       
  1119         CPtiCoreLanguage* lang = NULL;    	   
       
  1120         for (TInt i = 0; i < iLanguageList->Count(); i++)
       
  1121             {
       
  1122     	    lang = static_cast<CPtiCoreLanguage*>(iLanguageList->At(i));
       
  1123     	    if (lang && lang->DataFactory() == iKeyMapDataFactory)
       
  1124     	        {
       
  1125     		    lang->SetKeyMapDataFactory(NULL);		
       
  1126     	        }
       
  1127             }
       
  1128 
       
  1129         delete iKeyMapDataFactory;
       
  1130         iKeyMapDataFactory = NULL;
       
  1131         }   
       
  1132     }
       
  1133 	
       
  1134 // End of file