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