textinput/peninputfingerhwr/src/peninputfingerhwrengine.cpp
changeset 0 eb1f2e154e89
child 3 f5a1e66df979
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Implementation of HWR engine
       
    15 *
       
    16 */
       
    17 
       
    18 //FEP INCLUDES
       
    19 #include <aknfepglobalenums.h>
       
    20 #include <aknfeppeninputenums.h>
       
    21 #include <ptihwrrecognizer.h>
       
    22 #include <e32property.h>
       
    23 #include "PtiDefs.h"
       
    24 
       
    25 //USER INCLUDES
       
    26 #include "peninputfingerhwrengine.h"
       
    27 #include "peninputfingerhwrdatastore.h"
       
    28 
       
    29 // CONSTANT DEFINITION HEADER
       
    30 #include "peninputfingerhwrstoreconstants.h"
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // SplitString()
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 static TInt SplitString( const TPtrC &aPtr, 
       
    37     TUint16 aSeperator, 
       
    38     RPointerArray<HBufC>& aStringArray )
       
    39 	{
       
    40 	// phrase input mode
       
    41     TInt start = 0;
       
    42     TInt length = 0;
       
    43 	
       
    44     for ( TInt i = 0; i < aPtr.Length(); i++ )
       
    45         {
       
    46         if ( aPtr[i] == aSeperator )
       
    47             {
       
    48             TPtrC segment( aPtr.Ptr() + start, length );
       
    49             TRAP_IGNORE( aStringArray.AppendL( segment.AllocL() ) );
       
    50             start += ( length + 1 );
       
    51             length = 0;
       
    52             }
       
    53         else
       
    54             {
       
    55             length++;               
       
    56             }
       
    57         }
       
    58 
       
    59     if ( length )
       
    60         {
       
    61         TPtrC segm( aPtr.Ptr() + start, length );
       
    62         TRAP_IGNORE( aStringArray.AppendL( segm.AllocL() ) );
       
    63         }
       
    64         
       
    65     return aStringArray.Count();
       
    66 	}
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // Symbian constructor
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CAknFepHwrEngine* CAknFepHwrEngine::NewL( CPtiEngine* aPtiEngine, 
       
    73     CPeninputFingerHwrDataStore* aOwner )
       
    74     {
       
    75     CAknFepHwrEngine* self = new ( ELeave ) CAknFepHwrEngine();
       
    76     
       
    77     CleanupStack::PushL( self );
       
    78     self->ConstructL( aPtiEngine, aOwner );
       
    79     CleanupStack::Pop( self );//self
       
    80 
       
    81     return self;
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // destructor
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CAknFepHwrEngine::~CAknFepHwrEngine()
       
    89     {
       
    90     if( iOwnPtiEngine )
       
    91         {
       
    92         delete iPtiEngine;
       
    93         }
       
    94     delete iCustomKeymap;
       
    95     
       
    96     delete iIdle;
       
    97     
       
    98     iNeedPermittedRanges.Close();
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // Do recoginize by engine
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 void CAknFepHwrEngine::DoRecognizeL( const RArray<TPoint>& aTraceData, 
       
   106     RPointerArray<HBufC>& aCandidates )
       
   107     {
       
   108     if ( !iRecognizer)
       
   109         {
       
   110         DoIdleConstructL();
       
   111         }
       
   112         
       
   113     TPoint ctrlStrokeEndMark = iOwner->StrokeEndMarkFromControl();
       
   114         
       
   115     if ( ctrlStrokeEndMark != iRecognizer->StrokeEndMark() )
       
   116         {
       
   117         ConvertStrokeEndMark( CONST_CAST( RArray<TPoint>&, aTraceData ), 
       
   118             iOwner->StrokeEndMarkFromControl(), 
       
   119             iRecognizer->StrokeEndMark() );
       
   120         iOwner->SetStrokeEndMark(); // make control's stroke end mark info same to engine
       
   121         }
       
   122     
       
   123     aCandidates.ResetAndDestroy();
       
   124 
       
   125     TInt primaryCount = iRecognizer->Recognize( aTraceData, aCandidates ); 
       
   126 
       
   127     // filter recognized candidate, set start position for all ranges    
       
   128     TPtrC ptr( KSeparator );
       
   129     
       
   130     // remove uncessary aux candidate, including range separator 
       
   131     for ( TInt i=0; i < aCandidates.Count(); i++ )
       
   132         {
       
   133         if ( aCandidates[i]->Compare( KGestureBackspace ) == 0 )
       
   134         	{
       
   135         	// convert backspace returned by engine, to make sure it display correctly.
       
   136             *aCandidates[i] = KDisplayBackspace;
       
   137             break;
       
   138         	}
       
   139         }
       
   140         
       
   141     // remove uncessary primary candidate
       
   142     TInt totallyCount = aCandidates.Count();
       
   143     TInt removePos = iTotalCandidateNum;        
       
   144     
       
   145     for ( TInt i = removePos; i < totallyCount; i++ )
       
   146          {
       
   147          delete aCandidates[removePos];
       
   148          aCandidates.Remove( removePos );
       
   149          } 
       
   150    
       
   151     // not allowing '-' to be the first char in chinese range 
       
   152     // not allowing '/' to be the first char in English and Number range 
       
   153     TPtrC dashPtr( KDash );
       
   154     TPtrC solidusPtr( KSolidus );
       
   155     if ( ( iPremaryRange == ERangeNative ) && 
       
   156         ( aCandidates[0]->Compare( dashPtr ) == 0 ) )
       
   157         {
       
   158         *aCandidates[0] = *aCandidates[1];
       
   159         *aCandidates[1] = dashPtr;
       
   160         }
       
   161     else if ( ( ( iPremaryRange == ERangeEnglish ) || 
       
   162         ( iPremaryRange == ERangeNumber ) ) 
       
   163         && ( aCandidates[0]->Compare( solidusPtr ) == 0 ) )
       
   164         {
       
   165         *aCandidates[0] = *aCandidates[1];
       
   166         *aCandidates[1] = solidusPtr;
       
   167         }
       
   168     }
       
   169     
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // Do predictive using trigger string
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 void CAknFepHwrEngine::DoPredictiveL( const TDesC& aTriggerStr, 
       
   176     RPointerArray<HBufC>& aPredictives,
       
   177     TBool aNextPage )
       
   178     {
       
   179     // predictive only valid for Chinese
       
   180     if ( ( iLanguage != ELangPrcChinese ) &&
       
   181         ( iLanguage != ELangTaiwanChinese ) && 
       
   182         ( iLanguage != ELangHongKongChinese ) )
       
   183     	{
       
   184     	return;    	
       
   185     	}
       
   186 
       
   187     // activate correct pti language according to given language
       
   188     if ( !aNextPage )
       
   189         {
       
   190     	iPtiEngine->SetCandidatePageLength( KPredictiveCountPerPage );
       
   191     	
       
   192     	aPredictives.ResetAndDestroy();
       
   193     	if( !iPtiEngine->SetPredictiveChineseChar( aTriggerStr ) )
       
   194     		{
       
   195     		return;
       
   196     		}
       
   197         }
       
   198     else
       
   199         {
       
   200         if ( !iPtiEngine->NextCandidatePage() )
       
   201             {
       
   202         	return;
       
   203             }
       
   204         }
       
   205         
       
   206     TPtrC ptr = iPtiEngine->CandidatePage();
       
   207     
       
   208     if ( ( iPtiEngine->InputMode() == EPtiEnginePinyinVkb ) || 
       
   209         ( iPtiEngine->InputMode() == EPtiEngineStrokeByPhrase ) ||
       
   210         ( iPtiEngine->InputMode() == EPtiEngineZhuyinVkb ) )
       
   211     	{
       
   212     	SplitString( ptr, KSegment, aPredictives );
       
   213     	}
       
   214     else
       
   215         {
       
   216         TInt predictiveCandidateNum = ptr.Length();
       
   217 
       
   218         for ( TInt i=0; i<predictiveCandidateNum; i++ )
       
   219             {
       
   220             aPredictives.Append( ptr.Mid( i,1 ).AllocL() );
       
   221             }
       
   222         }	
       
   223     }
       
   224     
       
   225 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   226 // ---------------------------------------------------------------------------
       
   227 // Do predictive for auto complete in English range
       
   228 // ---------------------------------------------------------------------------
       
   229 //
       
   230  void CAknFepHwrEngine::DoEngPredictiveL( const TDesC& aTriggerStr, 
       
   231     RPointerArray<HBufC>& aPredictives)
       
   232     {
       
   233 
       
   234     aPredictives.ResetAndDestroy();
       
   235     CDesCArray* cands = new (ELeave) CDesCArrayFlat(16);
       
   236     CleanupStack::PushL(cands);
       
   237     iPtiEngine->ClearCurrentWord();
       
   238 	iPtiEngine->SetCurrentWord(aTriggerStr);
       
   239   
       
   240     // Get auto complete candidates
       
   241     iPtiEngine->GetCandidateListL(*cands);
       
   242     for ( TInt i = 1; i < cands->Count(); i++ )
       
   243         {
       
   244         // Don't show the first predictive
       
   245         aPredictives.Append( (*cands)[i].AllocL() );
       
   246         }
       
   247    
       
   248     CleanupStack::PopAndDestroy( cands ); //cands  	
       
   249     }
       
   250 #endif
       
   251  
       
   252 // ---------------------------------------------------------------------------
       
   253 // Set primary and auxiliary ranges for hwr engine
       
   254 // ---------------------------------------------------------------------------
       
   255 //
       
   256 void CAknFepHwrEngine::SetRanges( const RArray<TInt>& aPermittedRanges )
       
   257     {
       
   258     TRAP_IGNORE( SetRangesL( aPermittedRanges ) );
       
   259     }
       
   260     
       
   261 // ---------------------------------------------------------------------------
       
   262 // Set primary and auxiliary ranges for hwr engine
       
   263 // ---------------------------------------------------------------------------
       
   264 //
       
   265 void CAknFepHwrEngine::SetRangesL( const RArray<TInt>& aPermittedRanges )
       
   266     {
       
   267    	ASSERT( aPermittedRanges.Count() > 0 );
       
   268 
       
   269     if ( !iRecognizer )
       
   270         {
       
   271     	iNeedPermittedRanges.Reset();
       
   272     	
       
   273     	for ( TInt i = 0; i < aPermittedRanges.Count(); i++ )
       
   274     	    {
       
   275             iNeedPermittedRanges.Append( aPermittedRanges[i] );
       
   276     	    }
       
   277     	
       
   278     	iNeedSetRange = ETrue;
       
   279     	return;    
       
   280         }
       
   281     else 
       
   282     	{
       
   283         iPremaryRange = aPermittedRanges[0];
       
   284         iRangeCount = aPermittedRanges.Count();
       
   285 
       
   286         SetCandidatesMaxCount( KCandidateCount );
       
   287 
       
   288 
       
   289         TRecognitionRange range;
       
   290         SetRecognitionRange( aPermittedRanges[0], range );
       
   291         
       
   292     
       
   293 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   294         if(iPremaryRange == ERangeEnglish)
       
   295             {
       
   296             iPtiEngine->ActivateLanguageL( ELangEnglish, EPtiEngineQwertyPredictive );
       
   297             iPtiEngine->HandleCommandL( EPtiCommandEnableAutoCompletion  );
       
   298             }
       
   299         else
       
   300             {
       
   301             iPtiEngine->HandleCommandL( EPtiCommandDisableAutoCompletion );
       
   302             
       
   303         	switch ( iLanguage )
       
   304                 {
       
   305                 case ELangPrcChinese:
       
   306                     {
       
   307                     if ( iPtiEngine->ActivateLanguageL( iLanguage, EPtiEnginePinyinVkb ) != KErrNone )
       
   308                     	{
       
   309                     	iPtiEngine->ActivateLanguageL( iLanguage, EPtiEnginePinyin );
       
   310                     	}
       
   311                     }
       
   312                     break;
       
   313                 case ELangHongKongChinese:
       
   314                     {
       
   315                     if ( iPtiEngine->ActivateLanguageL( iLanguage, EPtiEngineStrokeByPhrase ) != KErrNone )
       
   316                     	{
       
   317                     	iPtiEngine->ActivateLanguageL( ELangHongKongChinese, EPtiEngineStroke );
       
   318                     	}
       
   319                     }
       
   320                     break;
       
   321                 case ELangTaiwanChinese:
       
   322                     {
       
   323                     if ( iPtiEngine->ActivateLanguageL( iLanguage, EPtiEngineZhuyinVkb ) != KErrNone )
       
   324                     	{
       
   325                     	iPtiEngine->ActivateLanguageL( ELangTaiwanChinese, EPtiEngineZhuyin );
       
   326                     	}
       
   327                     }
       
   328                     break;
       
   329                 default:
       
   330                     return;
       
   331                 }            
       
   332             }         
       
   333 #endif //RD_INTELLIGENT_TEXT_INPUT        
       
   334         
       
   335         iRecognizer->SetRange( range );
       
   336         SetCase( iCase );
       
   337     	}
       
   338     }
       
   339 
       
   340     
       
   341 // ---------------------------------------------------------------------------------------------
       
   342 // Set case
       
   343 // ---------------------------------------------------------------------------------------------
       
   344 //
       
   345 void CAknFepHwrEngine::SetCase( const TInt aCase )
       
   346     {
       
   347     iCase = aCase;
       
   348     
       
   349     if ( !iRecognizer )
       
   350         {
       
   351     	iNeedSetCase = ETrue;
       
   352         }
       
   353     else
       
   354         {
       
   355         // set letter to lower first when LowerCase
       
   356 	    // set letter to upper first when UpperCase and TextCase
       
   357         if ( aCase == ECaseLower )
       
   358             {
       
   359             iRecognizer->SetFirstLetterOrder( ELowerFirst );
       
   360             }
       
   361         else
       
   362             {
       
   363             iRecognizer->SetFirstLetterOrder( EUpperFirst );
       
   364             }
       
   365         }
       
   366     }
       
   367 
       
   368 // ---------------------------------------------------------------------------------------------
       
   369 // Set number mode for hwr engine
       
   370 // ---------------------------------------------------------------------------------------------
       
   371 //
       
   372 void CAknFepHwrEngine::SetNumberMode( const TAknEditorNumericKeymap& aNumberMode )
       
   373     {
       
   374     iNumberMode = aNumberMode;
       
   375     
       
   376     if ( !iRecognizer )
       
   377         {
       
   378         iNeedSetNumberMode = ETrue;
       
   379         }
       
   380     else
       
   381         {
       
   382         iRecognizer->SetNumberMode( aNumberMode );
       
   383         if( aNumberMode !=  EKeymapFromResource )
       
   384             {
       
   385             ResetCustomKeyMap();
       
   386             }
       
   387         }
       
   388     }
       
   389 
       
   390 // ---------------------------------------------------------------------------------------------
       
   391 // Get stroke end mark from hwr engine
       
   392 // ---------------------------------------------------------------------------------------------
       
   393 //
       
   394 TPoint CAknFepHwrEngine::StrokeEndMark() const
       
   395     {
       
   396     if ( iRecognizer )
       
   397         {
       
   398         return iRecognizer->StrokeEndMark();
       
   399         }
       
   400     else
       
   401         {
       
   402         return TPoint( KDefaultStrokeEndMarkX, KDefaultStrokeEndMarkY );
       
   403         }
       
   404     }
       
   405 
       
   406 // ---------------------------------------------------------------------------------------------
       
   407 // Set primary candidate num for hwr engine
       
   408 // ---------------------------------------------------------------------------------------------
       
   409 //
       
   410 TInt CAknFepHwrEngine::SetPrimaryCandidateNum( const TInt aNum )
       
   411     {
       
   412     if ( iRecognizer )
       
   413         {
       
   414         return iRecognizer->SetCandidateNum( aNum );
       
   415         }
       
   416     else
       
   417         {
       
   418         return KErrGeneral;
       
   419         }
       
   420     }
       
   421         
       
   422 // ---------------------------------------------------------------------------------------------
       
   423 // Set total candidate num that should be shown
       
   424 // ---------------------------------------------------------------------------------------------
       
   425 //
       
   426 void CAknFepHwrEngine::SetCandidatesMaxCount( const TInt aCount )
       
   427     {
       
   428     iTotalCandidateNum = aCount;
       
   429     }
       
   430     
       
   431 // ---------------------------------------------------------------------------------------------
       
   432 // Set language
       
   433 // ---------------------------------------------------------------------------------------------
       
   434 //
       
   435 void CAknFepHwrEngine::SetLanguageL( const TInt aLanguage )
       
   436     {
       
   437     if ( ( iLanguage == aLanguage ) ||
       
   438          ( aLanguage != ELangPrcChinese && 
       
   439           aLanguage != ELangHongKongChinese && 
       
   440           aLanguage != ELangTaiwanChinese ) )
       
   441         {
       
   442         return;
       
   443         }
       
   444         
       
   445     iLanguage = aLanguage;
       
   446         
       
   447 	switch ( iLanguage )
       
   448     {
       
   449     case ELangPrcChinese:
       
   450         {
       
   451         if ( iPtiEngine->ActivateLanguageL( iLanguage, EPtiEnginePinyinVkb ) != KErrNone )
       
   452         	{
       
   453         	iPtiEngine->ActivateLanguageL( iLanguage, EPtiEnginePinyin );
       
   454         	}
       
   455         }
       
   456         break;
       
   457     case ELangHongKongChinese:
       
   458         if ( iPtiEngine->ActivateLanguageL( iLanguage, EPtiEngineStrokeByPhrase ) != KErrNone )
       
   459         	{
       
   460         	iPtiEngine->ActivateLanguageL( ELangHongKongChinese, EPtiEngineStroke );
       
   461         	}
       
   462         break;
       
   463     case ELangTaiwanChinese:
       
   464         if ( iPtiEngine->ActivateLanguageL( iLanguage, EPtiEngineZhuyinVkb ) != KErrNone )
       
   465         	{
       
   466         	iPtiEngine->ActivateLanguageL( ELangTaiwanChinese, EPtiEngineZhuyin );
       
   467         	}
       
   468         break;
       
   469     default:
       
   470         return;
       
   471     }
       
   472 
       
   473 	iRecognizer = NULL;
       
   474 	
       
   475 	if( !iIdle->IsActive() )
       
   476 	    {
       
   477 	    iIdle->Start( TCallBack( BackgroundTaskL, this ) );
       
   478 	    }
       
   479     }
       
   480 
       
   481 // ---------------------------------------------------------------------------
       
   482 // Set recognition range for hwr engine
       
   483 // ---------------------------------------------------------------------------
       
   484 //
       
   485 void CAknFepHwrEngine::SetCustomKeymapL( const TDesC& aKeyMap )
       
   486     {
       
   487     ResetCustomKeyMap();
       
   488     
       
   489     iCustomKeymap = HBufC::NewL( aKeyMap.Length() + KNumberString().Length() );
       
   490     iCustomKeymap->Des().Copy( KNumberString() );
       
   491     iCustomKeymap->Des().Append( aKeyMap );
       
   492     }
       
   493 
       
   494 // ---------------------------------------------------------------------------
       
   495 // Set recognition range for hwr engine
       
   496 // ---------------------------------------------------------------------------
       
   497 //
       
   498 void CAknFepHwrEngine::ResetCustomKeyMap()
       
   499     {
       
   500     delete iCustomKeymap;
       
   501     iCustomKeymap = NULL;
       
   502     }
       
   503 
       
   504 // ---------------------------------------------------------------------------------------------
       
   505 // CAknFepHwrEngine::BackgroundConstructL
       
   506 // Do background construct.
       
   507 // ---------------------------------------------------------------------------------------------
       
   508 //
       
   509 TBool CAknFepHwrEngine::BackgroundTaskL( TAny* aPtr )
       
   510     {
       
   511     CAknFepHwrEngine* self = static_cast<CAknFepHwrEngine*>( aPtr );
       
   512     self->DoIdleConstructL();
       
   513     return EFalse;
       
   514     }
       
   515     
       
   516 // ---------------------------------------------------------------------------
       
   517 // Set hand writing area size
       
   518 // ---------------------------------------------------------------------------
       
   519 //
       
   520 TInt CAknFepHwrEngine::SetInputAreaSize(TSize& aSize)
       
   521     {
       
   522     return iRecognizer ? iRecognizer->SetInputAreaSize(aSize) : KErrNotFound;     
       
   523     }
       
   524 
       
   525 // ---------------------------------------------------------------------------
       
   526 // Set hand writing screen size
       
   527 // ---------------------------------------------------------------------------
       
   528 //
       
   529 TInt CAknFepHwrEngine::SetScreenSize(TSize& aSize)    
       
   530     {
       
   531     return iRecognizer ? iRecognizer->SetScreenSize(aSize) : KErrNotFound;
       
   532     }
       
   533 
       
   534 // ---------------------------------------------------------------------------
       
   535 // C++ constructor
       
   536 // ---------------------------------------------------------------------------
       
   537 //
       
   538 CAknFepHwrEngine::CAknFepHwrEngine()
       
   539     {
       
   540     iNeedSetNumberMode = EFalse;
       
   541     iNeedSetCase = EFalse;
       
   542     iNeedSetRange = EFalse;
       
   543     iRecognizer = NULL;    
       
   544     iOwnPtiEngine = EFalse;
       
   545     }
       
   546 
       
   547 // ---------------------------------------------------------------------------
       
   548 // Second phase constructor
       
   549 // ---------------------------------------------------------------------------
       
   550 //
       
   551 void CAknFepHwrEngine::ConstructL( CPtiEngine* aPtiEngine, 
       
   552     CPeninputFingerHwrDataStore* aOwner )
       
   553     {
       
   554     if( !aPtiEngine )
       
   555         {
       
   556         iPtiEngine = CPtiEngine::NewL( ETrue );
       
   557         iOwnPtiEngine = ETrue;
       
   558         }
       
   559     else
       
   560     	{
       
   561     	iPtiEngine = aPtiEngine;
       
   562     	}
       
   563 
       
   564     iIdle = CIdle::NewL( CActive::EPriorityIdle );
       
   565     iOwner = aOwner;
       
   566     }
       
   567 
       
   568 // ---------------------------------------------------------------------------
       
   569 // Set recognition range for hwr engine
       
   570 // ---------------------------------------------------------------------------
       
   571 //
       
   572 void CAknFepHwrEngine::SetRecognitionRange( const TInt aRange, 
       
   573     TRecognitionRange& aRecognitionRange )
       
   574     {
       
   575     aRecognitionRange.iLanguage = TLanguage( iLanguage );
       
   576 
       
   577     switch ( aRange )
       
   578         {
       
   579         case ERangeNative:
       
   580 			{
       
   581             if ( iLanguage == ELangPrcChinese )
       
   582                 {
       
   583                 aRecognitionRange.iSubRange = EPtiRangePRCChinese;
       
   584                 }
       
   585             else if ( iLanguage == ELangHongKongChinese )
       
   586                 {
       
   587                 aRecognitionRange.iSubRange = EPtiRangeHKChinese;
       
   588                 }
       
   589             else
       
   590             	{
       
   591                 aRecognitionRange.iSubRange = EPtiRangeTWChinese;
       
   592                 }
       
   593 			}
       
   594             break;
       
   595         case ERangeEnglish:
       
   596             {
       
   597             aRecognitionRange.iLanguage = ELangEnglish;
       
   598             aRecognitionRange.iSubRange = EPtiRangeLatin;  
       
   599             }
       
   600             break;
       
   601         case ERangeNumber:
       
   602             {
       
   603             aRecognitionRange.iSubRange = EPtiRangeNumber;
       
   604             }
       
   605             break;
       
   606         default:
       
   607             break;
       
   608         }
       
   609     }
       
   610     
       
   611 // ---------------------------------------------------------------------------------------------
       
   612 // CAknFepHwrEngine::DoIdleConstructL
       
   613 // Do background construct.
       
   614 // ---------------------------------------------------------------------------------------------
       
   615 //
       
   616 void CAknFepHwrEngine::DoIdleConstructL()
       
   617     {
       
   618     if ( iRecognizer )
       
   619         {
       
   620         return;
       
   621         }
       
   622 
       
   623 	iRecognizer = iPtiEngine->GetHwrRecognizerL( TLanguage( iLanguage ) );
       
   624     
       
   625 	iOwner->SetStrokeEndMark();
       
   626 	SetPrimaryCandidateNum( KPremaryCandidateCount );
       
   627 	
       
   628     if ( iNeedSetRange )
       
   629         {
       
   630         SetRanges( iNeedPermittedRanges );
       
   631         iNeedPermittedRanges.Reset();
       
   632         iNeedSetRange = EFalse;        
       
   633         }
       
   634     
       
   635     if ( iNeedSetCase )
       
   636         {
       
   637     	SetCase( iCase );
       
   638     	iNeedSetCase = EFalse;
       
   639         }
       
   640     
       
   641     if ( iNeedSetNumberMode )
       
   642         {
       
   643     	SetNumberMode( TAknEditorNumericKeymap( iNumberMode ) );
       
   644     	iNeedSetNumberMode = EFalse;
       
   645         }
       
   646     }
       
   647 
       
   648 // ---------------------------------------------------------------------------
       
   649 // Convert stroke end mark
       
   650 // ---------------------------------------------------------------------------
       
   651 //
       
   652 void CAknFepHwrEngine::ConvertStrokeEndMark( RArray<TPoint>& aTraceData, 
       
   653     TPoint aPnt1, TPoint aPnt2 )
       
   654     {
       
   655     TInt count = aTraceData.Count();
       
   656 
       
   657     for ( TInt i = 0; i < count; i++ )
       
   658         {
       
   659     	if ( aTraceData[i] == aPnt1 )
       
   660     	    {
       
   661     		aTraceData.Remove( i );
       
   662     		aTraceData.Insert( aPnt2, i );
       
   663     	    }
       
   664         }
       
   665     }
       
   666     
       
   667 // ---------------------------------------------------------------------------
       
   668 // Reset Keyboard type to original type
       
   669 // ---------------------------------------------------------------------------
       
   670 //
       
   671 void CAknFepHwrEngine::ResetKeyboardType()
       
   672     {
       
   673 #ifdef RD_INTELLIGENT_TEXT_INPUT    
       
   674     RProperty::Set(KCRUidAvkon, KAknKeyBoardLayout, iKeyboardType);
       
   675 #endif
       
   676     }        
       
   677      
       
   678 // ---------------------------------------------------------------------------
       
   679 // Set Keyboard type to Qwerty
       
   680 // ---------------------------------------------------------------------------
       
   681 //
       
   682 void CAknFepHwrEngine::SetKeyboardToQwerty()
       
   683     {
       
   684 #ifdef RD_INTELLIGENT_TEXT_INPUT   
       
   685     RProperty::Set(KCRUidAvkon, KAknKeyBoardLayout, EPtiKeyboardQwerty4x12);
       
   686 #endif
       
   687     }        
       
   688 
       
   689 // ---------------------------------------------------------------------------
       
   690 // Get Keyboard type
       
   691 // ---------------------------------------------------------------------------
       
   692 //
       
   693 void CAknFepHwrEngine::GetKeyboardType()
       
   694     {
       
   695 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   696     RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, iKeyboardType);
       
   697 #endif    
       
   698     }        
       
   699 
       
   700      
       
   701        
       
   702 //End Of File