textinput/peninputvkbcn/ctrlsrc/peninputvkbclientarea.cpp
changeset 0 eb1f2e154e89
child 10 6defe5d1bd39
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  vkb client area implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // system includes
       
    20 #include <peninputvkbctrlext.h>
       
    21 #include <peninputvkbctrllayout.h>
       
    22 #include <peninputlayout.h>
       
    23 #include <peninputlayoutrootctrl.h>
       
    24 #include <peninputeventbutton.h>
       
    25 #include <peninputdropdownlist.h>
       
    26 #include <peninputmultimodebutton.h>
       
    27 #include <aknfeppeninputenums.h>    //command from fep or IME to plugin
       
    28 #include <peninputrangebar.h>
       
    29 #include <peninputvkbcn.rsg>
       
    30 #include <peninputrepeatbutton.h>
       
    31 #include <AknLayoutDef.h>
       
    32 #include <AknUtils.h>
       
    33 #include <aknlayoutscalable_avkon.cdl.h>
       
    34 #include <AknsUtils.h>
       
    35 #include <peninputlayoutmultilineicf.h>
       
    36 #include <peninputdragbutton.h>
       
    37 #include <peninputpluginutils.h>
       
    38 
       
    39 // user includes
       
    40 #include "peninputvkbevent.h"
       
    41 #include "peninputvkbdataprovider.h"
       
    42 #include "peninputvkbclientarea.h"
       
    43 #include "peninputvkbctrlpool.h"
       
    44 #include "peninputvkblayoutpool.h"
       
    45 #include "peninputvkbcompositionfield.h"
       
    46 #include "peninputvkbImlayout.h"
       
    47 #include "peninputvkbnumerickeymappingmgr.h"
       
    48 #include "peninputvkbwindow.h"
       
    49 #include "peninputvkbdatamgr.h"
       
    50 #include "peninputvkbuistate.h"
       
    51 
       
    52 // constant definition
       
    53 const TInt KDropdownRowsForStroke = 3;
       
    54 const TInt KDropdownRowsForOthers = 4;
       
    55 
       
    56 const TUint16 KStrokeSeparator = 0x2022;
       
    57 const TUint16 KPinyinSeparator = 0x0027;
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 // ======== MEMBER FUNCTIONS ========
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CAknFepVkbClientArea::CAknFepVkbClientArea
       
    66 // (other items were commented in a header).
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CAknFepVkbClientArea::CAknFepVkbClientArea(CFepUiLayout* aUiLayout, 
       
    70                                            TInt aControlId,
       
    71                                            MAknFepVkbDataProvider* aDataProvider,
       
    72                                            CPeninputCnGenericVkbLafMgr* aLafMgr)
       
    73     :CControlGroup(aUiLayout, aControlId, EFalse), 
       
    74      iDataProvider(aDataProvider),
       
    75      iTextPropertySet(EFalse),
       
    76      iDropdownPropertySet(EFalse),
       
    77      iLafMgr(aLafMgr)
       
    78     {
       
    79     }
       
    80     
       
    81 // ---------------------------------------------------------------------------
       
    82 // CAknFepVkbClientArea::NewL
       
    83 // (other items were commented in a header).
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CAknFepVkbClientArea* CAknFepVkbClientArea::NewL(CFepUiLayout* aUiLayout, 
       
    87                                                  TInt aControlId,
       
    88                                                  MAknFepVkbDataProvider* aDataProvider,
       
    89                                                  CPeninputCnGenericVkbLafMgr* aLafMgr)
       
    90     {
       
    91     CAknFepVkbClientArea* self = CAknFepVkbClientArea::NewLC(aUiLayout, aControlId, 
       
    92                                                              aDataProvider, aLafMgr);
       
    93     CleanupStack::Pop(self);
       
    94     return self;
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CAknFepVkbClientArea::NewLC
       
    99 // (other items were commented in a header).
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 CAknFepVkbClientArea* CAknFepVkbClientArea::NewLC(CFepUiLayout* aUiLayout, 
       
   103                                                   TInt aControlId,
       
   104                                                   MAknFepVkbDataProvider* aDataProvider,
       
   105                                                   CPeninputCnGenericVkbLafMgr* aLafMgr)
       
   106     {
       
   107     CAknFepVkbClientArea* self = new (ELeave) CAknFepVkbClientArea(aUiLayout, aControlId, 
       
   108                                                                    aDataProvider, aLafMgr);
       
   109     CleanupStack::PushL(self);
       
   110     self->ConstructL();
       
   111     return self;
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // CAknFepVkbClientArea::SetTextProperty
       
   116 // (other items were commented in a header).
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CAknFepVkbClientArea::SetTextProperty()
       
   120 	{
       
   121     TAknTextLineLayout compositionText;
       
   122     compositionText = AknLayoutScalable_Avkon::cell_vkb_candidate_pane_t1().LayoutLine();
       
   123 
       
   124     iCompositionField->SetNormalColor(AKN_LAF_COLOR_STATIC(compositionText.iC));
       
   125     iCompositionField->SetWarningColor(KRgbRed);
       
   126     
       
   127     iCompositionField->SetFont(AknLayoutUtils::FontFromId(compositionText.iFont, NULL));
       
   128     
       
   129     iTextPropertySet = ETrue;
       
   130 	}
       
   131     
       
   132 // ---------------------------------------------------------------------------
       
   133 // CAknFepVkbClientArea::ConstructL
       
   134 // (other items were commented in a header).
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void CAknFepVkbClientArea::ConstructL()
       
   138     {
       
   139     BaseConstructL();
       
   140     
       
   141     iCtrlPool = CAknFepVkbCtrlPool::NewL();
       
   142     iVkbLayout = CAknFepCtrlVkbLayout::NewL();
       
   143     iLayoutPool = CAknFepLayoutPool::NewL( *iVkbLayout );    
       
   144     
       
   145     TResourceReader reader;
       
   146     CCoeEnv::Static()->CreateResourceReaderLC(reader, R_AKN_FEP_VKB_KEY_MAPPING_STRING_LIST);
       
   147     iKeyMappingMgr = CAknFepVkbNumericKepMappingMgr::NewL(reader);
       
   148     CleanupStack::PopAndDestroy(); // reader
       
   149  
       
   150     // 1.Create all control in the client, including all kinds of control in different layout
       
   151     // Composition field
       
   152     iCompositionField = CAknFepVkbCompositionField::NewL(KMaxLengthCompFieldElemCount,TRect(),
       
   153                                                          UiLayout(),
       
   154                                                          EAknFepVkbCtrlIdCompositionField, 
       
   155                                                          iDataProvider );
       
   156     iCompositionField->SetResourceId(R_AKN_FEP_VKB_COMPOSITION_FIELD);
       
   157     iCompositionField->ConstructFromResourceL();
       
   158     iCtrlPool->AddControl(iCompositionField);   
       
   159     AddButtonL(EAknFepVkbCtrlIdArrowUpBtn,
       
   160                EVkbEventUpArrow,
       
   161                R_AKN_FEP_VKB_ARROW_UP_BUTTON,
       
   162                EKeyUpArrow,
       
   163                ETrue);
       
   164     
       
   165     AddButtonL(EAknFepVkbCtrlIdArrowDownBtn,
       
   166                EVkbEventDownArrow,
       
   167                R_AKN_FEP_VKB_ARROW_DOWN_BUTTON,
       
   168                EKeyDownArrow,
       
   169                ETrue
       
   170                );
       
   171     
       
   172     AddButtonL(EAknFepVkbCtrlIdArrowLeftBtn,
       
   173                EVkbEventLeftArrow,
       
   174                R_AKN_FEP_VKB_ARROW_LEFT_BUTTON,
       
   175                EKeyLeftArrow,
       
   176                ETrue
       
   177                );
       
   178     
       
   179     AddButtonL(EAknFepVkbCtrlIdArrowRightBtn,
       
   180                EVkbEventRightArrow,
       
   181                R_AKN_FEP_VKB_ARROW_RIGHT_BUTTON,
       
   182                EKeyRightArrow,
       
   183                ETrue
       
   184                );
       
   185                                          
       
   186     // Vkb control   
       
   187     iVkbCtrl = CPeninputVkbCtrlExt::NewL(TRect(), 
       
   188                                        UiLayout(), 
       
   189                                        EAknFepVkbCtrlIdVkbCtrl, 
       
   190                                        NULL);
       
   191     iVkbCtrl->SetResourceId( R_PENINPUT_LAYOUT_VKB_KEYBOARD );
       
   192     iVkbCtrl->ConstructFromResourceL();                                  
       
   193     iVkbCtrl->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG68 );                                   
       
   194     iVkbLayout->SetVkbKeyboard( iVkbCtrl );
       
   195     if (UiLayout()->PenInputType() == EPluginInputModeVkb)
       
   196         {
       
   197         iVkbCtrl->SetIrregularKeyBoard(ETrue);
       
   198         iVkbLayout->SetIrregularResourceId(R_AKN_FEP_VKBCN_IRREGULAR_BITMAP);
       
   199         iVkbLayout->ConstructFromIrregularResourceL();
       
   200         }
       
   201     else if (UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
   202         {
       
   203         iVkbCtrl->SetIrregularKeyBoard(EFalse);
       
   204         iVkbLayout->SetNonIrregularResourceId(R_AKN_FEP_VKBCN_NONIRREGULAR_BITMAP);
       
   205         iVkbLayout->ConstructFromNonIrregularResourceL(); 
       
   206         
       
   207         //set key to be 9 piece graphics
       
   208         iVkbCtrl->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal );
       
   209         iVkbCtrl->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed );
       
   210         iVkbCtrl->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive );
       
   211 
       
   212         }
       
   213     iCtrlPool->AddControl(iVkbCtrl);
       
   214     
       
   215         // Add bubble support
       
   216     iVkbCtrl->ShowBubble(ETrue);    
       
   217     iVkbCtrl->SetGowithPointerDown(ETrue);
       
   218     iVkbCtrl->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview);  //Change the ID when ID into release
       
   219 
       
   220 
       
   221     AddButtonL(EAknFepVkbCtrlIdTouchInputOption, 
       
   222                EVkbEventTouchInputOption, 
       
   223                R_AKN_FEP_VKB_TOUCH_INPUT_OPTION);
       
   224     
       
   225     // Enter button          
       
   226     AddButtonL(EAknFepVkbCtrlIdEnterBtn,EVkbEventKeyEnter,R_AKN_FEP_VKB_ENTER, EKeyEnter);
       
   227     
       
   228     // Drop down list  
       
   229     AddDropdownListL();
       
   230     
       
   231     // Range bar
       
   232     AddRangeBarL();
       
   233 
       
   234     // Shift and capslock merged button
       
   235     CAknFepCtrlMultiModeButton* button = 
       
   236   		CAknFepCtrlMultiModeButton::NewLC( UiLayout(), EAknFepVkbCtrlIdShiftBtn );
       
   237     if ( button )
       
   238 	    {
       
   239 	    // Read resource
       
   240 	    TResourceReader reader;
       
   241 	    
       
   242 	    CCoeEnv::Static()->CreateResourceReaderLC( reader,
       
   243 	    	 			                           R_AKN_FEP_VKB_SHIFT_CAPSLOCK );  
       
   244 	    button->SetResourceId( R_AKN_FEP_VKB_SHIFT_CAPSLOCK );      
       
   245 	    button->ConstructFromResourceL();  
       
   246 	    // Pop and destroy reader
       
   247 	    CleanupStack::PopAndDestroy( 1 );
       
   248 	    
       
   249 	    // Add into the control pool                                                   
       
   250 	    iCtrlPool->AddControl( button );
       
   251 	    }
       
   252     CleanupStack::Pop( button );     
       
   253      
       
   254     // Space button          
       
   255     CAknFepCtrlEventButton* spaceButton = AddButtonL(
       
   256     										EAknFepVkbCtrlIdSpaceBtn,
       
   257     										EVkbEventKeySpace,
       
   258     										R_AKN_FEP_VKB_SPACE1, 
       
   259     										EKeySpace);
       
   260     // Create 3-pieces color icon for space button
       
   261 	CPenInput3PiecesColorIcons* colorIcons = 
       
   262 				CPenInput3PiecesColorIcons::NewL( R_AKN_FEP_VKB_SPACE_ICON1,
       
   263 												  R_AKN_FEP_VKB_SPACE_ICON2,
       
   264 												  R_AKN_FEP_VKB_SPACE_ICON3 );
       
   265 	spaceButton->Set3PiecesColorIcons( colorIcons );
       
   266 	
       
   267    //set background of space button to be 9 piece graphics
       
   268     if ( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
   269         {
       
   270         spaceButton->SetImageFrameId( KAknsIIDQsnFrKeypadButtonFrNormal, 
       
   271                                       KAknsIIDQsnFrKeypadButtonFrPressed,
       
   272                                       KAknsIIDQsnFrKeypadButtonFrInactive );
       
   273         }
       
   274 
       
   275     									
       
   276     // switch to hwr button  
       
   277     AddButtonL(EAknFepVkbCtrlIdSwitchToHwrBtn,EVkbEventHwr,R_AKN_FEP_VKB_HWR);   
       
   278     
       
   279     SetTextProperty();
       
   280    
       
   281     for (TInt i=0; i < iCtrlPool->ControlCount(); i++)
       
   282         {
       
   283         if ( iCtrlPool )
       
   284             {
       
   285             iCtrlPool->ControlByIndex(i)->AddEventObserver(UiLayout());    
       
   286             }       
       
   287         }
       
   288     }
       
   289 
       
   290 // ---------------------------------------------------------------------------
       
   291 // CAknFepVkbClientArea::~CAknFepVkbClientArea
       
   292 // (other items were commented in a header).
       
   293 // ---------------------------------------------------------------------------
       
   294 //
       
   295 CAknFepVkbClientArea::~CAknFepVkbClientArea()
       
   296     {
       
   297     delete iVkbLayout;
       
   298     delete iCtrlPool;
       
   299     delete iLayoutPool;
       
   300     delete iKeyMappingMgr;
       
   301     iRemainedPoolControlIDs.Close();
       
   302     }
       
   303 
       
   304 // ---------------------------------------------------------------------------
       
   305 // CAknFepVkbClientArea::SizeChanged
       
   306 // (other items were commented in a header).
       
   307 // ---------------------------------------------------------------------------
       
   308 //
       
   309 void CAknFepVkbClientArea::SizeChanged()
       
   310     {
       
   311     TAknTextLineLayout keypadText, compositionText, dropDownText;
       
   312     
       
   313     TInt btnWidth = iDataProvider->RequestData(EAknFepDataTypeUnitWidth);
       
   314     TInt btnHeight = iDataProvider->RequestData(EAknFepDataTypeUnitHeight);
       
   315     
       
   316     if (iDataProvider->SizeChanging() || (!iTextPropertySet))
       
   317     	{
       
   318     	SetTextProperty();
       
   319     	}
       
   320         
       
   321     // modify drop down list font
       
   322     if (iDataProvider->SizeChanging() || (!iDropdownPropertySet))
       
   323     	{
       
   324         TAknTextLineLayout listText = 
       
   325                                 AknLayoutScalable_Avkon::cell_vkb_candidate_pane_t1().LayoutLine();
       
   326         iDropdownList->SetFont(AknLayoutUtils::FontFromId(listText.iFont, NULL));
       
   327         //iDropdownList->SetTextColor(AKN_LAF_COLOR_STATIC(listText.iC), ETrue);
       
   328 
       
   329         iDropdownList->SizeChanged(btnWidth, btnHeight, btnWidth);
       
   330     	}
       
   331     
       
   332     if ( iCurrentImLayout )
       
   333         {
       
   334         //3.Change the postion and size of controls in current layout
       
   335         ReorganizeControls(iCurrentImLayout, EFalse);
       
   336         }        
       
   337 
       
   338     //calculate current vkblayout according current imlayout
       
   339     if ( iCurrentVkbLayout )
       
   340         {
       
   341         //dimmed some keys if needed
       
   342         TRAP_IGNORE(DimKeys());    
       
   343         }
       
   344     }
       
   345         
       
   346 // ---------------------------------------------------------------------------
       
   347 // CAknFepVkbClientArea::ChangeImLayout
       
   348 // (other items were commented in a header).
       
   349 // ---------------------------------------------------------------------------
       
   350 //
       
   351 void CAknFepVkbClientArea::ChangeImLayout(TInt aImLayout, TBool aChangeVkb)
       
   352     {
       
   353     iDataProvider->SetData(EAknFepDataTypeIMLayout, aImLayout);
       
   354     static_cast<CAknFepVkbDataMgr*>(iDataProvider)->ResetUnitSize();
       
   355     
       
   356     TInt currentRange = iDataProvider->RequestData(EAknFepDataTypeCurrentRange);        
       
   357 
       
   358     CAknFepVkbImLayout* newImLayout = iLayoutPool->GetImLayout(aImLayout);
       
   359 
       
   360     if ( iCurrentImLayout != newImLayout)
       
   361         {
       
   362         iCurrentImLayout = newImLayout;
       
   363         if  ( currentRange == ERangeNative) 
       
   364             {
       
   365             iDropdownList->SetRowNum(aImLayout == EAknFepVkbImCnStroke ?
       
   366                                      KDropdownRowsForStroke : KDropdownRowsForOthers );
       
   367             }
       
   368         ReorganizeControls(iCurrentImLayout, ETrue);  
       
   369         }
       
   370 
       
   371     if ( iRangeBar )
       
   372         {
       
   373         iRangeBar->SetRange(currentRange);
       
   374         }
       
   375         
       
   376     //calculate current vkblayout according current imlayout
       
   377     if (aChangeVkb)
       
   378         {
       
   379          if ( ( currentRange == ERangeEnglish ) || ( currentRange == ERangeAccent ) )
       
   380             {
       
   381             // Change shift and capslock button status according to the current case
       
   382             TInt curCase = iDataProvider->RequestData( EAknFepDataTypeCase );
       
   383             TInt shfit;  
       
   384             TInt capslock;  
       
   385             
       
   386             switch ( curCase )
       
   387                 {
       
   388                 case ECaseUpper:
       
   389                     shfit = 0;
       
   390                     capslock = 1;
       
   391                     break;
       
   392                 case ECaseText:
       
   393                     shfit = 1;
       
   394                     capslock = 0;
       
   395                     break;
       
   396                 case ECaseInverseText:        
       
   397                     shfit = 1;
       
   398                     capslock = 1;
       
   399                     break;            
       
   400                 case ECaseLower:        
       
   401                 case ECaseInvalide:
       
   402                 default:
       
   403                     shfit = 0;
       
   404                     capslock = 0;        
       
   405                     break;   
       
   406                 }     
       
   407 
       
   408             iDataProvider->SetData( EAknFepDataTypeShfitDown, shfit );
       
   409             //ChangeButtonStatus( shfit, EAknFepVkbCtrlIdShiftBtn );
       
   410             iDataProvider->SetData( EAknFepDataTypeCapslockDown, capslock );
       
   411             //ChangeButtonStatus( capslock, EAknFepVkbCtrlIdCapslockBtn );                
       
   412             ChangeMergedButtonStatus(shfit, capslock);
       
   413             
       
   414             if ( ( shfit && capslock ) || ( !shfit && !capslock  ) )
       
   415                 {
       
   416                 ChangeVkbLayout();
       
   417                 }
       
   418             else
       
   419                 {
       
   420                 TAknFepVkbLayout vkbLayout = ShiftCapsSingleVkbLayoutId( currentRange );
       
   421                 ChangeVkbLayout( vkbLayout );
       
   422                 }
       
   423             }
       
   424         else
       
   425             {
       
   426             iDataProvider->SetData( EAknFepDataTypeShfitDown, 0 );
       
   427             //ChangeButtonStatus( 0, EAknFepVkbCtrlIdShiftBtn );
       
   428             iDataProvider->SetData( EAknFepDataTypeCapslockDown, 0 );
       
   429             //ChangeButtonStatus( 0, EAknFepVkbCtrlIdCapslockBtn ); 
       
   430             ChangeMergedButtonStatus(0, 0);
       
   431  
       
   432             ChangeVkbLayout();
       
   433             }
       
   434         }
       
   435     }
       
   436 
       
   437 // ---------------------------------------------------------------------------
       
   438 // CAknFepVkbClientArea::ShiftCapsSingleVkbLayoutId
       
   439 // (other items were commented in a header).
       
   440 // ---------------------------------------------------------------------------
       
   441 //    
       
   442 TAknFepVkbLayout CAknFepVkbClientArea::ShiftCapsSingleVkbLayoutId( TInt aRange )
       
   443     {
       
   444     TInt defaultIMLayout = iDataProvider->RequestData(EAknFepDataTypeDefaultIMLayout);
       
   445     TInt curLanguage = iDataProvider->RequestData(EAknFepDataTypeInputLanguage);
       
   446     TAknFepVkbLayout vkbLayout = EAknFepVkbVkbLatinShift;
       
   447     TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
   448     
       
   449     switch (aRange)
       
   450         {
       
   451         case ERangeEnglish:
       
   452         	if (curLanguage == ELangTaiwanChinese && defaultIMLayout != EAknFepVkbImCnStroke)
       
   453         		{
       
   454         		vkbLayout = EAknFepVkbVkbLatinForZhuyinShift;
       
   455         		}
       
   456         	else 
       
   457         		{
       
   458         		vkbLayout = EAknFepVkbVkbLatinShift;
       
   459         		}
       
   460             break;
       
   461         case ERangeNumber:
       
   462         	if (curLanguage == ELangTaiwanChinese && defaultIMLayout != EAknFepVkbImCnStroke)
       
   463         		{
       
   464         		vkbLayout = EAknFepVkbVkbNumberForZhuyinShift;
       
   465         		}
       
   466         	else 
       
   467         		{
       
   468         		vkbLayout = EAknFepVkbVkbNumberShift;
       
   469         		}            
       
   470             break;
       
   471         case ERangeSymbol:
       
   472             vkbLayout = EAknFepVkbVkbSymbolShift;
       
   473             break;
       
   474         case ERangeAccent:
       
   475             {
       
   476             TInt accent = iDataProvider->RequestData(EAknFepDataTypeCurrentAccent);    
       
   477             switch (accent)
       
   478                 {
       
   479                 case EAknFepVkbVkbAccented1:
       
   480                     vkbLayout = EAknFepVkbVkbAccentedShfit1; 
       
   481                     break;
       
   482                 case EAknFepVkbVkbAccented2:
       
   483                     vkbLayout = EAknFepVkbVkbAccentedShfit2; 
       
   484                     break;
       
   485                 case EAknFepVkbVkbAccented3:
       
   486                     vkbLayout = EAknFepVkbVkbAccentedShfit3; 
       
   487                     break;
       
   488                 default:
       
   489                     vkbLayout = EAknFepVkbVkbAccentedShfit1; 
       
   490                     break;                            
       
   491                 }
       
   492             }
       
   493                                 
       
   494             break;
       
   495         default:
       
   496             break;
       
   497         } 
       
   498         return vkbLayout;
       
   499     }
       
   500     
       
   501 // ---------------------------------------------------------------------------
       
   502 // CAknFepVkbClientArea::ChangeVkbLayout
       
   503 // (other items were commented in a header).
       
   504 // ---------------------------------------------------------------------------
       
   505 //
       
   506 void CAknFepVkbClientArea::ChangeVkbLayout(TInt aVkbLayoutId)
       
   507     {
       
   508     TAknFepVkbLayout vkbLayoutId;
       
   509     TInt range = iDataProvider->RequestData(EAknFepDataTypeCurrentRange);
       
   510     if ( aVkbLayoutId >= 0 )
       
   511         {
       
   512         CPeninputVkbLayoutInfo* tempLayout = iLayoutPool->GetVkbLayout(aVkbLayoutId); 
       
   513         if ( iCurrentVkbLayout == tempLayout)
       
   514             {
       
   515             return;
       
   516             }
       
   517         else
       
   518             {
       
   519             iCurrentVkbLayout = tempLayout;
       
   520             }
       
   521         vkbLayoutId = static_cast<TAknFepVkbLayout>(aVkbLayoutId);
       
   522         }
       
   523     else
       
   524         {
       
   525         
       
   526         vkbLayoutId = GetDefaultVkbLayout(range);
       
   527         iCurrentVkbLayout = iLayoutPool->GetVkbLayout(vkbLayoutId);
       
   528         }
       
   529     
       
   530     iVkbLayout->ChangeVkbLayout( vkbLayoutId );
       
   531     iVkbLayoutId = aVkbLayoutId;
       
   532     SetVkbLayoutSize(vkbLayoutId);
       
   533       
       
   534     iVkbCtrl->SetRect( TRect( iVkbBoardLeftTop, iLafMgr->KeypadRect().Size() ) );
       
   535     
       
   536     //dimmed some keys if needed
       
   537     TRAP_IGNORE(DimKeys());
       
   538     }
       
   539  
       
   540 // ---------------------------------------------------------------------------
       
   541 // CAknFepVkbClientArea::SetVkbLayoutSize
       
   542 // (other items were commented in a header).
       
   543 // ---------------------------------------------------------------------------
       
   544 //
       
   545 void CAknFepVkbClientArea::SetVkbLayoutSize(TInt aVkbLayoutId)
       
   546     {
       
   547     TInt currentRange = iDataProvider->RequestData(EAknFepDataTypeCurrentRange);
       
   548     TAknFepVkbLayout vkbLayoutid;
       
   549     
       
   550     if(aVkbLayoutId < 0)
       
   551         {
       
   552         vkbLayoutid = GetDefaultVkbLayout(currentRange);
       
   553         }
       
   554     else
       
   555         {
       
   556         vkbLayoutid = static_cast<TAknFepVkbLayout>(aVkbLayoutId);
       
   557         }
       
   558 
       
   559     CPeninputVkbLayoutInfo* vkbLayout = iLayoutPool->GetVkbLayout( vkbLayoutid );
       
   560 
       
   561     // Calculate current vkblayout according current layout
       
   562     if ( vkbLayout )
       
   563         {
       
   564         const TInt columns = vkbLayout->Columns();
       
   565         const TInt rows = vkbLayout->Rows();
       
   566         TRect keyRect;
       
   567         TRect charRect;
       
   568         
       
   569         iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(rows,columns));
       
   570         
       
   571  		// Set priview popup size
       
   572 		TRect outrect,innerrect;   
       
   573 		iLafMgr->GetPreviewWndRect(outrect,innerrect);
       
   574 		iVkbCtrl->SetTextFormat(iLafMgr->PreviewWndText());  //Read laf 
       
   575 		iVkbCtrl->SetBubbleSize(TSize(outrect.Width(),outrect.Height()));  // Read laf
       
   576 		iVkbCtrl->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX,
       
   577 		               innerrect.iTl.iY - outrect.iTl.iY,
       
   578 		               outrect.iBr.iX - innerrect.iBr.iX,
       
   579 		               outrect.iBr.iY - innerrect.iBr.iY);
       
   580 
       
   581         if(iDropdownList)
       
   582             {
       
   583             iDropdownList->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview);
       
   584             
       
   585     		iDropdownList->SetTextFormat(iLafMgr->PreviewWndText());  //Read laf
       
   586     		iDropdownList->SetBubbleTextFont(iLafMgr->PreviewFont()); 
       
   587     		iDropdownList->SetBubbleSize(TSize(outrect.Width(),outrect.Height()));  // Read laf
       
   588     		iDropdownList->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX,
       
   589     		               innerrect.iTl.iY - outrect.iTl.iY,
       
   590     		               outrect.iBr.iX - innerrect.iBr.iX,
       
   591     		               outrect.iBr.iY - innerrect.iBr.iY);
       
   592             }
       
   593 
       
   594         for (TInt exter = 0; exter < rows; exter ++)
       
   595             {
       
   596             for (TInt inter = 0; inter < columns; inter ++ )
       
   597                 {
       
   598                 iLafMgr->GetKeyRect(inter,exter, keyRect, charRect);
       
   599                 vkbLayout->SetKeyInfo(exter,inter,keyRect,charRect,iLafMgr->KeyTextFont());
       
   600                 }
       
   601             }
       
   602         TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size();
       
   603 
       
   604         if ( iVkbCtrl->IsIrregularKeyBoard() )
       
   605             {
       
   606             TSize size = 
       
   607                         iVkbCtrl->IrregularKeyBitmap(EKeyLeftDown,EKeyStateNormal)->SizeInPixels();
       
   608             if ( curSize != size )
       
   609                 {
       
   610                 for ( TInt i = 0; i <= EKeyRightUp; i++ )
       
   611                     {
       
   612                     for ( TInt j = 0; j <= EKeyStateDimmedMask; j++ )
       
   613                         {
       
   614                         AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap(
       
   615                             (TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j), 
       
   616                              curSize, EAspectRatioNotPreserved ); 
       
   617                             
       
   618                         AknIconUtils::SetSize( iVkbCtrl->IrregularKeyBitmap(
       
   619                             (TVirtualKeyIrregularKeyType)i,(TVirtualKeyIrregularKeyState)j), 
       
   620                              curSize, EAspectRatioNotPreserved );
       
   621                         }
       
   622                     }
       
   623                 }
       
   624             }
       
   625         else
       
   626         	{
       
   627         	TSize size = iVkbCtrl->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
       
   628         	if( curSize != size )	
       
   629         		{
       
   630                 for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
       
   631                     {
       
   632                     if( iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
       
   633                     	{
       
   634                         AknIconUtils::SetSize( 
       
   635                             iVkbCtrl->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), curSize, 
       
   636                                                              EAspectRatioNotPreserved );
       
   637                     	}
       
   638                     }
       
   639         		}
       
   640         	}
       
   641         }
       
   642     }
       
   643     
       
   644 
       
   645 // ---------------------------------------------------------------------------
       
   646 // CAknFepVkbClientArea::LoopVkbLayout
       
   647 // (other items were commented in a header).
       
   648 // ---------------------------------------------------------------------------
       
   649 //
       
   650 void CAknFepVkbClientArea::LoopVkbLayout(TVkbShiftType aType, TBool aNotify)
       
   651     {
       
   652     TInt currentRange = iDataProvider->RequestData(EAknFepDataTypeCurrentRange);        
       
   653     
       
   654     if (currentRange!=ERangeNative)
       
   655         {
       
   656         TBool shiftDown = iDataProvider->RequestData(EAknFepDataTypeShfitDown); 
       
   657         TBool capslockDown = iDataProvider->RequestData(EAknFepDataTypeCapslockDown);
       
   658         
       
   659         if ( aType == EVkbShift)
       
   660             {
       
   661             if ((currentRange == ERangeEnglish) || (currentRange == ERangeAccent))
       
   662                 {
       
   663                 capslockDown = !capslockDown;
       
   664                 iDataProvider->SetData( EAknFepDataTypeCapslockDown, capslockDown );
       
   665                 ChangeMergedButtonStatus( shiftDown, capslockDown );   
       
   666                 }
       
   667             }
       
   668         else if ( aType == EVkbCapslock )
       
   669             {
       
   670             if(static_cast<CAknFepVkbDataMgr*>(iDataProvider)->IsShiftPermitted())
       
   671                 {
       
   672                 if ((currentRange == ERangeEnglish) || (currentRange == ERangeAccent))
       
   673                     {
       
   674                     shiftDown = !shiftDown;
       
   675                     ChangeMergedButtonStatus( shiftDown, capslockDown );
       
   676                     iDataProvider->SetData( EAknFepDataTypeShfitDown, shiftDown );   
       
   677                     }
       
   678                 
       
   679                 }
       
   680             else
       
   681                 {
       
   682                 if(static_cast<CAknFepVkbDataMgr*>(iDataProvider)->IsCapsLockPermitted())
       
   683                     {
       
   684                     capslockDown = !capslockDown;
       
   685                     iDataProvider->SetData( EAknFepDataTypeCapslockDown, capslockDown );
       
   686                     ChangeMergedButtonStatus( shiftDown, capslockDown );   
       
   687                     }
       
   688                 }
       
   689             }
       
   690         else  if( aType == EVkbBoth )
       
   691             {
       
   692             if ( shiftDown )
       
   693                 {
       
   694                 shiftDown = 0;
       
   695                 }
       
   696             else
       
   697                 {
       
   698                 shiftDown = 1;
       
   699                 }
       
   700             iDataProvider->SetData( EAknFepDataTypeShfitDown, shiftDown );
       
   701             
       
   702             if ((currentRange == ERangeEnglish) || (currentRange == ERangeAccent))
       
   703                 {
       
   704                 capslockDown = !capslockDown;
       
   705                 iDataProvider->SetData( EAknFepDataTypeCapslockDown, capslockDown );
       
   706                 ChangeMergedButtonStatus( shiftDown, capslockDown );   
       
   707                 }           
       
   708             }
       
   709         else 
       
   710             {
       
   711             ChangeMergedButtonStatus( shiftDown, capslockDown );            
       
   712             }
       
   713          
       
   714         // Update indicator 
       
   715         TInt  caseid = CaseByShiftCapslockStatus();         
       
   716          
       
   717          
       
   718         if ( aNotify && (currentRange == ERangeEnglish || currentRange == ERangeAccent))
       
   719             {
       
   720             TBuf<4> buf;
       
   721             TInt fepcase = FepCaseByCaseId( caseid );
       
   722             iDataProvider->SetData( EAknFepDataTypeCase, fepcase );
       
   723             buf.Append(reinterpret_cast<TText*>(&fepcase), 4);
       
   724             UiLayout()->LayoutOwner()->SignalOwner( ESignalCaseMode, buf );            
       
   725             }
       
   726 
       
   727                 
       
   728         if ( ( shiftDown && capslockDown ) || ( !shiftDown && !capslockDown  ) )
       
   729             {
       
   730             ChangeVkbLayout();
       
   731             }
       
   732         else
       
   733             {
       
   734             TAknFepVkbLayout vkbLayout = ShiftCapsSingleVkbLayoutId( currentRange );
       
   735             ChangeVkbLayout( vkbLayout );
       
   736             }
       
   737         }
       
   738     Draw();
       
   739     UpdateArea(Rect(), EFalse);    
       
   740     }
       
   741 
       
   742 // ---------------------------------------------------------------------------
       
   743 // CAknFepVkbClientArea::FepCaseByCaseId
       
   744 // (other items were commented in a header).
       
   745 // ---------------------------------------------------------------------------
       
   746 //
       
   747 TInt CAknFepVkbClientArea::FepCaseByCaseId( TInt aCaseId )
       
   748     {
       
   749     switch ( aCaseId )
       
   750         {
       
   751         case 0:
       
   752             return ECaseLower;
       
   753         case 1:
       
   754             return ECaseText;
       
   755         case 2:
       
   756             return ECaseUpper;
       
   757         case 3:        
       
   758             return ECaseInverseText;
       
   759         default:
       
   760             return ECaseLower;
       
   761         }        
       
   762     }
       
   763 
       
   764 // ---------------------------------------------------------------------------
       
   765 // CAknFepVkbClientArea::CaseByShiftCapslockStatus
       
   766 // (other items were commented in a header).
       
   767 // ---------------------------------------------------------------------------
       
   768 //
       
   769 TInt CAknFepVkbClientArea::CaseByShiftCapslockStatus()
       
   770     {
       
   771     TBool shiftDown = iDataProvider->RequestData(EAknFepDataTypeShfitDown); 
       
   772     TBool capslockDown = iDataProvider->RequestData(EAknFepDataTypeCapslockDown);
       
   773         
       
   774     return ( (TInt)capslockDown * 2 + (TInt)shiftDown );
       
   775     }
       
   776 
       
   777 void CAknFepVkbClientArea::ReorganizeZhuYinControls( TBool aShowArrowKey )
       
   778     {
       
   779     if ( UiLayout()->PenInputType() != EPluginInputModeFSQ )
       
   780         {
       
   781         return;
       
   782         }
       
   783 
       
   784     CAknFepCtrlRepeatButton* arrowUpBtn = static_cast<CAknFepCtrlRepeatButton*>
       
   785         ( ControlById( EAknFepVkbCtrlIdArrowUpBtn ) );
       
   786     CAknFepCtrlRepeatButton* arrowDownBtn = static_cast<CAknFepCtrlRepeatButton*>
       
   787         ( ControlById( EAknFepVkbCtrlIdArrowDownBtn ) );
       
   788     CAknFepCtrlRepeatButton* arrowLeftBtn = static_cast<CAknFepCtrlRepeatButton*>
       
   789         ( ControlById( EAknFepVkbCtrlIdArrowLeftBtn ) );
       
   790     CAknFepCtrlRepeatButton* arrowRightBtn = static_cast<CAknFepCtrlRepeatButton*>
       
   791         ( ControlById( EAknFepVkbCtrlIdArrowRightBtn ) );
       
   792     CAknFepVkbCompositionField* compositionField = static_cast<CAknFepVkbCompositionField*>
       
   793         (ControlById( EAknFepVkbCtrlIdCompositionField));
       
   794     CFepCtrlDropdownList* dropdownList = static_cast<CFepCtrlDropdownList*>
       
   795         (ControlById( EAknFepVkbCtrlIdCandidateList)); 
       
   796 
       
   797     if ( iDataProvider->RequestData(EAknFepDataTypeIMLayout) == EAknFepVkbImCnZhuyin )
       
   798         {
       
   799         if ( aShowArrowKey )
       
   800             {    
       
   801             compositionField->Hide(ETrue);
       
   802             dropdownList->Hide(ETrue);
       
   803             arrowUpBtn->Hide(EFalse);
       
   804             arrowDownBtn->Hide(EFalse);
       
   805             arrowLeftBtn->Hide(EFalse); 
       
   806             arrowRightBtn->Hide(EFalse);
       
   807             }
       
   808         else
       
   809             {
       
   810             arrowUpBtn->Hide(ETrue);
       
   811             arrowDownBtn->Hide(ETrue);
       
   812             arrowLeftBtn->Hide(ETrue);
       
   813             arrowRightBtn->Hide(ETrue);
       
   814             compositionField->Hide(EFalse);
       
   815             dropdownList->Hide(EFalse); 
       
   816             }
       
   817         }
       
   818     else if( iDataProvider->RequestData(EAknFepDataTypeIMLayout) == EAknFepVkbImCnPinyin ||
       
   819              iDataProvider->RequestData(EAknFepDataTypeIMLayout) == EAknFepVkbImCnStroke ||
       
   820              iDataProvider->RequestData(EAknFepDataTypeIMLayout) == EAknFepVkbImCnCangjie )
       
   821         {
       
   822         compositionField->Hide(EFalse);
       
   823         dropdownList->Hide(EFalse); 
       
   824         }
       
   825     }
       
   826 
       
   827     
       
   828 // ---------------------------------------------------------------------------
       
   829 // CAknFepVkbClientArea::ReorganizeControls
       
   830 // (other items were commented in a header).
       
   831 // ---------------------------------------------------------------------------
       
   832 //
       
   833 void CAknFepVkbClientArea::ReorganizeControls(CAknFepVkbImLayout* aImLayout,
       
   834                                               TBool aImLayoutChanged)
       
   835     {
       
   836     // First remove all controls in the group, but don't delete them
       
   837     Reset(aImLayoutChanged);
       
   838 
       
   839     // Then add controls according to the configuration of clientlayout
       
   840     RPointerArray<CAknFepControlInfo>& controlList = aImLayout->ControlInfoList();
       
   841     
       
   842     TInt count = controlList.Count();
       
   843     TInt controlID = 0;
       
   844 
       
   845     
       
   846     CFepUiBaseCtrl* ctrl = NULL;   
       
   847 
       
   848     TInt range = iDataProvider->RequestData(EAknFepDataTypeCurrentRange);
       
   849     TInt curLanguage = iDataProvider->RequestData(EAknFepDataTypeInputLanguage);
       
   850     
       
   851     TInt vkbLayoutId = GetDefaultVkbLayout(range);
       
   852     CPeninputVkbLayoutInfo* vkbLayout = iLayoutPool->GetVkbLayout(vkbLayoutId);
       
   853     
       
   854     TInt vkbRows = vkbLayout->Rows();
       
   855     TInt vkbColumns = vkbLayout->Columns();
       
   856     iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(vkbRows,vkbColumns));
       
   857     
       
   858     TPeninputCnCellType cellType = GetCellType(vkbColumns);
       
   859     iCellAidGap = iLafMgr->CellAidGap(cellType);
       
   860     
       
   861     TRect rect;
       
   862     TInt btnWidth = iDataProvider->RequestData(EAknFepDataTypeUnitWidth);
       
   863     TInt btnHeight = iDataProvider->RequestData(EAknFepDataTypeUnitHeight);
       
   864     TInt layoutType = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
   865     
       
   866     TInt candidateHeight = 0;
       
   867     if ( layoutType == EAknFepVkbImCnZhuyin )
       
   868     	{
       
   869     	candidateHeight = btnHeight;
       
   870     	}
       
   871     else if (UiLayout()->PenInputType() != EPluginInputModeFSQ)
       
   872     	{
       
   873     	candidateHeight = iLafMgr->KeypadRect().Height() / vkbRows + 1;
       
   874     	}
       
   875     else if (UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
   876         {
       
   877         candidateHeight = iLafMgr->KeypadRect().Height() / vkbRows;
       
   878         }
       
   879     	
       
   880     TSize size;
       
   881     TInt width = UiLayout()->PenInputType() == EPluginInputModeFSQ ?
       
   882     			 iLafMgr->EntirePaneRect().Width() : iLafMgr->KeypadRect().Width();
       
   883     if (range == ERangeNative)
       
   884     	{
       
   885 		size = TSize( width,
       
   886                       iLafMgr->KeypadRect().Height() 
       
   887                       + ( aImLayout->Rows() - vkbRows - 1)*btnHeight
       
   888                       + candidateHeight);
       
   889     	}
       
   890    	else
       
   891    		{
       
   892 		size = TSize( width,
       
   893 		              iLafMgr->KeypadRect().Height() 
       
   894 		              + ( aImLayout->Rows() - vkbRows)*btnHeight);
       
   895    		}
       
   896     
       
   897     if (UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
   898         {
       
   899         TRect screenrect;
       
   900         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenrect);
       
   901 
       
   902         size = screenrect.Size();
       
   903         }
       
   904     
       
   905     rect.SetSize( size );
       
   906     
       
   907     //Set owner rect
       
   908     SetWholeWindowRect(rect);
       
   909     
       
   910     TInt needJustify = iDataProvider->RequestData(EAknFepDataTypeNeedBRJustify);
       
   911     if (needJustify)
       
   912         {
       
   913         BottomRightJustify();
       
   914         iDataProvider->SetData(EAknFepDataTypeNeedBRJustify, EFalse);
       
   915         }
       
   916 
       
   917     TPoint point = Rect().iTl;
       
   918     TInt i = 0;
       
   919     // Copy ctrl ID from ctrl pool
       
   920     iRemainedPoolControlIDs.Reset();
       
   921     for( i = 0; i < iCtrlPool->ControlCount(); i++ )
       
   922     	{
       
   923     	TInt id = iCtrlPool->ControlByIndex(i)->ControlId();
       
   924     	iRemainedPoolControlIDs.Append(id);
       
   925     	}
       
   926     	
       
   927     for (i=0;i<count;i++)
       
   928         {
       
   929         controlID = controlList[i]->ControlID();
       
   930         ctrl = iCtrlPool->Control(controlID);
       
   931 
       
   932         if ( ctrl )
       
   933             {
       
   934             
       
   935             TRAP_IGNORE(AddControlL(ctrl));
       
   936             
       
   937 	        // Remove control IDs added to the control group in the array
       
   938 			TInt n = iRemainedPoolControlIDs.Find( controlID );
       
   939 			if( n != KErrNotFound)
       
   940 				iRemainedPoolControlIDs.Remove(n);            
       
   941             }        
       
   942         }
       
   943     
       
   944     if ( iCtrlList.Count() != count )
       
   945         {
       
   946         return;
       
   947         }
       
   948     TRect optionRect;
       
   949     TRect compositionRect;
       
   950     TRect innerRect;
       
   951     
       
   952     if (range == ERangeNative)
       
   953         {
       
   954         if ( layoutType == EAknFepVkbImCnZhuyin )
       
   955             {
       
   956             // Option Btn
       
   957             optionRect.iTl = Rect().iTl;
       
   958             optionRect.SetSize(TSize(btnWidth, btnHeight));
       
   959             AknPenImageUtils::CalculateGraphicRect( optionRect, innerRect );
       
   960             static_cast<CAknFepCtrlEventButton*>
       
   961                 (ControlById(EAknFepVkbCtrlIdTouchInputOption))->SizeChanged(optionRect, 
       
   962                                                                              innerRect, 
       
   963                                                                              ETrue);
       
   964             
       
   965             TRect arrowRect;
       
   966             TRect innerRect;
       
   967             
       
   968             if ( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
   969                 {
       
   970                 arrowRect.iTl = TPoint( optionRect.iBr.iX, optionRect.iTl.iY );
       
   971                 arrowRect.SetSize(TSize(btnWidth + btnWidth, btnHeight));
       
   972                 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   973                 static_cast<CAknFepCtrlRepeatButton*>
       
   974                     ( ControlById( EAknFepVkbCtrlIdArrowUpBtn ) )->SizeChanged(arrowRect, 
       
   975                                                                                innerRect, 
       
   976                                                                                ETrue);
       
   977                     
       
   978                 arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY);
       
   979                 arrowRect.SetSize(TSize(btnWidth + btnWidth, btnHeight));
       
   980                 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   981                 static_cast<CAknFepCtrlRepeatButton*>
       
   982                     ( ControlById( EAknFepVkbCtrlIdArrowDownBtn ) )->SizeChanged(arrowRect,
       
   983                                                                                  innerRect, 
       
   984                                                                                  ETrue);
       
   985                     
       
   986                 arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY);
       
   987                 arrowRect.SetSize(TSize(btnWidth + btnWidth, btnHeight));
       
   988                 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   989                 static_cast<CAknFepCtrlRepeatButton*>
       
   990                     ( ControlById( EAknFepVkbCtrlIdArrowLeftBtn ) )->SizeChanged(arrowRect, 
       
   991                                                                                  innerRect, 
       
   992                                                                                  ETrue);
       
   993                     
       
   994                 arrowRect.iTl = TPoint(arrowRect.iBr.iX, arrowRect.iTl.iY);
       
   995                 arrowRect.SetSize(TSize(btnWidth + btnWidth, btnHeight));
       
   996                 AknPenImageUtils::CalculateGraphicRect( arrowRect, innerRect );
       
   997                 static_cast<CAknFepCtrlRepeatButton*>
       
   998                     ( ControlById( EAknFepVkbCtrlIdArrowRightBtn ) )->SizeChanged(arrowRect, 
       
   999                                                                                   innerRect, 
       
  1000                                                                                   ETrue);
       
  1001                 }
       
  1002             
       
  1003             compositionRect.iTl = TPoint(optionRect.iBr.iX, optionRect.iTl.iY);
       
  1004             compositionRect.SetSize(TSize(btnWidth * 3 + iCellAidGap, candidateHeight));
       
  1005             }
       
  1006 	        else
       
  1007 	            {
       
  1008 	            compositionRect.iTl = Rect().iTl;
       
  1009 	            compositionRect.SetSize(TSize(btnWidth * 3 + iCellAidGap, candidateHeight));
       
  1010 	            }
       
  1011         iCompositionField->SetReady(ETrue);
       
  1012         iCompositionField->Hide(EFalse);
       
  1013         iCompositionField->SizeChanged(compositionRect);    
       
  1014         
       
  1015         TRect candidateRect;
       
  1016         candidateRect.iTl = TPoint(compositionRect.iBr.iX, compositionRect.iTl.iY);
       
  1017         candidateRect.SetSize(TSize(btnWidth * 6, candidateHeight));        
       
  1018              
       
  1019         static_cast<CFepCtrlDropdownList*>(ControlById( EAknFepVkbCtrlIdCandidateList))->
       
  1020         		SizeChanged(btnWidth, candidateHeight, btnWidth, candidateRect.iTl);    
       
  1021         if( iDropdownList && iDropdownList->Hiden() )
       
  1022         	iDropdownList->Hide(EFalse);      
       
  1023         
       
  1024         ReorganizeZhuYinControls( ETrue );
       
  1025         }
       
  1026     else
       
  1027         {
       
  1028         // Hide composition field when is not native range, since
       
  1029         // Hide process also can deregister its tactile feedback
       
  1030         // area, or else click button '3' when it is dimmed will 
       
  1031         // cause tactile feedback, because '3' is just at the same
       
  1032         // place in number range as the composition filed in the 
       
  1033         // native range.
       
  1034         if (iCompositionField)
       
  1035             iCompositionField->Hide(ETrue);
       
  1036                 
       
  1037         if( iDropdownList && !iDropdownList->Hiden() )
       
  1038         	iDropdownList->Hide(ETrue);
       
  1039         }
       
  1040     iVkbBoardLeftTop = Rect().iTl;
       
  1041     if (range == ERangeNative)
       
  1042         {
       
  1043         if( layoutType == EAknFepVkbImCnZhuyin )
       
  1044             {
       
  1045             iVkbBoardLeftTop = TPoint(optionRect.iTl.iX, optionRect.iBr.iY);
       
  1046             }
       
  1047         else
       
  1048             {
       
  1049             iVkbBoardLeftTop = TPoint(compositionRect.iTl.iX, compositionRect.iBr.iY);
       
  1050             }
       
  1051         }
       
  1052     //TPoint vkbLeftTop = iVkbBoardLeftTop;
       
  1053 	iVkbBoardLeftTop.iX += UiLayout()->PenInputType() == EPluginInputModeFSQ ?
       
  1054 						   iLafMgr->KeypadRect().iTl.iX : 0;
       
  1055 	// After update LAF data for grid gap feature, the keyboard height is cut.
       
  1056 	// This modification affact FSQ window size.
       
  1057 	TInt yAxisOffset = UiLayout()->PenInputType() == EPluginInputModeFSQ ?
       
  1058 						   3 : 0;				   
       
  1059 	iVkbBoardLeftTop.iY += yAxisOffset;
       
  1060 						   	   						   
       
  1061     TRect vkbRect = TRect( iVkbBoardLeftTop, iLafMgr->KeypadRect().Size() );
       
  1062     CPeninputVkbCtrlExt* vkbCtrl = 
       
  1063                         static_cast<CPeninputVkbCtrlExt*>(ControlById( EAknFepVkbCtrlIdVkbCtrl));
       
  1064     vkbCtrl->SetRect( vkbRect );
       
  1065     vkbCtrl->SetFont( iLafMgr->KeyTextFont() );
       
  1066 	vkbCtrl->SetTextLineLayout( iLafMgr->KeyTextLayout() );
       
  1067     vkbCtrl->SetTextFormat( iLafMgr->KeyTextLayout() );  //Read laf 
       
  1068     
       
  1069     TInt tempHeightForFSQ = btnHeight;
       
  1070     if (UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
  1071     	{
       
  1072         tempHeightForFSQ = btnHeight + 3;	
       
  1073     	}
       
  1074     
       
  1075     TPoint rangeBarRefPoint = TPoint(vkbRect.iTl.iX, vkbRect.iBr.iY);
       
  1076     rangeBarRefPoint.iY += yAxisOffset;
       
  1077     
       
  1078     if (range != ERangeNative)
       
  1079         {
       
  1080         TRect shiftRect;
       
  1081         shiftRect.iTl = TPoint(Rect().iTl.iX, vkbRect.iBr.iY);
       
  1082         shiftRect.iTl.iY += yAxisOffset; 
       
  1083         shiftRect.SetSize(TSize(btnWidth, tempHeightForFSQ)); 
       
  1084         AknPenImageUtils::CalculateGraphicRect( shiftRect, innerRect );       
       
  1085         ControlById( EAknFepVkbCtrlIdShiftBtn)->SetReady(ETrue);    
       
  1086         static_cast<CAknFepCtrlMultiModeButton*>(ControlById( EAknFepVkbCtrlIdShiftBtn))->
       
  1087         					SizeChanged(shiftRect, innerRect, ETrue);    
       
  1088         
       
  1089         rangeBarRefPoint = TPoint(shiftRect.iBr.iX, shiftRect.iTl.iY);
       
  1090         }
       
  1091     
       
  1092     TRect rangeBarRect;
       
  1093     //rangeBarRect.iTl = TPoint(shiftRect.iBr.iX, shiftRect.iTl.iY);
       
  1094     rangeBarRect.iTl = rangeBarRefPoint;
       
  1095     rangeBarRect.SetSize(TSize(btnWidth, tempHeightForFSQ));
       
  1096     static_cast<CAknFepCtrlRangeBar*>
       
  1097                    (ControlById( EAknFepVkbCtrlIdRangeBar))->SizeChanged(rangeBarRect);
       
  1098     rangeBarRect = 
       
  1099                 static_cast<CAknFepCtrlRangeBar*>(ControlById( EAknFepVkbCtrlIdRangeBar))->Rect();
       
  1100 
       
  1101     TRect spaceBtnRect;
       
  1102     TInt spaceWidthCount = 4;
       
  1103  /*   if( range == ERangeNumber && UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
  1104     	{
       
  1105     	spaceWidthCount = 5;
       
  1106     	}*/
       
  1107     	
       
  1108     if (range == ERangeNative || curLanguage == ELangTaiwanChinese)
       
  1109         {
       
  1110         spaceWidthCount =  (vkbLayoutId == EAknFepVkbVkbCnZhuyinInitial) ? 6 : 5;
       
  1111         }
       
  1112     
       
  1113     TInt defaultIMLayout = iDataProvider->RequestData(EAknFepDataTypeDefaultIMLayout);
       
  1114     if (curLanguage == ELangTaiwanChinese && 
       
  1115         defaultIMLayout == EAknFepVkbImCnStroke && range != ERangeNative)
       
  1116         {
       
  1117         spaceWidthCount = 4;
       
  1118         }
       
  1119     
       
  1120     spaceBtnRect.iTl = TPoint(rangeBarRect.iBr.iX, rangeBarRect.iTl.iY);
       
  1121     spaceBtnRect.SetSize(TSize(btnWidth * spaceWidthCount + iCellAidGap, tempHeightForFSQ));
       
  1122     //AknPenImageUtils::CalculateGraphicRect( spaceBtnRect, innerRect );
       
  1123     innerRect = spaceBtnRect;
       
  1124     TSize iconOffset = iLafMgr->GetSpaceIconOffset();
       
  1125     innerRect.Shrink( iconOffset );
       
  1126     
       
  1127     static_cast<CAknFepCtrlEventButton*>
       
  1128         (ControlById(EAknFepVkbCtrlIdSpaceBtn))->SizeChanged(spaceBtnRect, innerRect, ETrue);
       
  1129         
       
  1130     TRect spaceIconRect = innerRect;
       
  1131     spaceIconRect.Shrink( iLafMgr->GetSpaceSideIconWidth(), 0);
       
  1132 	static_cast<CAknFepCtrlEventButton*>
       
  1133         (ControlById(EAknFepVkbCtrlIdSpaceBtn))->SetDraw3PieceFrameInfo(
       
  1134                             TDraw3PiecesFrame(KAknsIIDQgnIndiInputSpaceL,
       
  1135 													  KAknsIIDQgnIndiInputSpaceMiddle,
       
  1136 													  KAknsIIDQgnIndiInputSpaceR,
       
  1137 													  spaceIconRect));    
       
  1138     
       
  1139     TRect returnBtnRect;
       
  1140     returnBtnRect.iTl = TPoint(spaceBtnRect.iBr.iX, spaceBtnRect.iTl.iY);
       
  1141     returnBtnRect.SetSize(TSize(btnWidth, tempHeightForFSQ));
       
  1142     AknPenImageUtils::CalculateGraphicRect( returnBtnRect, innerRect );
       
  1143     static_cast<CAknFepCtrlEventButton*>
       
  1144         (ControlById(EAknFepVkbCtrlIdEnterBtn))->SizeChanged(returnBtnRect, innerRect, ETrue);
       
  1145         
       
  1146     TRect inputModeSwitchBtnRect;
       
  1147     inputModeSwitchBtnRect.iTl = TPoint(returnBtnRect.iBr.iX, returnBtnRect.iTl.iY);
       
  1148     inputModeSwitchBtnRect.SetSize(TSize(btnWidth, tempHeightForFSQ));
       
  1149     AknPenImageUtils::CalculateGraphicRect( inputModeSwitchBtnRect, innerRect );
       
  1150     static_cast<CAknFepCtrlEventButton*>
       
  1151         (ControlById(EAknFepVkbCtrlIdSwitchToHwrBtn))->SizeChanged(inputModeSwitchBtnRect, 
       
  1152                                                                    innerRect, 
       
  1153                                                                    ETrue);        
       
  1154     }
       
  1155     
       
  1156 // ---------------------------------------------------------------------------
       
  1157 // CAknFepVkbClientArea::Reset
       
  1158 // (other items were commented in a header).
       
  1159 // ---------------------------------------------------------------------------
       
  1160 //
       
  1161 void CAknFepVkbClientArea::Reset(TBool aImLayoutChanged)
       
  1162     {
       
  1163     iActiveCtrl = NULL;
       
  1164     iCtrlList.Reset();
       
  1165 
       
  1166     if (aImLayoutChanged)
       
  1167         {
       
  1168         iVkbCtrl->Reset();
       
  1169         }
       
  1170     }
       
  1171 
       
  1172 // ---------------------------------------------------------------------------
       
  1173 // CAknFepVkbClientArea::HandleControlEvent
       
  1174 // (other items were commented in a header).
       
  1175 // ---------------------------------------------------------------------------
       
  1176 //
       
  1177 void CAknFepVkbClientArea::HandleControlEvent(TInt aEventType,
       
  1178                                               CFepUiBaseCtrl* aCtrl,
       
  1179                                               const TDesC& aEventData)
       
  1180     {
       
  1181     TInt* data = (TInt*) aEventData.Ptr();
       
  1182     TInt layoutType = iDataProvider->RequestData(EAknFepDataTypeIMLayout); 
       
  1183     switch (aEventType)
       
  1184         {
       
  1185         case EVkbEventResetShift:
       
  1186             LoopVkbLayout(EVkbCapslock, ETrue);
       
  1187             break;
       
  1188 
       
  1189         case EVkbEventSetPermittedRange:
       
  1190             iRangeBar->SetPermittedRanges(*data);
       
  1191             break;
       
  1192         case EVkbEventPositionChanged:
       
  1193             {
       
  1194             TInt style = *( ( TUint16* ) aEventData.Ptr() );
       
  1195             CalculatePosition( style );
       
  1196             }
       
  1197             break;
       
  1198                 
       
  1199         //Events need to send to composition field 
       
  1200         case EVkbEventWindowClose:
       
  1201         case EVkbEventCandidateSelected:
       
  1202         case EVkbEventCompFieldAnalysisResponse:
       
  1203         case EPeninputLayoutEventBack:
       
  1204         case EVkbEventKeySpace:
       
  1205         case EVkbEventKeyEnter:
       
  1206         case EEventVirtualKeyUp:
       
  1207         case EVkbEventLeftArrow:
       
  1208         case EVkbEventRightArrow:
       
  1209             {
       
  1210             TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
  1211 
       
  1212             if ((imLayout == EAknFepVkbImCnStroke) && (aEventType == EVkbEventKeySpace))
       
  1213             	{
       
  1214                 TBuf<1> buf;
       
  1215                 buf.Append(KStrokeSeparator);
       
  1216                 iCompositionField->HandleControlEvent(aEventType,aCtrl,buf);
       
  1217             	}
       
  1218             else if(((imLayout == EAknFepVkbImCnPinyin)) 
       
  1219                     && (aEventType == EVkbEventKeySpace))
       
  1220                 {
       
  1221                 TBuf<1> buf;
       
  1222                 buf.Append(KPinyinSeparator);
       
  1223                 iCompositionField->HandleControlEvent(aEventType,aCtrl,buf);
       
  1224                 }
       
  1225             else
       
  1226                 {
       
  1227                 iCompositionField->HandleControlEvent(aEventType,aCtrl,aEventData);	
       
  1228                 }
       
  1229             }
       
  1230 
       
  1231             break;
       
  1232         case EVkbEventCompFieldDataFlush:
       
  1233             UiLayout()->SignalOwner(ESignalKeyEvent,aEventData);                         
       
  1234             ClearCandidatesInList();
       
  1235             ReorganizeZhuYinControls( ETrue ); 
       
  1236             break;
       
  1237             
       
  1238         case EVkbEventClearContent:
       
  1239             {
       
  1240             TBool isChineseInputting = EFalse;
       
  1241             TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
  1242             if(imLayout == EAknFepVkbImCnPinyin ||
       
  1243                imLayout == EAknFepVkbImCnZhuyin ||
       
  1244                imLayout == EAknFepVkbImCnStroke ||
       
  1245                imLayout == EAknFepVkbImCnCangjie)
       
  1246                 {
       
  1247                 isChineseInputting = ETrue;
       
  1248                 }
       
  1249             
       
  1250             if (isChineseInputting)
       
  1251                 {
       
  1252                 //Clear context in composition field
       
  1253                 iCompositionField->HandleControlEvent(aEventType,aCtrl,aEventData);
       
  1254                 }
       
  1255             //Clear all candidates in the list if needed
       
  1256             if ( layoutType!= EAknFepVkbImLatin )
       
  1257                 {
       
  1258                 if (isChineseInputting)
       
  1259                     {
       
  1260                     ClearCandidatesInList();
       
  1261                     }
       
  1262                 ReorganizeZhuYinControls( ETrue ); 
       
  1263                 }
       
  1264             }
       
  1265             break;            
       
  1266         case EVkbEventCompFieldNoChars:
       
  1267             //Clear all candidates in the list
       
  1268             ClearCandidatesInList();
       
  1269             ReorganizeZhuYinControls( ETrue ); 
       
  1270             break;
       
  1271             
       
  1272         case EEventControlFocusGained:
       
  1273             if ( *data == ECompotisionFieldGetFocus )
       
  1274                 {
       
  1275                 iCompositionField->HandleControlEvent(aEventType,aCtrl,aEventData);
       
  1276                 }
       
  1277             break;
       
  1278         case EEventControlFocusLost:
       
  1279             if ( ( aCtrl ) && ( aCtrl->ControlId() == EPeninputWindowCtrlIdMultiLineICF) )
       
  1280                 {
       
  1281                 iCompositionField->HandleControlEvent(aEventType,aCtrl,aEventData);
       
  1282                 }
       
  1283             break;
       
  1284         //Events sent to composition field are over
       
  1285         
       
  1286         case EVkbEventResetShiftCapslock:
       
  1287 //            ChangeButtonStatus(EFalse, EAknFepVkbCtrlIdShiftBtn);
       
  1288 //            ChangeButtonStatus(EFalse, EAknFepVkbCtrlIdCapslockBtn);
       
  1289             ChangeMergedButtonStatus(0, 0);
       
  1290             break;
       
  1291         case EVkbEventCandidatesChanged:
       
  1292             {
       
  1293             RPointerArray<HBufC>* list = (RPointerArray<HBufC>*)aCtrl;
       
  1294             if (list && iCompositionField->IsValidSpell() )
       
  1295                 {
       
  1296                 ReorganizeZhuYinControls( EFalse );
       
  1297                 if(UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
  1298                     {
       
  1299                     TRAP_IGNORE(iDropdownList->SetCandidatesL(*list,
       
  1300                                 CFepCtrlDropdownList::EListExpandableWithBubble));
       
  1301                     }
       
  1302                 else
       
  1303                     {
       
  1304                     TRAP_IGNORE(iDropdownList->SetCandidatesL(*list,
       
  1305                                 CFepCtrlDropdownList::EListExpandable));
       
  1306                     }
       
  1307                 }               
       
  1308             else
       
  1309                 {
       
  1310                 ClearCandidatesInList();    
       
  1311 				// Not display arrow keys when composition field get focus
       
  1312                 if(!(iCompositionField->IsFocused()))
       
  1313                     {
       
  1314                     ReorganizeZhuYinControls( ETrue );
       
  1315                     }
       
  1316                 }
       
  1317             }
       
  1318             break;
       
  1319        	case EVkbEventGetNextPageCandidate:
       
  1320        	    {
       
  1321             RPointerArray<HBufC>* list = (RPointerArray<HBufC>*)aCtrl;
       
  1322             
       
  1323             if (list)
       
  1324                 {
       
  1325             	TRAP_IGNORE(iDropdownList->AddCandidatesL(*list,
       
  1326                                                         CFepCtrlDropdownList::EListExpandable));
       
  1327                 }
       
  1328        	    }
       
  1329        	    break;
       
  1330         case EVkbEventComposition2Standby:
       
  1331             //Change vkb layout to standy ui state
       
  1332             if ( layoutType == EAknFepVkbImCnPinyin)
       
  1333                 {
       
  1334                 ChangeVkbLayout(EAknFepVkbVkbCnPinyinInitial);
       
  1335                 }
       
  1336             else if ( layoutType == EAknFepVkbImCnZhuyin)
       
  1337                 {
       
  1338                 ChangeVkbLayout(EAknFepVkbVkbCnZhuyinInitial);
       
  1339                 }           
       
  1340             else if ( layoutType == EAknFepVkbImCnStroke || EAknFepVkbImCnCangjie)
       
  1341                 {
       
  1342                 iVkbCtrl->CancelDims();
       
  1343                 }       
       
  1344             break;
       
  1345         case EVkbEventStandby2Composition:
       
  1346         	TRAP_IGNORE( HandleStandby2CompositionEventL() );
       
  1347             break;
       
  1348         default:
       
  1349             break;    
       
  1350         }      
       
  1351     }
       
  1352 
       
  1353 // ---------------------------------------------------------------------------
       
  1354 // CAknFepVkbClientArea::CompositionFieldStringLength
       
  1355 // (other items were commented in a header).
       
  1356 // ---------------------------------------------------------------------------
       
  1357 //
       
  1358 TInt CAknFepVkbClientArea::CompositionFieldStringLength()
       
  1359     {
       
  1360     if ( iCurrentImLayout->FindControlInfo(EAknFepVkbCtrlIdCompositionField) )
       
  1361         {
       
  1362         if ( iCompositionField )
       
  1363             {
       
  1364             return iCompositionField->Length();
       
  1365             }        
       
  1366         }
       
  1367         
       
  1368     return 0;
       
  1369     }
       
  1370 
       
  1371 // ---------------------------------------------------------------------------
       
  1372 // CAknFepVkbClientArea::GetDefaultVkbLayout
       
  1373 // (other items were commented in a header).
       
  1374 // ---------------------------------------------------------------------------
       
  1375 //
       
  1376 TAknFepVkbLayout CAknFepVkbClientArea::GetDefaultVkbLayout(const TInt aRange)
       
  1377     {
       
  1378     TInt defaultIMLayout = iDataProvider->RequestData(EAknFepDataTypeDefaultIMLayout);
       
  1379     
       
  1380     TInt curLanguage = iDataProvider->RequestData(EAknFepDataTypeInputLanguage);
       
  1381     TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
  1382     switch (aRange)
       
  1383         {
       
  1384         case ERangeNative:
       
  1385             {
       
  1386             switch (imLayout)
       
  1387                 {
       
  1388                 case EAknFepVkbImCnPinyin:
       
  1389                     return EAknFepVkbVkbCnPinyinInitial;
       
  1390                 case EAknFepVkbImCnZhuyin:
       
  1391                     return EAknFepVkbVkbCnZhuyinInitial;
       
  1392                 case EAknFepVkbImCnStroke:
       
  1393                     return EAknFepVkbVkbCnStroke;
       
  1394                 case EAknFepVkbImCnCangjie:
       
  1395                     return EAknFepVkbVkbCnCangjie;                
       
  1396                 }
       
  1397             }
       
  1398         	if (curLanguage == ELangTaiwanChinese && defaultIMLayout != EAknFepVkbImCnStroke)
       
  1399         		{
       
  1400         		return EAknFepVkbVkbLatinForZhuyin;
       
  1401         		}
       
  1402         	else 
       
  1403         		{
       
  1404         		return EAknFepVkbVkbLatin;
       
  1405         		}
       
  1406         case ERangeEnglish:
       
  1407         	if (curLanguage == ELangTaiwanChinese && defaultIMLayout != EAknFepVkbImCnStroke)
       
  1408         		{
       
  1409         		return EAknFepVkbVkbLatinForZhuyin;
       
  1410         		}
       
  1411         	else 
       
  1412         		{
       
  1413         		return EAknFepVkbVkbLatin;
       
  1414         		}
       
  1415         	    
       
  1416         case ERangeNumber:
       
  1417         	if (curLanguage == ELangTaiwanChinese && defaultIMLayout != EAknFepVkbImCnStroke)
       
  1418         		{
       
  1419         		return EAknFepVkbVkbNumberForZhuyin;
       
  1420         		}
       
  1421         	else 
       
  1422         		{
       
  1423         		return EAknFepVkbVkbNumber;
       
  1424         		}        
       
  1425         case ERangeSymbol:
       
  1426             return EAknFepVkbVkbSymbol;
       
  1427         case ERangeAccent:
       
  1428             {
       
  1429             TInt accent = iDataProvider->RequestData(EAknFepDataTypeCurrentAccent);    
       
  1430             switch (accent)
       
  1431                 {
       
  1432                 case EAknFepVkbVkbAccented1:
       
  1433                     return EAknFepVkbVkbAccented1;
       
  1434                 case EAknFepVkbVkbAccented2:
       
  1435                     return EAknFepVkbVkbAccented2; 
       
  1436                 case EAknFepVkbVkbAccented3:
       
  1437                     return EAknFepVkbVkbAccented3; 
       
  1438                 default:
       
  1439                     return EAknFepVkbVkbAccented1;
       
  1440                 }    
       
  1441             }
       
  1442         default:
       
  1443         	if (curLanguage == ELangTaiwanChinese && defaultIMLayout != EAknFepVkbImCnStroke)
       
  1444         		{
       
  1445         		return EAknFepVkbVkbLatinForZhuyin;
       
  1446         		}
       
  1447         	else 
       
  1448         		{
       
  1449         		return EAknFepVkbVkbLatin;
       
  1450         		}
       
  1451         }
       
  1452     }
       
  1453               
       
  1454 // ---------------------------------------------------------------------------
       
  1455 // CAknFepVkbClientArea::SetWholeWindowRect
       
  1456 // (other items were commented in a header).
       
  1457 // ---------------------------------------------------------------------------
       
  1458 //
       
  1459 void CAknFepVkbClientArea::SetWholeWindowRect(const TRect& aRect)
       
  1460     {
       
  1461     TRect rect = aRect;
       
  1462     
       
  1463     TInt btnHeight = iDataProvider->RequestData(EAknFepDataTypeUnitHeight);
       
  1464     //rect.iTl.iY = rect.iTl.iY - iDataProvider->RequestData(EAknFepDataTypeUnitHeight) * 2;
       
  1465     TInt imLayout = iDataProvider->RequestData(EAknFepDataTypeIMLayout);
       
  1466     TInt titlebarHeight = iDataProvider->RequestData(EAknFepDataTypeTitleBarHeight); 
       
  1467 
       
  1468     rect.iTl.iY = aRect.iTl.iY - titlebarHeight;
       
  1469     
       
  1470     
       
  1471     iTopParent->SetRect(rect);
       
  1472     
       
  1473     TPoint tl = TPoint( iTopParent->Rect().iTl.iX,
       
  1474                         iTopParent->Rect().iTl.iY + titlebarHeight );
       
  1475     
       
  1476     //rect.SetSize(TSize((10 * iUnitWidth), iDataProvider->RequestData(EAknFepDataTypeUnitHeight) * 2 + 6 * iUnitHeight));
       
  1477 
       
  1478     SetRect( TRect( tl, iTopParent->Rect().iBr ) );
       
  1479     
       
  1480 
       
  1481     }
       
  1482 
       
  1483 // ---------------------------------------------------------------------------
       
  1484 // CAknFepVkbWindow::CalculatePosition
       
  1485 // (other items were commented in a header).
       
  1486 // ---------------------------------------------------------------------------
       
  1487 //
       
  1488 void CAknFepVkbClientArea::CalculatePosition( TInt aJustifyMode )
       
  1489     {
       
  1490     switch ( aJustifyMode )
       
  1491         {
       
  1492         case EVkbPositionChangeBrJustify:
       
  1493             BottomRightJustify();
       
  1494             break;
       
  1495             
       
  1496         case EVkbPositionChangeDataQuery:
       
  1497             //BottomRightJustify();
       
  1498             DataQueryJustify();
       
  1499             break;
       
  1500         
       
  1501         /*case EVkbPositionChangeNone:
       
  1502             break;*/
       
  1503             
       
  1504         default:
       
  1505             TopLeftJustify();
       
  1506             break;;                    
       
  1507         }        
       
  1508     }
       
  1509 
       
  1510 // ---------------------------------------------------------------------------
       
  1511 // CAknFepVkbClientArea::TopLeftJustify
       
  1512 // (other items were commented in a header).
       
  1513 // ---------------------------------------------------------------------------
       
  1514 //   
       
  1515 void CAknFepVkbClientArea::TopLeftJustify()
       
  1516     {
       
  1517     // Read position from datamgr 
       
  1518     TRect newRect = TRect(UiLayout()->Position(),UiLayout()->Rect().Size());
       
  1519     TPoint tl = UiLayout()->Position();     
       
  1520                
       
  1521     if (tl.iX < 0)
       
  1522         {
       
  1523         tl.iX = 0;
       
  1524         }
       
  1525     
       
  1526     if (tl.iY < 0)
       
  1527         {
       
  1528         tl.iY = 0;  
       
  1529         }
       
  1530         
       
  1531     newRect.iTl = tl;
       
  1532     newRect.SetSize(iTopParent->Rect().Size());    
       
  1533     
       
  1534     if (newRect != UiLayout()->Rect())
       
  1535         {
       
  1536         //Write the new position into CenRep
       
  1537         TInt x = 0;
       
  1538         TInt y = 0;
       
  1539         x = 0x0000FFFF & newRect.iBr.iX;
       
  1540         y = 0xFFFF0000 & ( newRect.iBr.iY << 16 );      
       
  1541         iDataProvider->SetData(EAknFepDataTypeWindowPosition,x | y);                    
       
  1542         }
       
  1543         
       
  1544     //Set the layout position
       
  1545     UiLayout()->SetRect(newRect);
       
  1546     }
       
  1547 
       
  1548 // ---------------------------------------------------------------------------
       
  1549 // CAknFepVkbClientArea::BottomRightJustify
       
  1550 // (other items were commented in a header).
       
  1551 // ---------------------------------------------------------------------------
       
  1552 //    
       
  1553 void CAknFepVkbClientArea::BottomRightJustify()
       
  1554     {
       
  1555     if(UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
  1556         {
       
  1557         return;
       
  1558         }    
       
  1559     
       
  1560     // Read position from datamgr 
       
  1561     TRect newRect = TRect(UiLayout()->Position(),UiLayout()->Rect().Size());
       
  1562     TPoint oldbr,br;
       
  1563     TPoint tl;  
       
  1564     TSize screenSize;
       
  1565     
       
  1566     TInt screenSizeData = iDataProvider->RequestData(EAknFepDataTypeScreenSize);
       
  1567     screenSize.iWidth = screenSizeData & 0x0000FFFF;
       
  1568     screenSize.iHeight = ( screenSizeData & 0xFFFF0000 ) >> 16; 
       
  1569     
       
  1570     TRect screenRect = TRect(TPoint(0,0),screenSize);
       
  1571     
       
  1572     TInt windowPosition = iDataProvider->RequestData(EAknFepDataTypeWindowPosition);
       
  1573 
       
  1574     oldbr.iX = windowPosition & 0x0000FFFF;
       
  1575     oldbr.iY = ( windowPosition & 0xFFFF0000 ) >> 16;    
       
  1576     
       
  1577     br = oldbr;
       
  1578         
       
  1579     if ( !screenRect.Contains(br) )
       
  1580         {
       
  1581         if (screenSize.iWidth < br.iX)
       
  1582             {
       
  1583             br.iX = screenSize.iWidth;
       
  1584             }
       
  1585         if (screenSize.iHeight < br.iY)
       
  1586             {
       
  1587             br.iY = screenSize.iHeight;
       
  1588             }
       
  1589         }
       
  1590     
       
  1591     // Check the top left point is in screen
       
  1592     tl.iX = br.iX - UiLayout()->Rect().Width();
       
  1593     if (tl.iX < 0)
       
  1594         {
       
  1595         tl.iX = 0;
       
  1596         }
       
  1597 
       
  1598     tl.iY = br.iY - UiLayout()->Rect().Height();        
       
  1599     if (tl.iY < 0)
       
  1600         {
       
  1601         tl.iY = 0;  
       
  1602         }
       
  1603         
       
  1604     if (UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
  1605         {
       
  1606         tl.iX = 0;
       
  1607         tl.iY = 0;
       
  1608         }
       
  1609     newRect.iTl = tl;
       
  1610     newRect.SetSize(UiLayout()->Rect().Size());    
       
  1611     
       
  1612     if (oldbr != newRect.iBr)
       
  1613         {
       
  1614         //Write the new position into CenRep
       
  1615         TInt x = 0;
       
  1616         TInt y = 0;
       
  1617         x = 0x0000FFFF & newRect.iBr.iX;
       
  1618         y = 0xFFFF0000 & ( newRect.iBr.iY << 16 );
       
  1619         iDataProvider->SetData(EAknFepDataTypeWindowPosition,x | y);
       
  1620 
       
  1621         //Set the layout position
       
  1622         UiLayout()->SetRect(TRect(tl,newRect.Size()));
       
  1623         }
       
  1624         
       
  1625     //Set the layout position
       
  1626     UiLayout()->SetRect(newRect);
       
  1627     }
       
  1628 
       
  1629 // ---------------------------------------------------------------------------
       
  1630 // CAknFepVkbClientArea::DataQueryJustify
       
  1631 // (other items were commented in a header).
       
  1632 // ---------------------------------------------------------------------------
       
  1633 //   
       
  1634 void CAknFepVkbClientArea::DataQueryJustify()
       
  1635     {
       
  1636     TRect* dataQueryRect = (TRect*) (iDataProvider->RequestData(EAknFepDataTypeDataQueryRect));
       
  1637     
       
  1638     TRect rect = TRect(UiLayout()->Position(),UiLayout()->Rect().Size());
       
  1639     
       
  1640 	CCoeEnv* coeEnv = CCoeEnv::Static();
       
  1641     TPixelsTwipsAndRotation ptSize;     
       
  1642     coeEnv->ScreenDevice()->GetDefaultScreenSizeAndRotation(ptSize);    
       
  1643 
       
  1644 	// Landscape mode: move window to the br of the screen
       
  1645     if (ptSize.iPixelSize.iWidth > ptSize.iPixelSize.iHeight)
       
  1646     	{
       
  1647     	rect.SetRect(ptSize.iPixelSize.iWidth - rect.Width(), 
       
  1648     			     ptSize.iPixelSize.iHeight/2 - rect.Height()/2,
       
  1649     			     ptSize.iPixelSize.iWidth, 
       
  1650     			     ptSize.iPixelSize.iHeight/2 + rect.Height()/2);
       
  1651     	}
       
  1652 	// Portrait mode: dodge the dataquery   	
       
  1653     else if ( rect.Intersects(*dataQueryRect) )
       
  1654         {
       
  1655         TInt Y = dataQueryRect->iTl.iY;
       
  1656         TInt height = rect.iBr.iY - rect.iTl.iY;
       
  1657         rect.iTl.iY = Y - height;
       
  1658         rect.iBr.iY = Y;
       
  1659         if( rect.iTl.iY <0 )
       
  1660             {
       
  1661             rect.iTl.iY = 0;
       
  1662             rect.iBr.iY = height;
       
  1663             }
       
  1664         }
       
  1665 
       
  1666 
       
  1667     //Write the new position into CenRep
       
  1668     TInt x = 0;
       
  1669     TInt y = 0;
       
  1670     x = 0x0000FFFF & rect.iBr.iX;
       
  1671     y = 0xFFFF0000 & ( rect.iBr.iY << 16 );     
       
  1672     iDataProvider->SetData(EAknFepDataTypeWindowPosition,x | y);           
       
  1673 
       
  1674     //Set the layout position
       
  1675     UiLayout()->SetRect(rect);
       
  1676 
       
  1677     /*    
       
  1678     TInt fontHeight = aData & 0x0000FFFF;
       
  1679     
       
  1680     TInt bottomY = ( aData & 0xFFFF0000 ) >> 16;
       
  1681     
       
  1682     if ( ( (bottomY - fontHeight) >= UiLayout()->Rect().iBr.iY )
       
  1683         || ( (bottomY + fontHeight)  <= UiLayout()->Rect().iTl.iY ) )
       
  1684         {
       
  1685         return; 
       
  1686         }
       
  1687     else
       
  1688         {
       
  1689         tl = UiLayout()->Rect().iTl;
       
  1690         br = UiLayout()->Rect().iBr;
       
  1691         TInt middleY = UiLayout()->Rect().iTl.iY +  UiLayout()->Rect().Height() / 2;
       
  1692         if ( middleY <= bottomY )
       
  1693             {
       
  1694             br.iY = bottomY - fontHeight;
       
  1695             tl.iY = br.iY - UiLayout()->Rect().Height();
       
  1696             if (tl.iY < 0) // Then skip to the bottom of the current editor
       
  1697                 {
       
  1698                 tl.iY = bottomY + fontHeight;
       
  1699                 br.iY = tl.iY + UiLayout()->Rect().Height();                                        
       
  1700                 }
       
  1701             }
       
  1702         else
       
  1703             {
       
  1704             tl.iY = bottomY + fontHeight;
       
  1705             br.iY = tl.iY + UiLayout()->Rect().Height();
       
  1706             if (br.iY > screenSize.iHeight)
       
  1707                 {
       
  1708                 br.iY = bottomY - fontHeight;
       
  1709                 tl.iY = br.iY - UiLayout()->Rect().Height();                        
       
  1710                 }
       
  1711             }
       
  1712             
       
  1713         TInt x = 0;
       
  1714         TInt y = 0;
       
  1715         x = 0x0000FFFF & br.iX;
       
  1716         y = 0xFFFF0000 & ( br.iY << 16 );       
       
  1717         iDataProvider->SetData(EAknFepDataTypeWindowPosition,x | y);                                
       
  1718         }
       
  1719     */        
       
  1720     }
       
  1721 
       
  1722         
       
  1723 // ---------------------------------------------------------------------------
       
  1724 // CAknFepVkbClientArea::SetTopParent
       
  1725 // (other items were commented in a header).
       
  1726 // ---------------------------------------------------------------------------
       
  1727 //
       
  1728 void CAknFepVkbClientArea::SetTopParent(CFepUiBaseCtrl* aParent)
       
  1729     {
       
  1730     iTopParent = aParent;
       
  1731     }     
       
  1732 
       
  1733 
       
  1734 // ---------------------------------------------------------------------------
       
  1735 // CAknFepVkbClientArea::AddDropdownListL
       
  1736 // (other items were commented in a header).
       
  1737 // ---------------------------------------------------------------------------
       
  1738 //
       
  1739 void CAknFepVkbClientArea::AddDropdownListL()
       
  1740     {
       
  1741     TResourceReader reader;
       
  1742     CCoeEnv::Static()->CreateResourceReaderLC(reader,R_AKN_FEP_VKB_DROP_DOWN_LIST);
       
  1743            
       
  1744     if (!iDataProvider->UnitShadowSizeSet())
       
  1745     	{
       
  1746         iDataProvider->ReadUnitShadowSize();
       
  1747     	}
       
  1748     	
       
  1749     
       
  1750     TInt btnWidth = iDataProvider->RequestData(EAknFepDataTypeUnitWidth);
       
  1751     TInt btnHeight = iDataProvider->RequestData(EAknFepDataTypeUnitHeight);
       
  1752         	
       
  1753     	
       
  1754     TAknTextLineLayout listText = 
       
  1755                               AknLayoutScalable_Avkon::cell_vkb_candidate_pane_t1().LayoutLine();
       
  1756 
       
  1757     TDropdownListDrawInfo candiDrawInfo(KAknsIIDQsnFrFunctionButtonInactive, 
       
  1758     						            KAknsIIDQsnFrFunctionButtonNormal,
       
  1759     						            KAknsIIDQsnFrFunctionButtonPressed,
       
  1760     						            KAknsIIDQsnFrItutButtonCandiSideL,
       
  1761     						            KAknsIIDQsnFrItutButtonCandiMiddle,
       
  1762     						            KAknsIIDQsnFrItutButtonCandiSideR,
       
  1763     						            KAknsIIDQsnFrItutButtonCandiPressedSideL,
       
  1764                                         KAknsIIDQsnFrItutButtonCandiPressedMiddle,
       
  1765                                         KAknsIIDQsnFrItutButtonCandiPressedSideR,    						            
       
  1766     						            TRgb(194, 221, 242),
       
  1767     						            ETrue);
       
  1768 
       
  1769     iDropdownList = CFepCtrlDropdownList::NewL(TPoint(0,btnWidth),
       
  1770                                                UiLayout(),
       
  1771                                                EAknFepVkbCtrlIdCandidateList,
       
  1772                                                reader,                                            
       
  1773                                                0,
       
  1774                                                0,
       
  1775                                                btnWidth,
       
  1776                                                6,
       
  1777                                                4,
       
  1778                                                AknLayoutUtils::FontFromId(listText.iFont, NULL),
       
  1779                                                NULL,
       
  1780                                                CGraphicsContext::ECenter,
       
  1781                                                3,
       
  1782                                                KRgbBlack,       // border color 
       
  1783                                                TRgb(0xeeeeee),  // content bg color
       
  1784                                                KRgbWhite,       // navi bg color
       
  1785                                                AKN_LAF_COLOR_STATIC(listText.iC),
       
  1786                                                KRgbRed);
       
  1787 
       
  1788     iDropdownPropertySet = ETrue;                                               
       
  1789 
       
  1790     iDropdownList->SetResourceId(R_AKN_FEP_VKB_DROP_DOWN_LIST);
       
  1791     iDropdownList->SetEventIdForCandidateSelected(EVkbEventCandidateSelected);
       
  1792     iDropdownList->SetEventIdForNextPageCandidate(EVkbEventGetNextPageCandidate);
       
  1793     iDropdownList->SetEventIdForPreviousPageCandidate(EVkbEventGetPreviousPageCandidate);
       
  1794     iDropdownList->SetEventIdForCandidateExisted(EVkbEventQueryCandidateExisted);
       
  1795 	iDropdownList->SetDropdownListImgID(candiDrawInfo);
       
  1796     //iDropdownList->AddEventObserver(UiLayout());
       
  1797     CleanupStack::PopAndDestroy(); // reader
       
  1798     if ( iCtrlPool )
       
  1799         {
       
  1800         iCtrlPool->AddControl(iDropdownList);    
       
  1801         }
       
  1802     }
       
  1803     
       
  1804 // ---------------------------------------------------------------------------
       
  1805 // CAknFepVkbClientArea::AddButtonL
       
  1806 // (other items were commented in a header).
       
  1807 // ---------------------------------------------------------------------------
       
  1808 //
       
  1809 CAknFepCtrlEventButton* CAknFepVkbClientArea::AddButtonL(const TInt aControlId,
       
  1810                                                          const TInt aEventId,
       
  1811                                                          const TInt aResId,
       
  1812                                                          const TInt aUnicode,
       
  1813                                                          const TBool aIsRepeat)
       
  1814     {
       
  1815     CAknFepCtrlEventButton* button = NULL;
       
  1816     
       
  1817     if ( aIsRepeat )
       
  1818         {
       
  1819         button = CAknFepCtrlRepeatButton::NewL( UiLayout(),
       
  1820         										aControlId, 
       
  1821         										aEventId, 
       
  1822         										aUnicode,
       
  1823         										KAknsIIDQsnFrFunctionButtonNormal,
       
  1824         									  KAknsIIDQsnFrFunctionButtonPressed,
       
  1825         									  KAknsIIDQsnFrFunctionButtonInactive);
       
  1826         }
       
  1827     else
       
  1828         {
       
  1829         button = CAknFepCtrlEventButton::NewL(UiLayout(),
       
  1830         									  aControlId, 
       
  1831         									  aEventId, 
       
  1832         									  aUnicode,
       
  1833     									      KAknsIIDQsnFrFunctionButtonNormal,
       
  1834         									  KAknsIIDQsnFrFunctionButtonPressed,
       
  1835         									  KAknsIIDQsnFrFunctionButtonInactive);
       
  1836         }
       
  1837     
       
  1838     if ( button )
       
  1839         {
       
  1840         // Read resource
       
  1841         TResourceReader reader;
       
  1842         CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId); 
       
  1843         button->SetResourceId( aResId );    
       
  1844         button->ConstructFromResourceL();  
       
  1845         CleanupStack::PopAndDestroy(); // reader
       
  1846         
       
  1847         // Add into the control pool                                                   
       
  1848         if ( iCtrlPool )
       
  1849             {
       
  1850             iCtrlPool->AddControl(button);    
       
  1851             }    
       
  1852         }
       
  1853     return button;
       
  1854     }    
       
  1855 
       
  1856 // ---------------------------------------------------------------------------
       
  1857 // CAknFepVkbClientArea::AddRangeBarL
       
  1858 // (other items were commented in a header).
       
  1859 // ---------------------------------------------------------------------------
       
  1860 //
       
  1861 void CAknFepVkbClientArea::AddRangeBarL()
       
  1862     {
       
  1863     // Range bar             
       
  1864     iRangeBar = CAknFepCtrlRangeBar::NewL(UiLayout(),
       
  1865                                           EAknFepVkbCtrlIdRangeBar,
       
  1866                                           CAknFepCtrlRangeBar::EBtnGroupHorizontal);
       
  1867                                           
       
  1868     iRangeBar->SetActionStyle( CAknFepCtrlRangeBar::ERangeBarActionStyleHighLight );
       
  1869     
       
  1870     TResourceReader reader;
       
  1871     CCoeEnv::Static()->CreateResourceReaderLC(reader, R_AKN_FEP_VKB_RANGE_LIST);
       
  1872     iRangeBar->ConstructFromResourceL(reader);
       
  1873     CleanupStack::PopAndDestroy(); // reader
       
  1874     
       
  1875     //Set event id    
       
  1876     iRangeBar->SetEventIdForRange(EVkbEventSetRange);
       
  1877 
       
  1878     iCtrlPool->AddControl(iRangeBar);    
       
  1879     }           
       
  1880          
       
  1881 // ---------------------------------------------------------------------------
       
  1882 // CAknFepVkbClientArea::ChangeMergedButtonStatus
       
  1883 // (other items were commented in a header)
       
  1884 // ---------------------------------------------------------------------------
       
  1885 // 
       
  1886 void CAknFepVkbClientArea::ChangeMergedButtonStatus( 
       
  1887 											const TInt aIsShiftCase, 
       
  1888     								 		const TInt aIsCapslockCase )
       
  1889 	{
       
  1890 	CAknFepCtrlMultiModeButton* button = 
       
  1891 		static_cast<CAknFepCtrlMultiModeButton*>
       
  1892         (ControlById( EAknFepVkbCtrlIdShiftBtn ) );
       
  1893     
       
  1894     if( !button )
       
  1895         {
       
  1896         return;
       
  1897         }
       
  1898     switch ( aIsCapslockCase * 2 + aIsShiftCase )
       
  1899         {
       
  1900         case 1: // text case        
       
  1901             {
       
  1902             TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 1 ) );			
       
  1903 	    	button->SetHighlight( ETrue );
       
  1904             }
       
  1905             break; 
       
  1906         case 2: // upper case
       
  1907             {
       
  1908             TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 2 ) );	
       
  1909             button->SetHighlight( ETrue );
       
  1910             }
       
  1911             break;
       
  1912         default:
       
  1913             {
       
  1914             TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 0 ) );	
       
  1915         	button->SetHighlight( EFalse );
       
  1916             }
       
  1917             break;
       
  1918 	    }
       
  1919 	}      
       
  1920     
       
  1921     
       
  1922 // ---------------------------------------------------------------------------
       
  1923 // CAknFepVkbClientArea::CompositionField
       
  1924 // (other items were commented in a header).
       
  1925 // ---------------------------------------------------------------------------
       
  1926 //
       
  1927 CFepLayoutEditAreaBase* CAknFepVkbClientArea::CompositionField()
       
  1928     {
       
  1929     if ( iCurrentImLayout && iCurrentImLayout->FindControlInfo(EAknFepVkbCtrlIdCompositionField) ) 
       
  1930         {
       
  1931         return iCompositionField;
       
  1932         }
       
  1933     return NULL;
       
  1934     }
       
  1935 
       
  1936 // ---------------------------------------------------------------------------
       
  1937 // CAknFepVkbClientArea::AddControlL
       
  1938 // (other items were commented in a header).
       
  1939 // ---------------------------------------------------------------------------
       
  1940 //
       
  1941 void CAknFepVkbClientArea::AddControlL(CFepUiBaseCtrl* aControl)
       
  1942     {
       
  1943     //do nothing if we already has the control.
       
  1944     if(KErrNotFound != iCtrlList.Find(aControl))
       
  1945         return;
       
  1946     
       
  1947     if(aControl)
       
  1948         {        
       
  1949         aControl->SetReady( Ready() );
       
  1950         iCtrlList.AppendL(aControl);   
       
  1951 
       
  1952         RRegion region(8);
       
  1953         region.Copy(Region());   
       
  1954 
       
  1955         region.AddRect(aControl->Rect());
       
  1956         SetRegion(region);
       
  1957         }
       
  1958     }    
       
  1959 
       
  1960 // ---------------------------------------------------------------------------
       
  1961 // CAknFepVkbClientArea::DimKeys
       
  1962 // (other items were commented in a header).
       
  1963 // ---------------------------------------------------------------------------
       
  1964 //
       
  1965 void CAknFepVkbClientArea::DimKeys()
       
  1966     {
       
  1967     TRAP_IGNORE(DimKeysL());
       
  1968     }
       
  1969 
       
  1970 void CAknFepVkbClientArea::DimKeysL()
       
  1971     {
       
  1972     iVkbCtrl->CancelDims();
       
  1973     TInt currentRange = iDataProvider->RequestData(EAknFepDataTypeCurrentRange);            
       
  1974     TInt permitRange = iDataProvider->RequestData(EAknFepDataTypePermittedRange);            
       
  1975     if ( (currentRange == ERangeNumber )
       
  1976         && ( permitRange == ERangeNumber ) )
       
  1977         {
       
  1978         TInt keyMapping = iDataProvider->RequestData(EAknFepDataTypeNumericKeymap);
       
  1979         HBufC* rs = NULL;
       
  1980         if ( keyMapping == EKeymapFromResource )
       
  1981             {
       
  1982             HBufC* customRes = 
       
  1983                            (HBufC*) iDataProvider->RequestData(EAknFepDataTypeUseDefinedResource);
       
  1984             _LIT(KTenNumbers,"0123456789");
       
  1985             rs = HBufC::NewL(KTenNumbers().Length() + customRes->Length());
       
  1986             rs->Des().Copy(*customRes);
       
  1987             rs->Des().Append(KTenNumbers);
       
  1988             iVkbCtrl->DimKeys(rs);        
       
  1989             }
       
  1990         else
       
  1991             {
       
  1992             rs = iKeyMappingMgr->KeyMappingStringL(keyMapping);
       
  1993             iVkbCtrl->DimKeys(rs);
       
  1994             }
       
  1995             
       
  1996         delete rs;
       
  1997         }    
       
  1998     iVkbCtrl->Draw();    
       
  1999     UpdateArea(iVkbCtrl->Rect(), EFalse);
       
  2000     }
       
  2001 
       
  2002 // ---------------------------------------------------------------------------
       
  2003 // CAknFepVkbClientArea::ClearCandidatesInList
       
  2004 // (other items were commented in a header).
       
  2005 // ---------------------------------------------------------------------------
       
  2006 //
       
  2007 void CAknFepVkbClientArea::ClearCandidatesInList()
       
  2008     {
       
  2009     RPointerArray<HBufC> candidates;
       
  2010     if(UiLayout()->PenInputType() == EPluginInputModeFSQ)
       
  2011         {
       
  2012         TRAP_IGNORE(iDropdownList->SetCandidatesL(candidates,
       
  2013             CFepCtrlDropdownList::EListNoExpandableWithBubble));
       
  2014         }
       
  2015     else
       
  2016         {
       
  2017         TRAP_IGNORE(iDropdownList->SetCandidatesL(candidates,
       
  2018             CFepCtrlDropdownList::EListNoExpandable));
       
  2019         }
       
  2020 
       
  2021     iDataProvider->SetData(EAknFepDataTypeCandidateCount,0);
       
  2022     candidates.Close();            
       
  2023     }
       
  2024     
       
  2025 // ---------------------------------------------------------------------------
       
  2026 // CAknFepVkbClientArea::NeedCreateWord
       
  2027 // (other items were commented in a header).
       
  2028 // ---------------------------------------------------------------------------
       
  2029 //
       
  2030 TBool CAknFepVkbClientArea::NeedCreateWord()
       
  2031 	{
       
  2032     return iCompositionField->NeedCreateWord();
       
  2033 	}
       
  2034     
       
  2035 // ---------------------------------------------------------------------------
       
  2036 // CAknFepVkbClientArea::SetNextCandidateExistFlag
       
  2037 // (other items were commented in a header).
       
  2038 // ---------------------------------------------------------------------------
       
  2039 //  
       
  2040 void CAknFepVkbClientArea::SetNextCandidateExistFlag(TBool aFlag)
       
  2041     {
       
  2042 	iDropdownList->SetFlagCandidateExist(aFlag);
       
  2043     }
       
  2044     
       
  2045 // ---------------------------------------------------------------------------
       
  2046 // CAknFepVkbClientArea::ConstructFromResourceL
       
  2047 // (other items were commented in a header).
       
  2048 // ---------------------------------------------------------------------------
       
  2049 //  
       
  2050 void CAknFepVkbClientArea::ConstructFromResourceL()
       
  2051     {                
       
  2052     CControlGroup::ConstructFromResourceL();
       
  2053     // Construct for rest controls not in the control group
       
  2054     for(TInt i = 0; i < iRemainedPoolControlIDs.Count(); i++ )
       
  2055     	{
       
  2056     	iCtrlPool->Control( iRemainedPoolControlIDs[i] )->ConstructFromResourceL();	
       
  2057     	}
       
  2058     	
       
  2059     if( iVkbLayout )
       
  2060     	{
       
  2061     	if( iVkbCtrl->IsIrregularKeyBoard() )    	
       
  2062     		iVkbLayout->ConstructFromIrregularResourceL();
       
  2063     	else
       
  2064     		iVkbLayout->ConstructFromNonIrregularResourceL();    	
       
  2065     	SetVkbLayoutSize( iVkbLayoutId );
       
  2066     	}
       
  2067 //    iVkbLayout->ConstructFromResourceL();
       
  2068     }
       
  2069     
       
  2070 // ---------------------------------------------------------------------------
       
  2071 // CAknFepVkbClientArea::SetEnableSwitchToHwr
       
  2072 // (other items were commented in a header)
       
  2073 // ---------------------------------------------------------------------------
       
  2074 //     
       
  2075 void CAknFepVkbClientArea::SetEnableSwitchToHwr(TBool aEnable)
       
  2076     {
       
  2077     CAknFepCtrlEventButton* switchToHwrBtn = static_cast<CAknFepCtrlEventButton*>
       
  2078         ( iCtrlPool->Control( EAknFepVkbCtrlIdSwitchToHwrBtn ) );
       
  2079 
       
  2080     if ( aEnable )    
       
  2081         {
       
  2082         switchToHwrBtn->SetDimmed(EFalse);
       
  2083         }
       
  2084     else
       
  2085         {
       
  2086         switchToHwrBtn->SetDimmed(ETrue);
       
  2087         switchToHwrBtn->SetActive(EFalse);
       
  2088         } 
       
  2089     }
       
  2090 
       
  2091 // ---------------------------------------------------------------------------
       
  2092 // CAknFepVkbClientArea::ActiveCurrentRange
       
  2093 // (other items were commented in a header)
       
  2094 // ---------------------------------------------------------------------------
       
  2095 //     
       
  2096 void CAknFepVkbClientArea::ActiveCurrentRange()
       
  2097     {
       
  2098     TInt curRange = iDataProvider->RequestData(EAknFepDataTypeCurrentRange); 
       
  2099     
       
  2100     if ( iRangeBar )
       
  2101         {
       
  2102         iRangeBar->SetRange(curRange);
       
  2103         }  
       
  2104     }
       
  2105     
       
  2106 // ---------------------------------------------------------------------------
       
  2107 // CAknFepVkbClientArea::GetCreatedWordSpell
       
  2108 // (other items were commented in a header)
       
  2109 // ---------------------------------------------------------------------------
       
  2110 //     
       
  2111 TPtrC CAknFepVkbClientArea::GetCreatedWordSpell()
       
  2112     {
       
  2113     return iCompositionField->GetCreatedWordSpell();
       
  2114     }
       
  2115     
       
  2116 TPeninputCnCellType CAknFepVkbClientArea::GetCellType(TInt aColumns)
       
  2117 	{
       
  2118 /*	TInt curRange = iDataProvider->RequestData(EAknFepDataTypeCurrentRange);  
       
  2119     TBool zhuyinIm = iDataProvider->RequestData(EAknFepDataTypeIMLayout) == EAknFepVkbImCnZhuyin;
       
  2120     TPeninputCnCellType cellType;
       
  2121     
       
  2122     if( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
  2123     	{
       
  2124     	cellType = ( aColumns == 10 )? EVkbCangjieAndPinying_FSQ : EVkbZhuyin_FSQ;
       
  2125     	}
       
  2126     else if( UiLayout()->PenInputType() == EPluginInputModeVkb )
       
  2127     	{
       
  2128     	if (curRange == ERangeEnglish)
       
  2129     		{
       
  2130     		cellType = EVkbLatin;
       
  2131     		}
       
  2132     	if (curRange == ERangeNumber)
       
  2133     		{
       
  2134     		cellType = EVkbNumber;	
       
  2135     		}
       
  2136     	if (curRange == ERangeAccent)
       
  2137     		{
       
  2138     		cellType = EVkbAccent;	
       
  2139     		}      
       
  2140     	else
       
  2141     		{
       
  2142     		cellType = ( zhuyinIm )? EVkbZhuyin : EVkbCangjieAndPinying;
       
  2143     		}
       
  2144     	}*/
       
  2145 	TInt curLanguage = iDataProvider->RequestData(EAknFepDataTypeInputLanguage);
       
  2146 	    	
       
  2147     TPeninputCnCellType cellType = EVkbCangjieAndPinying;
       
  2148     if( UiLayout()->PenInputType() == EPluginInputModeFSQ )
       
  2149     	{
       
  2150 	    if (aColumns == 10)
       
  2151 	    	{
       
  2152 	    	cellType = EVkbCangjieAndPinying_FSQ;
       
  2153 	    	}
       
  2154 	    else if(aColumns == 11)
       
  2155 	    	{
       
  2156 	    	cellType = EVkbZhuyin_FSQ;
       
  2157 	    	}
       
  2158     	}
       
  2159 	else 
       
  2160 		{
       
  2161 	    if (aColumns == 10)
       
  2162 	    	{
       
  2163 	    	cellType = EVkbCangjieAndPinying;
       
  2164 	    	}
       
  2165 	    else if(aColumns == 11)
       
  2166 	    	{
       
  2167 	    	cellType = EVkbZhuyin;
       
  2168 	    	}			
       
  2169 		}    	
       
  2170     return cellType;
       
  2171 	}
       
  2172 	
       
  2173 void CAknFepVkbClientArea::ShowBubble(TBool aShow)
       
  2174     {
       
  2175     if (iVkbCtrl)
       
  2176         {
       
  2177         iVkbCtrl->ShowBubble(aShow);    
       
  2178         }
       
  2179     if(iDropdownList)
       
  2180         {
       
  2181         iDropdownList->ShowBubble(aShow);
       
  2182         }
       
  2183     }
       
  2184 
       
  2185 
       
  2186 void CAknFepVkbClientArea::DimArrowKeys( TBool aDimArrow )
       
  2187     {
       
  2188     static_cast<CAknFepCtrlRepeatButton*>
       
  2189         ( iCtrlPool->Control( EAknFepVkbCtrlIdArrowUpBtn ) )->SetDimmed(aDimArrow);
       
  2190     static_cast<CAknFepCtrlRepeatButton*>
       
  2191         ( iCtrlPool->Control( EAknFepVkbCtrlIdArrowDownBtn ) )->SetDimmed(aDimArrow);
       
  2192     static_cast<CAknFepCtrlRepeatButton*>
       
  2193         ( iCtrlPool->Control( EAknFepVkbCtrlIdArrowLeftBtn ) )->SetDimmed(aDimArrow);
       
  2194     static_cast<CAknFepCtrlRepeatButton*>
       
  2195         ( iCtrlPool->Control( EAknFepVkbCtrlIdArrowRightBtn ) )->SetDimmed(aDimArrow);
       
  2196     }
       
  2197 void CAknFepVkbClientArea::HandleStandby2CompositionEventL()
       
  2198     {
       
  2199     TInt layoutType = iDataProvider->RequestData(EAknFepDataTypeIMLayout); 
       
  2200     //Change vkb layout to composition ui state
       
  2201     ReorganizeZhuYinControls( EFalse );
       
  2202            
       
  2203     if ( layoutType == EAknFepVkbImCnPinyin)
       
  2204         {
       
  2205         ChangeVkbLayout(EAknFepVkbVkbCnPinyinComposition);
       
  2206         }
       
  2207     else if ( layoutType == EAknFepVkbImCnZhuyin)
       
  2208         {
       
  2209         ChangeVkbLayout(EAknFepVkbVkbCnZhuyinComposition);
       
  2210         } 
       
  2211     else if ( layoutType == EAknFepVkbImCnStroke || EAknFepVkbImCnCangjie)
       
  2212         {
       
  2213         HBufC* symbolNumSet = HBufC::NewLC( KLengthSymbolNeedToFilter );
       
  2214 
       
  2215         for (TInt index = 0; index < KLengthSymbolNeedToFilter; index ++)
       
  2216             {
       
  2217             symbolNumSet->Des().Append( KSymbolsNeedToFilter[index] );
       
  2218             }
       
  2219             
       
  2220         iVkbCtrl->DimKeySet( symbolNumSet, ETrue );
       
  2221         CleanupStack::PopAndDestroy( symbolNumSet );
       
  2222         }
       
  2223     }
       
  2224 // End Of File