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