textinput/ptienginev2/src/PtiSymbolList.cpp
branchRCL_3
changeset 20 ebd48d2de13c
parent 9 e6a39382bb9c
child 21 ecbabf52600f
equal deleted inserted replaced
19:ac7e4d1d9209 20:ebd48d2de13c
   179     TInt idx = -1;
   179     TInt idx = -1;
   180     return GetSymbolIndex( aChar, idx, aRange ) == KErrNone ? ETrue : EFalse ;
   180     return GetSymbolIndex( aChar, idx, aRange ) == KErrNone ? ETrue : EFalse ;
   181     }
   181     }
   182 
   182 
   183 void CSymbolList::GetSymbolModelL(const TDesC& aChar, RArray<TPoint>& aModel ,TUint& aUnicode, const THwrUdmRange& aRange )
   183 void CSymbolList::GetSymbolModelL(const TDesC& aChar, RArray<TPoint>& aModel ,TUint& aUnicode, const THwrUdmRange& aRange )
   184     {CleanupClosePushL( aModel );
   184     {
   185     TInt idx = -1;
   185     TInt idx = -1;
   186     if ( GetSymbolIndex( aChar, idx, aRange ) != KErrNone )
   186     if ( GetSymbolIndex( aChar, idx, aRange ) != KErrNone )
   187         {
   187         {
   188         User::Leave( KErrNotFound );
   188         User::Leave( KErrNotFound );
   189         }
   189         }
   201     aUnicode = symbol->iPresetCode;
   201     aUnicode = symbol->iPresetCode;
   202     aModel.Reset();
   202     aModel.Reset();
   203     for ( int i = 0; i < symbol->iPointVectorLen; i++ )
   203     for ( int i = 0; i < symbol->iPointVectorLen; i++ )
   204         {
   204         {
   205         aModel.AppendL( symbol->iPointVector[i] );    
   205         aModel.AppendL( symbol->iPointVector[i] );    
   206         }  
   206         }    
   207     CleanupStack::Pop( &aModel );
       
   208     }
   207     }
   209 
   208 
   210 void CSymbolList::DeleteSymbolModelL(const TDesC& aChar ,const THwrUdmRange& aRange )
   209 void CSymbolList::DeleteSymbolModelL(const TDesC& aChar ,const THwrUdmRange& aRange )
   211     {
   210     {
   212     TInt idx = -1;
   211     TInt idx = -1;
   290         iPresetModels->ExternalizeL();
   289         iPresetModels->ExternalizeL();
   291         }
   290         }
   292     }
   291     }
   293     
   292     
   294 void CSymbolList::GetModelIndexListL( RArray<TInt>& aList, const THwrUdmRange& aRange)
   293 void CSymbolList::GetModelIndexListL( RArray<TInt>& aList, const THwrUdmRange& aRange)
   295     {CleanupClosePushL( aList );
   294     {
   296     
       
   297     aList.Reset();
   295     aList.Reset();
   298     for ( int i = 0; i < iSymbolList.Count(); i++ )
   296     for ( int i = 0; i < iSymbolList.Count(); i++ )
   299         {
   297         {
   300         if ( iSymbolList[i]->Match( aRange ) )
   298         if ( iSymbolList[i]->Match( aRange ) )
   301             {
   299             {
   313                 {
   311                 {
   314                 aList.AppendL( i + iSymbolList.Count() );
   312                 aList.AppendL( i + iSymbolList.Count() );
   315                 }
   313                 }
   316             }
   314             }
   317         }
   315         }
   318     CleanupStack::Pop( &aList );
       
   319     }
   316     }
   320 
   317 
   321 void CSymbolList::InternalizeL(const TDesC& /*aFile*/)
   318 void CSymbolList::InternalizeL(const TDesC& /*aFile*/)
   322     {
   319     {
   323     // Read the data file and construct the object
   320     // Read the data file and construct the object
   531         
   528         
   532     User::Leave( KErrNotFound );
   529     User::Leave( KErrNotFound );
   533     }
   530     }
   534 
   531 
   535 void CSymbolList::GetAllPresetSymbolsL( RArray<TUint>& aPresets )
   532 void CSymbolList::GetAllPresetSymbolsL( RArray<TUint>& aPresets )
   536     {CleanupClosePushL( aPresets );
   533     {
   537     User::LeaveIfNull( iPresetModels );
   534     User::LeaveIfNull( iPresetModels );
   538     
   535     
   539     for ( int i = 0; i < iPresetModels->iSymbolList.Count(); i ++ )
   536     for ( int i = 0; i < iPresetModels->iSymbolList.Count(); i ++ )
   540         {
   537         {
   541         aPresets.AppendL( iPresetModels->iSymbolList[i]->iPresetCode );
   538         aPresets.AppendL( iPresetModels->iSymbolList[i]->iPresetCode );
   542         }
   539         }
   543     CleanupStack::Pop( &aPresets );
       
   544     }
   540     }
   545 
   541 
   546 void CSymbolList::GetPresetSymbolByUnicodeL( TUint aUnicode, RArray<TPoint>& aModel, TDes& aShortcut )
   542 void CSymbolList::GetPresetSymbolByUnicodeL( TUint aUnicode, RArray<TPoint>& aModel, TDes& aShortcut )
   547     {
   543     {
   548 	CleanupClosePushL( aModel );
   544     User::LeaveIfNull( iPresetModels );
   549     User::LeaveIfNull( iPresetModels ); 
   545     
   550     for ( int i = 0; i < iPresetModels->iSymbolList.Count(); i ++ )
   546     for ( int i = 0; i < iPresetModels->iSymbolList.Count(); i ++ )
   551         {
   547         {
   552         CSymbol* sym = iPresetModels->iSymbolList[i];
   548         CSymbol* sym = iPresetModels->iSymbolList[i];
   553         if ( aUnicode == sym->iPresetCode )
   549         if ( aUnicode == sym->iPresetCode )
   554             {
   550             {
   559                 }
   555                 }
   560             
   556             
   561             for ( int i = 0; i < sym->iPointVectorLen; i++ )
   557             for ( int i = 0; i < sym->iPointVectorLen; i++ )
   562                 {
   558                 {
   563                 aModel.AppendL( sym->iPointVector[i] );    
   559                 aModel.AppendL( sym->iPointVector[i] );    
   564                 }
   560                 }    
   565             CleanupStack::Pop( &aModel );   
       
   566             return;
   561             return;
   567             }
   562             }
   568         }
   563         }
   569     CleanupStack::Pop( &aModel );
   564     User::Leave( KErrNotFound );    
   570     User::Leave( KErrNotFound ); 
       
   571     }
   565     }
   572     
   566     
   573 void CSymbolList::SignalMutex(TAny* aMutex)
   567 void CSymbolList::SignalMutex(TAny* aMutex)
   574    {
   568    {
   575    STATIC_CAST( RMutex*, aMutex )->Signal();
   569    STATIC_CAST( RMutex*, aMutex )->Signal();