textinput/peninputfingerhwrar/src/peninputfingerhwrardatastore.cpp
branchRCL_3
changeset 10 6defe5d1bd39
parent 7 a47de9135b21
child 19 5e18d8c489d6
equal deleted inserted replaced
8:6ceef9a83b1a 10:6defe5d1bd39
     1 /*
     1 /*
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   181 //
   181 //
   182 void CPeninputFingerHwrArDataStore::SetPermittedCases( TInt aPermittedCases )
   182 void CPeninputFingerHwrArDataStore::SetPermittedCases( TInt aPermittedCases )
   183     {
   183     {
   184     iPermittedCases = aPermittedCases;
   184     iPermittedCases = aPermittedCases;
   185     }
   185     }
   186 
       
   187 // ----------------------------------------------------------------------------
       
   188 // Set Primary range
       
   189 // ----------------------------------------------------------------------------
       
   190 //
       
   191 void CPeninputFingerHwrArDataStore::SetPrimaryRange( TInt aPrimaryRange )
       
   192     {
       
   193     const TInt oldIndex = iPermittedRanges.Find( aPrimaryRange );
       
   194     
       
   195     // store the current range
       
   196     switch(aPrimaryRange)
       
   197         {
       
   198         case ERangeNative:
       
   199             {
       
   200             iCurrentRange = EFingerHwrNativeRange;
       
   201             }
       
   202             break;
       
   203         case ERangeEnglish:
       
   204             {
       
   205             iCurrentRange = EFingerHwrEnglishRange;
       
   206             }
       
   207             break;
       
   208         case ERangeNumber:
       
   209             {
       
   210             iCurrentRange = EFingerHwrNumberRange;
       
   211             }
       
   212             break;
       
   213         default:
       
   214             break;
       
   215         }
       
   216         
       
   217     if ( oldIndex > 0 )
       
   218         {
       
   219         iPermittedRanges.Sort();
       
   220         const TInt index = iPermittedRanges.Find( aPrimaryRange );
       
   221         
       
   222         iPermittedRanges.Remove( index );
       
   223         iPermittedRanges.Insert( aPrimaryRange, 0 );
       
   224 
       
   225         // set primary range for hwr engine
       
   226         iHwrEngine->SetRanges( iPermittedRanges );
       
   227         }
       
   228     }
       
   229 
       
   230 // ----------------------------------------------------------------------------
   186 // ----------------------------------------------------------------------------
   231 // get Primary range
   187 // get Primary range
   232 // ----------------------------------------------------------------------------
   188 // ----------------------------------------------------------------------------
   233 //
   189 //
   234 TInt CPeninputFingerHwrArDataStore::PrimaryRange()
   190 TInt CPeninputFingerHwrArDataStore::PrimaryRange()
   435             }       
   391             }       
   436         }
   392         }
   437         
   393         
   438     return rs.AllocL();          
   394     return rs.AllocL();          
   439     }
   395     }
   440 
   396     
   441 // ------------------------------------------------------------------------
       
   442 // CPeninputFingerHwrArDataStore::IsSpecialDisplayChars
       
   443 // ------------------------------------------------------------------------
       
   444 //       
       
   445 TBool CPeninputFingerHwrArDataStore::IsSpecialDisplayChars( const TDesC& aChar ) const
       
   446     { 
       
   447     if( aChar.Compare( KGestureEnter ) == 0 
       
   448        || aChar.Compare( KDisplayBackspace ) == 0
       
   449        || aChar.Compare( KGestureSpace )== 0 )
       
   450         {
       
   451         return ETrue;
       
   452         }
       
   453             
       
   454     return EFalse;
       
   455     }    
       
   456 
       
   457 // -----------------------------------------------------------------------------
       
   458 // CPeninputFingerHwrArDataStore::IsDirectlySentCandidate
       
   459 // -----------------------------------------------------------------------------
       
   460 //  
       
   461 TBool CPeninputFingerHwrArDataStore::IsDirectlySentCandidate( const TDesC& aChar ) const
       
   462     {
       
   463     
       
   464     if( aChar.Compare( KGestureEnter ) == 0 ||
       
   465         aChar.Compare( KDisplayBackspace ) == 0)
       
   466        {
       
   467        return ETrue;
       
   468        }
       
   469            
       
   470     return EFalse;
       
   471     }    
       
   472     
       
   473 // ------------------------------------------------------------------------
       
   474 // CPeninputFingerHwrArDataStore::ConvertDisplayChars
       
   475 // ------------------------------------------------------------------------
       
   476 //   
       
   477 HBufC* CPeninputFingerHwrArDataStore::ConvertDisplayChars( const TDesC& aChar ) const   
       
   478     {
       
   479     HBufC* convertedCan = NULL;
       
   480     TBuf<KSpecialConvertedCharCount> str;
       
   481     if( aChar.Compare( KGestureEnter ) == 0 )
       
   482         {
       
   483         str.Append( EKeyEnter );
       
   484         } 
       
   485     else if( aChar.Compare( KDisplayBackspace ) == 0 )
       
   486         {
       
   487         str.Append( EKeyBackspace );
       
   488         }
       
   489     else if( aChar.Compare( KGestureSpace )== 0 )
       
   490         {
       
   491         str.Append( EKeySpace );
       
   492         }
       
   493                  
       
   494     if( str.Length() > 0 )
       
   495     	{
       
   496     	convertedCan = str.Alloc();	
       
   497     	}
       
   498     	
       
   499     return convertedCan;
       
   500     }
       
   501 
       
   502 // -----------------------------------------------------------------------------
   397 // -----------------------------------------------------------------------------
   503 // CPeninputFingerHwrArDataStore::StartCharacter
   398 // CPeninputFingerHwrArDataStore::StartCharacter
   504 // -----------------------------------------------------------------------------
   399 // -----------------------------------------------------------------------------
   505 //
   400 //
   506 TBool CPeninputFingerHwrArDataStore::StartCharacter()
   401 TBool CPeninputFingerHwrArDataStore::StartCharacter()
   684      {
   579      {
   685      AknPenInputUtils::GetISOLanguageCode( TLanguage( aLanguage ), 
   580      AknPenInputUtils::GetISOLanguageCode( TLanguage( aLanguage ), 
   686          iLanguageShowText );
   581          iLanguageShowText );
   687      }
   582      }
   688 
   583 
   689     
       
   690  // ----------------------------------------------------------------------------
       
   691  // Reset key board type
       
   692  // ----------------------------------------------------------------------------
       
   693  //   
       
   694 void CPeninputFingerHwrArDataStore::ResetKeyboardType()
       
   695     {
       
   696     iHwrEngine->ResetKeyboardType();        
       
   697     }
       
   698  
       
   699  // ----------------------------------------------------------------------------
       
   700  // Set key board type to Qwerty
       
   701  // ----------------------------------------------------------------------------
       
   702  //   
       
   703 void CPeninputFingerHwrArDataStore::SetKeyboardToQwerty()
       
   704     {
       
   705     iHwrEngine->SetKeyboardToQwerty(); 
       
   706     }
       
   707 
       
   708  // ----------------------------------------------------------------------------
       
   709  // Get key board type
       
   710  // ----------------------------------------------------------------------------
       
   711  //       
       
   712 void CPeninputFingerHwrArDataStore::GetKeyboardType()
       
   713     {
       
   714     iHwrEngine->GetKeyboardType();
       
   715     }
       
   716 
       
   717 // ----------------------------------------------------------------------------
   584 // ----------------------------------------------------------------------------
   718 // CPeninputFingerHwrArDataStore::GetTopGuideLinePos
   585 // CPeninputFingerHwrArDataStore::GetTopGuideLinePos
   719 // ----------------------------------------------------------------------------
   586 // ----------------------------------------------------------------------------
   720 //   
   587 //   
   721 void CPeninputFingerHwrArDataStore::GetTopGuideLinePos(TInt& aPos)
   588 void CPeninputFingerHwrArDataStore::GetTopGuideLinePos(TInt& aPos)