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