textinput/peninputhwrboxjp/src/peninputhwrboxlayout.cpp
changeset 0 eb1f2e154e89
child 7 6defe5d1bd39
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Implementation of the hwr layout
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // system includes
       
    20 #include <peninputhiraganakanji.h>       // hiraganakanji
       
    21 #include <peninputuistatemgr.h>    // use ui state mgr
       
    22 #include <peninputdataconverter.h>
       
    23 #include <aknfeppeninputenums.h>    //command from fep or IME to plugin. for vkb/hwr, range defination
       
    24 #include <peninputcommonlayoutglobalenum.h>  // EPeninputLayoutEventEnter
       
    25 #include <peninputeventjp.h>
       
    26 #include <AknFepGlobalEnums.h> //define TWidthChar
       
    27 #include <PtiEngine.h>
       
    28 #include <peninputjapanesecandidatewnd.h>
       
    29 #include <peninputjapanesepredictivewnd.h>
       
    30 
       
    31 // user includes
       
    32 #include "peninputhwrboxlayout.h"
       
    33 #include "peninputhwrboxuistatetype.h"         // UI state
       
    34 #include "peninputhwrboxwindow.h"        // use hwr window, which derived from base window
       
    35 #include "peninputhwrboxdatamgr.h"       // use data mgr
       
    36 #include "peninputhwrboxuistatestandby.h"
       
    37 #include "peninputhwrboxuistatestandbyjp.h"
       
    38 #include "peninputhwrboxuistatewithtransitorychars.h"
       
    39 #include "peninputhwrboxuistatepenstandby.h"
       
    40 #include "peninputhwrboxuistatepenbeginwriting.h"
       
    41 #include "peninputhwrboxuistatepenendwriting.h"
       
    42 #include "peninputhwrboxuistatepencandidateselecting.h"
       
    43 #include "peninputhwrevent.h"
       
    44 #include "peninputhwrboxgroup.h"
       
    45 
       
    46 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
    47 #include <PeninputHwrStrokeLogConst.h>
       
    48 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
    49 
       
    50 // constant definition
       
    51 const TInt KMaxCandidateLen = 128;
       
    52 const TUint16 KBackRep = 0x2408;
       
    53 const TUint16 KEnterRep = 0xF801;
       
    54 const TUint16 KSpaceRep = 0xF800;
       
    55 const TInt KDelay = 100000; //1/10 second
       
    56 const TInt KPeninputBufLen = 16;
       
    57 const TInt KPeninputBufLen8 = 8;
       
    58 
       
    59 // ======== MEMBER FUNCTIONS ========
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CPeninputHwrBoxLayout::NewL
       
    63 // (other items were commented in a header).
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 CPeninputHwrBoxLayout* CPeninputHwrBoxLayout::NewL(MLayoutOwner* aLayoutOwner,
       
    67                                          const TAny* aInitData)
       
    68     {
       
    69     CPeninputHwrBoxLayout* self = new (ELeave) CPeninputHwrBoxLayout(aLayoutOwner);
       
    70 
       
    71     CleanupStack::PushL(self);
       
    72     self->ConstructL(aInitData);
       
    73     CleanupStack::Pop(self);
       
    74 
       
    75     return self;
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CPeninputHwrBoxLayout::~CPeninputHwrBoxLayout
       
    80 // (other items were commented in a header).
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 CPeninputHwrBoxLayout::~CPeninputHwrBoxLayout()
       
    84     {
       
    85     delete iHiraganaKanji;
       
    86     delete iKeyEventAsync;
       
    87     delete iKeyEventClearAsync;
       
    88     delete iPointerEventAsync;
       
    89     delete iUiStatePenMgr;
       
    90     delete iSubmitText;
       
    91 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
    92     if (iLogger.LogValid())
       
    93         {
       
    94         iLogger.CloseLog();
       
    95         }
       
    96     iLogger.Close();
       
    97 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CPeninputHwrBoxLayout::HandleEventL
       
   102 // handle event from window server
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 TBool CPeninputHwrBoxLayout::HandleEventL(TEventType aType, const TAny* aData)
       
   106     {
       
   107     TRawEvent event=*((TRawEvent*)aData);
       
   108     CFepUiBaseCtrl* ctrl = NULL;
       
   109     if(ERawEvent == aType)
       
   110         {
       
   111         if (TRawEvent::EButton1Down == event.Type() && iHiraganaKanji)
       
   112             {
       
   113             iHiraganaKanji->CancelRepeat();
       
   114             }
       
   115         // DropDownList expanded and PointerDown on drawing area ---> cancel input and to StandBy
       
   116         if (iExpanded
       
   117             && TRawEvent::EButton1Down == event.Type()
       
   118             && iUiStatePenMgr->CurrentUiState() == iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenCandidateSelecting)
       
   119             && iDropdownList
       
   120             && iHwrWindow->BoxGroup())
       
   121             {
       
   122             TPoint point = event.Pos() - Position ();
       
   123             if (!iDropdownList->Rect().Contains(point)
       
   124                 && iHwrWindow->BoxGroup()->Rect().Contains(point))
       
   125                 {
       
   126                 ClearInputToPenStandByL();
       
   127                 return ETrue;
       
   128                 }
       
   129             }
       
   130         if(TRawEvent::EButton1Up == event.Type())
       
   131             {
       
   132             ctrl = RootControl()->CtrlCapPointer();
       
   133             }
       
   134         }
       
   135     TBool handled = CPeninputCommonLayout::HandleEventL(aType,aData);
       
   136     // if dropdownlist expanded, capture off
       
   137     // as the dropdownlist is the 1st control in the clientpane controlgroup, capture is not need.
       
   138     if (TRawEvent::EButton1Up == event.Type() && !ctrl)
       
   139         {
       
   140         CFepUiBaseCtrl* capture = RootControl()->CtrlCapPointer();
       
   141         if (capture && capture->ControlId() == EPeninutWindowCtrlIdDropDownList)
       
   142            {  // dropdownlist expanded
       
   143            iDropdownList = capture;
       
   144            capture->CapturePointer(EFalse);
       
   145            SetCapturePointerEventAgain(); // capture for transitory input on
       
   146            HandleControlEvent(EPeninputLayoutHwrEventDropDownListExpanded, capture, KNullDesC);
       
   147            }
       
   148         }
       
   149     // if a control do capture off, capture for transitory input on.
       
   150     if (ctrl && !RootControl()->CtrlCapPointer())
       
   151         {
       
   152         SetCapturePointerEventAgain();
       
   153         }
       
   154     return handled;
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CPeninputHwrBoxLayout::HandleCommand
       
   159 // (other items were commented in a header).
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 TInt CPeninputHwrBoxLayout::HandleCommand(TInt aCmd, TUint8* aData)
       
   163     {
       
   164     // Handle command from fep or IME to this layout
       
   165     TUint* data = (TUint*) aData;
       
   166 
       
   167     switch ( aCmd )
       
   168         {
       
   169         case ECmdPenInputPermittedRange:  // different from common layout
       
   170             // this command comes after ECmdPenInputJapaneseSetting
       
   171             if (iDataMgr)
       
   172                 {
       
   173                 // in SetData, SetPermittedRanges() and SetCharacterRangePopupLare() called.
       
   174                 SetData(EPeninputDataTypePermittedRange, aData);
       
   175                 }
       
   176             break;
       
   177         case ECmdPenInputLanguage:
       
   178             {
       
   179             CPeninputCommonLayout::HandleCommand(aCmd, aData);
       
   180             }
       
   181             break;
       
   182         case ECmdPenInputWindowOpen:
       
   183             if (iHwrWindow)
       
   184                 {
       
   185                 iHwrWindow->Opened();
       
   186                 iLayoutWindow->Hide(EFalse);  // before Hide Check or Change, parent controlgroup should be Hide Off.
       
   187                 TInt curRange = CPeninputDataConverter::AnyToInt(RequestData(EPeninputDataTypeCurrentRange));
       
   188                 TBool currHide = iHwrWindow->PredictiveWindow()->Hiden();
       
   189                 TBool newHide = ETrue;
       
   190                 if (static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->Predictive()
       
   191                               && static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->Conversion()
       
   192                               &&  ERangeHiraganaKanji == curRange)
       
   193                     {
       
   194                     newHide = EFalse;
       
   195                     }
       
   196                 if (newHide && !currHide || !newHide && currHide)
       
   197                     {
       
   198                     iHwrWindow->PredictiveWindow()->Hide(newHide);
       
   199                     iHwrWindow->SizeChanged(ETrue);
       
   200                     }
       
   201                 CPeninputCommonLayout::HandleCommand( aCmd, aData );
       
   202                 if (*data != EPenInputOpenManually && Position() == TPoint(0,0))
       
   203                     {  // position is not yet set.(English --> Japanese)
       
   204                     SendEventToWindow(EPeninputLayoutEventMovePosition, NULL, KNullDesC);
       
   205                     }
       
   206                 iHwrWindow->ICFEnableRegionUpdating();  // ICF::OnActivate()
       
   207                 }
       
   208             ToPenStandBy();
       
   209 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   210     if (iLogger.Handle())
       
   211         {
       
   212         if (iLogger.LogValid())
       
   213             {
       
   214             iLogger.CloseLog();
       
   215             }
       
   216         // Generate file name based on date.
       
   217         TTime time;
       
   218         time.HomeTime();
       
   219         TDateTime datetime = time.DateTime();
       
   220         TBuf<KHwrStrokeLogFileNameMaxLen> name;
       
   221         name.Format(KHwrStrokeLogFileExt(),
       
   222             datetime.Year(), TInt(datetime.Month()+1), datetime.Day()+1,
       
   223             datetime.Hour(), datetime.Minute(), datetime.Second());
       
   224         // Open(or create) log file
       
   225         iLogger.CreateLog( KHwrStrokeLogDir(), name, EFileLoggingModeAppend);
       
   226         // Disable date and time
       
   227         iLogger.SetDateAndTime(EFalse, EFalse);
       
   228         // Write log
       
   229         iLogger.Write(KHwrStrokeLogOpen());
       
   230         WriteHwrStrokeLogRange();
       
   231         }
       
   232 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
   233             break;
       
   234         case ECmdPenInputWindowClose:
       
   235             SendEventToWindow(EPeninputLayoutEventCloseCharacterRange, NULL, KNullDesC);
       
   236             HiraganaKanjiCompleteAll();
       
   237             CPeninputCommonLayout::HandleCommand( aCmd, aData );
       
   238             UiStateMgr()->SetCurrentUiState( EPeninputHwrUiStateNone );
       
   239             Initialize();
       
   240             SetCapturePointerEvent(EFalse);
       
   241             iHwrWindow->Closed();
       
   242 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   243     if (iLogger.LogValid())
       
   244         {
       
   245         iLogger.Write(KHwrStrokeLogClose());
       
   246         iLogger.CloseLog();
       
   247         }
       
   248 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
   249             break;
       
   250         case ECmdPenInputRange:  // different from common layout:control. ptiEngine.
       
   251             {
       
   252 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   253     iLogOff = 1;
       
   254 #endif
       
   255             // this command comes after ECmdPenInputJapaneseSetting, ECmdPenInputPermittedRange
       
   256             if (iLayoutWindow)
       
   257                 {
       
   258                 iHwrWindow->ICFDisableRegionUpdating();  // ICF::OnDeActivate()
       
   259                 iLayoutWindow->Hide(EFalse);  // before Hide Check or Change, parent controlgroup should be Hide Off.
       
   260                 }
       
   261             if (iDataMgr)
       
   262                 {
       
   263                 TUint range = TranslateRangeHullHalf(*data);
       
   264                 TUint8* rangedata = reinterpret_cast<TUint8*>(&range);
       
   265                 // SetData(SetPremaryRange) and SizeChangedForBaseWindow and ChangeClientLayout
       
   266                 CPeninputCommonLayout::HandleCommand( aCmd, rangedata );
       
   267                 iRangeOrg = range;
       
   268                 TInt permittedRange = CPeninputDataConverter::AnyToInt(RequestData(EPeninputDataTypePermittedRange));
       
   269                 if (permittedRange & (ERangeHiraganaKanji | ERangeKatakana | ERangeFullWidthKatakana))
       
   270                     {
       
   271                     TInt index = 0;
       
   272                     if (range == ERangeEnglish || range == ERangeFullWidthEnglish)
       
   273                         {
       
   274                         index = 2;  // see CPeninputHwrBoxDataMgr::SetCharacterRangePopupL()
       
   275                         }
       
   276                     if (range == ERangeNumber || range == ERangeFullWidthNumeric)
       
   277                         {
       
   278                         index = (permittedRange & (ERangeEnglish | ERangeFullWidthEnglish))? 3:2;
       
   279                                                  // see CPeninputHwrBoxDataMgr::SetCharacterRangePopupL()
       
   280                         }
       
   281                     if (index)
       
   282                         {
       
   283                         TPtrC dataPtr;
       
   284                         dataPtr.Set(reinterpret_cast<TUint16*>(&index),sizeof(TInt)/sizeof(TUint16));
       
   285                         HandleControlEvent(EPeninputLayoutEventRange,NULL,dataPtr);  // call DoSetCurrentRange()
       
   286                         }
       
   287                     else
       
   288                         {
       
   289                         DoSetCurrentRange();
       
   290                         }
       
   291                     }
       
   292                 else
       
   293                     {
       
   294                     DoSetCurrentRange();
       
   295                     }
       
   296                 }
       
   297             }
       
   298 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   299     iLogOff = 0;
       
   300 #endif
       
   301             break;
       
   302         case ECmdPenInputJapaneseSetting:  // Japanese setting information
       
   303             // this command comes before ECmdPenInputPermittedRange, ECmdPenInputRange
       
   304             if (iDataMgr)
       
   305                 {
       
   306                 iDataMgr->Reset();
       
   307                 TUint val = *data;
       
   308                 TInt sctDimmFlag = (val & EPenInputJapaneseSettingLunchSCT)? 0: 1;
       
   309                 TPtr ptr((TUint16*)&sctDimmFlag, sizeof(TInt)/sizeof(TUint16));
       
   310                 SendEventToWindow(EEventSetDimmedSctBtn, NULL, ptr);
       
   311                 static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->SetFullHalf(
       
   312                                 (val & EPenInputJapaneseSettingCharacterWidth)? 1: 0);
       
   313                 static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->SetPredictive(
       
   314                                 (val & EPenInputJapaneseSettingPredictive)? ETrue: EFalse);
       
   315                 static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->SetConversion(
       
   316                                 (val & EPenInputJapaneseSettingConversion)? ETrue: EFalse);
       
   317                 static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->SetClear(
       
   318                                 (val & EPenInputJapaneseSettingDeletingDirection)? 1: 0);
       
   319                 }
       
   320             break;
       
   321         case ECmdPenInputEnableSettingBtn:
       
   322             iHwrWindow->SetEnableSettingBtnJp(*data);
       
   323             break;
       
   324         case ECmdPenInputSendEditorTextAndCurPos:
       
   325             CFepUiLayout::HandleCommand( aCmd, aData );
       
   326             break;
       
   327         default:
       
   328             CPeninputCommonLayout::HandleCommand( aCmd, aData );
       
   329             break;
       
   330         }
       
   331     return KErrNone;
       
   332     }
       
   333 
       
   334 // ---------------------------------------------------------------------------
       
   335 // CPeninputHwrBoxLayout::HandleControlEvent
       
   336 // (other items were commented in a header).
       
   337 // ---------------------------------------------------------------------------
       
   338 //
       
   339 void CPeninputHwrBoxLayout::HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData)
       
   340     {
       
   341     // Handle event from control
       
   342     TInt* data = (TInt*)aEventData.Ptr();
       
   343     TBool handled = EFalse;
       
   344 
       
   345     if (EEventDraggingEnd == aEventType)
       
   346         {
       
   347         CPeninputCommonLayout::HandleControlEvent(aEventType, aCtrl, aEventData);
       
   348         }
       
   349 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   350     if (EPeninputLayoutEventBack == aEventType)
       
   351         {
       
   352         WriteHwrStrokeLogClear();
       
   353         }
       
   354     if (EPeninputLayoutHwrEventCandidateSelected == aEventType && iLogger.LogValid())
       
   355         {
       
   356         if (aEventData.Length() > 1)
       
   357             {
       
   358                     //get the candidate index
       
   359             const TInt cellNo = aEventData[aEventData.Length()-1] + 1;
       
   360             iLogger.WriteFormat(KHwrStrokeLogSelected(), cellNo);
       
   361             }
       
   362         }
       
   363 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
   364 
       
   365     if (iUiStatePenMgr != NULL)
       
   366         {
       
   367         handled = HandleControlEventPen(aEventType, aCtrl, aEventData);
       
   368         }
       
   369     if (handled)
       
   370         {
       
   371         return;
       
   372         }
       
   373 
       
   374     //deal with the event from all controls in layout
       
   375     switch (aEventType)
       
   376         {
       
   377         case EPeninputLayoutEventClose:
       
   378         case EPeninputLayoutEventOption:
       
   379         case EPeninputLayoutEventToVkb:
       
   380             HiraganaKanjiCompleteAll();  // call ToPenStandBy()
       
   381             SetCapturePointerEvent(EFalse);
       
   382             if (EPeninputLayoutEventClose == aEventType)
       
   383                 {
       
   384                 Initialize();  //jump to init state
       
   385                 }
       
   386             if (EPeninputLayoutEventToVkb == aEventType)
       
   387                 {
       
   388                 TBuf<KPeninputBufLen8> buf;
       
   389                 TBool switchByMode = ETrue;
       
   390                 TInt mode = EPluginInputModeVkb;
       
   391                 CPeninputDataConverter::CombinationToDesc( switchByMode, 
       
   392                                                                  mode, buf );
       
   393                 SignalOwner( ESignalLayoutUIChanged, buf );
       
   394                 }
       
   395             else
       
   396                 {
       
   397                 CPeninputCommonLayout::HandleControlEvent(aEventType, aCtrl, aEventData);
       
   398                 }
       
   399             break;
       
   400         case EPeninputLayoutEventSct:
       
   401             HiraganaKanjiCompleteAll();
       
   402             SetCapturePointerEvent(EFalse);
       
   403             SignalOwner(ESignalHwNotifySctPopup);
       
   404             break;
       
   405         case EPeninputLayoutEventSwitchLanguage: // nop
       
   406             break;
       
   407 
       
   408         case EPeninputLayoutEventRange:  // from character range popup or when accept ECmdPenInputRange command
       
   409             {
       
   410             TInt permittedRange = CPeninputDataConverter::AnyToInt(RequestData(EPeninputDataTypePermittedRange));
       
   411             TInt currentRange = CPeninputDataConverter::AnyToInt( RequestData( EPeninputDataTypeCurrentRange ) );
       
   412             TInt range = currentRange;
       
   413             TInt deActive = 0;   // 0:none 1:ICF 2:display off
       
   414             static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->SetCurrentCharacterRangeIndex(*data);
       
   415             switch(static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->CharacterRangeId())
       
   416                 {
       
   417                 case EPeninutCharacterRangeIdAll:
       
   418                     if (permittedRange & (ERangeHiraganaKanji | ERangeKatakana | ERangeFullWidthKatakana))
       
   419                         {
       
   420                         if (!(range & (ERangeHiraganaKanji | ERangeKatakana | ERangeFullWidthKatakana)))
       
   421                             {
       
   422                             range = (permittedRange & ERangeHiraganaKanji)? ERangeHiraganaKanji : ERangeKatakana;
       
   423                             }
       
   424                         }
       
   425                     break;
       
   426                 case EPeninutCharacterRangeIdKanaKanji:
       
   427                     permittedRange &= (ERangeHiraganaKanji | ERangeKatakana | ERangeFullWidthKatakana);
       
   428                     if (!(permittedRange & range))
       
   429                         {
       
   430                         range = (permittedRange & ERangeHiraganaKanji)? ERangeHiraganaKanji : ERangeKatakana;
       
   431                         }
       
   432                     break;
       
   433                 case EPeninutCharacterRangeIdLatin:
       
   434                     permittedRange &= (ERangeEnglish | ERangeFullWidthEnglish);
       
   435                     range = ERangeEnglish;
       
   436                     break;
       
   437                 case EPeninutCharacterRangeIdNumber:
       
   438                     permittedRange &= (ERangeNumber | ERangeFullWidthNumeric);
       
   439                     range = ERangeNumber;
       
   440                     break;
       
   441                 default:
       
   442                     break;
       
   443                 }
       
   444             static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->SetPermittedRanges(permittedRange);
       
   445             range = TranslateRangeHullHalf(range);
       
   446             if (!(range & permittedRange))
       
   447                 {
       
   448                 range = iRangeOrg;
       
   449                 }
       
   450             if (aCtrl)  // from character range popup
       
   451                 {
       
   452                 TBool currHide = iHwrWindow->PredictiveWindow()->Hiden();
       
   453                 TBool newHide = ETrue;
       
   454                 if (static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->Predictive()
       
   455                                   && static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->Conversion()
       
   456                                   &&  ERangeHiraganaKanji == range)
       
   457                     {
       
   458                     newHide = EFalse;
       
   459                     }
       
   460                 if (newHide && !currHide || !newHide && currHide)
       
   461                     {
       
   462                     LayoutOwner()->Hide(ETrue);   // display off
       
   463                     deActive = 2;
       
   464                     iHwrWindow->PredictiveWindow()->Hide(newHide);
       
   465                     iHwrWindow->SizeChanged(ETrue);
       
   466                     }
       
   467                 else
       
   468                     {
       
   469                     iHwrWindow->ICFDisableRegionUpdating();  // ICF::OnDeActivate()
       
   470                     deActive = 1;
       
   471                     }
       
   472                 iHwrWindow->CharacterRangeWindow()->HidePopup();
       
   473                 }
       
   474             if (aCtrl && range != currentRange)  // from character range popup
       
   475                 {
       
   476                 // SetData(SetPremaryRange) and Sendkey( ESignalRange,...)
       
   477                 TPtrC rangeptr((TUint16*)(&range), sizeof(TInt)/sizeof(TUint16));
       
   478                 CPeninputCommonLayout::HandleControlEvent(aEventType, aCtrl, rangeptr);
       
   479                 if (ERangeEnglish != range && ERangeNumber != range)
       
   480                     {
       
   481                     TInt native = ERangeNative;
       
   482                     TBuf<KPeninputBufLen> buf;
       
   483                     CPeninputDataConverter::CombinationToDesc( native, range, buf );
       
   484                     Sendkey( ESignalRange, buf );
       
   485                     }
       
   486                 }
       
   487             else
       
   488                 {
       
   489                 SetData(EPeninputDataTypeCurrentRange, &range);
       
   490                 }
       
   491             DoSetCurrentRange();
       
   492             if (deActive == 2)
       
   493                 {
       
   494                 LayoutOwner()->Hide(EFalse);   // display on
       
   495                 }
       
   496             else if (deActive == 1)
       
   497                 {
       
   498                 iHwrWindow->ICFEnableRegionUpdating();  // ICF Cursor On
       
   499                 }
       
   500             }
       
   501             break;
       
   502 
       
   503         // from HiraganaKanji
       
   504         case EEventHiraganaKanjiWithTransitoryChars2Standbyjp:
       
   505             if (UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
   506                 {
       
   507                 UiStateMgr()->SetCurrentUiState(EPeninputHwrUiStateStandbyjp);
       
   508                 SetCapturePointerEvent(EFalse);
       
   509                 ToPenStandBy();
       
   510                 }
       
   511             break;
       
   512         // from HiraganaKanji
       
   513         case EEventHiraganaKanjiWithoutTransitoryChars:
       
   514             if (UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
   515                 {
       
   516                 SetCapturePointerEvent(EFalse);
       
   517                 }
       
   518             break;
       
   519 
       
   520         case EEventVirtualKeyUp:
       
   521             if ( UiStateMgr()->CurrentUiState()
       
   522             && !static_cast<CPeninputHwrBoxUiState*>(UiStateMgr()->CurrentUiState())->HandleControlEvent(aEventType,aEventData) )
       
   523                 {
       
   524                 SetCapturePointerEvent(ETrue);
       
   525                 HiraganaHandleControlEventJp(aEventType, aEventData);
       
   526                 }
       
   527             break;
       
   528         case EPeninputLayoutEventBack:
       
   529             {
       
   530             TInt clear = EKeyBackspace;
       
   531             TPtrC clearptr((TUint16*)(&clear), 1);
       
   532             if ( UiStateMgr()->CurrentUiState()
       
   533             && !static_cast<CPeninputHwrBoxUiState*>(UiStateMgr()->CurrentUiState())->HandleControlEvent(aEventType,clearptr) )
       
   534                 {
       
   535                 HiraganaHandleControlEventJp(aEventType, clearptr);
       
   536                 }
       
   537             }
       
   538             break;
       
   539         case EPeninputLayoutEventEnter:
       
   540         case EPeninputLayoutEventSelectItem:  // select from prediction/convert candidates by pointer
       
   541         case EPeninputLayoutEventTab:
       
   542             if (EPeninputLayoutEventEnter == aEventType && IsPredictiveWithNoChar())
       
   543                 {    // without transitory chars and next word prediction candidates are offered
       
   544                      // Enter button should clear Prediction and enter a newline
       
   545                 TRAP_IGNORE(iHiraganaKanji->HandleControlEventJpL(EPeninputLayoutEventBack,KNullDesC));
       
   546                 }
       
   547             if ( UiStateMgr()->CurrentUiState()
       
   548             && !static_cast<CPeninputHwrBoxUiState*>(UiStateMgr()->CurrentUiState())->HandleControlEvent(aEventType,aEventData) )
       
   549                 {
       
   550                 TRAP_IGNORE(iHiraganaKanji->HandleControlEventJpL(aEventType,aEventData));
       
   551                 }
       
   552             break;
       
   553         case EPeninputLayoutEventSpace:   // convert
       
   554             if ( UiStateMgr()->CurrentUiState()
       
   555             && !static_cast<CPeninputHwrBoxUiState*>(UiStateMgr()->CurrentUiState())->HandleControlEvent(aEventType, aEventData) )
       
   556                 {
       
   557                 HiraganaHandleControlEventJp(aEventType, aEventData);
       
   558                 }
       
   559             break;
       
   560         case EEventIcfPointerUp:  // from ContextField
       
   561         case EEventIcfCompleteAll:  // from ContextField
       
   562             TRAP_IGNORE(iHiraganaKanji->HandleControlEventJpL(aEventType,aEventData));
       
   563             break;
       
   564         case EEventShowCandidateWnd:   // CandidateWnd On
       
   565             {
       
   566             iHwrWindow->SetDimmed(ETrue);
       
   567             }
       
   568             break;
       
   569         case EEventHideCandidateWnd:   // CandidateWnd Off
       
   570             {
       
   571             iHwrWindow->SetDimmed(EFalse);
       
   572             }
       
   573             break;
       
   574         case EEventWaitforEditorTextComing:   // may use, someday.
       
   575             {
       
   576             iWaitforEditorTextComing = 1;
       
   577             }
       
   578             break;
       
   579         case EEventDraggingEnd:
       
   580             break;
       
   581         case EPeninputLayoutEventSwitchCharacterRange:
       
   582             if (static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->CharacterRangeArray()->Count() > 1)
       
   583                 {
       
   584                 HiraganaKanjiCompleteAll();
       
   585                 SendEventToWindow(aEventType, aCtrl, aEventData);
       
   586                 }
       
   587             break;
       
   588         case EEventICFSelectionChanged:  // from ContextField (when whithout transitory input)
       
   589             if (iHiraganaKanji)
       
   590                 {  // update saved data
       
   591                 TRAP_IGNORE(iHiraganaKanji->HandleControlEventJpL(aEventType,aEventData));
       
   592                 }
       
   593             break;
       
   594         case EEventSetAppCursorSelection:  // from ContextField
       
   595             if (UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
   596                 {
       
   597                 TRAP_IGNORE(iHiraganaKanji->HandleControlEventJpL(aEventType,aEventData));
       
   598                 }
       
   599             break;
       
   600         case EPeninputLayoutHwrEventDropDownListExpanded:
       
   601 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   602     if (iLogger.LogValid())
       
   603         {
       
   604         iLogger.Write(KHwrStrokeLogExpand());
       
   605         }
       
   606 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
   607             CPeninputCommonLayout::HandleControlEvent(aEventType, aCtrl, aEventData);
       
   608             iExpanded = ETrue;
       
   609             break;
       
   610         default:
       
   611             CPeninputCommonLayout::HandleControlEvent(aEventType, aCtrl, aEventData);
       
   612             break;
       
   613         }
       
   614     }
       
   615 
       
   616 // ---------------------------------------------------------------------------
       
   617 // CPeninputHwrBoxLayout::HandleControlEventPen
       
   618 // (other items were commented in a header).
       
   619 // ---------------------------------------------------------------------------
       
   620 //
       
   621 TBool CPeninputHwrBoxLayout::HandleControlEventPen(TInt aEventType, CFepUiBaseCtrl* /*aCtrl*/, const TDesC& aEventData)
       
   622     {
       
   623     TBool handled = EFalse;
       
   624     CPeninputHwrBoxUiState* current = static_cast<CPeninputHwrBoxUiState*>(iUiStatePenMgr->CurrentUiState());
       
   625     TBuf<KMaxCandidateLen> charCode;
       
   626     //filter un-related events
       
   627     if (aEventType != EEventSetAppCursorSelection
       
   628         && aEventType != EPeninputLayoutEventClose
       
   629         && aEventType != EPeninputLayoutEventBack
       
   630         && aEventType != EPeninputLayoutEventEnter
       
   631         && (aEventType != EPeninputLayoutEventSpace || !iCapturePointerEvent)
       
   632         && aEventType != EPeninputLayoutEventRange
       
   633         && aEventType != EPeninputLayoutEventOption
       
   634         && aEventType != EPeninputLayoutEventSct
       
   635         && aEventType != EPeninputLayoutEventSwitchCharacterRange
       
   636         && aEventType != EEventDraggingEnd
       
   637         && (aEventType >= EPeninputLayoutHwrEventLast || aEventType < EPeninputLayoutHwrEventBeginWriting))
       
   638         {
       
   639         return handled;
       
   640         }
       
   641     TRAPD(err, current->HandleControlEventPenL(aEventType, aEventData, *this, charCode, handled));
       
   642     if (KErrNone != err)
       
   643         {   // close peninput
       
   644         HiraganaKanjiCompleteAll();  // call ToPenStandBy()
       
   645         SetCapturePointerEvent(EFalse);
       
   646         Initialize();  //jump to init state
       
   647         CPeninputCommonLayout::HandleControlEvent(EPeninputLayoutEventClose, NULL, KNullDesC);
       
   648         handled = ETrue;
       
   649         }
       
   650     return handled;
       
   651     }
       
   652 
       
   653 // ---------------------------------------------------------------------------
       
   654 // CPeninputHwrBoxLayout::OnAppEditorTextComing
       
   655 // (other items were commented in a header).
       
   656 // ---------------------------------------------------------------------------
       
   657 //
       
   658 TInt CPeninputHwrBoxLayout::OnAppEditorTextComing(const TFepInputContextFieldData& aData)
       
   659     {
       
   660     iWaitforEditorTextComing = 0;
       
   661     // Handle edit text coming
       
   662     if (iHiraganaKanji)
       
   663         {
       
   664         TRAPD(err, iHiraganaKanji->SetEditorTextL(aData));
       
   665         if (KErrNone != err)
       
   666             {
       
   667             HandleControlEvent(EPeninputLayoutEventClose, NULL, KNullDesC);
       
   668             }
       
   669         return err;
       
   670         }
       
   671     return KErrNone;
       
   672     }
       
   673 
       
   674 // ---------------------------------------------------------
       
   675 // Submit the char code.
       
   676 // ---------------------------------------------------------
       
   677 //
       
   678 void CPeninputHwrBoxLayout::SubmitL(const TDesC& aCharCode)
       
   679     {
       
   680     TInt len = 0;
       
   681     if (iSubmitText && !(*iSubmitText).CompareC(aCharCode)
       
   682         || !UiStateMgr()
       
   683         || !UiStateMgr()->CurrentUiState())
       
   684         {
       
   685         return;
       
   686         }
       
   687     if (iSubmitText)
       
   688         {
       
   689         len = iSubmitText->Length();
       
   690         if (len > 1 
       
   691             && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
   692             {
       
   693             len = 1;
       
   694             }
       
   695         }
       
   696     delete iSubmitText;
       
   697     iSubmitText = NULL;
       
   698     iSubmitText = aCharCode.AllocL();
       
   699 
       
   700     TInt eventType = EEventVirtualKeyUp;
       
   701     TPtr charcode(iSubmitText->Des());
       
   702 
       
   703     //if charcode is enter or back or space, translate them back
       
   704     TPtrC16 ptr;
       
   705     ptr.Set(&KBackRep, sizeof(KBackRep)/sizeof(TUint16));
       
   706 
       
   707     if (charcode.CompareC(ptr) == 0)
       
   708         {
       
   709         charcode.Zero();
       
   710         charcode.Append((TChar)EKeyBackspace);
       
   711         eventType = EPeninputLayoutEventBack;
       
   712         }
       
   713     else
       
   714         {
       
   715         ptr.Set(&KSpaceRep, sizeof(KSpaceRep)/sizeof(TUint16));
       
   716         if (charcode.CompareC(ptr) == 0)
       
   717             {
       
   718             charcode.Zero();
       
   719             charcode.Append((TChar)EKeySpace);
       
   720             eventType = EPeninputLayoutEventSpace;
       
   721             }
       
   722         else
       
   723             {
       
   724             ptr.Set(&KEnterRep, sizeof(KEnterRep)/sizeof(TUint16));
       
   725             if (charcode.CompareC(ptr) == 0)
       
   726                 {
       
   727                 charcode.Zero();
       
   728                 charcode.Append((TChar)EKeyEnter);
       
   729                 eventType = EPeninputLayoutEventEnter;
       
   730                 }
       
   731             }
       
   732         }
       
   733     if (len > 0 && 
       
   734         (EEventVirtualKeyUp != eventType
       
   735                   || UiStateMgr()->CurrentUiState() != UiStateMgr()->GetUiState(EPeninputHwrUiStateStandby)))
       
   736         {
       
   737         for (TInt i = 0; i < len; i++)
       
   738             {
       
   739             DeleteL(EKeyDelete);
       
   740             }
       
   741         }
       
   742 
       
   743     if (len > 0 && 
       
   744         (EEventVirtualKeyUp == eventType
       
   745                   && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateStandby)))
       
   746         {
       
   747         // len == 1 or 2, charcode.Length() == 1 or 2.
       
   748         TInt diff = charcode.Length() - len;
       
   749         if (diff > 0)
       
   750             {
       
   751             HBufC* p = HBufC::NewL(charcode.Length() + 2);
       
   752             p->Des().Append((TUint16*)&len, 2);
       
   753             p->Des().Append(charcode.Left(len));
       
   754             Sendkey( ESignalReplaceTextJp, *p );
       
   755             delete p;
       
   756             Sendkey( ESignalKeyEvent, charcode.Right(diff));
       
   757             }
       
   758         else
       
   759             {
       
   760             while (len > charcode.Length())
       
   761                 {
       
   762                 DeleteL(EKeyDelete);
       
   763                 --len;
       
   764                 }
       
   765             HBufC* p = HBufC::NewL(charcode.Length() + 2);
       
   766             p->Des().Append((TUint16*)&len, 2);
       
   767             p->Des().Append(charcode);
       
   768             Sendkey( ESignalReplaceTextJp, *p );
       
   769             delete p;
       
   770             }
       
   771         }
       
   772     else if ( !static_cast<CPeninputHwrBoxUiState*>(UiStateMgr()->CurrentUiState())->HandleControlEvent(eventType,charcode) )
       
   773         {
       
   774         SetCapturePointerEvent(ETrue);
       
   775         iHiraganaKanji->HandleControlEventJpL(eventType, charcode);
       
   776         }
       
   777     if (EEventVirtualKeyUp != eventType)
       
   778         {
       
   779         delete iSubmitText;
       
   780         iSubmitText = NULL;
       
   781         }
       
   782     }
       
   783 
       
   784 // ---------------------------------------------------------
       
   785 // Delete the previous charcode
       
   786 // ---------------------------------------------------------
       
   787 //
       
   788 void CPeninputHwrBoxLayout::DeleteL(TInt aChar/*  = EKeyBackspace*/)
       
   789     {
       
   790         //delete the last char
       
   791     const TInt len = sizeof(aChar);
       
   792     TBuf<len> aBufBck;
       
   793     aBufBck.Append((TChar)aChar);
       
   794 
       
   795     if (UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
   796         {
       
   797         static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->PtiEngine()->HandleCommandL(EPtiCommandBackSpaceByForce);
       
   798         }
       
   799     else
       
   800         {
       
   801         SignalOwner(ESignalKeyEvent, aBufBck);
       
   802         }
       
   803     }
       
   804 
       
   805 // ---------------------------------------------------------------------------
       
   806 // CPeninputHwrBoxLayout::HandleRawKeyEventL
       
   807 // (other items were commented in a header).
       
   808 // ---------------------------------------------------------------------------
       
   809 //
       
   810 TBool CPeninputHwrBoxLayout::HandleRawKeyEventL(const TRawEvent& aKeyEvent)
       
   811     {
       
   812     TBool rs = EFalse;
       
   813     if (iHiraganaKanji)
       
   814         {
       
   815         iHiraganaKanji->CancelRepeat();
       
   816         }
       
   817     if (iUiStatePenMgr)
       
   818         {
       
   819         CPeninputUiStateBase* current = iUiStatePenMgr->CurrentUiState();
       
   820         if (iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenBeginWriting) == current)
       
   821             {  // temporary
       
   822             return ETrue;
       
   823             }
       
   824         if (iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenEndWriting) == current
       
   825             || iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenCandidateSelecting) == current)
       
   826             {
       
   827             TInt key = (aKeyEvent.ScanCode() & 0x000000FF);
       
   828             switch(key)
       
   829                 {  // Handle clear key
       
   830                 case EKeyBackspace:
       
   831                 case EStdKeyBackspace:      /* 0x01 */
       
   832                 case EStdKeyEscape:         /* 0x04 */
       
   833                     {
       
   834                     // if TRawEvent::EKeyDown, return at once.
       
   835                     if (TRawEvent::EKeyDown == aKeyEvent.Type())
       
   836                         {
       
   837                         iKeyEventClearAsync->CallBack();
       
   838                         }
       
   839                     return ETrue;
       
   840                     }
       
   841                 default:
       
   842                     ToPenStandBy();
       
   843                     break;
       
   844                 }
       
   845             }
       
   846         }
       
   847     if (UiStateMgr() && UiStateMgr()->CurrentUiState())
       
   848         {
       
   849         rs = UiStateMgr()->CurrentUiState()->HandleKeyEventL(aKeyEvent);
       
   850         if (rs && iHiraganaKanji)
       
   851             {
       
   852             if (EStdKeyEnter == (aKeyEvent.ScanCode() & 0x000000FF) && IsPredictiveWithNoChar())
       
   853                 {    // without transitory chars and next word prediction candidates are offered
       
   854                      // Enter button should clear Prediction and enter a newline
       
   855                 TRAP_IGNORE(iHiraganaKanji->HandleControlEventJpL(EPeninputLayoutEventBack,KNullDesC));
       
   856                 return UiStateMgr()->GetUiState(EPeninputHwrUiStateStandby)->HandleKeyEventL(aKeyEvent);
       
   857                 }
       
   858             rs = iHiraganaKanji->HandleKeyEvent(aKeyEvent);
       
   859             }
       
   860         }
       
   861     if (!iWaitforEditorTextComing && TRawEvent::EKeyDown == aKeyEvent.Type() && TRawEvent::ENone == iKeyEvent.Type())
       
   862         {
       
   863         if (!rs)
       
   864             {
       
   865             SendEventToWindow(EPeninputLayoutEventCloseCharacterRange, NULL, KNullDesC);
       
   866             HiraganaKanjiCompleteAll();
       
   867             if (iWaitforEditorTextComing)  // complete done.
       
   868                 {
       
   869                 rs = ETrue;
       
   870                 iKeyEvent = aKeyEvent;
       
   871                 iKeyEventAsync->CallBack();       // for key that hiraganakanji do not handle
       
   872                 }
       
   873             }
       
   874         else if (iHiraganaKanji)
       
   875             {
       
   876             iKeyEventAsync->CallBack();   // for pending event
       
   877             }
       
   878         }
       
   879     return rs;
       
   880     }
       
   881 
       
   882 // ---------------------------------------------------------------------------
       
   883 // CPeninputHwrBoxLayout::OnPointerEventOutsideLayout
       
   884 // Call back when the pointer down/up event happends outside of the layout
       
   885 // (other items were commented in a header).
       
   886 // ---------------------------------------------------------------------------
       
   887 //
       
   888 TBool CPeninputHwrBoxLayout::OnPointerEventOutsideLayout(const TRawEvent& aEvent)
       
   889     {
       
   890     if (TRawEvent::EButton1Down == aEvent.Type()) // this if is not necessary. only EButton1Down.
       
   891         {
       
   892         HandleControlEventPen(EPeninputLayoutHwrEventPointerOutsideWnd, NULL, KNullDesC);
       
   893         SendEventToWindow(EPeninputLayoutEventCloseCharacterRange, NULL, KNullDesC);
       
   894         HiraganaKanjiCompleteAll();
       
   895         if (iCapturePointerEvent)
       
   896             {
       
   897             iPointerEventDown = aEvent;
       
   898             SetCapturePointerEvent(EFalse);
       
   899             iPointerEventAsync->CallBack();
       
   900             }
       
   901         }
       
   902     return EFalse;
       
   903     }
       
   904 
       
   905 // ---------------------------------------------------------------------------
       
   906 // CPeninputHwrBoxLayout::DataMgr
       
   907 // (other items were commented in a header)
       
   908 // ---------------------------------------------------------------------------
       
   909 //
       
   910 CPeninputHwrBoxDataMgr* CPeninputHwrBoxLayout::DataMgr(TInt /*aDummy*/)
       
   911     {
       
   912     return static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr);
       
   913     }
       
   914 
       
   915 // ---------------------------------------------------------------------------
       
   916 // CPeninputHwrBoxLayout::HwrBoxWindow
       
   917 // (other items were commented in a header)
       
   918 // ---------------------------------------------------------------------------
       
   919 //
       
   920 CPeninputHwrBoxWindow* CPeninputHwrBoxLayout::HwrBoxWindow()
       
   921     {
       
   922     return iHwrWindow;
       
   923     }
       
   924 
       
   925 void CPeninputHwrBoxLayout::ToPenStandBy(TBool aNotStandBy/* = EFalse*/)
       
   926     {
       
   927     if (iUiStatePenMgr)
       
   928         {
       
   929         CPeninputUiStateBase* current = iUiStatePenMgr->CurrentUiState();
       
   930         if (iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenEndWriting) == current
       
   931             || iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenCandidateSelecting) == current)
       
   932             {
       
   933             static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->ClearCandidates();
       
   934 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   935             if (iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenEndWriting) == current && !aNotStandBy)
       
   936                 {
       
   937                 WriteHwrStrokeLogNew();
       
   938                 }
       
   939 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
   940             }
       
   941         if (!aNotStandBy)
       
   942             {
       
   943             iUiStatePenMgr->SetCurrentUiState(EPeninputHwrUiStatePenStandBy);
       
   944             iHwrWindow->CancelWriting();   // Standby::OnEntry()
       
   945             iHwrWindow->DimInputContextField(EFalse);
       
   946             }
       
   947         delete iSubmitText;
       
   948         iSubmitText = NULL;
       
   949         iExpanded = EFalse;
       
   950         }
       
   951     }
       
   952 
       
   953 void CPeninputHwrBoxLayout::Initialize()
       
   954     {
       
   955     if (iUiStatePenMgr)
       
   956         {
       
   957 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   958         CPeninputUiStateBase* current = iUiStatePenMgr->CurrentUiState();
       
   959         if (iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenEndWriting) == current
       
   960             || iUiStatePenMgr->GetUiState(EPeninputHwrUiStatePenBeginWriting) == current)
       
   961             {
       
   962             WriteHwrStrokeLogNew();
       
   963             }
       
   964 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
   965         iUiStatePenMgr->SetCurrentUiState(EPeninputHwrUiStateNone);
       
   966         }
       
   967     if (iHwrWindow)
       
   968         {
       
   969         iHwrWindow->CancelWriting();
       
   970         iHwrWindow->Hide(ETrue);
       
   971         iExpanded = EFalse;
       
   972         }
       
   973     }
       
   974 
       
   975 void CPeninputHwrBoxLayout::CompleteIfConvertingL()
       
   976     {
       
   977     if (iCapturePointerEvent    // Transitory Input Exists
       
   978         && UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
   979         {
       
   980         iWaitforEditorTextComing = 0;
       
   981         if (iHiraganaKanji)
       
   982             {
       
   983             iHiraganaKanji->HandleControlEventJpL(EEventCompleteIfConvertingHiraganaKanji, KNullDesC);
       
   984             }
       
   985         if (iWaitforEditorTextComing)   // the status of hiraganakanji was converting  ---> complete,but should not capture off
       
   986             {
       
   987             UiStateMgr()->SetCurrentUiState(EPeninputHwrUiStateStandbyjp);
       
   988             iCapturePointerEvent = EFalse;
       
   989             }
       
   990         }
       
   991     }
       
   992 
       
   993 // ---------------------------------------------------------------------------
       
   994 // CPeninputHwrBoxLayout::ClearInputToPenStandByL()
       
   995 // clear last input char and goto PenStandBy
       
   996 // (other items were commented in a header)
       
   997 // ---------------------------------------------------------------------------
       
   998 //
       
   999 void CPeninputHwrBoxLayout::ClearInputToPenStandByL()
       
  1000     {
       
  1001     if (iSubmitText)
       
  1002         {
       
  1003         TInt len = iSubmitText->Length();
       
  1004         if (len > 1 &&
       
  1005             UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
  1006             {
       
  1007             len = 1;
       
  1008             }
       
  1009         for (TInt i = 0; i < len; i++)
       
  1010             {
       
  1011             DeleteL(EKeyDelete);
       
  1012             }
       
  1013         }
       
  1014     ToPenStandBy();
       
  1015     if (UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
  1016         {
       
  1017         iHiraganaKanji->HandleControlEventJpL(EEventVirtualKeyUp,KNullDesC);
       
  1018         }
       
  1019     }
       
  1020 
       
  1021 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
  1022 // ---------------------------------------------------------------------------
       
  1023 // CPeninputHwrBoxLayout::WriteHwrStrokeLogNew
       
  1024 // write log "New"
       
  1025 // (other items were commented in a header)
       
  1026 // ---------------------------------------------------------------------------
       
  1027 //
       
  1028 void CPeninputHwrBoxLayout::WriteHwrStrokeLogNew()
       
  1029     {
       
  1030     if (iLogger.LogValid())
       
  1031         {
       
  1032         iLogger.Write(KHwrStrokeLogNew());
       
  1033         }
       
  1034     }
       
  1035 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
  1036 
       
  1037 // ---------------------------------------------------------------------------
       
  1038 // CPeninputHwrBoxLayout::CPeninputHwrBoxLayout
       
  1039 // (other items were commented in a header).
       
  1040 // ---------------------------------------------------------------------------
       
  1041 //
       
  1042 CPeninputHwrBoxLayout::CPeninputHwrBoxLayout(MLayoutOwner* aLayoutOwner)
       
  1043     : CPeninputCommonLayout( aLayoutOwner ),
       
  1044     iCapturePointerEvent(EFalse),
       
  1045     iExpanded(EFalse)
       
  1046     {
       
  1047     }
       
  1048 
       
  1049 // ---------------------------------------------------------------------------
       
  1050 // CPeninputHwrBoxLayout::ConstructL
       
  1051 // (other items were commented in a header).
       
  1052 // ---------------------------------------------------------------------------
       
  1053 //
       
  1054 void CPeninputHwrBoxLayout::ConstructL(const TAny* aInitData)
       
  1055     {
       
  1056     CPeninputCommonLayout::ConstructL( aInitData );
       
  1057 
       
  1058 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
  1059     User::LeaveIfError( iLogger.Connect() );
       
  1060     // Make directory
       
  1061     RFs fs;
       
  1062     if (fs.Connect() == KErrNone)
       
  1063         {
       
  1064         TInt ret = fs.MkDirAll(KHwrStrokeLogBaseDir());
       
  1065         fs.Close();
       
  1066         }
       
  1067 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
  1068 
       
  1069     iUiStatePenMgr = CPeninputUiStateMgr::NewL( this );
       
  1070 
       
  1071     CPeninputUiStateBase* initialState =
       
  1072         CPeninputUiStateBase::NewL( UiStateMgr(), this );
       
  1073     UiStateMgr()->AddUiState( initialState, EPeninputHwrUiStateNone );
       
  1074 
       
  1075     CPeninputHwrBoxUiStateStandby* standbyState =
       
  1076         CPeninputHwrBoxUiStateStandby::NewL( UiStateMgr(), this );
       
  1077     UiStateMgr()->AddUiState( standbyState, EPeninputHwrUiStateStandby );
       
  1078 
       
  1079     CPeninputHwrBoxUiStateStandbyjp* standbyjpState =
       
  1080         CPeninputHwrBoxUiStateStandbyjp::NewL( UiStateMgr(), this );
       
  1081     UiStateMgr()->AddUiState( standbyjpState, EPeninputHwrUiStateStandbyjp );
       
  1082 
       
  1083     CPeninputHwrBoxUiStateWithTransitoryChars* transitoryState =
       
  1084         CPeninputHwrBoxUiStateWithTransitoryChars::NewL( UiStateMgr(), this );
       
  1085     UiStateMgr()->AddUiState( transitoryState, EPeninputHwrUiStateWithTransitoryChars );
       
  1086 
       
  1087     UiStateMgr()->SetCurrentUiState( initialState );
       
  1088 
       
  1089     CPeninputUiStateBase* penInitialState =
       
  1090         CPeninputHwrBoxUiState::NewL( iUiStatePenMgr, this );
       
  1091 
       
  1092     iUiStatePenMgr->AddUiState( penInitialState, EPeninputHwrUiStateNone );
       
  1093     CPeninputHwrBoxUiStatePenStandby* penStandbyState =
       
  1094         CPeninputHwrBoxUiStatePenStandby::NewL( iUiStatePenMgr, this );
       
  1095     iUiStatePenMgr->AddUiState( penStandbyState, EPeninputHwrUiStatePenStandBy );
       
  1096 
       
  1097     CPeninputHwrBoxUiStatePenBeginWriting* penBeginState =
       
  1098         CPeninputHwrBoxUiStatePenBeginWriting::NewL( iUiStatePenMgr, this );
       
  1099     iUiStatePenMgr->AddUiState( penBeginState, EPeninputHwrUiStatePenBeginWriting );
       
  1100 
       
  1101     CPeninputHwrBoxUiStatePenEndWriting* penEndState =
       
  1102         CPeninputHwrBoxUiStatePenEndWriting::NewL( iUiStatePenMgr, this );
       
  1103     iUiStatePenMgr->AddUiState( penEndState, EPeninputHwrUiStatePenEndWriting );
       
  1104 
       
  1105     CPeninputHwrBoxUiStatePenCandidateSelecting* penCandidateSelectingState =
       
  1106         CPeninputHwrBoxUiStatePenCandidateSelecting::NewL( iUiStatePenMgr, this );
       
  1107     iUiStatePenMgr->AddUiState( penCandidateSelectingState, EPeninputHwrUiStatePenCandidateSelecting );
       
  1108 
       
  1109     iUiStatePenMgr->SetCurrentUiState( penInitialState );
       
  1110 
       
  1111     iHwrWindow = static_cast<CPeninputHwrBoxWindow*>(iLayoutWindow);
       
  1112     Initialize();
       
  1113     {
       
  1114     TInt penSpeed = static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->WritingSpeed();
       
  1115     TPtr ptr((TUint16*)&penSpeed,sizeof(TInt)/sizeof(TUint16));
       
  1116     SendEventToWindow(EPeninputLayoutHwrEventWritingSpeedChange, NULL, ptr);
       
  1117     }
       
  1118     {
       
  1119     TSize penSize = static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->PenSize();
       
  1120     TPtr ptr((TUint16*)&penSize,sizeof(TSize)/sizeof(TUint16));
       
  1121     SendEventToWindow(EPeninputLayoutHwrEventPenSizeChange, NULL, ptr);
       
  1122     }
       
  1123     {
       
  1124     TRgb penColor = static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->PenColor();
       
  1125     TPtr ptr((TUint16*)&penColor,sizeof(TRgb)/sizeof(TUint16));
       
  1126     SendEventToWindow(EPeninputLayoutHwrEventPenColorChange, NULL, ptr);
       
  1127     }
       
  1128     //create hiraganakanji
       
  1129     iHiraganaKanji = CPeninputHiraganaKanji::NewL(static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->PtiEngine()
       
  1130                                                        , this
       
  1131                                                        , iHwrWindow->InputContextField()
       
  1132                                                        , iHwrWindow->CandidateWindow()
       
  1133                                                        , iHwrWindow->PredictiveWindow());
       
  1134     TCallBack cb(KeyEventCallback, this);
       
  1135     TCallBack cbpointer(PointerEventCallback, this);
       
  1136     iKeyEventAsync = new(ELeave) CAsyncCallBack(cb, CActive::EPriorityHigh);
       
  1137     iPointerEventAsync = new(ELeave) CAsyncCallBack(cbpointer, CActive::EPriorityStandard);
       
  1138     TCallBack cbClear(KeyEventClearCallback, this);
       
  1139     iKeyEventClearAsync = new(ELeave) CAsyncCallBack(cbClear, CActive::EPriorityHigh);
       
  1140 
       
  1141     iKeyEvent.Set(TRawEvent::ENone,0);
       
  1142     iPointerEventDown.Set(TRawEvent::ENone,0);
       
  1143     }
       
  1144 
       
  1145 // ---------------------------------------------------------------------------
       
  1146 // CPeninputHwrBoxLayout::DoSetCurrentRange
       
  1147 // (other items were commented in a header).
       
  1148 // ---------------------------------------------------------------------------
       
  1149 //
       
  1150 void CPeninputHwrBoxLayout::DoSetCurrentRange()
       
  1151     {
       
  1152     TInt currentRange = CPeninputDataConverter::AnyToInt( RequestData( EPeninputDataTypeCurrentRange ) );
       
  1153     static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->SetEngineInputMode(currentRange); // PtiEngine:SetInputMode()
       
  1154 
       
  1155     if ( currentRange == ERangeHiraganaKanji && static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->Conversion())
       
  1156         {
       
  1157         UiStateMgr()->SetCurrentUiState(EPeninputHwrUiStateStandbyjp);
       
  1158         }
       
  1159     else
       
  1160         {
       
  1161         UiStateMgr()->SetCurrentUiState(EPeninputHwrUiStateStandby);
       
  1162         }
       
  1163    SetCapturePointerEvent(EFalse);
       
  1164    ToPenStandBy();
       
  1165 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
  1166    WriteHwrStrokeLogRange();
       
  1167 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
  1168    }
       
  1169 
       
  1170 // ---------------------------------------------------------------------------
       
  1171 // CPeninputHwrBoxLayout::CompleteAllHiraganaKanji
       
  1172 // ---------------------------------------------------------------------------
       
  1173 //
       
  1174 void CPeninputHwrBoxLayout::HiraganaKanjiCompleteAll()
       
  1175     {
       
  1176     ToPenStandBy();
       
  1177     if( UiStateMgr() && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
  1178         {
       
  1179         if (iHiraganaKanji)
       
  1180             {  // CompleteALL
       
  1181             TRAP_IGNORE(iHiraganaKanji->HandleControlEventJpL(EEventCompleteAllHiraganaKanji, KNullDesC));
       
  1182             }
       
  1183         }
       
  1184     }
       
  1185 
       
  1186 // ---------------------------------------------------------------------------
       
  1187 // CPeninputHwrBoxLayout::CreateLayoutWindowL
       
  1188 // (other items were commented in a header)
       
  1189 // ---------------------------------------------------------------------------
       
  1190 //
       
  1191 void CPeninputHwrBoxLayout::CreateLayoutWindowL()
       
  1192     {
       
  1193     iLayoutWindow = CPeninputHwrBoxWindow::NewL( this, this );
       
  1194     }
       
  1195 
       
  1196 // ---------------------------------------------------------------------------
       
  1197 // CPeninputHwrBoxLayout::CreateDataMgrL
       
  1198 // (other items were commented in a header)
       
  1199 // ---------------------------------------------------------------------------
       
  1200 //
       
  1201 void CPeninputHwrBoxLayout::CreateDataMgrL( const TAny* /*aInitData*/ )
       
  1202     {
       
  1203     iDataMgr = CPeninputHwrBoxDataMgr::NewL( this );
       
  1204     }
       
  1205 
       
  1206 // ---------------------------------------------------------------------------
       
  1207 // CPeninputHwrBoxLayout::LayoutType
       
  1208 // (other items were commented in a header)
       
  1209 // ---------------------------------------------------------------------------
       
  1210 //
       
  1211 TInt CPeninputHwrBoxLayout::LayoutType()
       
  1212     {
       
  1213     return EPluginInputModeHwr;
       
  1214     }
       
  1215 
       
  1216 // ---------------------------------------------------------------------------
       
  1217 // CPeninputHwrBoxLayout::SemiTransparencyRequired
       
  1218 // (other items were commented in a header)
       
  1219 // ---------------------------------------------------------------------------
       
  1220 //
       
  1221 TBool CPeninputHwrBoxLayout::SemiTransparencyRequired()
       
  1222     {
       
  1223     return ETrue;
       
  1224     }
       
  1225 
       
  1226 // ---------------------------------------------------------------------------
       
  1227 // CPeninputHwrBoxLayout::TranslateRangeHullHalf
       
  1228 // (other items were commented in a header)
       
  1229 // ---------------------------------------------------------------------------
       
  1230 //
       
  1231 TInt CPeninputHwrBoxLayout::TranslateRangeHullHalf(TInt aRange) const
       
  1232     {
       
  1233     TInt newRange = aRange;
       
  1234     if (static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->FullHalf()) // Full
       
  1235         {
       
  1236         switch (aRange)
       
  1237             {
       
  1238             case ERangeEnglish:
       
  1239                 newRange = ERangeFullWidthEnglish;
       
  1240                 break;
       
  1241             case ERangeNumber:
       
  1242                  newRange = ERangeFullWidthNumeric;
       
  1243                  break;
       
  1244             case ERangeKatakana:
       
  1245                 newRange = ERangeFullWidthKatakana;
       
  1246                 break;
       
  1247             default:
       
  1248                 break;
       
  1249             }
       
  1250         }
       
  1251     else   // half
       
  1252         {
       
  1253         switch (aRange)
       
  1254             {
       
  1255             case ERangeFullWidthEnglish:
       
  1256                 newRange = ERangeEnglish;
       
  1257                 break;
       
  1258             case ERangeFullWidthNumeric:
       
  1259                 newRange = ERangeNumber;
       
  1260                 break;
       
  1261             case ERangeFullWidthKatakana:
       
  1262                 newRange = ERangeKatakana;
       
  1263                 break;
       
  1264             default:
       
  1265                 break;
       
  1266             }
       
  1267         }
       
  1268     return newRange;
       
  1269     }
       
  1270 
       
  1271 TInt CPeninputHwrBoxLayout::KeyEventCallback(TAny* aThis)
       
  1272     {
       
  1273     if (aThis)
       
  1274         {
       
  1275         TRAPD(err,static_cast<CPeninputHwrBoxLayout*>(aThis)->DoKeyEventL());
       
  1276         if (KErrNone != err)
       
  1277             {
       
  1278             static_cast<CPeninputHwrBoxLayout*>(aThis)->HandleControlEvent(EPeninputLayoutEventClose, NULL, KNullDesC);
       
  1279             }
       
  1280         return err;
       
  1281         }
       
  1282     return 0;
       
  1283     }
       
  1284 
       
  1285 TInt CPeninputHwrBoxLayout::PointerEventCallback(TAny* aThis)
       
  1286     {
       
  1287     if (aThis)
       
  1288         {
       
  1289         static_cast<CPeninputHwrBoxLayout*>(aThis)->DoPointerEvent();
       
  1290         }
       
  1291     return 0;
       
  1292     }
       
  1293 
       
  1294 void CPeninputHwrBoxLayout::DoKeyEventL()
       
  1295     {
       
  1296     TBool ret = iHiraganaKanji->HandlePendingEventL();
       
  1297     if (!ret && TRawEvent::ENone != iKeyEvent.Type())
       
  1298         {
       
  1299         iKeyEvent.Set(TRawEvent::EKeyUp,iKeyEvent.ScanCode());
       
  1300         CCoeEnv::Static()->WsSession().SimulateRawEvent(iKeyEvent);
       
  1301         iKeyEvent.Set(TRawEvent::EKeyDown,iKeyEvent.ScanCode());
       
  1302         CCoeEnv::Static()->WsSession().SimulateRawEvent(iKeyEvent);
       
  1303         iKeyEvent.Set(TRawEvent::EKeyUp,iKeyEvent.ScanCode());
       
  1304         CCoeEnv::Static()->WsSession().SimulateRawEvent(iKeyEvent);
       
  1305         iKeyEvent.Set(TRawEvent::ENone,0);
       
  1306         }
       
  1307     }
       
  1308 
       
  1309 void CPeninputHwrBoxLayout::DoPointerEvent()
       
  1310     {
       
  1311     if (TRawEvent::ENone != iPointerEventDown.Type())
       
  1312         {
       
  1313         User::After(KDelay);
       
  1314         CCoeEnv::Static()->WsSession().SimulateRawEvent(iPointerEventDown);
       
  1315         iPointerEventDown.Set(TRawEvent::EButton1Up,iPointerEventDown.Pos().iX,iPointerEventDown.Pos().iY);
       
  1316         CCoeEnv::Static()->WsSession().SimulateRawEvent(iPointerEventDown);
       
  1317         iPointerEventDown.Set(TRawEvent::ENone,0);
       
  1318         }
       
  1319     }
       
  1320 
       
  1321 TInt CPeninputHwrBoxLayout::KeyEventClearCallback(TAny* aThis)
       
  1322     {
       
  1323     if (aThis)
       
  1324         {
       
  1325         TRAPD(err,static_cast<CPeninputHwrBoxLayout*>(aThis)->DoKeyClearEventL());
       
  1326         if (KErrNone != err)
       
  1327             {
       
  1328             static_cast<CPeninputHwrBoxLayout*>(aThis)->HandleControlEvent(EPeninputLayoutEventClose, NULL, KNullDesC);
       
  1329             }
       
  1330         return err;
       
  1331         }
       
  1332     return 0;
       
  1333     }
       
  1334 
       
  1335 void CPeninputHwrBoxLayout::DoKeyClearEventL()
       
  1336     {
       
  1337     ClearInputToPenStandByL();
       
  1338 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
  1339     WriteHwrStrokeLogClear();
       
  1340 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
  1341     if (iHiraganaKanji)
       
  1342         {
       
  1343         iHiraganaKanji->RepeatClearKeyStart();
       
  1344         }
       
  1345     }
       
  1346 
       
  1347 void CPeninputHwrBoxLayout::SetCapturePointerEvent(TBool aFlag)
       
  1348     {
       
  1349     if (iCapturePointerEvent && !aFlag || !iCapturePointerEvent && aFlag)
       
  1350         {
       
  1351         TBool dimmFlag = (aFlag)? EFalse : ETrue;
       
  1352         TPtr ptr((TUint16*)&dimmFlag,sizeof(TBool)/sizeof(TUint16));
       
  1353         SendEventToWindow(EPeninputLayoutEventSetConversion, NULL, ptr);
       
  1354         //signal the owner that pointer needs not be captured
       
  1355         TBool capture = aFlag;
       
  1356         TPtrC captureData;
       
  1357         captureData.Set((const TUint16*)&capture,sizeof(TBool)/sizeof(TUint16));
       
  1358         SignalOwner(ESignalCapturePointer,captureData);
       
  1359         iCapturePointerEvent = aFlag;
       
  1360         }
       
  1361     }
       
  1362 
       
  1363 void CPeninputHwrBoxLayout::SetCapturePointerEventAgain()
       
  1364     {
       
  1365     if (iCapturePointerEvent)
       
  1366         {
       
  1367         //signal the owner that pointer needs not be captured
       
  1368         TBool capture = ETrue;
       
  1369         TPtrC captureData;
       
  1370         captureData.Set((const TUint16*)&capture,sizeof(TBool)/sizeof(TUint16));
       
  1371         SignalOwner(ESignalCapturePointer,captureData);
       
  1372         }
       
  1373     }
       
  1374 
       
  1375 void CPeninputHwrBoxLayout::HiraganaHandleControlEventJp(TInt aEventType, const TDesC& aEventData)
       
  1376     {
       
  1377     if (iHiraganaKanji)
       
  1378         {
       
  1379         TRAPD(err, iHiraganaKanji->HandleControlEventJpL(aEventType,aEventData));
       
  1380         if (KErrNone != err)
       
  1381             {   // close peninput
       
  1382             HiraganaKanjiCompleteAll();  // call ToPenStandBy()
       
  1383             SetCapturePointerEvent(EFalse);
       
  1384             Initialize();  //jump to init state
       
  1385             CPeninputCommonLayout::HandleControlEvent(EPeninputLayoutEventClose, NULL, KNullDesC);
       
  1386             }
       
  1387         }
       
  1388     }
       
  1389 
       
  1390 TBool CPeninputHwrBoxLayout::IsPredictiveWithNoChar() const
       
  1391     {
       
  1392     if (!iCapturePointerEvent    // without transitory chars
       
  1393     && UiStateMgr()->CurrentUiState() == UiStateMgr()->GetUiState(EPeninputHwrUiStateWithTransitoryChars))
       
  1394         {
       
  1395         return ETrue;
       
  1396         }
       
  1397     return EFalse;
       
  1398     }
       
  1399 
       
  1400 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
  1401 // ---------------------------------------------------------------------------
       
  1402 // CPeninputHwrBoxLayout::WriteHwrStrokeLogClear
       
  1403 // write log "Clear"
       
  1404 // (other items were commented in a header)
       
  1405 // ---------------------------------------------------------------------------
       
  1406 //
       
  1407 void CPeninputHwrBoxLayout::WriteHwrStrokeLogClear()
       
  1408     {
       
  1409     if (iLogger.LogValid())
       
  1410         {
       
  1411         iLogger.Write(KHwrStrokeLogClear());
       
  1412         }
       
  1413     }
       
  1414 
       
  1415 // ---------------------------------------------------------------------------
       
  1416 // CPeninputHwrBoxLayout::WriteHwrStrokeLogRange
       
  1417 // write log characterrange
       
  1418 // (other items were commented in a header)
       
  1419 // ---------------------------------------------------------------------------
       
  1420 //
       
  1421 void CPeninputHwrBoxLayout::WriteHwrStrokeLogRange()
       
  1422     {
       
  1423     if (iLogger.LogValid() && !iLogOff)
       
  1424         {
       
  1425         TBuf<KHwrStrokeLogCharacterRangeLen> characterRange;
       
  1426         switch(static_cast<CPeninputHwrBoxDataMgr*>(iDataMgr)->CharacterRangeId())
       
  1427             {
       
  1428             case EPeninutCharacterRangeIdKanaKanji:
       
  1429                 characterRange.Append(KHwrStrokeLogRangeKanaKanji());
       
  1430                 break;
       
  1431             case EPeninutCharacterRangeIdLatin:
       
  1432                 characterRange.Append(KHwrStrokeLogRangeLatin());
       
  1433                 break;
       
  1434             case EPeninutCharacterRangeIdNumber:
       
  1435                 characterRange.Append(KHwrStrokeLogRangeNumber());
       
  1436                 break;
       
  1437             default:
       
  1438                 characterRange.Append(KHwrStrokeLogRangeAllTypes());
       
  1439                 break;
       
  1440             }
       
  1441         iLogger.WriteFormat(KHwrStrokeLogCharacterRange(), &characterRange);
       
  1442         }
       
  1443     }
       
  1444 #endif // __PENINPUT_HWR_STROKE_LOG_ON
       
  1445 // End Of File