fep/aknfep/peninputplugins/peninputimeplugingeneric/src/pluginfepmanagerbase.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2005 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:            Layout UI interface base class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 // System includes
       
    30 #include <w32std.h>
       
    31 #include <s32mem.h> 
       
    32 #include <aknedsts.h>               // CAknEdwinState
       
    33 #include <centralrepository.h>
       
    34 #include <AknUtils.h> 
       
    35 
       
    36 #include <peninputclient.h>
       
    37 #include <aknfeppeninputenums.h>
       
    38 #include <AknFepInternalCRKeys.h>
       
    39 #include <peninputcommonlayoutglobalenum.h>
       
    40 
       
    41 // User includes
       
    42 #include "pluginfepmanagerbase.h"
       
    43 #include "peninputimeplugingeneric.h"
       
    44 
       
    45 // ======== MEMBER FUNCTIONS ========
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CPluginFepManagerBase::CPluginFepManagerBase
       
    50 // Destructor
       
    51 // (other items were commented in a header).
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CPluginFepManagerBase::~CPluginFepManagerBase()
       
    55     {
       
    56     delete iRepository;
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CPluginFepManagerBase::OnInit
       
    61 // Initalize UI.
       
    62 // (other items were commented in a header).
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 void CPluginFepManagerBase::OnInit()
       
    66     {
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CPluginFepManagerBase::RetrieveEditorMaxLength
       
    71 // Explicitly get ICF max length from layout UI .
       
    72 // (other items were commented in a header).
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 void CPluginFepManagerBase::RetrieveEditorMaxLength()
       
    76     {
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CPluginFepManagerBase::UpdateCaseMode
       
    81 // Update local copy of case mode.
       
    82 // (other items were commented in a header).
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CPluginFepManagerBase::UpdateCaseMode( TInt aCaseMode )
       
    86     {
       
    87     iLastCase = aCaseMode; 
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CPluginFepManagerBase::SetNumberModeKeyMappingL
       
    92 // Set layout UI current number mode.
       
    93 // (other items were commented in a header).
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CPluginFepManagerBase::SetNumberModeKeyMappingL( 
       
    97     TAknEditorNumericKeymap aAknEditorNumericKeymap )
       
    98     {
       
    99     SendCommandToServer( ECmdPenInputEditorNumericKeyMap, 
       
   100                          aAknEditorNumericKeymap );    
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CPluginFepManagerBase::HandleKeyL
       
   105 // Handle key event.
       
   106 // (other items were commented in a header).
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 TBool CPluginFepManagerBase::HandleKeyL( TInt aKey, TKeyPressLength aLength, TEventCode /*aEventCode*/ )
       
   110     {
       
   111     return iHkbUi->HandleKeyL( aKey, aLength );
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CPluginFepManagerBase::HandleCommandL
       
   116 // Handle command come from FEP.
       
   117 // (other items were commented in a header).
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 void CPluginFepManagerBase::HandleCommandL( TInt aCommandId )
       
   121     {
       
   122     SendCommandToServer( aCommandId );
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CPluginFepManagerBase::HandleCommandL
       
   127 // Handle command come from FEP.
       
   128 // (other items were commented in a header).
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 void CPluginFepManagerBase::HandleCommandL(TInt aCommandId,TInt aParam)
       
   132     {
       
   133     switch ( aCommandId )
       
   134         {
       
   135         case ECmdPenInputRange:
       
   136             {
       
   137             iHkbMode = aParam;
       
   138             if ( iHkbMode == ENativeNumber && !SupportNativeNumberRange() )
       
   139                 {
       
   140                 iHkbMode = ENumber;
       
   141                 }
       
   142             }
       
   143             break;
       
   144         case ECmdPenInputPermittedRange:
       
   145             {
       
   146             iLastCase = ECaseInvalide;
       
   147             SetLayoutPermitedRanges( aParam );
       
   148             }
       
   149             break;
       
   150         case ECmdPenInputEditorState:
       
   151             {
       
   152             CAknEdwinState* state = 
       
   153                 reinterpret_cast<CAknEdwinState*>( aParam );
       
   154             SetLayoutRange( state );
       
   155             }
       
   156             break;
       
   157         case ECmdPenInputSetWindowPos:
       
   158             {
       
   159             TRect* rect = reinterpret_cast<TRect*>( aParam );
       
   160             ASSERT( rect );
       
   161             SetLayoutPosition( *rect );
       
   162             }
       
   163             break;
       
   164         case ECmdPenInputCaseMode:
       
   165             //if( aParam != iLastCase )
       
   166                 {
       
   167                 SendCommandToServer( ECmdPenInputCase, aParam );
       
   168                 iLastCase = aParam;
       
   169                 }
       
   170             break;
       
   171         case ECmdPenInputEditorCustomNumericKeyMap:
       
   172             {
       
   173             TDesC* res = (TDesC*)aParam;
       
   174             TPtrC8 param;
       
   175             param.Set((TUint8*)res->Ptr(), res->Size());
       
   176             SendCommandToServer( aCommandId, param ); 
       
   177             SetNumberModeKeyMappingL((TAknEditorNumericKeymap)EKeymapFromResource);
       
   178             }
       
   179             break;
       
   180         case ECmdPenInputSuggestRange:
       
   181             iSuggestedRange = aParam;
       
   182             if( iSuggestedRange == ERangeAccent )
       
   183                 {
       
   184                 iSuggestedRange = ERangeEnglish;
       
   185                 }
       
   186             break;
       
   187         case ECmdPenInputSendEditorTextAndCurPos:
       
   188             {    
       
   189             TFepInputContextFieldData* pIcfData = 
       
   190                 reinterpret_cast<TFepInputContextFieldData*>( aParam );
       
   191                        
       
   192             TInt dataSize = sizeof( TFepInputContextFieldData );
       
   193             TInt textSize = pIcfData->iText.Size();
       
   194             
       
   195 			HBufC8* buf = HBufC8::NewLC(dataSize + textSize + 2*sizeof(TInt));
       
   196 			TPtr8 bufPtr = buf->Des();
       
   197 			
       
   198 			RDesWriteStream writeStream;
       
   199 			writeStream.Open(bufPtr);
       
   200 			CleanupClosePushL(writeStream);
       
   201 			
       
   202 			writeStream.WriteInt32L(dataSize);
       
   203 			writeStream.WriteInt32L(textSize);
       
   204 			
       
   205 			const TUint8* pData = reinterpret_cast<const TUint8*>( pIcfData );
       
   206 			writeStream.WriteL( pData, dataSize );
       
   207         		
       
   208     		const TUint8* pText = reinterpret_cast<const TUint8*>( pIcfData->iText.Ptr() );
       
   209 		    writeStream.WriteL( pText, textSize );
       
   210 		    
       
   211             writeStream.CommitL();
       
   212         
       
   213             SendCommandToServer( aCommandId, bufPtr );
       
   214     
       
   215 			CleanupStack::PopAndDestroy(&writeStream);
       
   216 			CleanupStack::PopAndDestroy(buf);
       
   217             }
       
   218             break;
       
   219 	     case ECmdPenInputSetPromptText:
       
   220             {
       
   221             TFepPromptText* pPromptData = 
       
   222                 reinterpret_cast<TFepPromptText*>( aParam );
       
   223                 
       
   224             TInt dataSize = sizeof( TFepPromptText );
       
   225             TInt textSize = 0;
       
   226             
       
   227             if (pPromptData->iText.Length())
       
   228                 {
       
   229                 textSize = pPromptData->iText.Size();
       
   230                 }
       
   231             
       
   232 			HBufC8* buf = HBufC8::NewLC(dataSize + textSize + 2*sizeof(TInt));
       
   233 			TPtr8 bufPtr = buf->Des();
       
   234 			
       
   235 			RDesWriteStream writeStream;
       
   236 			writeStream.Open(bufPtr);
       
   237 			CleanupClosePushL(writeStream);
       
   238 			
       
   239 			writeStream.WriteInt32L(dataSize);
       
   240 			writeStream.WriteInt32L(textSize);
       
   241 			
       
   242 			const TUint8* pData = reinterpret_cast<const TUint8*>( pPromptData );
       
   243 			writeStream.WriteL( pData, dataSize );
       
   244         	
       
   245         	if (textSize != 0)
       
   246         	    {
       
   247                 const TUint16* pText = pPromptData->iText.Ptr();
       
   248     		    writeStream.WriteL( pText, textSize/2 );
       
   249         	    }
       
   250 		    
       
   251             writeStream.CommitL();
       
   252         
       
   253             SendCommandToServer( aCommandId, bufPtr );
       
   254     
       
   255 			CleanupStack::PopAndDestroy(&writeStream);
       
   256 			CleanupStack::PopAndDestroy(buf);
       
   257             }
       
   258             break;
       
   259         case ECmdPenInputPopupTooltip:
       
   260             {
       
   261             TPtrC* tooltipTextPtr = reinterpret_cast<TPtrC*>( aParam );
       
   262             HBufC8* buf8 = HBufC8::NewLC
       
   263                          ( sizeof( TInt ) + tooltipTextPtr->Size() );
       
   264             TPtr8 buf8Ptr = buf8->Des();
       
   265             RDesWriteStream writeStream;
       
   266             CleanupClosePushL(writeStream);
       
   267             writeStream.Open( buf8Ptr );
       
   268             writeStream.WriteInt32L( tooltipTextPtr->Size() );
       
   269             writeStream.WriteL( tooltipTextPtr->Ptr(), tooltipTextPtr->Length() );
       
   270             writeStream.CommitL();
       
   271             CleanupStack::PopAndDestroy( &writeStream );                        
       
   272             SendCommandToServer( aCommandId, buf8Ptr );            
       
   273             CleanupStack::PopAndDestroy( buf8 );
       
   274             break;
       
   275             }
       
   276         case ECmdPenInputPopupCandidateList:
       
   277             {
       
   278             TFepITICandidateList* candidatelist 
       
   279                                = reinterpret_cast<TFepITICandidateList*>( aParam );            
       
   280             CDesCArray* itemArray = candidatelist->iItemArray;
       
   281             if ( itemArray )
       
   282                 {           
       
   283                 TInt sumSize = 0;     
       
   284                 for ( TInt i = 0; i < itemArray->Count(); i++ )
       
   285                     {
       
   286                     sumSize += (*itemArray)[i].Size();
       
   287                     }
       
   288                 HBufC8* buf8 = HBufC8::NewLC( sizeof(TInt) // For active index
       
   289                                              + sizeof(TInt) // For the count of item array
       
   290                                              + sizeof(TInt)*( itemArray->Count() ) // For the size of each item
       
   291                                              + sumSize// For all of char data 
       
   292                                              );
       
   293                 TPtr8 buf8Ptr = buf8->Des();
       
   294                 RDesWriteStream writeStream;
       
   295                 CleanupClosePushL(writeStream);                
       
   296                 writeStream.Open( buf8Ptr );                
       
   297                 writeStream.WriteInt32L( candidatelist->iActiveIndex );
       
   298                 writeStream.WriteInt32L( itemArray->Count() );                
       
   299                 for ( TInt i = 0; i < itemArray->Count(); i++  )
       
   300                     {
       
   301                     writeStream.WriteInt32L( (*itemArray)[i].Size() );
       
   302                     writeStream.WriteL( (*itemArray)[i].Ptr(), (*itemArray)[i].Length() );
       
   303                     }
       
   304                 writeStream.CommitL();                 
       
   305                 CleanupStack::PopAndDestroy( &writeStream );
       
   306                 SendCommandToServer( aCommandId, buf8Ptr );
       
   307                 CleanupStack::PopAndDestroy( buf8 );
       
   308                 }            
       
   309             break;
       
   310             }
       
   311         default:
       
   312             SendCommandToServer( aCommandId, aParam );
       
   313             break;
       
   314         }
       
   315     }
       
   316 
       
   317 // -----------------------------------------------------------------------------
       
   318 // CPluginFepManagerBase::CloseUI
       
   319 // Close plugin layout UI.
       
   320 // (other items were commented in a header).
       
   321 // -----------------------------------------------------------------------------
       
   322 //
       
   323 void CPluginFepManagerBase::CloseUI()
       
   324     {
       
   325     iPenInputServer->ActivateLayout( EFalse );  
       
   326     }
       
   327 
       
   328 // -----------------------------------------------------------------------------
       
   329 // CPluginFepManagerBase::ActivateUI
       
   330 // Activate plugin layout UI.
       
   331 // (other items were commented in a header).
       
   332 // -----------------------------------------------------------------------------
       
   333 //
       
   334 void CPluginFepManagerBase::ActivateUI()
       
   335     {
       
   336     iPenInputServer->ActivateLayout( ETrue );    
       
   337     }
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CPluginFepManagerBase::EditorMaxLength
       
   341 // Get max text length of layout UI ICF control.
       
   342 // (other items were commented in a header).
       
   343 // -----------------------------------------------------------------------------
       
   344 //
       
   345 TInt CPluginFepManagerBase::EditorMaxLength()
       
   346     {
       
   347     return iMaxEditorLength;
       
   348     }
       
   349 
       
   350 // -----------------------------------------------------------------------------
       
   351 // CPluginFepManagerBase::SizeChanged
       
   352 // Handle screen size changed.
       
   353 // (other items were commented in a header).
       
   354 // -----------------------------------------------------------------------------
       
   355 //
       
   356 void CPluginFepManagerBase::ResourceChanged(TInt aType)
       
   357     {
       
   358     iPenInputServer->ResourceChanged(aType);
       
   359     }
       
   360 
       
   361 // -----------------------------------------------------------------------------
       
   362 // CPluginFepManagerBase::SetNextFepUI
       
   363 // Set underlining UI.
       
   364 // (other items were commented in a header).
       
   365 // -----------------------------------------------------------------------------
       
   366 //
       
   367 void CPluginFepManagerBase::SetNextFepUI( MAknFepManagerInterface* aNextUi )
       
   368     {
       
   369     iHkbUi = aNextUi;    
       
   370     }
       
   371 
       
   372 // -----------------------------------------------------------------------------
       
   373 // CPluginFepManagerBase::SupportLanguage
       
   374 // Get support language in sepecfied mode.
       
   375 // (other items were commented in a header).
       
   376 // -----------------------------------------------------------------------------
       
   377 //
       
   378 TInt CPluginFepManagerBase::SupportLanguage( TInt /*aMode*/ ) const
       
   379     {
       
   380     return iLanguage;
       
   381     }
       
   382 
       
   383 // -----------------------------------------------------------------------------
       
   384 // CPluginFepManagerBase::SetInputLanguageL
       
   385 // Set current language.
       
   386 // (other items were commented in a header).
       
   387 // -----------------------------------------------------------------------------
       
   388 //
       
   389 void CPluginFepManagerBase::SetInputLanguageL( TLanguage aLanguage )
       
   390     {
       
   391     iLanguage = aLanguage;
       
   392     //maybe language check is needed.
       
   393     TInt lang = (TInt)aLanguage;
       
   394     ASSERT( lang >=0 );
       
   395     SendCommandToServer( ECmdPenInputLanguage, lang );       
       
   396     }
       
   397 
       
   398 TInt CPluginFepManagerBase::InputLanguage()
       
   399     {
       
   400     return iLanguage;
       
   401     }
       
   402 
       
   403 // -----------------------------------------------------------------------------
       
   404 // CPluginFepManagerBase::SetFepAwareEditorText
       
   405 // Set editor text and cursor information to layout UI ICF control.
       
   406 // (other items were commented in a header).
       
   407 // -----------------------------------------------------------------------------
       
   408 //
       
   409 void CPluginFepManagerBase::SetFepAwareEditorText( 
       
   410     const TFepInputContextFieldData& aIcfData )
       
   411     {
       
   412     }
       
   413     
       
   414 // -----------------------------------------------------------------------------
       
   415 // CPluginFepManagerBase::SetMode
       
   416 // Set layout UI mode.
       
   417 // (other items were commented in a header).
       
   418 // -----------------------------------------------------------------------------
       
   419 //
       
   420 #ifdef RD_INTELLIGENT_TEXT_INPUT          
       
   421 void CPluginFepManagerBase::SetMode( TInt aMode, TBool aPredictive, 
       
   422                                      TBool aQwertyInputMode, TInt aKeyboardType)
       
   423 #else
       
   424 void CPluginFepManagerBase::SetMode( TInt aMode, TBool aPredictive, 
       
   425                                      TBool aQwertyInputMode )
       
   426 #endif    
       
   427     {
       
   428     iHkbUi->SetMode( aMode, aPredictive, aQwertyInputMode );
       
   429     }
       
   430 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   431     TBool CPluginFepManagerBase::IsValidFnKeyPress() const
       
   432     {
       
   433     return EFalse;
       
   434     }
       
   435     TBool CPluginFepManagerBase::IsValidLongChrKeyPress() const
       
   436     {
       
   437     return EFalse;
       
   438     }
       
   439 #endif
       
   440 
       
   441 // -----------------------------------------------------------------------------
       
   442 // CPluginFepManagerBase::SetMode
       
   443 // Set layout UI current case.
       
   444 // (other items were commented in a header).
       
   445 // -----------------------------------------------------------------------------
       
   446 //
       
   447 void CPluginFepManagerBase::SetCase( TCase aCase )
       
   448     {
       
   449     iHkbUi->SetCase( aCase );
       
   450     }
       
   451 
       
   452 // -----------------------------------------------------------------------------
       
   453 // CPluginFepManagerBase::ExpireMultitapTimer
       
   454 // Compatibile with HKB UI.
       
   455 // (other items were commented in a header).
       
   456 // -----------------------------------------------------------------------------
       
   457 //
       
   458 void CPluginFepManagerBase::ExpireMultitapTimer()
       
   459     {
       
   460     }
       
   461 
       
   462 // -----------------------------------------------------------------------------
       
   463 // CPluginFepManagerBase::IsValidNumericLongKeyPress
       
   464 // Compatibile with HKB UI.
       
   465 // (other items were commented in a header).
       
   466 // -----------------------------------------------------------------------------
       
   467 //
       
   468 TBool CPluginFepManagerBase::IsValidNumericLongKeyPress( TInt /*aKey*/ ) const
       
   469     {
       
   470     return EFalse;
       
   471     }
       
   472 
       
   473 // -----------------------------------------------------------------------------
       
   474 // CPluginFepManagerBase::AddTextToUserDictionaryL
       
   475 // Compatibile with HKB UI.
       
   476 // (other items were commented in a header).
       
   477 // -----------------------------------------------------------------------------
       
   478 //
       
   479 void CPluginFepManagerBase::AddTextToUserDictionaryL( const TDesC& /*aText*/ )
       
   480     {
       
   481     }
       
   482        
       
   483 // -----------------------------------------------------------------------------
       
   484 // CPluginFepManagerBase::GetFormatOfFepInlineText
       
   485 // Compatibile with HKB UI.
       
   486 // (other items were commented in a header).
       
   487 // -----------------------------------------------------------------------------
       
   488 //
       
   489 void CPluginFepManagerBase::GetFormatOfFepInlineText( 
       
   490                                 TCharFormat& /*aFormat*/, 
       
   491                                 TInt& /*aNumberOfCharactersWithSameFormat*/, 
       
   492                                 TInt /*aPositionOfCharacter*/ ) const
       
   493     {
       
   494     }
       
   495 
       
   496 // -----------------------------------------------------------------------------
       
   497 // CPluginFepManagerBase::IsValidShiftKeyPress
       
   498 // Compatibile with HKB UI.
       
   499 // (other items were commented in a header).
       
   500 // -----------------------------------------------------------------------------
       
   501 //
       
   502 TBool CPluginFepManagerBase::IsValidShiftKeyPress() const
       
   503     {
       
   504     return EFalse;
       
   505     }
       
   506 
       
   507 // -----------------------------------------------------------------------------
       
   508 // CPluginFepManagerBase::SetEditorContext
       
   509 // Compatibile with HKB UI.
       
   510 // (other items were commented in a header).
       
   511 // -----------------------------------------------------------------------------
       
   512 //
       
   513 void CPluginFepManagerBase::SetEditorContext( TInt /*aContext*/ )
       
   514     {
       
   515     }
       
   516 
       
   517 // -----------------------------------------------------------------------------
       
   518 // CPluginFepManagerBase::SetEditorContext
       
   519 // Compatibile with HKB UI.
       
   520 // (other items were commented in a header).
       
   521 // -----------------------------------------------------------------------------
       
   522 //
       
   523 void CPluginFepManagerBase::SetStarKeyFlag( TBool /*aSet*/ )
       
   524     {
       
   525     }
       
   526 
       
   527 // -----------------------------------------------------------------------------
       
   528 // CPluginFepManagerBase::CPluginFepManagerBase
       
   529 // C++ default constructor.
       
   530 // (other items were commented in a header).
       
   531 // -----------------------------------------------------------------------------
       
   532 //
       
   533 CPluginFepManagerBase::CPluginFepManagerBase( CPenInputImePluginGeneric& aOwner,
       
   534                                              RPeninputServer* aPenInputServer )
       
   535     :iOwner( aOwner ), iPenInputServer( aPenInputServer )
       
   536     {
       
   537     iSuggestedRange = ERangeInvalid;
       
   538     }
       
   539 
       
   540 // -----------------------------------------------------------------------------
       
   541 // CPluginFepManagerBase::BaseConstructL
       
   542 // Symbian 2nd phase constructor.
       
   543 // (other items were commented in a header).
       
   544 // -----------------------------------------------------------------------------
       
   545 //
       
   546 void CPluginFepManagerBase::BaseConstructL()
       
   547     {
       
   548     iRepository = CRepository::NewL( KCRUidAknFep );
       
   549     }
       
   550     
       
   551 // -----------------------------------------------------------------------------
       
   552 // CPluginFepManagerBase::SetLayoutPermitedRanges
       
   553 // Set layout permited ranges.
       
   554 // (other items were commented in a header).
       
   555 // -----------------------------------------------------------------------------
       
   556 //
       
   557 void CPluginFepManagerBase::SetLayoutPermitedRanges( TInt aPermittedMode )
       
   558     {
       
   559     iPermittedMode = aPermittedMode;
       
   560     
       
   561     // Not derived from edwin
       
   562     if ( aPermittedMode == EAknEditorNumericInputMode ) 
       
   563         {
       
   564 		if ( SupportNativeNumberRange() )
       
   565 		    {
       
   566 		    iPermittedRange = ERangeNativeNumber;
       
   567 		    }
       
   568 		iPermittedRange |= ERangeNumber;
       
   569         }
       
   570         
       
   571     else if ( aPermittedMode & EAknEditorTextInputMode )
       
   572         {
       
   573         // Derived from edwin and EAknEditorTextInputMode
       
   574         iPermittedRange = ERangeNative | 
       
   575                           ERangeNumber | 
       
   576                           ERangeEnglish | 
       
   577                           ERangeSymbol |
       
   578 						  ERangeNativeNumber;
       
   579         }
       
   580     else if ( aPermittedMode & EAknEditorSecretAlphaInputMode ) 
       
   581         {
       
   582         // Derived from EAknEditorSecretAlphaInputMode 
       
   583         iPermittedRange = ERangeNumber |
       
   584                           ERangeEnglish | 
       
   585                           ERangeSymbol;        
       
   586         }
       
   587     else
       
   588         {
       
   589         iPermittedRange = ERangeNative | 
       
   590                           ERangeNumber | 
       
   591                           ERangeEnglish | 
       
   592                           ERangeSymbol |
       
   593 						  ERangeNativeNumber;
       
   594         }
       
   595     }
       
   596     
       
   597 // -----------------------------------------------------------------------------
       
   598 // CPluginFepManagerBase::SetLayoutRange
       
   599 // Set layout primary range.
       
   600 // (other items were commented in a header).
       
   601 // -----------------------------------------------------------------------------
       
   602 //
       
   603 void CPluginFepManagerBase::SetLayoutRange( 
       
   604     const CAknEdwinState* aEditorState )
       
   605     {
       
   606     //calculate permitted ranges
       
   607     if(aEditorState)
       
   608         {
       
   609         if( aEditorState->Flags() & EAknEditorFlagLatinInputModesOnly )
       
   610             {
       
   611             iPermittedRange &= ~ERangeNative;
       
   612 			iPermittedRange &= ~ERangeNativeNumber;
       
   613             }      
       
   614         if ( iPermittedMode != EAknEditorNumericInputMode 
       
   615             && !SupportLatinRange() 
       
   616             && !( aEditorState->Flags() & EAknEditorFlagLatinInputModesOnly ) )
       
   617             {
       
   618 		    iPermittedRange &= ~ERangeEnglish;
       
   619             }
       
   620         }
       
   621     else
       
   622         {
       
   623         if ( iPermittedMode == EAknEditorNumericInputMode )
       
   624             {
       
   625             if( iHkbMode == ENumber )
       
   626                 {
       
   627                 iPermittedRange = ERangeNumber;
       
   628                 }
       
   629             else if ( iHkbMode == ENativeNumber )
       
   630                 {
       
   631                 iPermittedRange = ERangeNativeNumber;
       
   632                 } 
       
   633             }
       
   634         }
       
   635 
       
   636     SendCommandToServer( ECmdPenInputPermittedRange, iPermittedRange );
       
   637     
       
   638     TInt priRange;
       
   639     
       
   640     switch( iHkbMode )
       
   641         {
       
   642         case ECangJie:
       
   643         case EStrokeFind:
       
   644         case EStroke:
       
   645         case EPinyin:
       
   646         case EZhuyin:
       
   647         case EZhuyinFind:
       
   648         case EHindi:
       
   649             {
       
   650             priRange = ERangeNative;
       
   651             }
       
   652             break;                 
       
   653         case ENumber:
       
   654             {
       
   655             priRange = ERangeNumber;
       
   656             }
       
   657             break;  
       
   658         case ENativeNumber:
       
   659             {
       
   660             priRange = ERangeNativeNumber;
       
   661             }
       
   662             break;  
       
   663         case EPRCFind:
       
   664         case ELatin:
       
   665         case ELatinText:
       
   666         case ELatinUpper:
       
   667         case ELatinLower:
       
   668             if ( iLanguage == ELangHindi)
       
   669                 {
       
   670                 priRange = ERangeEnglish;
       
   671                 }
       
   672             else
       
   673                 {
       
   674                 priRange = iPermittedRange & ERangeNative ? ERangeNative : ERangeEnglish;
       
   675                 }
       
   676             break;
       
   677         default:
       
   678             {
       
   679             priRange = iPermittedRange & ERangeNative ? ERangeNative : ERangeEnglish;
       
   680             }
       
   681             break;               
       
   682         }
       
   683      
       
   684     if( iSuggestedRange != ERangeInvalid && (iSuggestedRange & iPermittedRange) )
       
   685         {
       
   686         priRange = iSuggestedRange;
       
   687         iSuggestedRange = ERangeInvalid;
       
   688         }
       
   689     SendCommandToServer( ECmdPenInputRange, priRange );  
       
   690     }
       
   691     
       
   692 // -----------------------------------------------------------------------------
       
   693 // CPluginFepManagerBase::SendCommandToServer
       
   694 // Send command to pen input server utility function.
       
   695 // (other items were commented in a header).
       
   696 // -----------------------------------------------------------------------------
       
   697 //
       
   698 void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId )
       
   699     {
       
   700     iPenInputServer->HandleCommand( aCommandId );
       
   701     }
       
   702 
       
   703 // -----------------------------------------------------------------------------
       
   704 // CPluginFepManagerBase::SendCommandToServer
       
   705 // Send command to pen input server utility function.
       
   706 // (other items were commented in a header).
       
   707 // -----------------------------------------------------------------------------
       
   708 //
       
   709 void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId, TInt aParam )
       
   710     {
       
   711     TBuf8<sizeof(TInt)> buf;
       
   712     buf.Append( (TUint8*)&aParam, sizeof(TInt) );    
       
   713     SendCommandToServer( aCommandId, buf );
       
   714     }
       
   715 
       
   716 // -----------------------------------------------------------------------------
       
   717 // CPluginFepManagerBase::SendCommandToServer
       
   718 // Send command to pen input server utility function.
       
   719 // (other items were commented in a header).
       
   720 // -----------------------------------------------------------------------------
       
   721 //
       
   722 void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId, 
       
   723                                                  const TDesC8& aParam )
       
   724     {
       
   725     iPenInputServer->HandleCommand( aCommandId, aParam );        
       
   726     }
       
   727 
       
   728 // -----------------------------------------------------------------------------
       
   729 // CPluginFepManagerBase::LayoutLastUsedRange
       
   730 // Get layout UI last used range.
       
   731 // (other items were commented in a header).
       
   732 // -----------------------------------------------------------------------------
       
   733 //
       
   734 TInt CPluginFepManagerBase::LayoutLastUsedRange()
       
   735     {
       
   736     TInt value = 0;
       
   737     if ( iRepository )
       
   738         {
       
   739         iRepository->Get( KAknFepLastUsedRange, value );
       
   740         }
       
   741         
       
   742     return value;
       
   743     }
       
   744 
       
   745 // -----------------------------------------------------------------------------
       
   746 // CPluginFepManagerBase::SetLayoutPosition
       
   747 // Set layout UI position.
       
   748 // (other items were commented in a header).
       
   749 // -----------------------------------------------------------------------------
       
   750 //
       
   751 void CPluginFepManagerBase::SetLayoutPosition( const TRect& pParam )
       
   752     {
       
   753     TBuf8<sizeof( TRect )> buf;
       
   754     buf.Append( (TUint8*)&pParam, sizeof( pParam ) );
       
   755     
       
   756     SendCommandToServer( ECmdPenInputSetWindowPos, buf );
       
   757     }
       
   758 
       
   759 // -----------------------------------------------------------------------------
       
   760 // CPluginFepManagerBase::GetLocalLanguage
       
   761 // (other items were commented in a header).
       
   762 // -----------------------------------------------------------------------------
       
   763 //
       
   764 TLanguage CPluginFepManagerBase::GetLocalLanguage( 
       
   765     const CAknEdwinState* aEditorState ) const
       
   766     {
       
   767     TLanguage language = ELangTest;
       
   768     // Check for a local language override
       
   769     if ( aEditorState )
       
   770         {
       
   771         TInt aknEditorFlags = aEditorState->Flags()	;
       
   772         if ( aknEditorFlags & EAknEditorFlagLatinInputModesOnly )
       
   773             {
       
   774             language = ELangEnglish;
       
   775             }
       
   776         else
       
   777             {
       
   778             language = aEditorState->LocalLanguage();
       
   779             }
       
   780         }
       
   781 
       
   782     return language;
       
   783     }
       
   784 
       
   785 TBool CPluginFepManagerBase::SupportLatinRange()
       
   786     {
       
   787 	if ( iLanguage == ELangRussian || iLanguage == ELangBulgarian ||
       
   788          iLanguage == ELangUkrainian || iLanguage == ELangHebrew )
       
   789 		 {
       
   790 		 return EFalse;
       
   791 		 }
       
   792 		 
       
   793 	if ( iLanguage == ELangGreek )
       
   794 		 {
       
   795 		 return EFalse;
       
   796 		 }
       
   797 		 
       
   798 	if ( iLanguage == ELangArabic || iLanguage == ELangFarsi ||
       
   799          iLanguage == ELangUrdu || iLanguage == ELangThai )
       
   800 		 {
       
   801 		 return EFalse;
       
   802 		 }
       
   803 
       
   804 	if ( iLanguage == ELangHindi || iLanguage == ELangMarathi )
       
   805 		 {
       
   806 		 return ETrue;
       
   807 		 }	
       
   808 		
       
   809     return ETrue;	 		 		 
       
   810 	}
       
   811 	
       
   812 
       
   813 TBool CPluginFepManagerBase::SupportNativeNumberRange()
       
   814     {
       
   815 	if ( iLanguage == ELangArabic || iLanguage == ELangFarsi ||
       
   816          iLanguage == ELangUrdu || iLanguage == ELangHindi ||
       
   817          iLanguage == ELangThai )
       
   818 		 {
       
   819 		 return ETrue;
       
   820 		 }
       
   821 		
       
   822     return EFalse;	 		 		 
       
   823 	}	
       
   824  // End Of File