fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuictrlpinyineep.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2008 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:           
       
    15  *      Provides the CAknFepUICtrlPinyinEEP definition 
       
    16  *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #include <eikenv.h>
       
    31 #include <eikappui.h>
       
    32 #include <AknsSkinInstance.h> 
       
    33 #include <AknsUtils.h> 
       
    34 #include <AknsDrawUtils.h> 
       
    35 #include <skinlayout.cdl.h>
       
    36 
       
    37 #include "aknlayoutscalable_avkon.cdl.h"
       
    38 #include "aknfepuictrlpinyineep.h"
       
    39 #include "aknfepuilayoutdatamgr.h"
       
    40 #include "aknfepchineseuidataconv.h"
       
    41 
       
    42 _LIT(KFullStop, "\x002E");
       
    43 
       
    44 _LIT( KToneMark1, "\x0020");
       
    45 _LIT( KToneMark2, "\x02CA");
       
    46 _LIT( KToneMark3, "\x02C7");
       
    47 _LIT( KToneMark4, "\x02CB");
       
    48 _LIT( KToneMark5, "\x02D9");
       
    49 _LIT( KLeftBracket, "\x0028");
       
    50 const TInt KControlNum = 1;
       
    51 const TInt KMaxCharNum = 200;
       
    52 const TInt KMaxDispNum = 200;
       
    53 
       
    54 // ---------------------------------------------------------
       
    55 // NewL function.
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 CAknFepUICtrlPinyinEEP* CAknFepUICtrlPinyinEEP::NewL( RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr )
       
    59     {
       
    60     CAknFepUICtrlPinyinEEP* self=CAknFepUICtrlPinyinEEP::NewLC( aParent, aLafDataMgr );
       
    61     CleanupStack::Pop(self); // self;
       
    62     return self;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------
       
    66 // NewLC function.
       
    67 // ---------------------------------------------------------
       
    68 //
       
    69 CAknFepUICtrlPinyinEEP* CAknFepUICtrlPinyinEEP::NewLC( RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr )
       
    70     {
       
    71     CAknFepUICtrlPinyinEEP* self = new(ELeave)CAknFepUICtrlPinyinEEP( aLafDataMgr );
       
    72     CleanupStack::PushL( self );
       
    73     self->ConstructL( aParent, aLafDataMgr);
       
    74     return self;
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // Destructor.
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 CAknFepUICtrlPinyinEEP::~CAknFepUICtrlPinyinEEP()
       
    82     {
       
    83     if ( iEditableEntryPane )
       
    84         {
       
    85         delete iEditableEntryPane;
       
    86         iEditableEntryPane = NULL;
       
    87         }
       
    88 //    if ( iBgContext )
       
    89 //        {
       
    90 //        delete iBgContext;
       
    91 //        iBgContext = NULL;
       
    92 //        }
       
    93     if ( iAbsoluteBuffer )
       
    94         {
       
    95         delete iAbsoluteBuffer;
       
    96         iAbsoluteBuffer = NULL;
       
    97         }
       
    98     if ( iVisualBuffer )
       
    99         {
       
   100         delete iVisualBuffer;
       
   101         iVisualBuffer = NULL;
       
   102         }
       
   103     iArray.ResetAndDestroy();
       
   104     delete iKeystrokeArray;
       
   105     delete iShowKeystrokeArray;
       
   106     delete iPhraseArray;
       
   107     delete iPhraseShowKeyStrokeArray;
       
   108     delete iTempArray;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------
       
   112 // From CCoeControl.
       
   113 // ---------------------------------------------------------
       
   114 //
       
   115 TInt CAknFepUICtrlPinyinEEP::CountComponentControls() const
       
   116     {
       
   117     return KControlNum;
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------
       
   121 // From CCoeControl.
       
   122 // ---------------------------------------------------------
       
   123 //
       
   124 CCoeControl* CAknFepUICtrlPinyinEEP::ComponentControl( TInt aIndex ) const
       
   125     {
       
   126     switch ( aIndex )
       
   127         {
       
   128         case EEditableEntryPane:
       
   129             return iEditableEntryPane;
       
   130         default:
       
   131             return NULL;
       
   132         }
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------
       
   136 // From CCoeControl.
       
   137 // ---------------------------------------------------------
       
   138 //
       
   139 void CAknFepUICtrlPinyinEEP::Draw( const TRect& /*aRect*/) const
       
   140     {
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------
       
   144 // From CCoeControl.
       
   145 // ---------------------------------------------------------
       
   146 //
       
   147 void CAknFepUICtrlPinyinEEP::SizeChanged()
       
   148     {
       
   149     LayoutContainedControls();
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------
       
   153 // Set the text buffer and posit the cursor index.
       
   154 // ---------------------------------------------------------
       
   155 //
       
   156 void CAknFepUICtrlPinyinEEP::SetText( const TDesC& aDes, TInt aCursorIndex, TBool aMiniQwertyZhuyin )
       
   157     {
       
   158     iMiniQwertyZhuyin = aMiniQwertyZhuyin;
       
   159     iAbsoluteUnderlineBeg = -1;
       
   160     iAbsoluteUnderlineEnd = -1;
       
   161     iAbsoluteHighlightBeg = -1;
       
   162     iAbsoluteHighlightEnd = -1;
       
   163     iArray.ResetAndDestroy();
       
   164     TInt absoluteBufferLen = iAbsoluteBuffer->Length();
       
   165     TInt desLen = aDes.Length();
       
   166 
       
   167     if ( aCursorIndex > aDes.Length() )
       
   168         {
       
   169         aCursorIndex = aDes.Length();
       
   170         }
       
   171     else if ( aCursorIndex < 0 )
       
   172         {
       
   173         aCursorIndex = 0;
       
   174         }
       
   175 
       
   176     // cursor is at the end of buffer and add a character 
       
   177     if ( aDes.Left( iAbsoluteBuffer->Length() ) == *iAbsoluteBuffer
       
   178         && iAbsoluteCursorPos == iAbsoluteBuffer->Length() && aCursorIndex
       
   179         == aDes.Length() )
       
   180         {
       
   181         Append( aDes.Right( aDes.Length() - iAbsoluteBuffer->Length() ) );
       
   182         }
       
   183     //    delete one character
       
   184     else if ( iAbsoluteBuffer->Left( aCursorIndex ).Compare(aDes.Left(aCursorIndex)) == 0
       
   185         && aCursorIndex < iAbsoluteCursorPos
       
   186         && iAbsoluteBuffer->Compare( aDes ) != 0
       
   187         && 0 == iAbsoluteBuffer->Right( absoluteBufferLen - iAbsoluteCursorPos ).Compare( 
       
   188             aDes.Right( desLen - aCursorIndex)) )
       
   189         {
       
   190         Delete( iAbsoluteCursorPos - (iAbsoluteBuffer->Length()
       
   191             - aDes.Length()), iAbsoluteBuffer->Length() - aDes.Length() );
       
   192         }
       
   193     else if ( iAbsoluteBuffer->Length() < aDes.Length()
       
   194         && iAbsoluteBuffer->Left( iAbsoluteCursorPos )
       
   195             == aDes.Left( iAbsoluteCursorPos )
       
   196         && iAbsoluteBuffer->Right( iAbsoluteBuffer->Length()
       
   197             - iAbsoluteCursorPos ) == aDes.Right( iAbsoluteBuffer->Length()
       
   198             - iAbsoluteCursorPos ) && aCursorIndex - iAbsoluteCursorPos
       
   199         == aDes.Length() - iAbsoluteBuffer->Length() )
       
   200         {
       
   201         TPtrC tmp = aDes.Mid( iAbsoluteCursorPos, aDes.Length()
       
   202             - iAbsoluteBuffer->Length() );
       
   203         Insert( iAbsoluteCursorPos, tmp );
       
   204         }
       
   205     else
       
   206         {
       
   207         SetText( aDes );
       
   208         SetCursor( aCursorIndex );
       
   209         }
       
   210     }
       
   211 
       
   212 // ---------------------------------------------------------
       
   213 // Set the text buffer and posit the cursor index for zhuyin.
       
   214 // ---------------------------------------------------------
       
   215 //
       
   216 void CAknFepUICtrlPinyinEEP::SetTextForZhuyin( 
       
   217     const TDesC& aDes, 
       
   218     TInt aCursor, 
       
   219     TInt aChineseCount, 
       
   220     const TDesC& aJudgeSeed, 
       
   221     TInt aKeystroke, 
       
   222     TBool aInvalid,
       
   223     TBool aMiniQwertyZhuyin)
       
   224     {
       
   225     iMiniQwertyZhuyin = aMiniQwertyZhuyin;
       
   226     TInt actionType = EZhuyinNULL;
       
   227     if ( aKeystroke == 0 && aJudgeSeed.Compare(iJudgeSeed) == 0)
       
   228         {
       
   229         actionType = EZhuyinMoveCursor;
       
   230         }
       
   231     else if ( aChineseCount == iChineseCount + 1 )
       
   232         {
       
   233         actionType = EZhuyinNULL;
       
   234         }
       
   235     else if ( aKeystroke == 0 && aJudgeSeed.Length() <= iJudgeSeed.Length() - 1)
       
   236         {
       
   237         actionType = EZhuyinDelete;
       
   238         }
       
   239     else
       
   240         {
       
   241         if ( aJudgeSeed.Length() == iJudgeSeed.Length())
       
   242             {
       
   243             if ( aJudgeSeed.Left(aKeystroke - 1).Compare(iJudgeSeed.Left(aKeystroke - 1)) == 0 
       
   244                 && aJudgeSeed.Mid(aKeystroke - 1,1).Compare(iJudgeSeed.Mid(aKeystroke - 1,1)) != 0 ) 
       
   245                 {
       
   246                 actionType = EZhuyinReplace;
       
   247                 }
       
   248             else if ( aCursor == GetCursor() )
       
   249                 {
       
   250                 actionType = EZhuyinReplace;
       
   251                 }
       
   252             else
       
   253                 {
       
   254                 actionType = EZhuyinMoveCursor;
       
   255                 }
       
   256             }
       
   257         else if ( aJudgeSeed.Length() == iJudgeSeed.Length() + 1)
       
   258             {
       
   259             actionType = EZhuyinInsert;
       
   260             }
       
   261         else if ( aJudgeSeed.Length() == iJudgeSeed.Length() - 1)
       
   262             {
       
   263             actionType = EZhuyinDelete;
       
   264             }
       
   265         else if ( KErrNotFound != iJudgeSeed.Find( aJudgeSeed ) )
       
   266             {
       
   267             actionType = EZhuyinDelete;
       
   268             }
       
   269         else
       
   270             {
       
   271             actionType = EZhuyinNULL;
       
   272             }
       
   273         }
       
   274     iArray.ResetAndDestroy();
       
   275     iJudgeSeed = aJudgeSeed;
       
   276     iChineseCount = aChineseCount;
       
   277     if ( iLastValid && aInvalid )
       
   278         {
       
   279         TInt newOffset = 0;
       
   280         TPtrC ptr = iAbsoluteBuffer->Des();
       
   281         for ( TInt i = 0; i < iOffset; i++ )
       
   282             {
       
   283             if ( ptr.Mid(i,1).Compare(KFullStop) == 0 )
       
   284                 {
       
   285                 continue;
       
   286                 }
       
   287             newOffset++;
       
   288             }
       
   289         iOffset = newOffset;
       
   290         }
       
   291     else if ( !iLastValid && !aInvalid )
       
   292         {
       
   293         TInt newOffset = 0;
       
   294         TInt i = 0;
       
   295         TPtrC ptr = aDes;
       
   296         for ( i = 0; i < iOffset && newOffset < ptr.Length(); )
       
   297             {
       
   298             if ( ptr.Mid(newOffset,1).Compare(KFullStop) != 0 )
       
   299                 {
       
   300                 i++;
       
   301                 }
       
   302             newOffset++;
       
   303             }
       
   304         iOffset = newOffset;
       
   305         }
       
   306     iLastValid = !aInvalid;
       
   307     switch ( actionType )
       
   308         {
       
   309         case EZhuyinInsert:
       
   310             {
       
   311             *iAbsoluteBuffer = aDes;
       
   312             iAbsoluteCursorPos = aCursor;
       
   313             this->CalculateVisualTextForInsert( 0, aDes );
       
   314             this->iEditableEntryPane->SetText( *iVisualBuffer );
       
   315             this->CalculateVisualIndex();
       
   316             iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos
       
   317                 - iOffset );
       
   318             }
       
   319             break;
       
   320         case EZhuyinReplace:
       
   321             {
       
   322             TRect panerect = iEditableEntryPane->Rect();
       
   323             TAknTextLineLayout textPaneTextLayout = 
       
   324                     CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
       
   325             const CFont* font = AknLayoutUtils::FontFromId(
       
   326                 textPaneTextLayout.iFont, 
       
   327                 NULL );
       
   328             TInt lenToCursor = font->TextWidthInPixels( aDes.Mid( iOffset,
       
   329                 aCursor - iOffset ) );
       
   330             if ( lenToCursor < panerect.Width() - panerect.Width()
       
   331                 *KLROffset/KDenominator * 2 )
       
   332                 {
       
   333                 *iAbsoluteBuffer = aDes;
       
   334                 iAbsoluteCursorPos = aCursor;
       
   335                 TInt stride = 0;
       
   336                 for (stride = 1;; stride ++ )
       
   337                     {
       
   338                     if ( iOffset + stride > aDes.Length() )
       
   339                         {
       
   340                         break;
       
   341                         }
       
   342                     TInt tmpFontLen = font->TextWidthInPixels( aDes.Mid(
       
   343                         iOffset, stride ) );
       
   344                     if ( tmpFontLen > panerect.Width() - panerect.Width()
       
   345                         *KLROffset/KDenominator * 2 )
       
   346                         {
       
   347                         break;
       
   348                         }
       
   349                     }
       
   350                 *iVisualBuffer = aDes.Mid( iOffset, stride - 1 );
       
   351                 iEditableEntryPane->SetText( *iVisualBuffer );
       
   352                 iEditableEntryPane->SetCursorPosition( aCursor-iOffset );
       
   353                 }
       
   354             else
       
   355                 {
       
   356                 SetText( aDes, aCursor );
       
   357                 }
       
   358             CalculateVisualIndex();
       
   359             break;
       
   360             }
       
   361         case EZhuyinDelete:
       
   362             {
       
   363             *iAbsoluteBuffer = aDes;
       
   364             iAbsoluteCursorPos = aCursor;
       
   365             this->CalculateVisualTextForDelete( 0, 0 );
       
   366             this->iEditableEntryPane->SetText( *iVisualBuffer );
       
   367             this->CalculateVisualIndex();
       
   368             iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos
       
   369                 - iOffset );
       
   370             }
       
   371             break;
       
   372         default:
       
   373             SetText( aDes, aCursor );
       
   374         }
       
   375     }
       
   376 
       
   377 // ---------------------------------------------------------
       
   378 // Set the text buffer and maintain the current cursor position.
       
   379 // ---------------------------------------------------------
       
   380 //
       
   381 void CAknFepUICtrlPinyinEEP::SetText( const TDesC& aDes )
       
   382     {
       
   383     iAbsoluteCursorPos = 0;
       
   384     iOffset = 0;
       
   385     iAbsoluteBuffer->Des().Zero();
       
   386     iVisualBuffer->Des().Zero();
       
   387     *iAbsoluteBuffer = aDes;
       
   388     CalculateVisualTextForMoveRight();
       
   389     iEditableEntryPane->SetText( *iVisualBuffer );
       
   390     CalculateVisualIndex();
       
   391     }
       
   392 
       
   393 // ---------------------------------------------------------
       
   394 // Set the cursor position.
       
   395 // ---------------------------------------------------------
       
   396 //
       
   397 void CAknFepUICtrlPinyinEEP::SetCursor( const TInt aIndex )
       
   398     {
       
   399     SetCursorForMoveRight( aIndex );
       
   400     }
       
   401 
       
   402 // ---------------------------------------------------------
       
   403 // get the position index of cursor.The max cursor index must 
       
   404 // be larger than the length of text buffer by 1.
       
   405 // ---------------------------------------------------------
       
   406 //
       
   407 TInt CAknFepUICtrlPinyinEEP::GetCursor()
       
   408     {
       
   409     return iAbsoluteCursorPos;
       
   410     }
       
   411 
       
   412 // ---------------------------------------------------------
       
   413 // move cursor to the left by a 1 stride.
       
   414 // ---------------------------------------------------------
       
   415 //
       
   416 TBool CAknFepUICtrlPinyinEEP::MoveCursorLeft( TInt aStride  )
       
   417     {
       
   418     if ( iAbsoluteCursorPos - aStride < 0 )
       
   419         {
       
   420         return EFalse;
       
   421         }
       
   422     if ( iEditableEntryPane->MoveCursorLeft( aStride ) == 0 )
       
   423         {
       
   424         iAbsoluteCursorPos = iAbsoluteCursorPos - aStride;
       
   425         }
       
   426     else
       
   427         {
       
   428         iAbsoluteCursorPos = iAbsoluteCursorPos - aStride;
       
   429         SetCursorForMoveLeft( iAbsoluteCursorPos );
       
   430         }
       
   431     return ETrue;
       
   432     }
       
   433 
       
   434 // ---------------------------------------------------------
       
   435 // move cursor to the right by a 1 stride.
       
   436 // ---------------------------------------------------------
       
   437 //
       
   438 TBool CAknFepUICtrlPinyinEEP::MoveCursorRight( TInt aStride )
       
   439     {
       
   440     if ( iAbsoluteCursorPos + aStride > iAbsoluteBuffer->Length() )
       
   441         {
       
   442         return EFalse;
       
   443         }
       
   444     if ( iEditableEntryPane->MoveCursorRight( aStride ) == 0 )
       
   445         {
       
   446         iAbsoluteCursorPos = iAbsoluteCursorPos + aStride;
       
   447         }
       
   448     else
       
   449         {
       
   450         iAbsoluteCursorPos = iAbsoluteCursorPos + aStride;
       
   451         SetCursorForMoveRight( iAbsoluteCursorPos );
       
   452         }
       
   453     return ETrue;
       
   454     }
       
   455 
       
   456 // ---------------------------------------------------------
       
   457 // active the cursor,the cursor will be black and with a wink
       
   458 // this cursor state represent this control is focused.
       
   459 // ---------------------------------------------------------
       
   460 //
       
   461 void CAknFepUICtrlPinyinEEP::ActiveCursor()
       
   462     {
       
   463     iEditableEntryPane->ActiveCursor();
       
   464     }
       
   465 
       
   466 // ---------------------------------------------------------
       
   467 // deactive the cursor, the cursor will be gray and no wink this cursor
       
   468 // state represent this control with no focus.
       
   469 // ---------------------------------------------------------
       
   470 //
       
   471 void CAknFepUICtrlPinyinEEP::DeactiveCursor()
       
   472     {
       
   473     iEditableEntryPane->DeactiveCursor();
       
   474     }
       
   475 
       
   476 // ---------------------------------------------------------
       
   477 // enable the cursor,the cursor will be drawn.
       
   478 // ---------------------------------------------------------
       
   479 //
       
   480 void CAknFepUICtrlPinyinEEP::EnableCursor()
       
   481     {
       
   482     iEditableEntryPane->EnableCursor();
       
   483     }
       
   484 
       
   485 // ---------------------------------------------------------
       
   486 // deactive the cursor, the cursor will not be drawn.
       
   487 // ---------------------------------------------------------
       
   488 //
       
   489 void CAknFepUICtrlPinyinEEP::DisableCursor()
       
   490     {
       
   491     iEditableEntryPane->DisableCursor();
       
   492     }
       
   493 
       
   494 // ---------------------------------------------------------
       
   495 // set the beginning and ending index for the underline text.
       
   496 // ---------------------------------------------------------
       
   497 //
       
   498 void CAknFepUICtrlPinyinEEP::SetUnderline( TInt aBeg, TInt aEnd )
       
   499     {
       
   500     CAknFepUICtrlEEPControl::TSegment* tmp =
       
   501         new CAknFepUICtrlEEPControl::TSegment ( aBeg, aEnd, CAknFepUICtrlEEPControl::EUnderline );
       
   502     iArray.Append( tmp );
       
   503 
       
   504     TInt visualUnderlineBeg = aBeg - iOffset;
       
   505     TInt visualUnderlineEnd = aEnd - iOffset;
       
   506 
       
   507     if (
       
   508         visualUnderlineBeg < 0 &&
       
   509         visualUnderlineEnd < 0
       
   510         ||
       
   511         visualUnderlineBeg> iVisualBuffer->Length() - 1 &&
       
   512         visualUnderlineEnd> iVisualBuffer->Length() - 1
       
   513     )
       
   514         {
       
   515         visualUnderlineBeg = -1;
       
   516         visualUnderlineEnd = -1;
       
   517         }
       
   518     else
       
   519         {
       
   520         if ( visualUnderlineBeg < 0 )
       
   521             {
       
   522             visualUnderlineBeg = 0;
       
   523             }
       
   524         if ( visualUnderlineEnd> iVisualBuffer->Length() - 1 )
       
   525             {
       
   526             visualUnderlineEnd = iVisualBuffer->Length() - 1;
       
   527             }
       
   528         }
       
   529     iEditableEntryPane->SetUnderline( visualUnderlineBeg, visualUnderlineEnd );
       
   530 
       
   531     iAbsoluteUnderlineBeg = aBeg;
       
   532     iAbsoluteUnderlineEnd = aEnd;
       
   533     }
       
   534 
       
   535 // ---------------------------------------------------------
       
   536 // get the indexes for text with underline.
       
   537 // ---------------------------------------------------------
       
   538 //
       
   539 void CAknFepUICtrlPinyinEEP::GetUnderlineIndex( TInt& aBeg, TInt& aEnd )
       
   540     {
       
   541     aBeg = iAbsoluteUnderlineBeg;
       
   542     aEnd = iAbsoluteUnderlineEnd;
       
   543     }
       
   544 
       
   545 // ---------------------------------------------------------
       
   546 // set the indexes for the text with highlight
       
   547 // ---------------------------------------------------------
       
   548 //
       
   549 void CAknFepUICtrlPinyinEEP::SetHighlight( TInt aBeg, TInt aEnd )
       
   550     {
       
   551     CAknFepUICtrlEEPControl::TSegment* tmp =
       
   552         new CAknFepUICtrlEEPControl::TSegment ( aBeg, aEnd, CAknFepUICtrlEEPControl::EHighlight );
       
   553     iArray.Append( tmp );
       
   554 
       
   555     TInt visualHighlightBeg = aBeg - iOffset;
       
   556     TInt visualHighlightEnd = aEnd - iOffset;
       
   557 
       
   558     if (
       
   559         visualHighlightBeg < 0 &&
       
   560         visualHighlightEnd < 0
       
   561         ||
       
   562         visualHighlightBeg> iVisualBuffer->Length() - 1 &&
       
   563         visualHighlightEnd> iVisualBuffer->Length() - 1
       
   564     )
       
   565         {
       
   566         visualHighlightBeg = -1;
       
   567         visualHighlightEnd = -1;
       
   568         }
       
   569     else
       
   570         {
       
   571         if ( visualHighlightBeg < 0 )
       
   572             {
       
   573             visualHighlightBeg = 0;
       
   574             }
       
   575         if ( visualHighlightEnd> iVisualBuffer->Length() - 1 )
       
   576             {
       
   577             visualHighlightEnd = iVisualBuffer->Length() - 1;
       
   578             }
       
   579         }
       
   580     iEditableEntryPane->SetHighlight( visualHighlightBeg, visualHighlightEnd );
       
   581 
       
   582     iAbsoluteHighlightBeg = aBeg;
       
   583     iAbsoluteHighlightEnd = aEnd;
       
   584     }
       
   585 
       
   586 // ---------------------------------------------------------
       
   587 // get the indexes for the text with highlight
       
   588 // ---------------------------------------------------------
       
   589 //
       
   590 void CAknFepUICtrlPinyinEEP::GetHighlightIndex( TInt& aBeg, TInt& aEnd )
       
   591     {
       
   592     aBeg = iAbsoluteHighlightBeg;
       
   593     aEnd = iAbsoluteHighlightEnd;
       
   594     }
       
   595 
       
   596 // ---------------------------------------------------------
       
   597 // set keystroke index. 
       
   598 // ---------------------------------------------------------
       
   599 //
       
   600 void CAknFepUICtrlPinyinEEP::SetCursorIndexOfKeystroke( const TInt aStartIndex )
       
   601     {
       
   602     iIndex = aStartIndex;
       
   603     }
       
   604 
       
   605 // ---------------------------------------------------------
       
   606 // get the keystroke index
       
   607 // ---------------------------------------------------------
       
   608 //
       
   609 TInt CAknFepUICtrlPinyinEEP::GetCursorIndexOfKeystroke()
       
   610     {
       
   611     return iIndex;
       
   612     }
       
   613 
       
   614 // ---------------------------------------------------------
       
   615 // whether this control will be actived.ETrue represent enable 
       
   616 // otherwise disable.
       
   617 // ---------------------------------------------------------
       
   618 //
       
   619 void CAknFepUICtrlPinyinEEP::Enable( TBool aEnable )
       
   620     {
       
   621     iEnabled = aEnable;
       
   622     if ( aEnable == EFalse )
       
   623         {
       
   624         Reset();
       
   625         DrawNow();
       
   626         }
       
   627     iEditableEntryPane->MakeVisible( aEnable );
       
   628     MakeVisible( aEnable );
       
   629     }
       
   630 	
       
   631 // ---------------------------------------------------------
       
   632 // return whether this control is enabled.
       
   633 // ---------------------------------------------------------
       
   634 //
       
   635 TBool CAknFepUICtrlPinyinEEP::IsEnabled() const
       
   636     {
       
   637     return iEnabled;
       
   638     }
       
   639 
       
   640 // ---------------------------------------------------------
       
   641 // Get the info before cursor.
       
   642 // ---------------------------------------------------------
       
   643 //
       
   644 void CAknFepUICtrlPinyinEEP::GetText( TDes& aText )
       
   645     {
       
   646     aText = *iAbsoluteBuffer;
       
   647     }
       
   648 
       
   649 // ---------------------------------------------------------
       
   650 // Get the info before cursor.
       
   651 // ---------------------------------------------------------
       
   652 //
       
   653 TBool CAknFepUICtrlPinyinEEP::GetDesBeforeCursor( TDes& aOut )
       
   654     {
       
   655     if ( iAbsoluteCursorPos == 0 )
       
   656         {
       
   657         return EFalse;
       
   658         }
       
   659     else
       
   660         {
       
   661         aOut = iAbsoluteBuffer->Mid( (iAbsoluteCursorPos - 1 ), 1 );
       
   662         return ETrue;
       
   663         }
       
   664     }
       
   665 
       
   666 // ---------------------------------------------------------
       
   667 // From MAknFepUICtrlEditPane.
       
   668 // ---------------------------------------------------------
       
   669 //
       
   670 void CAknFepUICtrlPinyinEEP::SetToneMark( const TDesC& /*aToneMark*/)
       
   671     {
       
   672     }
       
   673 
       
   674 // ---------------------------------------------------------
       
   675 // From MAknFepUICtrlEditPane.
       
   676 // ---------------------------------------------------------
       
   677 //
       
   678 void CAknFepUICtrlPinyinEEP::SetToneMarkValidity( TBool /*aValid*/)
       
   679     {
       
   680     }
       
   681 
       
   682 // ---------------------------------------------------------
       
   683 // From MAknFepUICtrlEditPane.
       
   684 // ---------------------------------------------------------
       
   685 //
       
   686 void CAknFepUICtrlPinyinEEP::SetOverrideFontId( TInt /*aFontId*/)
       
   687     {
       
   688     }
       
   689 
       
   690 // ---------------------------------------------------------
       
   691 // From MAknFepUICtrlEditPane.
       
   692 // ---------------------------------------------------------
       
   693 //
       
   694 void CAknFepUICtrlPinyinEEP::SetFlag( TInt /*aFlag*/)
       
   695     {
       
   696     }
       
   697 
       
   698 // ---------------------------------------------------------
       
   699 // From MAknFepUICtrlEditPane.
       
   700 // ---------------------------------------------------------
       
   701 //
       
   702 void CAknFepUICtrlPinyinEEP::ClearFlag( TInt /*aFlag*/)
       
   703     {
       
   704     }
       
   705 
       
   706 // ---------------------------------------------------------
       
   707 // From MAknFepUICtrlEditPane.
       
   708 // ---------------------------------------------------------
       
   709 //
       
   710 TBool CAknFepUICtrlPinyinEEP::IsFlagSet( TInt /*aFlag*/) const
       
   711     {
       
   712     return EFalse;
       
   713     }
       
   714 
       
   715 // ---------------------------------------------------------
       
   716 // Set the cursor index for moving to the left.
       
   717 // ---------------------------------------------------------
       
   718 //
       
   719 void CAknFepUICtrlPinyinEEP::SetCursorForMoveLeft( const TInt aIndex )
       
   720     {
       
   721     iAbsoluteCursorPos = aIndex;
       
   722     CalculateVisualTextForMoveLeft();
       
   723     iEditableEntryPane->SetText( *iVisualBuffer );
       
   724     iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
       
   725     CalculateVisualIndex();
       
   726     }
       
   727 
       
   728 // ---------------------------------------------------------
       
   729 // Set the cursor index for moving to the right.
       
   730 // ---------------------------------------------------------
       
   731 //
       
   732 void CAknFepUICtrlPinyinEEP::SetCursorForMoveRight( const TInt aIndex )
       
   733     {
       
   734     iAbsoluteCursorPos = aIndex;
       
   735     CalculateVisualTextForMoveRight();
       
   736     iEditableEntryPane->SetText( *iVisualBuffer );
       
   737     iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
       
   738     CalculateVisualIndex();
       
   739     }
       
   740 
       
   741 // ---------------------------------------------------------
       
   742 // Add some text at the end of buffer.
       
   743 // ---------------------------------------------------------
       
   744 //
       
   745 TBool CAknFepUICtrlPinyinEEP::Append( const TDesC& aDes )
       
   746     {
       
   747     if ( this->iAbsoluteCursorPos != this->iAbsoluteBuffer->Length() )
       
   748         {
       
   749         return EFalse;
       
   750         }
       
   751     else
       
   752         {
       
   753         if ( iAbsoluteBuffer->Length() + aDes.Length()
       
   754             > iAbsoluteBuffer->Des().MaxLength() )
       
   755             {
       
   756             return EFalse;
       
   757             }
       
   758         iAbsoluteBuffer->Des().Append( aDes );
       
   759         iAbsoluteCursorPos = iAbsoluteCursorPos + aDes.Length();
       
   760         this->CalculateVisualTextForAppend( aDes );
       
   761         this->iEditableEntryPane->SetText( *iVisualBuffer );
       
   762         this->CalculateVisualIndex();
       
   763         iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
       
   764         return ETrue;
       
   765         }
       
   766     }
       
   767 
       
   768 // ---------------------------------------------------------
       
   769 // delete the content begin with aBeg index, and with an aLen length.
       
   770 // ---------------------------------------------------------
       
   771 //
       
   772 TBool CAknFepUICtrlPinyinEEP::Delete( TInt aBeg, TInt aLen )
       
   773     {
       
   774     if ( aBeg < 0 || aLen < 0 || aBeg + aLen> iAbsoluteBuffer->Length() )
       
   775         {
       
   776         return EFalse;
       
   777         }
       
   778     else
       
   779         {
       
   780         iAbsoluteBuffer->Des().Delete( aBeg, aLen );
       
   781         iAbsoluteCursorPos = aBeg;
       
   782         this->CalculateVisualTextForDelete( aBeg, aLen );
       
   783         this->iEditableEntryPane->SetText( *iVisualBuffer );
       
   784         this->CalculateVisualIndex();
       
   785         iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
       
   786         return ETrue;
       
   787         }
       
   788     }
       
   789 
       
   790 // ---------------------------------------------------------
       
   791 // Insert some text after aIndex character.
       
   792 // ---------------------------------------------------------
       
   793 //
       
   794 TBool CAknFepUICtrlPinyinEEP::Insert( TInt aIndex, const TDesC& aDes )
       
   795     {
       
   796     if ( iAbsoluteBuffer->Length() + aDes.Length() > iAbsoluteBuffer->Des().MaxLength() )
       
   797         {
       
   798         return EFalse;
       
   799         }
       
   800     iAbsoluteBuffer->Des().Insert( aIndex, aDes );
       
   801     iAbsoluteCursorPos = iAbsoluteCursorPos + aDes.Length();
       
   802     this->CalculateVisualTextForInsert( aIndex, aDes );
       
   803     this->iEditableEntryPane->SetText( *iVisualBuffer );
       
   804     this->CalculateVisualIndex();
       
   805     iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
       
   806     return ETrue;
       
   807     }
       
   808 
       
   809 // ---------------------------------------------------------
       
   810 // Replace text from aBeg index to aBeg + aLen with aDes.
       
   811 // ---------------------------------------------------------
       
   812 //
       
   813 TBool CAknFepUICtrlPinyinEEP::Replace( TInt /*aBeg*/, TInt /*aLen*/,
       
   814     const TDesC& /*aDes*/)
       
   815     {
       
   816     return EFalse;
       
   817     }
       
   818 
       
   819 // ---------------------------------------------------------
       
   820 // Reset private member viariable.
       
   821 // ---------------------------------------------------------
       
   822 //
       
   823 void CAknFepUICtrlPinyinEEP::Reset()
       
   824     {
       
   825     iIndex = 0;
       
   826     iEnabled = EFalse;
       
   827     iAbsoluteCursorPos = 0;
       
   828     iOffset = 0;
       
   829     iAbsoluteUnderlineBeg = -1;
       
   830     iAbsoluteUnderlineEnd = -1;
       
   831     iAbsoluteHighlightBeg = -1;
       
   832     iAbsoluteHighlightEnd = -1;
       
   833     iAbsoluteBuffer->Des().Zero();
       
   834     iVisualBuffer->Des().Zero();
       
   835     iEditableEntryPane->ResetAll();
       
   836     iArray.ResetAndDestroy();
       
   837     iJudgeSeed.Zero();
       
   838     iLastValid = ETrue;
       
   839     iChineseCount = 0;
       
   840     }
       
   841 
       
   842 // ---------------------------------------------------------
       
   843 // Layout contained controls.
       
   844 // ---------------------------------------------------------
       
   845 //
       
   846 void CAknFepUICtrlPinyinEEP::LayoutContainedControls()
       
   847     {
       
   848     TRect outerRect;
       
   849     TRect innerRect;
       
   850     CalculateFrameRects( outerRect, innerRect );
       
   851     TRect rect = Rect();
       
   852     iEditableEntryPane->SetRect( rect );
       
   853     }
       
   854 
       
   855 // ---------------------------------------------------------
       
   856 // layout the background frames.
       
   857 // ---------------------------------------------------------
       
   858 //
       
   859 void CAknFepUICtrlPinyinEEP::LayoutFrames()
       
   860     {
       
   861     TRect outerRect;
       
   862     TRect innerRect;
       
   863 //    CalculateFrameRects( outerRect, innerRect );
       
   864 //    iBgContext->SetFrameRects( outerRect, innerRect );
       
   865 //    iBgContext->SetParentPos( PositionRelativeToScreen() );
       
   866     }
       
   867 
       
   868 // ---------------------------------------------------------
       
   869 // layout its rectangles
       
   870 // ---------------------------------------------------------
       
   871 //
       
   872 void CAknFepUICtrlPinyinEEP::LayoutRects()
       
   873     {
       
   874     TRect windowRect = 
       
   875         CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EEEPWindowRect ));
       
   876     TInt height = windowRect.Height();
       
   877     TInt width = windowRect.Width();
       
   878     windowRect.iTl.iY = 0;
       
   879     windowRect.iTl.iX = 0;
       
   880     windowRect.SetHeight( height );
       
   881     windowRect.SetWidth( width );
       
   882     iSize.SetSize( width, Rect().Height() );
       
   883     }
       
   884 
       
   885 // ---------------------------------------------------------
       
   886 // C++ constructor
       
   887 // ---------------------------------------------------------
       
   888 //
       
   889 CAknFepUICtrlPinyinEEP::CAknFepUICtrlPinyinEEP( CAknFepUiLayoutDataMgr* aLafDataMgr )
       
   890     {
       
   891     iIndex = 0;
       
   892     iEnabled = EFalse;
       
   893     iAbsoluteCursorPos = 0;
       
   894     iAbsoluteUnderlineBeg = -1;
       
   895     iAbsoluteUnderlineEnd = -1;
       
   896     iAbsoluteHighlightBeg = -1;
       
   897     iAbsoluteHighlightEnd = -1;
       
   898     iOffset = 0;
       
   899     iJudgeSeed.Zero();
       
   900     iLastValid = ETrue;
       
   901     iChineseCount = 0;
       
   902     iChangeFlag = 0;
       
   903     iAutoChangeFlag = 1;
       
   904     iAllValidFlag = 1;
       
   905     iInvalidKeystrokeIndex = 0;
       
   906     iCandidateRefreshFlag = 0;
       
   907     iDelimiterCount = 0;
       
   908     iLafDataMgr = aLafDataMgr;
       
   909     }
       
   910 
       
   911 // ---------------------------------------------------------
       
   912 // Two-phrase constructor.
       
   913 // ---------------------------------------------------------
       
   914 //
       
   915 void CAknFepUICtrlPinyinEEP::ConstructL( RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr )
       
   916     {
       
   917     SetContainerWindowL( aParent );
       
   918     iEditableEntryPane = CAknFepUICtrlEEPControl::NewL( Window(), aLafDataMgr );
       
   919     iAbsoluteBuffer = HBufC::New( KMaxCharNum );
       
   920     iVisualBuffer = HBufC::New( KMaxDispNum );
       
   921     TRect outerRect = TRect();
       
   922     TRect innerRect = TRect();
       
   923     CalculateFrameRects( outerRect, innerRect );
       
   924 //    iBgContext = CAknsFrameBackgroundControlContext::NewL(
       
   925 //        KAknsIIDQsnFrPopupSub, outerRect, innerRect, ETrue );
       
   926     iKeystrokeArray = new(ELeave)CDesCArrayFlat(1);
       
   927     iShowKeystrokeArray = new(ELeave)CDesCArrayFlat(1);
       
   928     iPhraseArray = new(ELeave)CDesCArrayFlat(1);
       
   929     iPhraseShowKeyStrokeArray = new(ELeave)CDesCArrayFlat(1);
       
   930     iTempArray = new(ELeave)CDesCArrayFlat(1);
       
   931     iMiniQwertyZhuyin = EFalse;
       
   932     iNeedClearDeliberateSelection = EFalse;
       
   933     }
       
   934 
       
   935 // ---------------------------------------------------------
       
   936 // Calculate visual text for appending.
       
   937 // ---------------------------------------------------------
       
   938 //
       
   939 void CAknFepUICtrlPinyinEEP::CalculateVisualTextForAppend( const TDesC& aDes )
       
   940     {
       
   941     TRect panerect = iEditableEntryPane->Rect();
       
   942     TAknTextLineLayout textPaneTextLayout = 
       
   943             CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
       
   944     const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, 
       
   945     NULL );
       
   946 
       
   947     TInt lenToEnd = font->TextWidthInPixels( iAbsoluteBuffer->Right( iVisualBuffer->Length()
       
   948         + aDes.Length() ) );
       
   949     if ( lenToEnd <= panerect.Width() - panerect.Width()*KLROffset
       
   950         /KDenominator * 2 )
       
   951         {
       
   952         *iVisualBuffer = iAbsoluteBuffer->Right( iVisualBuffer->Length()
       
   953             + aDes.Length() );
       
   954         }
       
   955     else
       
   956         {
       
   957         this->CalculateVisualTextForMoveRight();
       
   958         }
       
   959     }
       
   960 
       
   961 // ---------------------------------------------------------
       
   962 // Calculate visual text for deleting.
       
   963 // ---------------------------------------------------------
       
   964 //
       
   965 void CAknFepUICtrlPinyinEEP::CalculateVisualTextForDelete( TInt /*aBeg*/,
       
   966     TInt /*aLen*/)
       
   967     {
       
   968     TRect panerect = iEditableEntryPane->Rect();
       
   969     TAknTextLineLayout textPaneTextLayout = 
       
   970             CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
       
   971     const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, 
       
   972     NULL );
       
   973     iOffset = iOffset > iAbsoluteBuffer->Length()?iAbsoluteBuffer->Length():iOffset;
       
   974     TInt lenToEnd = font->TextWidthInPixels( iAbsoluteBuffer->Right( iAbsoluteBuffer->Length()
       
   975         - iOffset ) );
       
   976     
       
   977     TInt offsetLen = iAbsoluteCursorPos - iOffset;
       
   978     if ( offsetLen < 0 )
       
   979         {
       
   980         offsetLen = 0;
       
   981         }
       
   982     TInt LenOffsetToCursor = font->TextWidthInPixels( iAbsoluteBuffer->Mid( 
       
   983             iOffset, offsetLen ) );
       
   984 
       
   985     if ( lenToEnd > 0 && iAbsoluteCursorPos >= iOffset && LenOffsetToCursor > panerect.Width()*KLROffset/KDenominator )
       
   986         {
       
   987         TInt stride = 0;
       
   988         for (stride = 1;; stride ++ )
       
   989             {
       
   990             if ( iOffset + stride > iAbsoluteBuffer->Length() )
       
   991                 {
       
   992                 break;
       
   993                 }
       
   994             TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
       
   995                 iOffset, stride ) );
       
   996             if ( tmpFontLen > panerect.Width() - panerect.Width()
       
   997                 *KLROffset/KDenominator * 2 )
       
   998                 {
       
   999                 break;
       
  1000                 }
       
  1001             }
       
  1002         *iVisualBuffer = iAbsoluteBuffer->Mid( iOffset, stride - 1 );
       
  1003         }
       
  1004     else
       
  1005         {
       
  1006         this->CalculateVisualTextForMoveLeft();
       
  1007         }
       
  1008     }
       
  1009 
       
  1010 // ---------------------------------------------------------
       
  1011 // Calculate visual text for inserting.
       
  1012 // ---------------------------------------------------------
       
  1013 //
       
  1014 void CAknFepUICtrlPinyinEEP::CalculateVisualTextForInsert( TInt /*aIndex*/,
       
  1015     const TDesC& /*aDes*/)
       
  1016     {
       
  1017     TRect panerect = iEditableEntryPane->Rect();
       
  1018     TAknTextLineLayout textPaneTextLayout = 
       
  1019             CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
       
  1020     const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, 
       
  1021     NULL );
       
  1022     
       
  1023     TInt offsetLen = iAbsoluteCursorPos - iOffset;
       
  1024     if ( offsetLen < 0 )
       
  1025         {
       
  1026         offsetLen = 0;
       
  1027         }
       
  1028 
       
  1029     TInt lenToCursor = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
       
  1030         iOffset, offsetLen ) );
       
  1031     if ( lenToCursor < panerect.Width()* KCursorResetStartOffset / KDenominator
       
  1032         || iAbsoluteCursorPos == iAbsoluteBuffer->Length()
       
  1033         && lenToCursor <= panerect.Width() - panerect.Width()*KLROffset/KDenominator * 2)
       
  1034         {
       
  1035         TInt stride = 0;
       
  1036         for (stride = 1;; stride ++ )
       
  1037             {
       
  1038             if ( iOffset + stride > iAbsoluteBuffer->Length() )
       
  1039                 {
       
  1040                 break;
       
  1041                 }
       
  1042             TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
       
  1043                 iOffset, stride ) );
       
  1044             if ( tmpFontLen > panerect.Width() - panerect.Width()
       
  1045                 *KLROffset/KDenominator * 2 )
       
  1046                 {
       
  1047                 break;
       
  1048                 }
       
  1049             }
       
  1050         *iVisualBuffer = iAbsoluteBuffer->Mid( iOffset, stride - 1 );
       
  1051         }
       
  1052     else
       
  1053         {
       
  1054         this->CalculateVisualTextForMoveRight();
       
  1055         }
       
  1056     }
       
  1057 
       
  1058 // ---------------------------------------------------------
       
  1059 // Calculate visual text for replacing.
       
  1060 // ---------------------------------------------------------
       
  1061 //
       
  1062 void CAknFepUICtrlPinyinEEP::CalculateVisualTextForReplace( TInt /*aBeg*/,
       
  1063     TInt /*aLen*/, const TDesC& /*aDes*/)
       
  1064     {
       
  1065     }
       
  1066 
       
  1067 // ---------------------------------------------------------
       
  1068 // Calculate visual text for moving to left.
       
  1069 // ---------------------------------------------------------
       
  1070 //
       
  1071 void CAknFepUICtrlPinyinEEP::CalculateVisualTextForMoveLeft()
       
  1072     {
       
  1073     TRect panerect = iEditableEntryPane->Rect();
       
  1074     TAknTextLineLayout textPaneTextLayout = 
       
  1075             CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
       
  1076     const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, 
       
  1077     NULL );
       
  1078     TInt absolutelength = font->TextWidthInPixels( *iAbsoluteBuffer );
       
  1079     TInt
       
  1080         cursorToBegLength =
       
  1081             font->TextWidthInPixels( iAbsoluteBuffer->Left( iAbsoluteCursorPos ) );
       
  1082     if ( iAbsoluteCursorPos > iAbsoluteBuffer->Length() + 1 )
       
  1083         {
       
  1084         iAbsoluteCursorPos = iAbsoluteBuffer->Length() + 1;
       
  1085         }
       
  1086     TInt lenPixelToVisualBeg = panerect.Width() * KCursorResetOffset
       
  1087         / KDenominator;
       
  1088     TInt stride = 0;
       
  1089     TInt visualBeg = 0;
       
  1090     TInt visualEnd = 0;
       
  1091     for (stride = 1;; stride ++ )
       
  1092         {
       
  1093         if ( 0 > iAbsoluteCursorPos - stride )
       
  1094             {
       
  1095             visualBeg = 0;
       
  1096             break;
       
  1097             }
       
  1098         TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
       
  1099             iAbsoluteCursorPos - stride, stride ) );
       
  1100         if ( tmpFontLen > lenPixelToVisualBeg )
       
  1101             {
       
  1102             visualBeg = iAbsoluteCursorPos - stride + 1;
       
  1103             break;
       
  1104             }
       
  1105         }
       
  1106         
       
  1107     //Fix for bug ESXU-7U68JT, let adjustment of visualBeg before caculation of visualEnd. 
       
  1108     //For one, calculation always start before "(" for miniqwertyzhuyin
       
  1109     //For two, because characters(markers) might have different length in pixel, it's better recalculate visualEnd
       
  1110     // after changing visualBeg, therefore move changing visualBeg ahead of caculation take effect too.
       
  1111     if ( iMiniQwertyZhuyin && 
       
  1112         iAbsoluteBuffer->Length() > 0 && 
       
  1113         visualBeg >= iPhraseArray->Count() )
       
  1114         {
       
  1115         while ( visualBeg > 0 &&
       
  1116             iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KLeftBracket ) != 0 &&
       
  1117             iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark1 ) != 0 &&
       
  1118             iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark2 ) != 0 &&
       
  1119             iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark3 ) != 0 &&
       
  1120             iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark4 ) != 0 &&
       
  1121             iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark5 ) != 0 )
       
  1122             {
       
  1123             visualBeg--;
       
  1124             }
       
  1125         }
       
  1126 
       
  1127     for (stride = 1;; stride ++ )
       
  1128         {
       
  1129         if ( visualBeg + stride > iAbsoluteBuffer->Length() )
       
  1130             {
       
  1131             visualEnd = visualBeg + stride - 1;
       
  1132             break;
       
  1133             }
       
  1134         TPtrC tempString = iAbsoluteBuffer->Mid(visualBeg, stride );
       
  1135         TInt tmpFontLen = font->TextWidthInPixels( tempString );
       
  1136         if ( tmpFontLen > panerect.Width() - panerect.Width() *KLROffset
       
  1137             /KDenominator * 2 )
       
  1138             {
       
  1139             visualEnd = visualBeg + stride - 1;
       
  1140             //visualEnd = visualBeg + stride;
       
  1141             break;
       
  1142             }
       
  1143         }
       
  1144     *iVisualBuffer = iAbsoluteBuffer->Mid( visualBeg, visualEnd - visualBeg );
       
  1145     this->iOffset = visualBeg;
       
  1146     }
       
  1147 
       
  1148 // ---------------------------------------------------------
       
  1149 // Calculate visual text for moving to the right.
       
  1150 // ---------------------------------------------------------
       
  1151 //
       
  1152 void CAknFepUICtrlPinyinEEP::CalculateVisualTextForMoveRight()
       
  1153     {
       
  1154     TRect panerect = iEditableEntryPane->Rect();
       
  1155     TAknTextLineLayout textPaneTextLayout = 
       
  1156             CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
       
  1157     const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, 
       
  1158     NULL );
       
  1159     TInt absolutelength = font->TextWidthInPixels( *iAbsoluteBuffer );
       
  1160     TInt cursorToEndLength =
       
  1161         font->TextWidthInPixels( iAbsoluteBuffer->Mid( iAbsoluteCursorPos,
       
  1162             iAbsoluteBuffer->Length() - iAbsoluteCursorPos ) );
       
  1163     if ( iAbsoluteCursorPos > iAbsoluteBuffer->Length() + 1 )
       
  1164         {
       
  1165         iAbsoluteCursorPos = iAbsoluteBuffer->Length() + 1;
       
  1166         }
       
  1167     if ( absolutelength <= panerect.Width() - panerect.Width()*KLROffset
       
  1168         /KDenominator * 2 )
       
  1169         {
       
  1170         *iVisualBuffer = *iAbsoluteBuffer;
       
  1171         }
       
  1172     else if ( cursorToEndLength < panerect.Width() * KCursorResetOffset
       
  1173         / KDenominator )
       
  1174         {
       
  1175         TInt tmp70VisualEnd = iAbsoluteCursorPos;
       
  1176         TInt visualBeg = 0;
       
  1177         TInt visualEnd = 0;
       
  1178         TInt stride = 0;
       
  1179         visualEnd = iAbsoluteBuffer->Length();
       
  1180         for (stride = 1;; stride ++ )
       
  1181             {
       
  1182             TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
       
  1183                 tmp70VisualEnd - stride, stride ) );
       
  1184             if ( tmpFontLen > panerect.Width() * (KDenominator - 
       
  1185                 KLROffset * 2 - KCursorResetOffset ) / KDenominator )
       
  1186                 {
       
  1187                 visualBeg = tmp70VisualEnd - stride + 1;
       
  1188                 break;
       
  1189                 }
       
  1190             }
       
  1191         if ( iMiniQwertyZhuyin &&
       
  1192             iAbsoluteBuffer->Length( ) > 0 &&
       
  1193             visualBeg >= iPhraseArray->Count() )
       
  1194             {
       
  1195             while ( iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KLeftBracket ) != 0 &&
       
  1196                 iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark1 ) != 0 &&
       
  1197                 iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark2 ) != 0 &&
       
  1198                 iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark3 ) != 0 &&
       
  1199                 iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark4 ) != 0 &&
       
  1200                 iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark5 ) != 0 )
       
  1201                 {
       
  1202                 visualBeg++;
       
  1203                 //                visualEnd++;
       
  1204                 }
       
  1205             }
       
  1206         *iVisualBuffer = iAbsoluteBuffer->Right( visualEnd - visualBeg );
       
  1207         this->iOffset = visualBeg;
       
  1208         }
       
  1209     else
       
  1210         {
       
  1211         TInt absoluteOffset = font->TextWidthInPixels( 
       
  1212             iAbsoluteBuffer->Left( iAbsoluteCursorPos ) );
       
  1213         if ( absoluteOffset < panerect.Width() * 
       
  1214             KCursorResetStartOffset / KDenominator)
       
  1215             {
       
  1216             TInt stride = 0;
       
  1217             for (stride = 1;; stride ++ )
       
  1218                 {
       
  1219                 TInt tmpFontLen = font->TextWidthInPixels( 
       
  1220                     iAbsoluteBuffer->Left( stride ) );
       
  1221                 if ( tmpFontLen > panerect.Width() - panerect.Width()
       
  1222                     *KLROffset /KDenominator * 2 )
       
  1223                     {
       
  1224                     *iVisualBuffer = iAbsoluteBuffer->Left( stride - 1 );
       
  1225                     this->iOffset = 0;
       
  1226                     break;
       
  1227                     }
       
  1228                 }
       
  1229             }
       
  1230         else
       
  1231             {
       
  1232             TInt lenPixelToVisualEnd = panerect.Width() * KCursorResetOffset
       
  1233                 / KDenominator;
       
  1234             TInt stride = 0;
       
  1235             TInt visualBeg = 0;
       
  1236             TInt visualEnd = 0;
       
  1237             for (stride = 1;; stride ++ )
       
  1238                 {
       
  1239                 if ( iAbsoluteBuffer->Length() < iAbsoluteCursorPos + stride )
       
  1240                     {
       
  1241                     visualEnd = iAbsoluteBuffer->Length();
       
  1242                     break;
       
  1243                     }
       
  1244                 TInt tmpFontLen = font->TextWidthInPixels( 
       
  1245                     iAbsoluteBuffer->Mid( iAbsoluteCursorPos, stride ) );
       
  1246                 if ( tmpFontLen > lenPixelToVisualEnd )
       
  1247                     {
       
  1248                     visualEnd = iAbsoluteCursorPos + stride - 1;
       
  1249                     break;
       
  1250                     }
       
  1251                 }
       
  1252             for (stride = 1;; stride ++ )
       
  1253                 {
       
  1254                 TInt tmpFontLen = font->TextWidthInPixels( 
       
  1255                     iAbsoluteBuffer->Mid( visualEnd - stride, stride ) );
       
  1256                 if ( tmpFontLen > panerect.Width() - panerect.Width()
       
  1257                     *KLROffset /KDenominator * 2 )
       
  1258                     {
       
  1259                     visualBeg = visualEnd - stride + 1;
       
  1260                     break;
       
  1261                     }
       
  1262                 }
       
  1263             if ( iMiniQwertyZhuyin && 
       
  1264                 iAbsoluteBuffer->Length( ) > 0 &&
       
  1265                 visualBeg >= iPhraseArray->Count() )
       
  1266                 {
       
  1267                 while ( iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KLeftBracket ) != 0 &&
       
  1268                     iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark1 ) != 0 &&
       
  1269                     iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark2 ) != 0 &&
       
  1270                     iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark3 ) != 0 &&
       
  1271                     iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark4 ) != 0 &&
       
  1272                     iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark5 ) != 0 )
       
  1273                     {
       
  1274                     visualBeg++;
       
  1275                     //                    visualEnd++;
       
  1276                     }
       
  1277                 }
       
  1278             *iVisualBuffer = iAbsoluteBuffer->Mid( visualBeg, visualEnd
       
  1279                 - visualBeg );
       
  1280             this->iOffset = visualBeg;
       
  1281             }
       
  1282         }
       
  1283     }
       
  1284 
       
  1285 // ---------------------------------------------------------
       
  1286 // Calculate the underline indexes and highlight indexes according to the
       
  1287 // absolute value.
       
  1288 // ---------------------------------------------------------
       
  1289 //
       
  1290 void CAknFepUICtrlPinyinEEP::CalculateVisualIndex()
       
  1291     {
       
  1292     for (TInt i = 0; i < iArray.Count(); i++ )
       
  1293         {
       
  1294         TInt left = iArray[i]->iBegin - iOffset;
       
  1295         TInt right = iArray[i]->iEnd - iOffset;
       
  1296         if (
       
  1297             left < 0 &&
       
  1298             right < 0
       
  1299             ||
       
  1300             left> iVisualBuffer->Length() - 1 &&
       
  1301             right> iVisualBuffer->Length() - 1
       
  1302            )
       
  1303             {
       
  1304             left = -1;
       
  1305             right = -1;
       
  1306             }
       
  1307         else
       
  1308             {
       
  1309             if ( left < 0 )
       
  1310                 {
       
  1311                 left = 0;
       
  1312                 }
       
  1313             if ( right> iVisualBuffer->Length() - 1 )
       
  1314                 {
       
  1315                 right = iVisualBuffer->Length() - 1;
       
  1316                 }
       
  1317             }
       
  1318         if ( iArray[i]->iStyle == CAknFepUICtrlEEPControl::EHighlight )
       
  1319             {
       
  1320             iEditableEntryPane->SetHighlight( left, right );
       
  1321             }
       
  1322         else if ( iArray[i]->iStyle == CAknFepUICtrlEEPControl::EUnderline )
       
  1323             {
       
  1324             iEditableEntryPane->SetUnderline( left, right );
       
  1325             }
       
  1326         }
       
  1327     }
       
  1328 
       
  1329 // ---------------------------------------------------------
       
  1330 // layout the background frames.
       
  1331 // ---------------------------------------------------------
       
  1332 //
       
  1333 void CAknFepUICtrlPinyinEEP::CalculateFrameRects( TRect& aOuterRect,
       
  1334     TRect& aInnerRect ) const
       
  1335     {
       
  1336     TRect windowRect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEEP ));
       
  1337     TAknLayoutRect eepFirstHorizLineLayoutRect = CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( EEEPFirstHorizLine ));
       
  1338     TRect eepFirstHorizLineRect = eepFirstHorizLineLayoutRect.Rect();
       
  1339     TInt rectHeight = eepFirstHorizLineRect.iBr.iY - windowRect.iTl.iY + 2;
       
  1340     TInt rectWidth = windowRect.Width( );
       
  1341     windowRect.iTl.iX = 0;
       
  1342     windowRect.iTl.iY = 0;
       
  1343     windowRect.SetHeight( rectHeight );
       
  1344     windowRect.SetWidth( rectWidth );
       
  1345 
       
  1346     TAknLayoutRect topLeft;
       
  1347     topLeft.LayoutRect( windowRect,
       
  1348         SkinLayout::Submenu_skin_placing_Line_2() );
       
  1349 
       
  1350     TAknLayoutRect bottomRight;
       
  1351     bottomRight.LayoutRect( windowRect,
       
  1352         SkinLayout::Submenu_skin_placing_Line_5() );
       
  1353 
       
  1354     aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
       
  1355     aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
       
  1356     }
       
  1357 
       
  1358 // ---------------------------------------------------------
       
  1359 // Return kestroke array.
       
  1360 // ---------------------------------------------------------
       
  1361 //
       
  1362 CDesCArrayFlat* CAknFepUICtrlPinyinEEP::KeystrokeArray()
       
  1363     {
       
  1364     return iKeystrokeArray;
       
  1365     }
       
  1366 
       
  1367 // ---------------------------------------------------------
       
  1368 // Return kescode array.
       
  1369 // ---------------------------------------------------------
       
  1370 //
       
  1371 RArray<TInt>* CAknFepUICtrlPinyinEEP::KeycodeArray()
       
  1372     {
       
  1373     return &iKeycodeArray;
       
  1374     }
       
  1375 
       
  1376 // ---------------------------------------------------------
       
  1377 // Return kescode array.
       
  1378 // ---------------------------------------------------------
       
  1379 //
       
  1380 RArray<TInt>* CAknFepUICtrlPinyinEEP::PhraseKeycodeArray()
       
  1381     {
       
  1382     return &iPhraseKeycodeArray;
       
  1383     }
       
  1384 
       
  1385 // ---------------------------------------------------------
       
  1386 // Return show kestroke array.
       
  1387 // ---------------------------------------------------------
       
  1388 //
       
  1389 CDesCArrayFlat* CAknFepUICtrlPinyinEEP::ShowKeystrokeArray()
       
  1390     {
       
  1391     return iShowKeystrokeArray;
       
  1392     }
       
  1393 
       
  1394 // ---------------------------------------------------------
       
  1395 // Return choose chinese charater array.
       
  1396 // ---------------------------------------------------------
       
  1397 //
       
  1398 CDesCArrayFlat* CAknFepUICtrlPinyinEEP::PhraseArray()
       
  1399     {
       
  1400     return iPhraseArray;
       
  1401     }
       
  1402 
       
  1403 // ---------------------------------------------------------
       
  1404 // Return choose chinese charater show keystroke array.
       
  1405 // ---------------------------------------------------------
       
  1406 //
       
  1407 CDesCArrayFlat* CAknFepUICtrlPinyinEEP::PhraseShowKeyStrokeArray()
       
  1408     {
       
  1409     return iPhraseShowKeyStrokeArray;
       
  1410     }
       
  1411 // ---------------------------------------------------------
       
  1412 // Return temp array.
       
  1413 // ---------------------------------------------------------
       
  1414 //
       
  1415 CDesCArrayFlat* CAknFepUICtrlPinyinEEP::TempArray()
       
  1416     {
       
  1417     return iTempArray;
       
  1418     }
       
  1419 
       
  1420 // ---------------------------------------------------------
       
  1421 // Reset private member viariable array.
       
  1422 // ---------------------------------------------------------
       
  1423 //
       
  1424 void CAknFepUICtrlPinyinEEP::ResetAllArray()
       
  1425     {
       
  1426     iKeystrokeArray->Reset();
       
  1427     iKeystrokeArray->Compress();
       
  1428     iKeycodeArray.Reset();
       
  1429     iShowKeystrokeArray->Reset();
       
  1430     iShowKeystrokeArray->Compress();
       
  1431     iPhraseArray->Reset();
       
  1432     iPhraseArray->Compress();
       
  1433     iPhraseKeycodeArray.Reset();
       
  1434     iPhraseShowKeyStrokeArray->Reset();
       
  1435     iPhraseShowKeyStrokeArray->Compress();
       
  1436     iTempArray->Reset();
       
  1437     iTempArray->Compress();
       
  1438     iAllValidFlag = 1;
       
  1439     iInvalidKeystrokeIndex = 0;
       
  1440     iCandidateRefreshFlag = 0;
       
  1441     iDelimiterCount = 0;
       
  1442     }
       
  1443 
       
  1444 // ---------------------------------------------------------
       
  1445 // change state flag.
       
  1446 // ---------------------------------------------------------
       
  1447 //
       
  1448 void CAknFepUICtrlPinyinEEP::SetChangeState( TBool aState )
       
  1449     {
       
  1450     iChangeFlag = aState;
       
  1451     }
       
  1452 
       
  1453 // ---------------------------------------------------------
       
  1454 // check change state flag.
       
  1455 // ---------------------------------------------------------
       
  1456 //
       
  1457 TBool CAknFepUICtrlPinyinEEP::IsChangeState()
       
  1458     {
       
  1459     return iChangeFlag;
       
  1460     }
       
  1461 
       
  1462 // ---------------------------------------------------------
       
  1463 // Set auto change state flag.
       
  1464 // ---------------------------------------------------------
       
  1465 //
       
  1466 void CAknFepUICtrlPinyinEEP::SetAutoChangeStateFlag( TBool aState )
       
  1467     {
       
  1468     iAutoChangeFlag = aState;
       
  1469     }
       
  1470 
       
  1471 // ---------------------------------------------------------
       
  1472 // Set auto change state flag.
       
  1473 // ---------------------------------------------------------
       
  1474 //
       
  1475 TBool CAknFepUICtrlPinyinEEP::GetAutoChangeStateFlag()
       
  1476 
       
  1477     {
       
  1478     return iAutoChangeFlag;
       
  1479     }
       
  1480 
       
  1481 // ---------------------------------------------------------
       
  1482 // Set all the keystroke valid flag.
       
  1483 // ---------------------------------------------------------
       
  1484 //
       
  1485 void CAknFepUICtrlPinyinEEP::SetAllValidFlag( TBool aState )
       
  1486     {
       
  1487     iAllValidFlag = aState;
       
  1488     }
       
  1489 
       
  1490 // ---------------------------------------------------------
       
  1491 // Set all the keystroke valid flag.
       
  1492 // ---------------------------------------------------------
       
  1493 //
       
  1494 TBool CAknFepUICtrlPinyinEEP::GetAllValidFlag()
       
  1495     {
       
  1496     return iAllValidFlag;
       
  1497     }
       
  1498 
       
  1499 // ---------------------------------------------------------
       
  1500 // Set is Phrase creation.
       
  1501 // ---------------------------------------------------------
       
  1502 //
       
  1503 void CAknFepUICtrlPinyinEEP::SetPhraseCreationFlag( TBool aState )
       
  1504     {
       
  1505     iPhraseCreation = aState;
       
  1506     }
       
  1507 
       
  1508 // ---------------------------------------------------------
       
  1509 // Is Phrase creation.
       
  1510 // ---------------------------------------------------------
       
  1511 //
       
  1512 TBool CAknFepUICtrlPinyinEEP::GetPhraseCreationFlag()
       
  1513     {
       
  1514     return iPhraseCreation;
       
  1515     }
       
  1516 
       
  1517 // ---------------------------------------------------------
       
  1518 // Set the keystroke invalid index.
       
  1519 // ---------------------------------------------------------
       
  1520 //
       
  1521 void CAknFepUICtrlPinyinEEP::SetInvalidIndex( TInt aInvalidIndex )
       
  1522     {
       
  1523     iInvalidKeystrokeIndex = aInvalidIndex;
       
  1524     }
       
  1525 
       
  1526 // ---------------------------------------------------------
       
  1527 // Get all the invalid keystroke index.
       
  1528 // ---------------------------------------------------------
       
  1529 //
       
  1530 TInt CAknFepUICtrlPinyinEEP::GetInvalidIndex()
       
  1531     {
       
  1532     return iInvalidKeystrokeIndex;
       
  1533     }
       
  1534 
       
  1535 // ---------------------------------------------------------
       
  1536 // Set Phrase Candidate state need refresh UI flag.
       
  1537 // ---------------------------------------------------------
       
  1538 //
       
  1539 void CAknFepUICtrlPinyinEEP::SetCandidateRefreshFlag( TBool aState )
       
  1540     {
       
  1541     iCandidateRefreshFlag = aState;
       
  1542     }
       
  1543 
       
  1544 // ---------------------------------------------------------
       
  1545 // Get Phrase Candidate state need refresh UI flag.
       
  1546 // ---------------------------------------------------------
       
  1547 //
       
  1548 TInt CAknFepUICtrlPinyinEEP::GetCandidateRefreshFlag()
       
  1549     {
       
  1550     return iCandidateRefreshFlag;
       
  1551     }
       
  1552 
       
  1553 // ---------------------------------------------------------
       
  1554 // Set the delimiter count of keystroke.
       
  1555 // ---------------------------------------------------------
       
  1556 //
       
  1557 void CAknFepUICtrlPinyinEEP::SetDelimiterCount( TInt aCount )
       
  1558     {
       
  1559     iDelimiterCount = aCount;
       
  1560     }
       
  1561 
       
  1562 // ---------------------------------------------------------
       
  1563 // Get the delimiter count of keystroke.
       
  1564 // ---------------------------------------------------------
       
  1565 //
       
  1566 TInt CAknFepUICtrlPinyinEEP::GetDelimiterCount()
       
  1567     {
       
  1568     return iDelimiterCount;
       
  1569     }
       
  1570 
       
  1571 // ---------------------------------------------------------
       
  1572 // Get current cba resource id. 
       
  1573 // ---------------------------------------------------------
       
  1574 //
       
  1575 TInt CAknFepUICtrlPinyinEEP::GetCurrentCBAResID()
       
  1576     {
       
  1577     return iCurrentCBAResId;
       
  1578     }
       
  1579 
       
  1580 // ---------------------------------------------------------
       
  1581 // Set current cba resource id. 
       
  1582 // ---------------------------------------------------------
       
  1583 //
       
  1584 void CAknFepUICtrlPinyinEEP::SetCurrentCBAResID( TInt aResourceId )
       
  1585     {
       
  1586     iCurrentCBAResId = aResourceId;
       
  1587     }
       
  1588 
       
  1589 void CAknFepUICtrlPinyinEEP::SetEffictiveLength( TInt aLength )
       
  1590     {
       
  1591     iEffictiveLength = aLength;
       
  1592     }
       
  1593 
       
  1594 TInt CAknFepUICtrlPinyinEEP::GetEffictiveLength()
       
  1595     {
       
  1596     return iEffictiveLength;
       
  1597     }
       
  1598 
       
  1599 void CAknFepUICtrlPinyinEEP::AddEffictiveLength()
       
  1600     {
       
  1601     iEffictiveLength++;
       
  1602     }
       
  1603 
       
  1604 void CAknFepUICtrlPinyinEEP::DecEffictiveLength()
       
  1605     {
       
  1606     iEffictiveLength--;
       
  1607     }
       
  1608 
       
  1609 void CAknFepUICtrlPinyinEEP::SetNeedClearDeliberateSelection( TBool aNeedClearDeliberateSelection )
       
  1610     {
       
  1611     iNeedClearDeliberateSelection = aNeedClearDeliberateSelection;
       
  1612     }
       
  1613 
       
  1614 TBool CAknFepUICtrlPinyinEEP::NeedClearDeliberateSelection()
       
  1615     {
       
  1616     return iNeedClearDeliberateSelection;
       
  1617     }
       
  1618 
       
  1619 // End of file
       
  1620