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