textinput/peninputgenericitut/src/peninputgenericitutdatamgr.cpp
changeset 0 eb1f2e154e89
child 5 a47de9135b21
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  drop-down list control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <PtiEngine.h>
       
    20 #include <coemain.h>
       
    21 #include <AknUtils.h>
       
    22 #include <peninputgeneralitutnew.rsg>
       
    23 #include <peninputitutconfig_chinese.rsg>
       
    24 #include <peninputitutconfig_latin.rsg>
       
    25 #include <peninputitutconfig_korean.rsg>
       
    26 #include <peninputitutconfig_hebrew.rsg>
       
    27 #include <peninputitutconfig_farsi.rsg>
       
    28 #include <AknFepGlobalEnums.h>
       
    29 #include <eikon.hrh>
       
    30 #include <bautils.h>
       
    31 #include <aknlayoutscalable_apps.cdl.h>
       
    32 #include <aknlayoutscalable_avkon.cdl.h>
       
    33 #include <peninputlayoutmultilineicf.h>
       
    34 #include <AknSettingCache.h>
       
    35 
       
    36 #include "peninputgenericitutdatamgr.h"
       
    37 #include "peninputgenericitutlayoutcontext.h"
       
    38 #include "peninputgenericitutconverter.h"
       
    39 #include "peninputgenericitutcustomization.h"
       
    40 #include "peninputgenericitutwindowmanager.h"
       
    41 
       
    42 #define LAF_MODIFY 1
       
    43 _LIT(KItutCommonResFile, "z:\\resource\\plugins\\peninputgeneralitutnew.rsc");
       
    44 _LIT(KConfigResourceFile, 
       
    45      "z:\\resource\\plugins\\peninputitutconfig_");
       
    46 _LIT(KResourceFileExtName, ".rsc");
       
    47 
       
    48 _LIT(KAvkonResourceFile, "z:\\resource\\avkon.rsc");
       
    49      
       
    50 const TInt KOnePageCandidateCount = 40;
       
    51 const TInt KMaxPredictCandCnt = 250;
       
    52 const TInt KInvalidResId = -1;
       
    53 const TInt KInvalidImMode = -1;
       
    54 const TInt KInvalidIndex = -1;
       
    55 const TUint16 KPlusChar = '+';
       
    56 
       
    57 // For virtual ITUT candidate list in landscape mode. No reason
       
    58 const TInt KCandsAdjustment = 7;
       
    59 
       
    60 
       
    61 CGenericItutDataMgr* CGenericItutDataMgr::NewL(MItutLayoutContext* aLayoutContext, 
       
    62                                                CPtiEngine* aPtiEngine)
       
    63     {
       
    64     CGenericItutDataMgr* self = new (ELeave) CGenericItutDataMgr(aLayoutContext, aPtiEngine);
       
    65     CleanupStack::PushL(self);
       
    66     self->ConstructL();
       
    67     CleanupStack::Pop(self);//self
       
    68     return self;
       
    69     }
       
    70 
       
    71 void CGenericItutDataMgr::ClearChnCandidates(TInt aCmd)
       
    72     {
       
    73     switch (aCmd)
       
    74         {
       
    75         case EItutCandidates:
       
    76             {
       
    77             iCandidates.ResetAndDestroy();
       
    78             iCandidates.Close();
       
    79             }
       
    80             break;
       
    81         case EItutPuncCandidates:
       
    82             {
       
    83             iPuncCandidates.ResetAndDestroy();
       
    84             iPuncCandidates.Close();
       
    85             }
       
    86             break;
       
    87         default:
       
    88             break;
       
    89         }
       
    90     }
       
    91 
       
    92 CGenericItutDataMgr::~CGenericItutDataMgr()
       
    93     {
       
    94     iSubscriberList.Close();  
       
    95 
       
    96     iMenuItemList.ResetAndDestroy();
       
    97     
       
    98     CCoeEnv::Static()->DeleteResourceFile(iAvkonResId);
       
    99         
       
   100     CCoeEnv::Static()->DeleteResourceFile(iCommonResId);
       
   101     
       
   102     if (iConfigResId)
       
   103         {
       
   104         CCoeEnv::Static()->DeleteResourceFile(iConfigResId);
       
   105         }
       
   106 
       
   107     ClearChnCandidates(EItutCandidates);
       
   108     ClearChnCandidates(EItutPuncCandidates);
       
   109 
       
   110     iKeypadCellRects.Close();
       
   111     iKeypadCellRectsCn.Close();
       
   112     iKeypadCellRectsQuery.Close(); 
       
   113     delete iNumericKeymapData;
       
   114     }
       
   115 
       
   116 void CGenericItutDataMgr::ConstructL()
       
   117     {
       
   118 
       
   119     // initialize layout info of controls and layout
       
   120     ReadLafInfo();
       
   121 
       
   122     TFileName resourceCommonName(KItutCommonResFile);
       
   123     CCoeEnv* coeEnv = CCoeEnv::Static();
       
   124     BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceCommonName);
       
   125     iCommonResId = coeEnv->AddResourceFileL(resourceCommonName);
       
   126     
       
   127     TFileName resourceAvkonName(KAvkonResourceFile);
       
   128     BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceAvkonName);
       
   129     iAvkonResId = coeEnv->AddResourceFileL(resourceAvkonName);
       
   130     
       
   131     TResourceReader reader;
       
   132     CCoeEnv::Static()->CreateResourceReaderLC(reader, R_AVKON_TOUCH_INDICATOR_EDIT_MODE_MENU);
       
   133         
       
   134     const TInt count=reader.ReadInt16();
       
   135     for ( TInt ii=0; ii<count; ++ii )
       
   136         {
       
   137         TMenuItem* item = new (ELeave) TMenuItem();
       
   138         CleanupStack::PushL( item );
       
   139         item->iCommand = reader.ReadInt32();
       
   140         reader.ReadInt32();
       
   141         reader.ReadInt32();
       
   142         item->iText =  reader.ReadTPtrC();
       
   143         reader.ReadTPtrC();
       
   144         reader.ReadTPtrC();
       
   145         reader.ReadInt16();
       
   146         reader.ReadInt16();
       
   147         CleanupStack::Pop(); // pop first, since additem pushes again
       
   148         iMenuItemList.Append( item );
       
   149         reader.ReadInt32(); // extension link
       
   150         }        
       
   151     CleanupStack::PopAndDestroy(); //reader         
       
   152     }
       
   153 
       
   154 CGenericItutDataMgr::TMenuItem* CGenericItutDataMgr::GetMenuItem(TInt aCommand)
       
   155     {
       
   156     for (TInt i=0;i<iMenuItemList.Count();i++)
       
   157         {
       
   158         if ( iMenuItemList[i]->iCommand == aCommand )
       
   159             return iMenuItemList[i];
       
   160         }
       
   161     return NULL;
       
   162     }
       
   163     
       
   164 void CGenericItutDataMgr::AddSubscriber(MItutPropertySubscriber* aSubscriber)
       
   165     {
       
   166     if (aSubscriber)
       
   167         {
       
   168         const TInt index = iSubscriberList.Find(aSubscriber);
       
   169 
       
   170         if (index == KErrNotFound)
       
   171             {
       
   172             iSubscriberList.Append(aSubscriber);
       
   173             }
       
   174         }
       
   175     }
       
   176 
       
   177 void CGenericItutDataMgr::ReadLafInfo()
       
   178     {
       
   179     // Screen
       
   180     TRect rect, rectcn;
       
   181     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect);
       
   182     iScreenSize = rect.Size();
       
   183 
       
   184     iLandScape = iScreenSize.iWidth < iScreenSize.iHeight ? EFalse : ETrue;
       
   185 
       
   186     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, rect);
       
   187 
       
   188     // finger Layout
       
   189     TAknWindowLineLayout vitulayout;
       
   190     TAknLayoutRect viturect;
       
   191 
       
   192     if (iLandScape)
       
   193         {
       
   194         vitulayout = AknLayoutScalable_Apps::popup_vitu2_window(1).LayoutLine();
       
   195         }
       
   196     else
       
   197         {
       
   198         vitulayout = AknLayoutScalable_Apps::popup_vitu2_window(0).LayoutLine();
       
   199         }
       
   200     
       
   201     viturect.LayoutRect(rect, vitulayout);
       
   202 
       
   203     iLayoutRect = viturect.Rect();
       
   204     iLayoutOffset = iLayoutRect.iTl;
       
   205 
       
   206     // ICF & Keypad
       
   207     TAknWindowLineLayout icflayoutlatin, icflayoutcn,itukeypad, itucell,icflayoutbgcn;
       
   208     TAknTextLineLayout icflefttext;    
       
   209     TAknTextLineLayout icflefttext1, icflefttext2, icflefttext3; 
       
   210     TAknLayoutRect icfrectlatin, icfrectcn, itukeypadrect, itucellrect,icfrectcnbg;
       
   211 
       
   212     if (iLandScape)
       
   213         {
       
   214         icflayoutlatin = AknLayoutScalable_Apps::field_vitu2_entry_pane(1).LayoutLine();
       
   215         icflayoutcn = AknLayoutScalable_Apps::field_vitu2_entry_pane(3).LayoutLine();
       
   216         }
       
   217     else
       
   218         {
       
   219         icflayoutlatin = AknLayoutScalable_Apps::field_vitu2_entry_pane(0).LayoutLine();
       
   220         icflayoutcn = AknLayoutScalable_Apps::field_vitu2_entry_pane(2).LayoutLine();
       
   221         }
       
   222 
       
   223     icfrectlatin.LayoutRect(viturect.Rect(), icflayoutlatin);
       
   224     icflayoutbgcn = AknLayoutScalable_Apps::bg_popup_call_pane_cp08(0).LayoutLine();
       
   225     icfrectcn.LayoutRect(viturect.Rect(), icflayoutcn);
       
   226     icfrectcnbg.LayoutRect(icfrectcn.Rect(),icflayoutbgcn);
       
   227 	
       
   228     TAknLayoutScalableParameterLimits entryPaneVariety = 
       
   229                 AknLayoutScalable_Apps::field_vitu2_entry_pane_t1_ParamLimits(2);
       
   230     // Calc the max row number
       
   231     TInt maxRow = entryPaneVariety.LastRow();
       
   232     
       
   233     // latin ICF layout
       
   234     icflefttext = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1(2, 0, 0).LayoutLine();
       
   235     icflefttext1 = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1(2, 0, 1).LayoutLine();
       
   236     icflefttext2 = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1(2, 0, 2).LayoutLine();
       
   237     icflefttext3 = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1(2, 0, maxRow).LayoutLine();
       
   238 
       
   239     iIcfTextAlignment = icflefttext.iJ;
       
   240     iIcfTextLeftMargin = icflefttext.il;
       
   241     iIcfTextRightMargin = icflefttext.ir;
       
   242     
       
   243     TAknLayoutText ctxt, ctxt1, ctxt2, ctxt3;
       
   244     ctxt.LayoutText( icfrectlatin.Rect(), icflefttext );
       
   245     ctxt1.LayoutText( icfrectlatin.Rect(), icflefttext1 );
       
   246     ctxt2.LayoutText( icfrectlatin.Rect(), icflefttext2 );
       
   247     ctxt3.LayoutText( icfrectlatin.Rect(), icflefttext3 );
       
   248 
       
   249     
       
   250     iIcfTextTopMargin = ctxt.TextRect().iTl.iY - icfrectlatin.Rect().iTl.iY;
       
   251     iIcfTextLineSpaceMargin = ctxt1.TextRect().iTl.iY - ctxt.TextRect().iBr.iY;
       
   252     iIcfTextBottomMargin = icfrectlatin.Rect().iBr.iY - ctxt3.TextRect().iBr.iY 
       
   253                                                       - iIcfTextLineSpaceMargin;  
       
   254     iIcfTextHeight = ctxt.TextRect().Height();
       
   255     
       
   256     iIcfFont = const_cast<CFont*>(AknLayoutUtils::FontFromId(icflefttext.iFont, NULL));
       
   257     
       
   258     // chinese ICF layout
       
   259    	entryPaneVariety = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1_ParamLimits(0);
       
   260     // Calc the max row number
       
   261    	maxRow = entryPaneVariety.LastRow();
       
   262     icflefttext = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1(0, 0, 0).LayoutLine();
       
   263     icflefttext1 = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1(0, 0, 1).LayoutLine();
       
   264     icflefttext3 = AknLayoutScalable_Apps::field_vitu2_entry_pane_t1(0, 0, maxRow).LayoutLine();
       
   265     iIcfTextLeftMarginCn = icflefttext.il;
       
   266     iIcfTextRightMarginCn = icflefttext.ir;
       
   267     
       
   268     ctxt.LayoutText( icfrectcn.Rect(), icflefttext );
       
   269     ctxt1.LayoutText( icfrectcn.Rect(), icflefttext1 );
       
   270     ctxt3.LayoutText( icfrectcn.Rect(), icflefttext3 );
       
   271 	
       
   272     TInt topOffset = icfrectcnbg.Rect().iTl.iY - icfrectcn.Rect().iTl.iY;
       
   273     iIcfTextTopMarginCn = ctxt.TextRect().iTl.iY - icfrectcn.Rect().iTl.iY - topOffset;
       
   274     iIcfTextLineSpaceMarginCn = ctxt1.TextRect().iTl.iY - ctxt.TextRect().iBr.iY;
       
   275     iIcfTextBottomMarginCn = icfrectcn.Rect().iBr.iY - ctxt3.TextRect().iBr.iY 
       
   276                                                      - iIcfTextLineSpaceMarginCn;
       
   277     iIcfTextHeightCn = ctxt.TextRect().Height();    
       
   278  	
       
   279     iIcfFontCn = const_cast<CFont*>(AknLayoutUtils::FontFromId(icflefttext.iFont, NULL));
       
   280 
       
   281     rect = icfrectlatin.Rect();
       
   282     rect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   283     iIcfWesRect = rect;
       
   284 	
       
   285     rect = icfrectcnbg.Rect();
       
   286     rect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   287     iIcfChnRect = rect;
       
   288     //iIcfChnRect.iTl.iY += 10;
       
   289 #ifdef LAF_MODIFY
       
   290     //if(IsChinese())
       
   291         {
       
   292         iIcfChnRect.Move(0,-iIcfChnRect.iTl.iY + 14);
       
   293         }
       
   294 #endif
       
   295 
       
   296     // Keypad
       
   297     TInt keypadvariety = iLandScape ? 1 : 0;
       
   298     itukeypad = AknLayoutScalable_Apps::grid_vitu2_itu_pane(keypadvariety).LayoutLine();
       
   299     itukeypadrect.LayoutRect(viturect.Rect(), itukeypad);
       
   300     iKeypadRect = itukeypadrect.Rect();
       
   301     iKeypadRect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   302     
       
   303     TInt cnParam  = iLandScape ? 3 : 2;    
       
   304     itukeypad = AknLayoutScalable_Apps::grid_vitu2_itu_pane(cnParam).LayoutLine();
       
   305     itukeypadrect.LayoutRect(viturect.Rect(), itukeypad);
       
   306     iKeypadRectCn = itukeypadrect.Rect();
       
   307     iKeypadRectCn.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   308 
       
   309     TInt queryParam  = iLandScape ? 5 : 4;    
       
   310     itukeypad = AknLayoutScalable_Apps::grid_vitu2_itu_pane(queryParam).LayoutLine();
       
   311     itukeypadrect.LayoutRect(viturect.Rect(), itukeypad);
       
   312     iKeypadRectQuery = itukeypadrect.Rect();
       
   313     iKeypadRectQuery.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   314 
       
   315     iKeypadCellRects.Reset();
       
   316     iKeypadCellRectsCn.Reset();
       
   317     iKeypadCellRectsQuery.Reset();
       
   318 
       
   319     // keypad is 4 rows, 3 cols
       
   320     for (TInt i = 0; i < 4; i++)
       
   321         {
       
   322         for (TInt j = 0; j < 3; j++)
       
   323             {
       
   324             itucell = AknLayoutScalable_Apps::cell_vitu2_itu_pane(keypadvariety, 
       
   325                                                                   j, 
       
   326                                                                   i).LayoutLine();
       
   327             itucellrect.LayoutRect(iKeypadRect, itucell);
       
   328             TRect cellrect = itucellrect.Rect();
       
   329             cellrect.Move(-iKeypadRect.iTl.iX, -iKeypadRect.iTl.iY);
       
   330             iKeypadCellRects.Append(cellrect);
       
   331             
       
   332             // read shift icon rect
       
   333             if( i == 3 &&  j == 2 )
       
   334             	{
       
   335             	TAknWindowLineLayout shiftIcon =  AknLayoutScalable_Apps::
       
   336             					cell_vitu2_itu_pane_g1( keypadvariety ).LayoutLine();
       
   337             	TAknLayoutRect shiftIconRect;
       
   338             	shiftIconRect.LayoutRect( cellrect, shiftIcon );				
       
   339             	iShiftIconRect = shiftIconRect.Rect();			
       
   340             	}
       
   341             itucellrect.LayoutRect(iKeypadRectCn, itucell);
       
   342             cellrect = itucellrect.Rect();
       
   343             cellrect.Move(-iKeypadRectCn.iTl.iX, -iKeypadRectCn.iTl.iY);
       
   344             iKeypadCellRectsCn.Append(cellrect);
       
   345            
       
   346             itucellrect.LayoutRect(iKeypadRectQuery, itucell);
       
   347             cellrect = itucellrect.Rect();
       
   348             cellrect.Move(-iKeypadRectQuery.iTl.iX, -iKeypadRectQuery.iTl.iY);
       
   349             iKeypadCellRectsQuery.Append(cellrect);
       
   350             }
       
   351         }
       
   352 
       
   353     iVkNumText = iLandScape ? AknLayoutScalable_Apps::cell_vitu2_itu_pane_t1(4).LayoutLine() :
       
   354     						  AknLayoutScalable_Apps::cell_vitu2_itu_pane_t1(0).LayoutLine(); 
       
   355 	// Key text row 1   						  	
       
   356     iVkAlphaText1 = iLandScape ? AknLayoutScalable_Apps::cell_vitu2_itu_pane_t2(2).LayoutLine() :
       
   357     					AknLayoutScalable_Apps::cell_vitu2_itu_pane_t2(0).LayoutLine();
       
   358     iVkAlphaText3 = iLandScape ? AknLayoutScalable_Apps::cell_vitu2_itu_pane_t2(3).LayoutLine() :
       
   359     					AknLayoutScalable_Apps::cell_vitu2_itu_pane_t2(1).LayoutLine();
       
   360 	iVkAlphaText3.iJ = 3;   
       
   361 
       
   362     iVkAlphaText1ForThai = iLandScape ? AknLayoutScalable_Apps::cell_vitu2_itu_pane_t3(6).LayoutLine() :
       
   363                             AknLayoutScalable_Apps::cell_vitu2_itu_pane_t2(7).LayoutLine();
       
   364     iVkAlphaText3ForThai = iLandScape ? AknLayoutScalable_Apps::cell_vitu2_itu_pane_t2(10).LayoutLine() :
       
   365                         AknLayoutScalable_Apps::cell_vitu2_itu_pane_t2(8).LayoutLine();
       
   366     iVkAlphaText3ForThai.iJ = 3;
       
   367 					   					    					
       
   368     // Key text row 2    						  	
       
   369     iVkAlphaText2 = iLandScape ? AknLayoutScalable_Apps::cell_vitu2_itu_pane_t3(1).LayoutLine() :
       
   370     					AknLayoutScalable_Apps::cell_vitu2_itu_pane_t3(0).LayoutLine();
       
   371     iVkAlphaText2.iJ = 3;
       
   372     
       
   373     iVkAlphaText2ForThai = iLandScape ? AknLayoutScalable_Apps::cell_vitu2_itu_pane_t3(6).LayoutLine() :
       
   374                         AknLayoutScalable_Apps::cell_vitu2_itu_pane_t3(5).LayoutLine();
       
   375     iVkAlphaText2ForThai.iJ = 3;
       
   376     
       
   377     // backspace and switch button
       
   378     TAknWindowLineLayout funcbtn, funcclr, funcswitch, funcinner, funcinnercn, funcleft, funcright;
       
   379     TAknWindowLineLayout funcswitchcn, funcleftcn, funcrightcn, funcclrcn;
       
   380     TAknWindowLineLayout funcind, funcindcn, funcindinner, funcbtncn, funccell;
       
   381     TAknLayoutRect funcbtnrect, funcclrrect, funcswitchrect, funcbtncnrect;
       
   382     TAknLayoutRect funcindrect, funcindrectinner, funcindcnrect, funccellrect;
       
   383     TAknLayoutRect funcinnerrect, funcinnerrectcn, funcleftrect, funcrightrect;
       
   384     TAknLayoutRect funcclrcnrect, funcleftcnrect, funcrightcnrect, funcswitchcnrect;
       
   385   
       
   386     
       
   387     if (iLandScape)
       
   388         {
       
   389         funcbtn = AknLayoutScalable_Apps::grid_vitu2_function_pane(1).LayoutLine();
       
   390         funcbtncn = AknLayoutScalable_Apps::grid_vitu2_function_pane(3).LayoutLine();
       
   391         }
       
   392     else
       
   393         {
       
   394         funcbtn = AknLayoutScalable_Apps::grid_vitu2_function_pane(0).LayoutLine();
       
   395         funcbtncn = AknLayoutScalable_Apps::grid_vitu2_function_pane(2).LayoutLine();
       
   396         }
       
   397 
       
   398     funcclr = AknLayoutScalable_Apps::cell_vitu2_function_pane(0, 3, 0).LayoutLine();
       
   399     funcswitch = AknLayoutScalable_Apps::cell_vitu2_function_pane(0, 0, 0).LayoutLine();
       
   400 
       
   401     funcinner = AknLayoutScalable_Apps::cell_vitu2_function_pane_g1(0).LayoutLine();
       
   402 
       
   403     funcbtnrect.LayoutRect(viturect.Rect(), funcbtn);
       
   404     funcbtncnrect.LayoutRect(viturect.Rect(), funcbtncn);
       
   405     rect = funcbtnrect.Rect();
       
   406     rect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   407     funcclrrect.LayoutRect(rect, funcclr);
       
   408     funcswitchrect.LayoutRect(rect, funcswitch);
       
   409 
       
   410     // left and right button
       
   411     funcleft = AknLayoutScalable_Apps::cell_vitu2_function_pane(0, 1, 0).LayoutLine();
       
   412     funcright = AknLayoutScalable_Apps::cell_vitu2_function_pane(0, 2, 0).LayoutLine();
       
   413     funcleftrect.LayoutRect(rect, funcleft);
       
   414     funcrightrect.LayoutRect(rect, funcright);
       
   415     iArrowLeftRect 	= funcleftrect.Rect();
       
   416     iArrowRightRect	= funcrightrect.Rect();
       
   417     funcinnerrect.LayoutRect(iArrowLeftRect, funcinner);
       
   418     iArrowLeftInnerRect = funcinnerrect.Rect();
       
   419     funcinnerrect.LayoutRect(iArrowRightRect, funcinner);
       
   420     iArrowRightInnerRect = funcinnerrect.Rect();
       
   421 
       
   422     // funcinnerrect
       
   423     iBackspaceRect = funcclrrect.Rect();
       
   424     funcinnerrect.LayoutRect(iBackspaceRect, funcinner);
       
   425     iBackspaceInnerRect = funcinnerrect.Rect();
       
   426     iSwitchRect = funcswitchrect.Rect();
       
   427     funcinnerrect.LayoutRect( iSwitchRect, funcinner );
       
   428     iSwitchInnerRect = funcinnerrect.Rect();
       
   429 
       
   430     // Cursor button in Chinese input mode
       
   431     rect = funcbtncnrect.Rect();
       
   432     rect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   433     funcinnercn = AknLayoutScalable_Apps::cell_vitu2_function_pane_g1(1).LayoutLine();
       
   434     // 1. left arrow
       
   435     funccell = AknLayoutScalable_Apps::cell_vitu2_function_pane( 1, 1, 0 ).LayoutLine();
       
   436     funccellrect.LayoutRect( rect, funccell );
       
   437     iArrowLeftCnRect = funccellrect.Rect();
       
   438     funcinnerrectcn.LayoutRect( funccellrect.Rect(), funcinnercn );
       
   439     iArrowLeftInnerCnRect = funcinnerrectcn.Rect();
       
   440     
       
   441     // 2, up arrow
       
   442     funccell = AknLayoutScalable_Apps::cell_vitu2_function_pane( 1, 0, 0 ).LayoutLine();
       
   443     funccellrect.LayoutRect( rect, funccell );
       
   444     iArrowUpRect = funccellrect.Rect();
       
   445     funcinnerrectcn.LayoutRect( funccellrect.Rect(), funcinnercn );
       
   446     iArrowUpInnerRect = funcinnerrectcn.Rect();
       
   447     
       
   448     // 3. right arrow
       
   449     funccell = AknLayoutScalable_Apps::cell_vitu2_function_pane( 1, 2, 0 ).LayoutLine();
       
   450     funccellrect.LayoutRect( rect, funccell );
       
   451     iArrowRightCnRect = funccellrect.Rect();
       
   452     funcinnerrectcn.LayoutRect( funccellrect.Rect(), funcinnercn );
       
   453     iArrowRightInnerCnRect = funcinnerrectcn.Rect();
       
   454     
       
   455     // 4. down arrow
       
   456     funccell = AknLayoutScalable_Apps::cell_vitu2_function_pane( 1, 0, 1 ).LayoutLine();
       
   457     funccellrect.LayoutRect( rect, funccell );
       
   458     iArrowDownRect = funccellrect.Rect();
       
   459     funcinnerrectcn.LayoutRect( funccellrect.Rect(), funcinnercn );
       
   460     iArrowDownInnerRect = funcinnerrectcn.Rect();
       
   461 #ifdef LAF_MODIFY    
       
   462     //indicator bar rect
       
   463     funccell = AknLayoutScalable_Apps::cell_vitu2_function_pane( 1, 1, 1 ).LayoutLine();
       
   464     funccellrect.LayoutRect( rect, funccell );
       
   465     iImIndiOuterRectCn = funccellrect.Rect();
       
   466     funccell = AknLayoutScalable_Apps::cell_vitu2_function_pane( 1, 2, 1 ).LayoutLine();
       
   467     funccellrect.LayoutRect(rect,funccell);
       
   468     iImIndiOuterRectCn.iBr = funccellrect.Rect().iBr;    
       
   469 
       
   470     iImIndicatorChnRect	= iImIndiOuterRectCn;
       
   471     iImIndicatorChnRect.Shrink( 24, 12 );
       
   472 
       
   473 #endif
       
   474     
       
   475 	// candidate list
       
   476     TAknWindowLineLayout candlist, candlistpane, charpane, listctrl;
       
   477     TAknLayoutRect candlistrect, candlistpanerect, charpanerect1, charpanerect2;
       
   478     TAknLayoutRect charpanerect3, listctrlrect;
       
   479 	
       
   480     if (iLandScape)
       
   481         {
       
   482 		candlist = AknLayoutScalable_Apps::popup_vitu2_dropdown_list_window(1).
       
   483 										LayoutLine();        
       
   484         }
       
   485     else
       
   486         {
       
   487        	candlist = AknLayoutScalable_Apps::popup_vitu2_dropdown_list_window(0).
       
   488 										LayoutLine();
       
   489         }
       
   490     candlistrect.LayoutRect( viturect.Rect(), candlist );
       
   491     rect = candlistrect.Rect();
       
   492     rect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   493     candlistpane = AknLayoutScalable_Apps::grid_vitu2_dropdown_list_pane().
       
   494 										LayoutLine();
       
   495     candlistpanerect.LayoutRect( rect, candlistpane );
       
   496 	
       
   497     charpane = AknLayoutScalable_Apps::cell_vitu2_dropdown_list_char_pane( 0 , 0 , 0 ).
       
   498 										LayoutLine();
       
   499     charpanerect1.LayoutRect( candlistpanerect.Rect(), charpane );
       
   500     charpane = AknLayoutScalable_Apps::cell_vitu2_dropdown_list_char_pane( 0 , 1 , 0 ).
       
   501 										LayoutLine();
       
   502     charpanerect2.LayoutRect( candlistpanerect.Rect(), charpane );
       
   503     charpane = AknLayoutScalable_Apps::cell_vitu2_dropdown_list_char_pane( 0 , 0 , 1 ).
       
   504 										LayoutLine();
       
   505     charpanerect3.LayoutRect( candlistpanerect.Rect(), charpane );
       
   506     listctrl = AknLayoutScalable_Apps::cell_vitu2_dropdown_list_ctrl_pane( 0, 0, 0 ).
       
   507 										LayoutLine();
       
   508     listctrlrect.LayoutRect( candlistpanerect.Rect(), listctrl );
       
   509 									
       
   510     iCandsHorizontalMargin = charpanerect2.Rect().iTl.iX - charpanerect1.Rect().iBr.iX;
       
   511     iCandsVerticalMargin = charpanerect3.Rect().iTl.iY - charpanerect1.Rect().iBr.iY;
       
   512     iCandsNaviWidth = listctrlrect.Rect().Width();
       
   513 	
       
   514     iCandsUnitWidth = charpanerect1.Rect().Width();
       
   515     iCandsUnitHeight = charpanerect1.Rect().Height() ;
       
   516     
       
   517     iCandsSpinBtnHeight = listctrlrect.Rect().Height();
       
   518     iCandsSpellLTPos = charpanerect1.Rect().iTl;
       
   519     iCandsLTPos = charpanerect3.Rect().iTl;
       
   520     iCandsPuncLTPos = iCandsSpellLTPos;
       
   521     
       
   522     TAknTextLineLayout candstxtlayout = 
       
   523                      AknLayoutScalable_Apps::cell_vitu2_dropdown_list_char_pane_t1().LayoutLine();
       
   524     TAknLayoutText candstxt;
       
   525     candstxt.LayoutText( charpanerect1.Rect(), candstxtlayout );
       
   526     iCandsFont = const_cast<CFont*>( AknLayoutUtils::FontFromId( candstxtlayout.iFont, NULL ) );
       
   527     iCandsTextMargin = candstxt.TextRect().iTl.iX - charpanerect1.Rect().iTl.iX;
       
   528     iCandsTextColor = candstxt.Color();
       
   529     
       
   530     //extra adjustment
       
   531     // No reason to add the iCandsTextMargin and KCandsAdjustment
       
   532     iCandsUnitWidth += KCandsAdjustment;
       
   533     iCandsNaviWidth += iCandsTextMargin;
       
   534     
       
   535     TPtrC ptr(reinterpret_cast<TText*>(&iLandScape), sizeof(iLandScape)/sizeof(TText));
       
   536     NotifySubscriber(MItutPropertySubscriber::EItutPropertyLandscape, ptr);
       
   537 
       
   538     TSize spellSize( iCandsUnitWidth * 6 + iCandsHorizontalMargin * 7, iCandsUnitHeight );
       
   539     iSpellRect = TRect( iCandsSpellLTPos, spellSize );
       
   540     iSpellFont = const_cast<CFont*>( AknLayoutUtils::FontFromId( candstxtlayout.iFont, NULL ) );
       
   541     iSpellTextColor = candstxt.Color();
       
   542     
       
   543 
       
   544     
       
   545     // Navi buttons
       
   546     TAknWindowLineLayout toppane, toppanecn, btnup, btndown, btnopt, btncls, btnback;
       
   547     TAknLayoutRect toppanerect, toppanerectcn, btnuprect, btndownrect, 
       
   548                    btnoptrect, btnoptrectcn, btnclsrect, btnclsrectcn, btnbackrectcn;
       
   549     TAknWindowLineLayout upinner, downinner, optinner, clsinner;
       
   550     TAknLayoutRect upinrect, downinrect, optinrect, optinrectcn, clsinrect, clsinrectcn;	
       
   551     if (iLandScape)
       
   552         {
       
   553         toppane = AknLayoutScalable_Apps::grid_vitu2_function_top_pane(1).LayoutLine();
       
   554         toppanecn = AknLayoutScalable_Apps::grid_vitu2_function_top_pane(3).LayoutLine();
       
   555         }
       
   556     else
       
   557         {
       
   558         toppane = AknLayoutScalable_Apps::grid_vitu2_function_top_pane(0).LayoutLine();
       
   559         toppanecn = AknLayoutScalable_Apps::grid_vitu2_function_top_pane(2).LayoutLine();
       
   560         }	
       
   561     toppanerect.LayoutRect( viturect.Rect(), toppane );
       
   562     toppanerectcn.LayoutRect(viturect.Rect(), toppanecn);
       
   563     rect = toppanerect.Rect();
       
   564     rectcn = toppanerectcn.Rect();
       
   565     rect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   566     rectcn.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);
       
   567     
       
   568     // Chinese input mode
       
   569     funcswitchcn = AknLayoutScalable_Apps::cell_vitu2_function_top_pane( 0, 2, 0 ).LayoutLine();
       
   570     funcswitchcnrect.LayoutRect( rectcn, funcswitchcn );
       
   571     iSwitchCnRect = funcswitchcnrect.Rect();
       
   572     funcinnercn = AknLayoutScalable_Apps::cell_vitu2_function_top_pane_g1(0).LayoutLine();
       
   573     funcinnerrectcn.LayoutRect( funcswitchcnrect.Rect(), funcinnercn );
       
   574     iSwitchInnerCnRect = funcinnerrectcn.Rect();
       
   575     
       
   576     btnopt= AknLayoutScalable_Apps::cell_vitu2_function_top_pane( 0, 1, 0 ).LayoutLine();
       
   577     btnoptrect.LayoutRect( rect, btnopt );
       
   578     btnoptrectcn.LayoutRect(rectcn, btnopt);
       
   579     optinner = AknLayoutScalable_Apps::cell_vitu2_function_top_pane_g1(1).LayoutLine();
       
   580     optinrect.LayoutRect( btnoptrect.Rect(), optinner );
       
   581     optinner = AknLayoutScalable_Apps::cell_vitu2_function_top_pane_g1(0).LayoutLine();
       
   582     optinrectcn.LayoutRect(btnoptrectcn.Rect(), optinner);
       
   583     iOptionInnerRect = optinrect.Rect();
       
   584 #ifdef LAF_MODIFY	
       
   585     iOptionInnerRectCn = optinrectcn.Rect();
       
   586 #endif	
       
   587     btncls= AknLayoutScalable_Apps::cell_vitu2_function_top_pane( 0, 0, 0 ).LayoutLine();
       
   588     btnclsrect.LayoutRect( rect, btncls );
       
   589     btnclsrectcn.LayoutRect(rectcn, btncls);
       
   590     clsinner = AknLayoutScalable_Apps::cell_vitu2_function_top_pane_g1(1).LayoutLine();
       
   591     clsinrect.LayoutRect( btnclsrect.Rect(), clsinner );
       
   592     clsinner = AknLayoutScalable_Apps::cell_vitu2_function_top_pane_g1(0).LayoutLine();
       
   593     clsinrectcn.LayoutRect(btnclsrectcn.Rect(), clsinner);
       
   594     iCloseInnerRect = clsinrect.Rect();
       
   595 #ifdef LAF_MODIFY	
       
   596     iCloseInnerRectCn = clsinrectcn.Rect();
       
   597 #endif	
       
   598     btnback= AknLayoutScalable_Apps::cell_vitu2_function_top_pane( 0, 3, 0 ).LayoutLine();
       
   599     btnbackrectcn.LayoutRect(rectcn, btnback);
       
   600     iBackspaceCnRect = btnbackrectcn.Rect();
       
   601     funcinner = AknLayoutScalable_Apps::cell_vitu2_function_top_pane_g1(0).LayoutLine();
       
   602     funcinnerrect.LayoutRect( btnbackrectcn.Rect(), funcinner );
       
   603     iBackspaceInnerCnRect = funcinnerrect.Rect();
       
   604 	
       
   605 	
       
   606     iOptionsRect = btnoptrect.Rect();
       
   607     iOptionsRectCn = btnoptrectcn.Rect();
       
   608     iCloseRect = btnclsrect.Rect();
       
   609     iCloseRectCn = btnclsrectcn.Rect();
       
   610 
       
   611     // input mode indicator, should use laf data in the future
       
   612 #ifndef LAF_MODIFY    
       
   613     funcindcn = AknLayoutScalable_Apps::field_vitu2_entry_pane_g1().LayoutLine();
       
   614     funcindcnrect.LayoutRect( icfrectcn.Rect(), funcindcn );
       
   615 #endif    
       
   616     funcind = AknLayoutScalable_Apps::cell_vitu2_function_top_wide_pane(1).LayoutLine();
       
   617     funcindrect.LayoutRect(rect, funcind);
       
   618     
       
   619     funcindinner = AknLayoutScalable_Apps::cell_vitu2_function_top_wide_pane_g1(2).LayoutLine();
       
   620     funcindrectinner.LayoutRect(funcindrect.Rect(), funcindinner);
       
   621     //iBackspaceCnRect = funcindcnrect.Rect();
       
   622 
       
   623     iImIndicatorWesRect = funcindrectinner.Rect();	
       
   624     iImIndiOuterRect = funcindrect.Rect();
       
   625 #ifndef LAF_MODIFY
       
   626     funcindinner = AknLayoutScalable_Apps::cell_vitu2_function_top_wide_pane_g1(1).LayoutLine();
       
   627     funcindrectinner.LayoutRect(funcindrect.Rect(), funcindinner);    
       
   628     iImIndicatorChnRect = funcindrectinner.Rect();
       
   629 #endif
       
   630 	// match selection list
       
   631 	TAknWindowLineLayout matchlist, listpane, itempane1, itempane2, scrollpane;
       
   632 	TAknLayoutRect matchlistrect, listpanerect, itempanerect1, itempanerect2, scrollpanerect;
       
   633 	TAknWindowLineLayout arrowup, arrowdown, arrowupinner, arrowdowninner;
       
   634 	TAknLayoutRect arrowuprect, arrowdownrect, arrowupinnerRect, arrowdowninnerRect;
       
   635 	
       
   636 	if( iLandScape )
       
   637 		{
       
   638 		matchlist = AknLayoutScalable_Apps::popup_vitu2_match_list_window(3).LayoutLine();
       
   639 		listpane = AknLayoutScalable_Apps::list_vitu2_match_list_pane(1).LayoutLine();
       
   640 		scrollpane = AknLayoutScalable_Apps::vitu2_page_scroll_pane(1).LayoutLine();
       
   641 		}
       
   642 	else
       
   643 		{
       
   644 		matchlist = AknLayoutScalable_Apps::popup_vitu2_match_list_window(2).LayoutLine();
       
   645 		listpane = AknLayoutScalable_Apps::list_vitu2_match_list_pane(0).LayoutLine();
       
   646 		scrollpane = AknLayoutScalable_Apps::vitu2_page_scroll_pane(0).LayoutLine();
       
   647 		}
       
   648 	
       
   649 	matchlistrect.LayoutRect( viturect.Rect(), matchlist );
       
   650 	rect = matchlistrect.Rect();
       
   651     rect.Move(-iLayoutOffset.iX, -iLayoutOffset.iY);	
       
   652     
       
   653 	listpanerect.LayoutRect( rect, listpane );
       
   654 	scrollpanerect.LayoutRect( rect, scrollpane );
       
   655 	itempane1 = AknLayoutScalable_Apps::list_vitu2_match_list_item_pane( 0, 0, 0 ).LayoutLine();
       
   656 	itempanerect1.LayoutRect( listpanerect.Rect(), itempane1 );
       
   657 	itempane2 = AknLayoutScalable_Apps::list_vitu2_match_list_item_pane( 0, 0, 1 ).LayoutLine();
       
   658 	itempanerect2.LayoutRect( listpanerect.Rect(), itempane2 );
       
   659 	
       
   660 	arrowupinner= AknLayoutScalable_Apps::vitu2_page_scroll_pane_g1().LayoutLine();
       
   661 	arrowdowninner = AknLayoutScalable_Apps::vitu2_page_scroll_pane_g2().LayoutLine();
       
   662 	arrowup = AknLayoutScalable_Apps::bg_button_pane_cp023().LayoutLine();
       
   663 	arrowdown= AknLayoutScalable_Apps::bg_button_pane_cp024().LayoutLine();
       
   664 	arrowuprect.LayoutRect( scrollpanerect.Rect(), arrowup );
       
   665 	arrowdownrect.LayoutRect( scrollpanerect.Rect(), arrowdown );
       
   666 	arrowupinnerRect.LayoutRect( scrollpanerect.Rect(), arrowupinner );
       
   667 	arrowdowninnerRect.LayoutRect( scrollpanerect.Rect(), arrowdowninner );
       
   668 	
       
   669 	//iSelectionTl = rect.iTl;
       
   670 	iSelectionHorMargin = listpanerect.Rect().iTl.iX;
       
   671 	iSelectionVerMargin = listpanerect.Rect().iTl.iY;
       
   672 	iSelectionTl = TPoint(iIcfWesRect.iTl.iX + 10, iIcfWesRect.iTl.iY + 10);
       
   673 	iSelectionItemSize = itempanerect1.Rect().Size();
       
   674 	iSelectionItemMargin = itempanerect1.Rect().iBr.iY - itempanerect2.Rect().iTl.iY;
       
   675 	iSelectionNaviSize = arrowuprect.Rect().Size();
       
   676 	iSelectionNaviInnerSize = arrowupinnerRect.Rect().Size();
       
   677 	iSelectionTextLine = AknLayoutScalable_Apps::list_vitu2_match_list_item_pane_t1().LayoutLine();
       
   678     iSelectionPageTextLine = AknLayoutScalable_Apps::vitu2_page_scroll_pane_t1().LayoutLine();
       
   679 	
       
   680 	// read spell popup window laf
       
   681 	TAknWindowLineLayout queryPane, btnOK, btnCancle, ICFArea, btnClr, btnClrInner;
       
   682 	TAknWindowLineLayout editIndicator;
       
   683 	TAknLayoutRect queryPaneRect, btnOKRect, btnCancleRect, ICFAreaRect, btnClrRect;
       
   684 	TAknLayoutRect btnClrInnerRect, editIndicatorRect; 
       
   685 	TAknTextLineLayout btnOKText, btnCancleText;
       
   686 	if( iLandScape )
       
   687 		{
       
   688 		queryPane = AknLayoutScalable_Apps::popup_vitu2_query_window(1).LayoutLine();
       
   689 		}
       
   690 	else
       
   691 		{
       
   692 		queryPane = AknLayoutScalable_Apps::popup_vitu2_query_window(0).LayoutLine();	
       
   693 		}
       
   694 	queryPaneRect.LayoutRect( viturect.Rect(), queryPane );
       
   695 	btnOK = AknLayoutScalable_Apps::bg_button_pane_cp016().LayoutLine();
       
   696 	btnOKRect.LayoutRect( queryPaneRect.Rect(), btnOK );
       
   697 	btnCancle = AknLayoutScalable_Apps::bg_button_pane_cp017().LayoutLine();
       
   698 	btnCancleRect.LayoutRect( queryPaneRect.Rect(), btnCancle );
       
   699 	btnOKText = AknLayoutScalable_Apps::popup_vitu2_query_window_t4(0).LayoutLine();
       
   700 	btnCancleText = AknLayoutScalable_Apps::popup_vitu2_query_window_t5(0).LayoutLine();
       
   701 	
       
   702 	editIndicator = AknLayoutScalable_Apps::popup_vitu2_query_window_g1().LayoutLine();
       
   703 	editIndicatorRect.LayoutRect( queryPaneRect.Rect(), editIndicator  );
       
   704 	
       
   705 	ICFArea = AknLayoutScalable_Apps::input_focus_pane_cp08().LayoutLine();
       
   706 	ICFAreaRect.LayoutRect( queryPaneRect.Rect(), ICFArea  );
       
   707 	
       
   708 	btnClr = AknLayoutScalable_Apps::bg_button_pane_cp015().LayoutLine();
       
   709 	btnClrRect.LayoutRect( queryPaneRect.Rect(), btnClr );
       
   710 	btnClrInner = AknLayoutScalable_Apps::popup_vitu2_query_window_g2().LayoutLine();
       
   711 	btnClrInnerRect.LayoutRect( queryPaneRect.Rect(), btnClrInner );
       
   712 	
       
   713 	iSpellQueryPaneRect = queryPaneRect.Rect();
       
   714 	iSpellEditIndicator = editIndicatorRect.Rect();
       
   715     iOkRect = btnOKRect.Rect();
       
   716     iCancelRect = btnCancleRect.Rect();
       
   717     iSpellICFRect = ICFAreaRect.Rect();
       
   718     iSpellClrRect = btnClrRect.Rect();
       
   719     iSpellClrInnerRect = btnClrInnerRect.Rect();  
       
   720     
       
   721     iBtnTextFormat  = iVkAlphaText1;//btnOKText;
       
   722 	iBtnTextFormat1 = iVkAlphaText1;//btnCancleText;
       
   723 #ifdef LAF_MODIFY	
       
   724 // manully ajust.	
       
   725     iBtnTextFormat.iFont = btnOKText.iFont;
       
   726     iBtnTextFormat.il = iBtnTextFormat.il - 30 > 0? iBtnTextFormat.il - 30 : 0;
       
   727     iBtnTextFormat.iB = 10;
       
   728 	iBtnTextFormat1.iFont = btnCancleText.iFont;
       
   729     iBtnTextFormat1.il = iBtnTextFormat1.il - 30 > 0? iBtnTextFormat1.il - 30 : 0;
       
   730 	iBtnTextFormat1.iB = 10;
       
   731 	
       
   732 //	TInt offsetY = 50;
       
   733 //    iSpellICFRect.Move(0,-offsetY);
       
   734 //    iSpellClrRect.Move(0,-offsetY);
       
   735 //    iSpellClrInnerRect.Move( 0, -offsetY );
       
   736 #endif //LAF_MODIFY
       
   737 	
       
   738     // just test if there is size change of added ctrls
       
   739     iSendRect = iArrowLeftRect;
       
   740     iDisconnRect = iArrowRightRect;
       
   741     // end test    
       
   742     
       
   743     // preview popup window 
       
   744   	TAknWindowLineLayout previewWnd, previewBackground, previewWndInner;
       
   745   	TAknLayoutRect previewWndRect, previewBackgroundRect, previewWndInnerRect;
       
   746   	TAknLayoutText previewWndText;
       
   747   	previewWnd = AknLayoutScalable_Avkon::popup_fshwr2_char_preview_window(0).LayoutLine();	
       
   748   	            
       
   749   	previewWndRect.LayoutRect( iLayoutRect, previewWnd );
       
   750   	previewBackground = AknLayoutScalable_Avkon::bg_popup_fep_char_preview_window_cp01().LayoutLine();
       
   751   	previewBackgroundRect.LayoutRect( previewWndRect.Rect(), previewBackground );
       
   752   	iPreviewWndRect = previewBackgroundRect.Rect();
       
   753   	
       
   754   	previewWndInner = AknLayoutScalable_Avkon::bg_popup_fep_char_preview_window_g9().LayoutLine();
       
   755   	previewWndInnerRect.LayoutRect( previewBackgroundRect.Rect(), previewWndInner );
       
   756   	
       
   757   	iPreviewWndInnerRect = previewWndInnerRect.Rect();
       
   758   	iPreviewWndText = 
       
   759         AknLayoutScalable_Avkon::popup_fshwr2_char_preview_window_t1(0).LayoutLine();
       
   760     previewWndText.LayoutText(previewWndRect.Rect(), iPreviewWndText);
       
   761     iBubbleFont = const_cast<CFont*>(previewWndText.Font());
       
   762     }
       
   763     
       
   764 void CGenericItutDataMgr::SetTextAlignment()
       
   765     {
       
   766     CFepLayoutMultiLineIcf* icffield = static_cast<CFepLayoutMultiLineIcf*>(iLayoutContext->Control(ECtrlIdICF));
       
   767     
       
   768     if (icffield && InputLanguage() != ELangNone)
       
   769         {
       
   770         TRAP_IGNORE(icffield->SetTextAlignmentL(iIcfTextAlignment, InputLanguage()));
       
   771         }
       
   772     }
       
   773     
       
   774 void CGenericItutDataMgr::SetIcfTextAlignment(TInt aAlignment)
       
   775     {
       
   776     iIcfTextAlignment = aAlignment;
       
   777     }
       
   778 
       
   779 void CGenericItutDataMgr::SetLanguageL(TInt aLanguage)
       
   780     {    
       
   781     ASSERT( IsValidLanguage( aLanguage ) );
       
   782     	
       
   783     if (iLanguage != aLanguage)
       
   784         {	        
       
   785         if( IsValidLanguage( iLanguage ) )
       
   786         	iIsLangDirectionSwitch =  IsRtoLLanguage( aLanguage ) ^ IsRtoLLanguage( iLanguage );
       
   787         else        
       
   788         	//Check mirroring is needed when first setting language
       
   789         	iIsLangDirectionSwitch = IsRtoLLanguage( aLanguage );        	
       
   790         
       
   791         iLanguage = aLanguage;
       
   792         iInputMode = KInvalidImMode;
       
   793         
       
   794         //SetTextAlignment();
       
   795 
       
   796         TInt scriptIdx = GetConfigResFileName(aLanguage);
       
   797 
       
   798         if (scriptIdx != iCurrentScriptIdx)
       
   799             {
       
   800             iCurrentScriptIdx = scriptIdx;
       
   801 
       
   802             CCoeEnv* coeEnv = CCoeEnv::Static();
       
   803             
       
   804             if (iConfigResId)
       
   805                 {
       
   806                 coeEnv->DeleteResourceFile(iConfigResId);
       
   807                 }
       
   808 
       
   809             TFileName resourceConfigName(iResourceFilename);
       
   810             BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceConfigName);
       
   811             iConfigResId = coeEnv->AddResourceFileL(resourceConfigName);
       
   812             
       
   813             if (IsChinese())
       
   814                 {
       
   815                 iLayoutContext->UiManager()->CreateChineseSpecificCtrlsIfNeededL();
       
   816                 }
       
   817 
       
   818             NotifyChangeControlLayout(MItutPropertySubscriber::EItutPropertyKeypadResourceId, 
       
   819                                       KeypadResourceId());  
       
   820             }
       
   821         }
       
   822     }
       
   823 
       
   824 void CGenericItutDataMgr::SetCase(TInt aCase)
       
   825     {
       
   826     if (iCase != aCase || iInputMode == ELatin)
       
   827         {
       
   828         iCase = aCase;
       
   829         NotifyChangeControlLayout(MItutPropertySubscriber::EItutPropertyKeypadResourceId, 
       
   830                                   KeypadResourceId());  
       
   831         }
       
   832     }
       
   833 
       
   834 void CGenericItutDataMgr::SetInputModeL(TInt aMode)
       
   835     {
       
   836     TInt engineMode = KInvalidImMode;
       
   837 
       
   838     switch (aMode)
       
   839         {
       
   840         case EPinyin:
       
   841             {
       
   842             engineMode = EPtiEnginePinyinByPhrase;
       
   843             }
       
   844             break;
       
   845         case EStroke:
       
   846             {
       
   847             engineMode = EPtiEngineStrokeByPhrase;
       
   848             }
       
   849             break;
       
   850         case EZhuyin:
       
   851             {
       
   852             engineMode = EPtiEngineZhuyinByPhrase;
       
   853             }
       
   854             break;
       
   855         case ELatin:
       
   856         case EHindi:
       
   857         case ENumber:
       
   858         case EHangul:
       
   859         case ENativeNumber:
       
   860             {
       
   861             iInputMode = aMode;
       
   862             NotifyChangeControlLayout(MItutPropertySubscriber::EItutPropertyKeypadResourceId, 
       
   863                                       KeypadResourceId());  
       
   864             }
       
   865             break;
       
   866         case EZhuyinFind:
       
   867             {
       
   868             iInputMode = EZhuyin; 
       
   869             
       
   870             return; 
       
   871             }
       
   872         case EStrokeFind:
       
   873             {
       
   874             iInputMode = EStroke;  
       
   875             
       
   876             return;
       
   877             }
       
   878         default:
       
   879             return;    
       
   880         }
       
   881 
       
   882     if (IsChinese())
       
   883         {
       
   884         TInt err = iPtiEngine->ActivateLanguageL(iLanguage, TPtiEngineInputMode(engineMode));
       
   885         if (err == KErrNone)
       
   886             {
       
   887             iPtiEngine->SetCandidatePageLength(KOnePageCandidateCount);
       
   888             iInputMode = aMode;
       
   889             }
       
   890         }
       
   891     }
       
   892 
       
   893 TAny* CGenericItutDataMgr::RequestData(TInt aDataType)
       
   894     {
       
   895     switch ( aDataType )
       
   896         {
       
   897         case EScreenSize:
       
   898             return &iScreenSize;
       
   899         case ELayoutOffset:
       
   900             return &iLayoutOffset;
       
   901         case ELayoutRect:
       
   902             return &iLayoutRect;
       
   903         case EIcfRect:
       
   904             return IsChinese() ? &iIcfChnRect : & iIcfWesRect;
       
   905         case EIcfFont:
       
   906             return IsChinese() ? reinterpret_cast<TAny*>(iIcfFontCn) : 
       
   907                                  reinterpret_cast<TAny*>(iIcfFont);
       
   908         case EBackspaceRect:
       
   909         case EItutPosClear:
       
   910             return IsChinese() ? &iBackspaceCnRect : &iBackspaceRect;
       
   911         case ESwitchRect:
       
   912         case EItutPosSwitchLayout:
       
   913             return IsChinese() ? &iSwitchCnRect : &iSwitchRect;
       
   914         case EImIndicatorRect:
       
   915             if (iSpellMode)
       
   916             	{
       
   917             	return &iSpellEditIndicator;
       
   918             	}
       
   919             	
       
   920             if (IsChinese())
       
   921             	{
       
   922             	return &iImIndicatorChnRect;
       
   923             	} 
       
   924             CalWesternIndicator();
       
   925             return &iCalindwesternRect;
       
   926        	case EImIndicatorOuterRect:
       
   927        	    if(IsChinese())
       
   928        	        {
       
   929        	        return &iImIndiOuterRectCn;
       
   930        	        }
       
   931        	    else
       
   932        	        {
       
   933        	        return &iImIndiOuterRect;
       
   934        	        }
       
   935         case EKeypadRect:
       
   936         	return IsChinese() ? &iKeypadRectCn : &iKeypadRect;	        	
       
   937         case EKeypadCellRects:
       
   938         	return IsChinese() ? &iKeypadCellRectsCn : &iKeypadCellRects;	
       
   939         case EKeypadLeftTextLine:
       
   940             return &iVkNumText;
       
   941         case EKeypadRightTextLine1:
       
   942             return IsThai() ? &iVkAlphaText1ForThai : &iVkAlphaText1;
       
   943         case EKeypadRightTextLine2:
       
   944             return IsThai() ? &iVkAlphaText2ForThai : &iVkAlphaText2;
       
   945         case EKeypadRightTextLine3:
       
   946             return IsThai() ? &iVkAlphaText3ForThai : &iVkAlphaText3;
       
   947         case EDropdownlistUnitWidth:
       
   948             return &iCandsUnitWidth;
       
   949         case EDropdownlistUnitHeight:
       
   950             return &iCandsUnitHeight;
       
   951         case EDropdownlistHorizontalMargin:
       
   952             return &iCandsHorizontalMargin;
       
   953         case EDropdownlistVerticalMargin:
       
   954             return &iCandsVerticalMargin;
       
   955         case EDropdownListNaviWidth:
       
   956             return &iCandsNaviWidth;
       
   957         case EDropdownListSpinBtnHeight:
       
   958             return &iCandsSpinBtnHeight;
       
   959         case EDropdownListSpellLTPos:
       
   960             return &iCandsSpellLTPos;
       
   961         case EDropdownListCandsLTPos:
       
   962             return &iCandsLTPos;
       
   963         case EDropdownListPuncLTPos:
       
   964             return &iCandsPuncLTPos;
       
   965         case EDropdownListFont:
       
   966             return reinterpret_cast<TAny*>(iCandsFont);
       
   967         case EDropdownListTextMargin:
       
   968             return &iCandsTextMargin;
       
   969         case EDropdownListTextColor:
       
   970             return &iCandsTextColor;
       
   971         case ESpellRect:
       
   972             return &iSpellRect;
       
   973         case ESpellFont:
       
   974             return reinterpret_cast<TAny*>(iSpellFont);
       
   975         case ESpellTextColor:
       
   976             return &iSpellTextColor;
       
   977         case ELanguage:
       
   978             return &iLanguage;
       
   979         case EInputMode:
       
   980             return &iInputMode;
       
   981         case ECase:
       
   982             return &iCase;
       
   983         case EChnCandidates:
       
   984             return &iCandidates;
       
   985         case EChnPuncCandidates:
       
   986             return &iPuncCandidates;
       
   987         case EArrowLeftRect:
       
   988         case EItutPosArrowLeft:
       
   989             return IsChinese() ? &iArrowLeftCnRect : &iArrowLeftRect;
       
   990         case EArrowRightRect:
       
   991         case EItutPosArrowRight:
       
   992             return IsChinese() ? &iArrowRightCnRect : &iArrowRightRect;
       
   993         case EArrowUpRect:
       
   994         case EItutPosArrowUp:
       
   995             return &iArrowUpRect;
       
   996         case EArrowDownRect:
       
   997         case EItutPosArrowDown:
       
   998             return &iArrowDownRect;
       
   999         case EItutPosSend:
       
  1000             return &iSendRect;
       
  1001         case EItutPosDisconn:
       
  1002             return &iDisconnRect;
       
  1003         case EMatchSelectionTlPos:
       
  1004             return &iSelectionTl;
       
  1005         case EMatchSelectionItemSize:
       
  1006             return &iSelectionItemSize;
       
  1007         case EMatchSelectionItemMargin:
       
  1008             return &iSelectionItemMargin;
       
  1009         case EMatchSelectionTextLine:
       
  1010             return &iSelectionTextLine;
       
  1011         case EOptionsRect:
       
  1012 #ifdef LAF_MODIFY	
       
  1013         	return IsChinese() ? &iOptionsRectCn : &iOptionsRect;
       
  1014 #else        	
       
  1015             return &iOptionsRect;
       
  1016 #endif            
       
  1017         case ECloseRect:
       
  1018 #ifdef LAF_MODIFY	
       
  1019         	return IsChinese() ? &iCloseRectCn : &iCloseRect;
       
  1020 #else        	
       
  1021             return &iCloseRect;
       
  1022 #endif            
       
  1023        	case ESwitchInnerRect:
       
  1024         	return IsChinese() ? &iSwitchInnerCnRect : &iSwitchInnerRect;
       
  1025         case ELeftInnerRect:
       
  1026         	return IsChinese() ? &iArrowLeftInnerCnRect : &iArrowLeftInnerRect;
       
  1027         case ERightInnerRect:
       
  1028         	return IsChinese() ? &iArrowRightInnerCnRect : &iArrowRightInnerRect;
       
  1029         case EBackspaceInnerRect:
       
  1030         	return IsChinese() ? &iBackspaceInnerCnRect : &iBackspaceInnerRect;
       
  1031        	case EUpInnerRect:
       
  1032         	return &iArrowUpInnerRect;
       
  1033         case EDownInnerRect:
       
  1034         	return &iArrowDownInnerRect;
       
  1035        	case ECloseInnerRect:
       
  1036 #ifdef LAF_MODIFY	       	
       
  1037         	return IsChinese() ? &iCloseInnerRectCn : &iCloseInnerRect;
       
  1038 #else        	
       
  1039         	return &iCloseInnerRect;
       
  1040 #endif        	
       
  1041         case EOptionInnerRect:
       
  1042 #ifdef LAF_MODIFY	
       
  1043         	return IsChinese() ? &iOptionInnerRectCn : &iOptionInnerRect;
       
  1044 #else        	
       
  1045         	return &iOptionInnerRect;
       
  1046 #endif        	
       
  1047         case EItutPosOk:
       
  1048             return &iOkRect;
       
  1049         case EItutPosCancel:
       
  1050             return &iCancelRect;
       
  1051         case EBtnTextLine:
       
  1052             return &iBtnTextFormat;
       
  1053         case ESpellTextCancle:
       
  1054             return &iBtnTextFormat1;            
       
  1055         case ESpellICFRect:
       
  1056             return &iSpellICFRect;
       
  1057         case ESpellClrRect:
       
  1058             return &iSpellClrRect;
       
  1059         case ESpellClrInnerRect:
       
  1060             return &iSpellClrInnerRect;
       
  1061         case ESpellEditIndicatorRect:
       
  1062             return &iSpellEditIndicator;
       
  1063         case ESpellQueryPaneRect:
       
  1064             return &iSpellQueryPaneRect;       
       
  1065         case ELatinOnly:
       
  1066             return &iLatinOnly;
       
  1067         case EPreviewBubbleRect:
       
  1068             return &iPreviewWndRect;
       
  1069         case EPreviewBubbleInnerRect:
       
  1070             return &iPreviewWndInnerRect;
       
  1071         case EPreviewBubbleTextlayout:
       
  1072             return &iPreviewWndText;
       
  1073         case EPreviewBubbleFont:
       
  1074             return reinterpret_cast<TAny*>(iBubbleFont);    
       
  1075         default:
       
  1076             break;
       
  1077         }
       
  1078 
       
  1079     return NULL;
       
  1080     }
       
  1081 
       
  1082 CGenericItutDataMgr::CGenericItutDataMgr(MItutLayoutContext* aLayoutContext, 
       
  1083                                          CPtiEngine* aPtiEngine)
       
  1084                                         :
       
  1085                                          iPtiEngine( aPtiEngine ),
       
  1086                                          iLanguage(ELangNone),
       
  1087                                          iInputMode(KInvalidImMode),
       
  1088                                          iCase(EAknEditorUpperCase),
       
  1089                                          iConfigResId(0),
       
  1090                                          iLayoutContext(aLayoutContext),
       
  1091                                          iCurrentScriptIdx(KInvalidIndex),
       
  1092                                          iLandScape(EFalse),
       
  1093                                          iSpellMode(EFalse)
       
  1094     {
       
  1095     }
       
  1096 
       
  1097 void CGenericItutDataMgr::NotifySubscriber(MItutPropertySubscriber::TItutProperty aPropertyName, 
       
  1098                                            const TDesC& aValue)
       
  1099     {
       
  1100     for (TInt i = 0; i < iSubscriberList.Count(); i++)
       
  1101         {
       
  1102         TRAP_IGNORE(iSubscriberList[i]->SetPropertyL(aPropertyName, aValue));
       
  1103         }
       
  1104     }
       
  1105 
       
  1106 void CGenericItutDataMgr::NotifyChangeControlLayout(
       
  1107     MItutPropertySubscriber::TItutProperty aPropertyName, TInt aCtrlResId)
       
  1108     {
       
  1109     TInt ctrlResId = KInvalidResId;
       
  1110 
       
  1111     switch (aPropertyName)
       
  1112         {
       
  1113         case MItutPropertySubscriber::EItutPropertyKeypadResourceId:
       
  1114             {
       
  1115             ctrlResId = iLayoutContext->Control(ECtrlIdStdItut)->ResourceId();
       
  1116             }
       
  1117             break;
       
  1118         case MItutPropertySubscriber::EItutPropertyCandidateListResourceId:
       
  1119             {
       
  1120             ctrlResId = iLayoutContext->Control(ECtrlIdStdCandsList)->ResourceId();
       
  1121             }
       
  1122             break;
       
  1123         default:
       
  1124             break;
       
  1125         }
       
  1126 
       
  1127     // since keypad resource divided by script, so maybe ctrlResId unchanged,
       
  1128     // but it is actually changed in different script
       
  1129     if ((ctrlResId != aCtrlResId) ||
       
  1130         (aPropertyName == MItutPropertySubscriber::EItutPropertyKeypadResourceId))
       
  1131         {
       
  1132         TPtrC ptr(reinterpret_cast<TText*>(&aCtrlResId), sizeof(aCtrlResId)/sizeof(TText));
       
  1133 
       
  1134         NotifySubscriber(aPropertyName, ptr);
       
  1135         }
       
  1136     }
       
  1137 
       
  1138 TInt CGenericItutDataMgr::GetNextPageCandidateL(RPointerArray<HBufC>& aList)
       
  1139     {
       
  1140     if (iPtiEngine && (iPtiEngine->NextCandidatePage()))
       
  1141         {
       
  1142         TItutDataConverter::ConvertChnPhraseCandidateL(iPtiEngine->CandidatePage(), aList);
       
  1143 
       
  1144         return KErrNone;
       
  1145         }
       
  1146 
       
  1147     return KErrNotSupported;
       
  1148     }
       
  1149 
       
  1150 TBool CGenericItutDataMgr::NextPageCandidateExist()
       
  1151     {
       
  1152     if (iPtiEngine)
       
  1153         {
       
  1154         return iPtiEngine->MoreCandidatePages();
       
  1155         }
       
  1156 
       
  1157     return EFalse;    
       
  1158     }
       
  1159 
       
  1160 TInt CGenericItutDataMgr::KeypadResourceId()
       
  1161     {
       
  1162     if (iInputMode == ENumber )
       
  1163         {
       
  1164         if( IsExistPlusChar()  )
       
  1165             return R_FINGER_INPUT_KEYPAD_NUMBER_WITH_PLUS;
       
  1166         else
       
  1167         	return R_FINGER_INPUT_KEYPAD_NUMBER;
       
  1168         }
       
  1169     if( iInputMode == ENativeNumber )
       
  1170         {
       
  1171         if( IsExistPlusChar() )
       
  1172         	return R_FINGER_INPUT_KEYPAD_NATIVE_NUMBER_WITH_PLUS;
       
  1173         else
       
  1174         	return R_FINGER_INPUT_KEYPAD_NATIVE_NUMBER;
       
  1175         }
       
  1176 
       
  1177     if ( iLatinOnly )
       
  1178     	{
       
  1179     	if ( iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase )
       
  1180     		{
       
  1181     		return R_FINGER_INPUT_KEYPAD_LATINONLY_UPPERCASE;
       
  1182     		}
       
  1183         return R_FINGER_INPUT_KEYPAD_LATINONLY_LOWERCASE;
       
  1184     	}
       
  1185 
       
  1186     if (!iLangCaseSensitive )
       
  1187         {
       
  1188         return R_FINGER_INPUT_KEYPAD_ABC;
       
  1189         }
       
  1190     if ( IsChinese() )
       
  1191         {
       
  1192         return ChineseKeypadResourceId();
       
  1193         }
       
  1194     if ( IsHindi() )
       
  1195         {
       
  1196         return HindiKeypadResourceId();
       
  1197         }
       
  1198         
       
  1199     if ( IsKorean() )
       
  1200         {
       
  1201         return KoreanKeypadResourceId();
       
  1202         }
       
  1203     if (iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase)
       
  1204         {
       
  1205         return R_FINGER_INPUT_KEYPAD_ABC_UPPERCASE;
       
  1206         }
       
  1207     else
       
  1208         {
       
  1209         return R_FINGER_INPUT_KEYPAD_ABC_LOWERCASE;
       
  1210         }
       
  1211     }
       
  1212     
       
  1213 TInt CGenericItutDataMgr::ChineseKeypadResourceId()
       
  1214     {
       
  1215     
       
  1216     if (iInputMode == EZhuyin)
       
  1217         {
       
  1218         return R_FINGER_INPUT_KEYPAD_ZHUYIN_STANDBY_PREDICT;
       
  1219         }
       
  1220     if (iInputMode == EPinyin)
       
  1221         {
       
  1222         return R_FINGER_INPUT_KEYPAD_PINYIN_STANDBY_PREDICT;
       
  1223         }
       
  1224     if (iInputMode == EStroke)
       
  1225         {
       
  1226         TInt resID;
       
  1227         if (InputLanguage() == ELangPrcChinese)
       
  1228             {
       
  1229             resID = R_FINGER_INPUT_KEYPAD_STROKE_STANDBY_PREDICT_PRC;
       
  1230             }
       
  1231         else
       
  1232             {
       
  1233             resID = R_FINGER_INPUT_KEYPAD_STROKE_STANDBY_PREDICT_TRA;
       
  1234             }
       
  1235         return resID;
       
  1236         }
       
  1237         
       
  1238     if (iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase)
       
  1239         {
       
  1240         return R_FINGER_INPUT_KEYPAD_ABC_UPPERCASE_CHN;
       
  1241         }
       
  1242     else
       
  1243         {
       
  1244         return R_FINGER_INPUT_KEYPAD_ABC_LOWERCASE_CHN;
       
  1245         }
       
  1246     }
       
  1247 
       
  1248 TInt CGenericItutDataMgr::HindiKeypadResourceId()
       
  1249     {
       
  1250     if ( iInputMode == EHindi )
       
  1251         {
       
  1252         return R_FINGER_INPUT_KEYPAD_ABC;
       
  1253         }
       
  1254         
       
  1255     if (iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase)
       
  1256         {
       
  1257         return R_FINGER_INPUT_KEYPAD_LATINONLY_UPPERCASE;
       
  1258         }
       
  1259     else
       
  1260         {
       
  1261         return R_FINGER_INPUT_KEYPAD_LATINONLY_LOWERCASE;
       
  1262         }
       
  1263     }
       
  1264     
       
  1265 TInt CGenericItutDataMgr::KoreanKeypadResourceId()
       
  1266     {
       
  1267     if ( iInputMode == EHangul )
       
  1268         {
       
  1269         return R_FINGER_INPUT_KEYPAD_KOREAN;
       
  1270         }
       
  1271         
       
  1272     if (iCase == EAknEditorTextCase || iCase == EAknEditorUpperCase)
       
  1273         {
       
  1274         return R_FINGER_INPUT_KEYPAD_LATINONLY_UPPERCASE;
       
  1275         }
       
  1276     else
       
  1277         {
       
  1278         return R_FINGER_INPUT_KEYPAD_LATINONLY_LOWERCASE;
       
  1279         }
       
  1280     }
       
  1281     
       
  1282     
       
  1283 TInt CGenericItutDataMgr::GetConfigResFileName(TInt aLang)
       
  1284     {
       
  1285     iResourceFilename.Zero();
       
  1286     iResourceFilename = KConfigResourceFile();
       
  1287 
       
  1288     for (TInt i = 0; i < sizeof(TScriptMapping) / sizeof(TScriptMapping[0]); i++)
       
  1289         {
       
  1290         TScriptInfo script = TScriptMapping[i];
       
  1291 
       
  1292         if (FindLang(&(LangsArr[script.iStartIdx]), script.iEndIdx - script.iStartIdx, aLang) != 
       
  1293             KErrNotFound)
       
  1294             {
       
  1295             iResourceFilename.Append(ResFileExtByScriptIdx(script.iScriptExt));
       
  1296             iResourceFilename.Append(KResourceFileExtName);
       
  1297             iLangCaseSensitive = script.iCaseSensitive;
       
  1298             return i;
       
  1299             }
       
  1300         }
       
  1301 
       
  1302     // default resource file is latin
       
  1303     iResourceFilename.Append(ResFileExtByScriptIdx(TScriptMapping[0].iScriptExt));
       
  1304     iResourceFilename.Append(KResourceFileExtName);    
       
  1305     iLangCaseSensitive = TScriptMapping[0].iCaseSensitive;
       
  1306     return 0;
       
  1307     }
       
  1308 
       
  1309 TInt CGenericItutDataMgr::FindLang(const TInt* aArray, 
       
  1310                                    TInt aEndIdx,
       
  1311                                    TInt aLang) 
       
  1312     {
       
  1313     for (TInt i = 0; i <= aEndIdx; i++)
       
  1314         {
       
  1315         if (aLang == *aArray)
       
  1316             {
       
  1317             return i;
       
  1318             }
       
  1319 
       
  1320         aArray++;    
       
  1321         }
       
  1322 
       
  1323     return KErrNotFound;
       
  1324     }
       
  1325 
       
  1326 TBool CGenericItutDataMgr::IsChinese()
       
  1327     {
       
  1328     return (iLanguage == ELangPrcChinese || iLanguage == ELangHongKongChinese 
       
  1329          || iLanguage == ELangTaiwanChinese);
       
  1330     }
       
  1331 
       
  1332 // tp teleca addon
       
  1333 TBool CGenericItutDataMgr::IsKorean()
       
  1334     {
       
  1335     return ( iLanguage == ELangKorean );
       
  1336     }
       
  1337 
       
  1338 TBool CGenericItutDataMgr::IsHindi()
       
  1339     {
       
  1340     return ( iLanguage == ELangHindi );
       
  1341     }
       
  1342 
       
  1343 TBool CGenericItutDataMgr::IsThai()
       
  1344     {
       
  1345     return ( iLanguage == ELangThai );
       
  1346     }
       
  1347 
       
  1348 TBool CGenericItutDataMgr::IsRtoLLanguage()
       
  1349 	{
       
  1350 	return ( iLanguage == ELangArabic ||
       
  1351 			 iLanguage == ELangHebrew ||
       
  1352 			 iLanguage == ELangFarsi  ||
       
  1353 			 iLanguage == ELangUrdu );	
       
  1354 	}
       
  1355 	
       
  1356 TBool CGenericItutDataMgr::IsRtoLLanguage( TInt aLanguage )
       
  1357 	{
       
  1358 	return ( aLanguage == ELangArabic ||
       
  1359 			 aLanguage == ELangHebrew ||
       
  1360 			 aLanguage == ELangFarsi  ||
       
  1361 			 aLanguage == ELangUrdu );	
       
  1362 	}
       
  1363 
       
  1364 TBool CGenericItutDataMgr::IsLangDirectionSwitch() const
       
  1365 	{
       
  1366 	return iIsLangDirectionSwitch;	
       
  1367 	}
       
  1368 	
       
  1369 const TDesC& CGenericItutDataMgr::ResFileExtByScriptIdx(const TScriptExtIndex aIndex)
       
  1370     {
       
  1371     switch (aIndex)
       
  1372         {
       
  1373         case ELatinExt:
       
  1374             return KLatinExt;
       
  1375         case ECyrillicExt:
       
  1376             return KCyrillicExt;
       
  1377         case EGreekExt:
       
  1378             return KGreekExt;
       
  1379         case EHebrewExt:
       
  1380             return KHebrewExt;
       
  1381         case EArabicExt:
       
  1382             return KArabicExt;
       
  1383         case EFarsiExt:
       
  1384             return KFarsiExt;
       
  1385         case EUrduExt:
       
  1386             return KUrduExt;
       
  1387         case EThaiExt:
       
  1388             return KThaiExt;
       
  1389         case EChnExt:
       
  1390             return KChnExt;
       
  1391         case EDevanagiriExt:
       
  1392         	return KDevanagiriExt;
       
  1393         case EHangulExt:
       
  1394         	return KHangulExt;
       
  1395         default:
       
  1396             break;    
       
  1397         }
       
  1398 
       
  1399     return KNullDesC;
       
  1400     }
       
  1401     
       
  1402 void CGenericItutDataMgr::SetUpdate(TBool aNeedUpdate)
       
  1403 	{
       
  1404 	iNeedUpdate = 	aNeedUpdate;
       
  1405 	}
       
  1406 	
       
  1407 TBool CGenericItutDataMgr::IsUpdate() const
       
  1408 	{
       
  1409 	return 	iNeedUpdate;
       
  1410 	}
       
  1411 	
       
  1412 void CGenericItutDataMgr::CalWesternIndicator()
       
  1413 	{
       
  1414     TSize indSize(iImIndicatorWesRect.Width() * 5 / 6, iImIndicatorWesRect.Height() * 5 / 6);
       
  1415     
       
  1416     TInt offsetX = ( iImIndicatorWesRect.Width() - indSize.iWidth ) / 2;
       
  1417     TInt offsetY = ( iImIndicatorWesRect.Height() - indSize.iHeight ) / 2;
       
  1418     
       
  1419     TInt x = iImIndicatorWesRect.iTl.iX + offsetX;
       
  1420     TInt y = iImIndicatorWesRect.iTl.iY + offsetY;
       
  1421     
       
  1422     iCalindwesternRect.SetRect(TPoint(x,y) , indSize);	
       
  1423 	}
       
  1424 
       
  1425 void CGenericItutDataMgr::SetNumericKeymap( const TInt aKeymap )
       
  1426 	{
       
  1427 	iNumericKeymap = aKeymap;
       
  1428 	}
       
  1429 
       
  1430 void CGenericItutDataMgr::SetNumericKeymapData( TInt* aKeymapData )
       
  1431 	{
       
  1432 	delete iNumericKeymapData;
       
  1433     TInt* len = (TInt*)((TUint8*)aKeymapData - 4);
       
  1434     TPtrC16 keymapRes((const TUint16*)aKeymapData, *len/2);  
       
  1435     iNumericKeymapData = keymapRes.Alloc();
       
  1436 	}
       
  1437 
       
  1438 TBool CGenericItutDataMgr::IsExistPlusChar()
       
  1439     {
       
  1440     if( !IsNumericOnly() )
       
  1441     	{
       
  1442     	return EFalse;
       
  1443     	}
       
  1444     if ( iNumericKeymap == EKeymapFromResource )
       
  1445     	{
       
  1446     	HBufC* keyRes = iNumericKeymapData;
       
  1447     	if( keyRes != NULL && keyRes->Locate( TChar( KPlusChar ) ) != KErrNotFound )
       
  1448     		{
       
  1449     		return ETrue;
       
  1450     		}
       
  1451     	}
       
  1452     else if ( iNumericKeymap == EAknEditorStandardNumberModeKeymap 
       
  1453     		|| iNumericKeymap == EAknEditorConverterNumberModeKeymap
       
  1454     		|| iNumericKeymap == EAknEditorCalculatorNumberModeKeymap 
       
  1455     		|| iNumericKeymap == EAknEditorToFieldNumberModeKeymap 
       
  1456     		|| iNumericKeymap == EAknEditorFixedDiallingNumberModeKeymap 
       
  1457     		|| iNumericKeymap == EAknEditorSATNumberModeKeymap )
       
  1458     	{
       
  1459     	return ETrue;
       
  1460     	}
       
  1461     return EFalse;
       
  1462     }
       
  1463 
       
  1464 // End Of File