fep/aknfep/peninputplugins/peninputimeplugincn/src/pluginfepmanagerbase.cpp
branchRCL_3
changeset 44 ecbabf52600f
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     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 ECmdPeninputSpellICFDisplayContent:
       
   248 			{
       
   249 			// for set icf text before enter spell mode
       
   250 			}
       
   251 			break;
       
   252         case ECmdPenInputPopupTooltip:
       
   253             {
       
   254             TPtrC* tooltipTextPtr = reinterpret_cast<TPtrC*>( aParam );
       
   255             if ( tooltipTextPtr )
       
   256             	{
       
   257 				HBufC8* buf8 = HBufC8::NewLC
       
   258 							 ( sizeof( TInt ) + tooltipTextPtr->Size() );
       
   259 				TPtr8 buf8Ptr = buf8->Des();
       
   260 				RDesWriteStream writeStream;
       
   261 				CleanupClosePushL(writeStream);
       
   262 				writeStream.Open( buf8Ptr );
       
   263 				writeStream.WriteInt32L( tooltipTextPtr->Size() );
       
   264 				writeStream.WriteL( tooltipTextPtr->Ptr(), tooltipTextPtr->Length() );
       
   265 				writeStream.CommitL();
       
   266 				CleanupStack::PopAndDestroy( &writeStream );                        
       
   267 				SendCommandToServer( aCommandId, buf8Ptr );            
       
   268 				CleanupStack::PopAndDestroy( buf8 );
       
   269             	}
       
   270             }
       
   271             break;
       
   272         case ECmdPenInputPopupCandidateList:
       
   273             {
       
   274             TFepITICandidateList* candidatelist 
       
   275                                = reinterpret_cast<TFepITICandidateList*>( aParam );
       
   276             if ( candidatelist )
       
   277             	{
       
   278 				CDesCArray* itemArray = candidatelist->iItemArray;
       
   279 				if ( itemArray )
       
   280 					{           
       
   281 					TInt sumSize = 0;     
       
   282 					for ( TInt i = 0; i < itemArray->Count(); i++ )
       
   283 						{
       
   284 						sumSize += (*itemArray)[i].Size();
       
   285 						}
       
   286 					HBufC8* buf8 = HBufC8::NewLC( sizeof(TInt) // For active index
       
   287 												 + sizeof(TInt) // For the count of item array
       
   288 												 + sizeof(TInt) // langcode
       
   289 												 + sizeof(TInt)*( itemArray->Count() ) // For the size of each item
       
   290 												 + sumSize// For all of char data 
       
   291 												 );
       
   292 					TPtr8 buf8Ptr = buf8->Des();
       
   293 					RDesWriteStream writeStream;
       
   294 					CleanupClosePushL(writeStream);                
       
   295 					writeStream.Open( buf8Ptr );                
       
   296 					writeStream.WriteInt32L( candidatelist->iActiveIndex );
       
   297 					writeStream.WriteInt32L( itemArray->Count() );
       
   298 					writeStream.WriteInt32L( candidatelist->iLangCode );
       
   299 					
       
   300 					for ( TInt i = 0; i < itemArray->Count(); i++  )
       
   301 						{
       
   302 						writeStream.WriteInt32L( (*itemArray)[i].Size() );
       
   303 						writeStream.WriteL( (*itemArray)[i].Ptr(), (*itemArray)[i].Length() );
       
   304 						}
       
   305 					writeStream.CommitL();                 
       
   306 					CleanupStack::PopAndDestroy( &writeStream );
       
   307 					SendCommandToServer( aCommandId, buf8Ptr );
       
   308 					CleanupStack::PopAndDestroy( buf8 );
       
   309 					}
       
   310             	}
       
   311             }
       
   312             break;
       
   313         default:
       
   314             SendCommandToServer( aCommandId, aParam );
       
   315             break;
       
   316         }
       
   317     }
       
   318 
       
   319 // -----------------------------------------------------------------------------
       
   320 // CPluginFepManagerBase::CloseUI
       
   321 // Close plugin layout UI.
       
   322 // (other items were commented in a header).
       
   323 // -----------------------------------------------------------------------------
       
   324 //
       
   325 void CPluginFepManagerBase::CloseUI()
       
   326     {
       
   327     if (iPenInputServer->IsVisible())
       
   328 	    {
       
   329     	iPenInputServer->ActivateLayout( EFalse ); 
       
   330 		}
       
   331     }
       
   332 
       
   333 // -----------------------------------------------------------------------------
       
   334 // CPluginFepManagerBase::ActivateUI
       
   335 // Activate plugin layout UI.
       
   336 // (other items were commented in a header).
       
   337 // -----------------------------------------------------------------------------
       
   338 //
       
   339 void CPluginFepManagerBase::ActivateUI()
       
   340     {
       
   341     if(iPenInputServer)
       
   342         {
       
   343         iPenInputServer->ActivateLayout( ETrue ); 
       
   344         }   
       
   345     }
       
   346 
       
   347 // -----------------------------------------------------------------------------
       
   348 // CPluginFepManagerBase::EditorMaxLength
       
   349 // Get max text length of layout UI ICF control.
       
   350 // (other items were commented in a header).
       
   351 // -----------------------------------------------------------------------------
       
   352 //
       
   353 TInt CPluginFepManagerBase::EditorMaxLength()
       
   354     {
       
   355     return iMaxEditorLength;
       
   356     }
       
   357 
       
   358 // -----------------------------------------------------------------------------
       
   359 // CPluginFepManagerBase::SizeChanged
       
   360 // Handle screen size changed.
       
   361 // (other items were commented in a header).
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 void CPluginFepManagerBase::ResourceChanged(TInt aType)
       
   365     {
       
   366     iPenInputServer->ResourceChanged(aType);
       
   367     }
       
   368 
       
   369 // -----------------------------------------------------------------------------
       
   370 // CPluginFepManagerBase::SetNextFepUI
       
   371 // Set underlining UI.
       
   372 // (other items were commented in a header).
       
   373 // -----------------------------------------------------------------------------
       
   374 //
       
   375 void CPluginFepManagerBase::SetNextFepUI( MAknFepManagerInterface* aNextUi )
       
   376     {
       
   377     iHkbUi = aNextUi;    
       
   378     }
       
   379 
       
   380 // -----------------------------------------------------------------------------
       
   381 // CPluginFepManagerBase::SupportLanguage
       
   382 // Get support language in sepecfied mode.
       
   383 // (other items were commented in a header).
       
   384 // -----------------------------------------------------------------------------
       
   385 //
       
   386 TInt CPluginFepManagerBase::SupportLanguage( TInt /*aMode*/ ) const
       
   387     {
       
   388     return iLanguage;
       
   389     }
       
   390 
       
   391 // -----------------------------------------------------------------------------
       
   392 // CPluginFepManagerBase::SetInputLanguageL
       
   393 // Set current language.
       
   394 // (other items were commented in a header).
       
   395 // -----------------------------------------------------------------------------
       
   396 //
       
   397 void CPluginFepManagerBase::SetInputLanguageL(TLanguage aLanguage)
       
   398     {
       
   399     iLanguage = aLanguage;
       
   400 
       
   401     if(iLanguage == ELangTaiwanChinese ||
       
   402        iLanguage == ELangHongKongChinese ||
       
   403        iLanguage == ELangPrcChinese)
       
   404         {
       
   405     	SendCommandToServer(ECmdPenInputLanguage, (TInt)aLanguage);
       
   406         }
       
   407     else 
       
   408         {
       
   409         // other language except chinese, will treated as English
       
   410         iLanguage = ELangEnglish;
       
   411     	SendCommandToServer(ECmdPenInputLanguage, (TInt)ELangEnglish);
       
   412         }
       
   413     }
       
   414 
       
   415 // -----------------------------------------------------------------------------
       
   416 // CPluginFepManagerBase::SetFepAwareEditorText
       
   417 // Set editor text and cursor information to layout UI ICF control.
       
   418 // (other items were commented in a header).
       
   419 // -----------------------------------------------------------------------------
       
   420 //
       
   421 void CPluginFepManagerBase::SetFepAwareEditorText(const TFepInputContextFieldData& /*aIcfData*/)
       
   422     {
       
   423     }
       
   424     
       
   425 // -----------------------------------------------------------------------------
       
   426 // CPluginFepManagerBase::SetMode
       
   427 // Set layout UI mode.
       
   428 // (other items were commented in a header).
       
   429 // -----------------------------------------------------------------------------
       
   430 //
       
   431 #ifdef RD_INTELLIGENT_TEXT_INPUT          
       
   432 void CPluginFepManagerBase::SetMode( TInt aMode, TBool aPredictive, 
       
   433                                      TBool aQwertyInputMode, TInt /*aKeyboardType*/)
       
   434 #else
       
   435 void CPluginFepManagerBase::SetMode( TInt aMode, TBool aPredictive, 
       
   436                                      TBool aQwertyInputMode )
       
   437 #endif    
       
   438     {
       
   439     iHkbUi->SetMode(aMode, aPredictive, aQwertyInputMode);
       
   440     }
       
   441 
       
   442 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   443     TBool CPluginFepManagerBase::IsValidFnKeyPress() const
       
   444     {
       
   445     return EFalse;
       
   446     }
       
   447     TBool CPluginFepManagerBase::IsValidLongChrKeyPress() const
       
   448     {
       
   449     return EFalse;
       
   450     }
       
   451 #endif
       
   452 // -----------------------------------------------------------------------------
       
   453 // CPluginFepManagerBase::SetMode
       
   454 // Set layout UI current case.
       
   455 // (other items were commented in a header).
       
   456 // -----------------------------------------------------------------------------
       
   457 //
       
   458 void CPluginFepManagerBase::SetCase(TCase aCase)
       
   459     {
       
   460     iHkbUi->SetCase(aCase);
       
   461     }
       
   462 
       
   463 // -----------------------------------------------------------------------------
       
   464 // CPluginFepManagerBase::ExpireMultitapTimer
       
   465 // Compatibile with HKB UI.
       
   466 // (other items were commented in a header).
       
   467 // -----------------------------------------------------------------------------
       
   468 //
       
   469 void CPluginFepManagerBase::ExpireMultitapTimer()
       
   470     {
       
   471     }
       
   472 
       
   473 // -----------------------------------------------------------------------------
       
   474 // CPluginFepManagerBase::IsValidNumericLongKeyPress
       
   475 // Compatibile with HKB UI.
       
   476 // (other items were commented in a header).
       
   477 // -----------------------------------------------------------------------------
       
   478 //
       
   479 TBool CPluginFepManagerBase::IsValidNumericLongKeyPress( TInt /*aKey*/ ) const
       
   480     {
       
   481     return EFalse;
       
   482     }
       
   483 
       
   484 // -----------------------------------------------------------------------------
       
   485 // CPluginFepManagerBase::AddTextToUserDictionaryL
       
   486 // Compatibile with HKB UI.
       
   487 // (other items were commented in a header).
       
   488 // -----------------------------------------------------------------------------
       
   489 //
       
   490 void CPluginFepManagerBase::AddTextToUserDictionaryL( const TDesC& /*aText*/ )
       
   491     {
       
   492     }
       
   493        
       
   494 // -----------------------------------------------------------------------------
       
   495 // CPluginFepManagerBase::GetFormatOfFepInlineText
       
   496 // Compatibile with HKB UI.
       
   497 // (other items were commented in a header).
       
   498 // -----------------------------------------------------------------------------
       
   499 //
       
   500 void CPluginFepManagerBase::GetFormatOfFepInlineText( 
       
   501                                 TCharFormat& /*aFormat*/, 
       
   502                                 TInt& /*aNumberOfCharactersWithSameFormat*/, 
       
   503                                 TInt /*aPositionOfCharacter*/ ) const
       
   504     {
       
   505     }
       
   506 
       
   507 // -----------------------------------------------------------------------------
       
   508 // CPluginFepManagerBase::IsValidShiftKeyPress
       
   509 // Compatibile with HKB UI.
       
   510 // (other items were commented in a header).
       
   511 // -----------------------------------------------------------------------------
       
   512 //
       
   513 TBool CPluginFepManagerBase::IsValidShiftKeyPress() const
       
   514     {
       
   515     return EFalse;
       
   516     }
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CPluginFepManagerBase::SetEditorContext
       
   520 // Compatibile with HKB UI.
       
   521 // (other items were commented in a header).
       
   522 // -----------------------------------------------------------------------------
       
   523 //
       
   524 void CPluginFepManagerBase::SetEditorContext( TInt /*aContext*/ )
       
   525     {
       
   526     }
       
   527 
       
   528 // -----------------------------------------------------------------------------
       
   529 // CPluginFepManagerBase::SetEditorContext
       
   530 // Compatibile with HKB UI.
       
   531 // (other items were commented in a header).
       
   532 // -----------------------------------------------------------------------------
       
   533 //
       
   534 void CPluginFepManagerBase::SetStarKeyFlag( TBool /*aSet*/ )
       
   535     {
       
   536     }
       
   537 
       
   538 // -----------------------------------------------------------------------------
       
   539 // CPluginFepManagerBase::CPluginFepManagerBase
       
   540 // C++ default constructor.
       
   541 // (other items were commented in a header).
       
   542 // -----------------------------------------------------------------------------
       
   543 //
       
   544 CPluginFepManagerBase::CPluginFepManagerBase(CPenInputImePluginCn& aOwner,
       
   545                                              RPeninputServer* aPenInputServer )
       
   546     :iOwner( aOwner ), iPenInputServer( aPenInputServer )
       
   547     {
       
   548     }
       
   549 
       
   550 // -----------------------------------------------------------------------------
       
   551 // CPluginFepManagerBase::BaseConstructL
       
   552 // Symbian 2nd phase constructor.
       
   553 // (other items were commented in a header).
       
   554 // -----------------------------------------------------------------------------
       
   555 //
       
   556 void CPluginFepManagerBase::BaseConstructL()
       
   557     {
       
   558     iRepository = CRepository::NewL( KCRUidAknFep );
       
   559     }
       
   560     
       
   561 // -----------------------------------------------------------------------------
       
   562 // CPluginFepManagerBase::SetLayoutPermitedRanges
       
   563 // Set layout permited ranges.
       
   564 // (other items were commented in a header).
       
   565 // -----------------------------------------------------------------------------
       
   566 //
       
   567 void CPluginFepManagerBase::SetLayoutPermitedRanges( TInt aPermittedMode )
       
   568     {
       
   569     // Not derived from edwin
       
   570     if ( aPermittedMode == EAknEditorNumericInputMode ) 
       
   571         {
       
   572         iPermittedRange = ERangeNumber;         
       
   573         }
       
   574     else if ( aPermittedMode & EAknEditorTextInputMode )
       
   575         {
       
   576         // Derived from edwin and EAknEditorTextInputMode
       
   577         iPermittedRange = ERangeNative | 
       
   578                           ERangeNumber | 
       
   579                           ERangeEnglish | 
       
   580                           ERangeSymbol;
       
   581         }
       
   582     else if ( aPermittedMode & EAknEditorSecretAlphaInputMode ) 
       
   583         {
       
   584         // Derived from EAknEditorSecretAlphaInputMode 
       
   585         iPermittedRange = ERangeNumber |
       
   586                           ERangeEnglish | 
       
   587                           ERangeSymbol;        
       
   588         }
       
   589     else
       
   590         {
       
   591         iPermittedRange = ERangeNative | 
       
   592                           ERangeNumber | 
       
   593                           ERangeEnglish | 
       
   594                           ERangeSymbol;
       
   595         }
       
   596     }
       
   597     
       
   598 // -----------------------------------------------------------------------------
       
   599 // CPluginFepManagerBase::SetLayoutRange
       
   600 // Set layout primary range.
       
   601 // (other items were commented in a header).
       
   602 // -----------------------------------------------------------------------------
       
   603 //
       
   604 void CPluginFepManagerBase::SetLayoutRange(const CAknEdwinState* aEditorState)
       
   605     {
       
   606     //calculate permitted ranges
       
   607     if(aEditorState)
       
   608         {
       
   609         if( aEditorState->Flags() & EAknEditorFlagLatinInputModesOnly &&
       
   610             iPermittedRange & ERangeNative )
       
   611             {
       
   612             iPermittedRange &= ~ERangeNative;
       
   613             }
       
   614         }
       
   615 
       
   616     SendCommandToServer( ECmdPenInputPermittedRange, iPermittedRange );
       
   617     
       
   618     TInt priRange;
       
   619     
       
   620     switch( iHkbMode )
       
   621         {
       
   622         case ECangJie:
       
   623         case EStrokeFind:
       
   624         case EStroke:
       
   625         case EPinyin:
       
   626         case EZhuyin:
       
   627         case EZhuyinFind:
       
   628             {
       
   629             priRange = ERangeNative;
       
   630             }
       
   631             break;                 
       
   632         case ENumber:
       
   633             {
       
   634             priRange = ERangeNumber;
       
   635             }
       
   636             break;                 
       
   637         case EPRCFind:
       
   638         case ELatin:
       
   639         case ELatinText:
       
   640         case ELatinUpper:
       
   641         case ELatinLower:
       
   642         default:
       
   643             {
       
   644             priRange = ERangeEnglish;
       
   645             }
       
   646             break;               
       
   647         }
       
   648         
       
   649     if ((iLanguage == ELangEnglish) && (priRange == ERangeNative))
       
   650         {
       
   651         // when language switch button switch to English, if original range is Native, 
       
   652         // then it need to be changed to ERangeEnglish
       
   653     	priRange = ERangeEnglish;
       
   654         }
       
   655         
       
   656     if( iSuggestedRange != ERangeInvalid && (iSuggestedRange & iPermittedRange) )
       
   657         {
       
   658         priRange = iSuggestedRange;
       
   659         iSuggestedRange = ERangeInvalid;
       
   660         }
       
   661 
       
   662     SendCommandToServer( ECmdPenInputRange, priRange );  
       
   663     }
       
   664     
       
   665 // -----------------------------------------------------------------------------
       
   666 // CPluginFepManagerBase::SendCommandToServer
       
   667 // Send command to pen input server utility function.
       
   668 // (other items were commented in a header).
       
   669 // -----------------------------------------------------------------------------
       
   670 //
       
   671 void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId )
       
   672     {
       
   673     iPenInputServer->HandleCommand( aCommandId );
       
   674     }
       
   675 
       
   676 // -----------------------------------------------------------------------------
       
   677 // CPluginFepManagerBase::SendCommandToServer
       
   678 // Send command to pen input server utility function.
       
   679 // (other items were commented in a header).
       
   680 // -----------------------------------------------------------------------------
       
   681 //
       
   682 void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId, TInt aParam )
       
   683     {
       
   684     TBuf8<sizeof(TInt)> buf;
       
   685     buf.Append( (TUint8*)&aParam, sizeof(TInt) );    
       
   686     SendCommandToServer( aCommandId, buf );
       
   687     }
       
   688 
       
   689 // -----------------------------------------------------------------------------
       
   690 // CPluginFepManagerBase::SendCommandToServer
       
   691 // Send command to pen input server utility function.
       
   692 // (other items were commented in a header).
       
   693 // -----------------------------------------------------------------------------
       
   694 //
       
   695 void CPluginFepManagerBase::SendCommandToServer(TInt aCommandId, const TDesC8& aParam)
       
   696     {
       
   697     iPenInputServer->HandleCommand( aCommandId, aParam );        
       
   698     }
       
   699 
       
   700 // -----------------------------------------------------------------------------
       
   701 // CPluginFepManagerBase::LayoutLastUsedRange
       
   702 // Get layout UI last used range.
       
   703 // (other items were commented in a header).
       
   704 // -----------------------------------------------------------------------------
       
   705 //
       
   706 TInt CPluginFepManagerBase::LayoutLastUsedRange()
       
   707     {
       
   708     TInt value = 0;
       
   709     if( iRepository )
       
   710         {
       
   711         iRepository->Get( KAknFepLastUsedRange, value );
       
   712         }
       
   713         
       
   714     return value;
       
   715     }
       
   716 
       
   717 // -----------------------------------------------------------------------------
       
   718 // CPluginFepManagerBase::SetLayoutPosition
       
   719 // Set layout UI position.
       
   720 // (other items were commented in a header).
       
   721 // -----------------------------------------------------------------------------
       
   722 //
       
   723 void CPluginFepManagerBase::SetLayoutPosition( const TRect& pParam )
       
   724     {
       
   725     TBuf8<sizeof( TRect )> buf;
       
   726     buf.Append((TUint8*)&pParam, sizeof(pParam));
       
   727     
       
   728     SendCommandToServer( ECmdPenInputSetWindowPos, buf );
       
   729     }
       
   730 
       
   731 // -----------------------------------------------------------------------------
       
   732 // CPluginFepManagerBase::GetLocalLanguage
       
   733 // (other items were commented in a header).
       
   734 // -----------------------------------------------------------------------------
       
   735 //
       
   736 TLanguage CPluginFepManagerBase::GetLocalLanguage( 
       
   737     const CAknEdwinState* aEditorState ) const
       
   738     {
       
   739     TLanguage language = ELangTest;
       
   740     // Check for a local language override
       
   741     if ( aEditorState )
       
   742         {
       
   743         TInt aknEditorFlags = aEditorState->Flags()	;
       
   744         if ( aknEditorFlags & EAknEditorFlagLatinInputModesOnly )
       
   745             {
       
   746             language = ELangEnglish;
       
   747             }
       
   748         else
       
   749             {
       
   750             language = aEditorState->LocalLanguage();
       
   751             }
       
   752         }
       
   753 
       
   754     return language;
       
   755     }
       
   756 
       
   757  // End Of File