textinput/peninputgenericitut/inc/peninputgenericitutdatamgr.h
branchRCL_3
changeset 44 ecbabf52600f
child 50 5a1685599b76
equal deleted inserted replaced
43:ebd48d2de13c 44: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:  drop-down list control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_GENERICITUTDATAMGR_H
       
    20 #define C_GENERICITUTDATAMGR_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <PtiDefs.h>
       
    24 #include <AknLayout2Def.h>
       
    25 
       
    26 #include "peninputgenericitutpropertysubscriber.h"
       
    27 #include "peninputgenericitutdata.h"
       
    28 
       
    29 class CPtiEngine;
       
    30 class CFont;
       
    31 class MItutLayoutContext;
       
    32 class CGenericItutWindowManager;
       
    33 
       
    34 extern const TInt KInvalidResId;
       
    35 extern const TInt KMaxPredictCandCnt;
       
    36 extern const TInt KInvalidImMode;
       
    37 const TInt KMaxFileLength = 80;
       
    38 
       
    39 
       
    40 class CGenericItutDataMgr : public CBase
       
    41     {
       
    42 public:    
       
    43     /**
       
    44      * struct SItem
       
    45      * Choice list item data structure.
       
    46      * 
       
    47      */
       
    48     struct TMenuItem
       
    49         {
       
    50         /*
       
    51          * Command of choice list item.
       
    52          */
       
    53         TInt iCommand;
       
    54 
       
    55         /*
       
    56          * Title of choice list item.
       
    57          */
       
    58         TBuf<100> iText;
       
    59         };    
       
    60 public:
       
    61     static CGenericItutDataMgr* NewL(MItutLayoutContext* aLayoutContext, CPtiEngine* aPtiEngine );
       
    62 
       
    63     ~CGenericItutDataMgr();
       
    64 
       
    65     void AddSubscriber(MItutPropertySubscriber* aSubscriber);
       
    66 
       
    67     // should be called by owner when initialize data manager, and when SizeChanged
       
    68     void ReadLafInfo();
       
    69 
       
    70     void SetLanguageL(TInt aLanguage);
       
    71 
       
    72     void SetInputModeL(TInt aMode);
       
    73 
       
    74     void SetCase(TInt aCase);
       
    75 
       
    76     TAny* RequestData(TInt aDataType);
       
    77     TAny* RequestDataForPortraitWestUIAndChineseSpellUI(TInt aDataType);
       
    78 
       
    79     inline CPtiEngine* PtiEngine();
       
    80 
       
    81     // if there is need to change keypad layout, aKeypadResId: new keypad resource id
       
    82     void NotifyChangeControlLayout(MItutPropertySubscriber::TItutProperty aPropertyName, 
       
    83                                    TInt aCtrlResId);
       
    84 
       
    85     inline TInt InputLanguage();
       
    86 	inline TBool IsValidLanguage(TInt aLanguage);
       
    87     inline TInt InputMode();
       
    88     
       
    89     inline TInt TextCase();
       
    90 
       
    91     inline TBool IsLandScape();
       
    92     
       
    93     inline TBool IsSpellMode();
       
    94 
       
    95     TBool IsExistPlusChar();
       
    96     inline void SetSpellMode(TBool aSpellMode);
       
    97     
       
    98     inline void SetIndicatorData(TFepIndicatorInfo &aIndicatorData);
       
    99     inline TFepIndicatorInfo IndicatorData();
       
   100     
       
   101 
       
   102     inline void SetLatinOnly( TBool aLatinOnly );
       
   103 
       
   104     inline TBool IsPortraitWest();
       
   105     
       
   106 	void SetUpdate(TBool aNeedUpdate);
       
   107 	TBool IsUpdate() const;
       
   108     // when user press navi-next button on dropdownlist, there is need to 
       
   109     // retrieve next page candidate
       
   110     TInt GetNextPageCandidateL(RPointerArray<HBufC>& aList);
       
   111 
       
   112     TBool NextPageCandidateExist();
       
   113 
       
   114     void ClearChnCandidates(TInt aCmd);
       
   115 
       
   116     TInt KeypadResourceId();
       
   117     
       
   118     TBool IsChinese();
       
   119     TBool IsKorean(); // tp teleca addon
       
   120     TBool IsHindi();
       
   121     TBool IsThai();
       
   122 
       
   123     // Is Right to Left language
       
   124     TBool IsRtoLLanguage();
       
   125     TBool IsRtoLLanguage( TInt aLanguage );    
       
   126     TBool IsLangDirectionSwitch() const;
       
   127     inline void SetLangDirectionSwitch( TBool aIsChange );
       
   128         
       
   129     void SetTextAlignment();
       
   130     
       
   131     void SetIcfTextAlignment(TInt aAlignment);
       
   132     
       
   133     void SetNumericKeymap( const TInt aKeymap );
       
   134     
       
   135     void SetNumericKeymapData( TInt* aKeymapData );
       
   136     
       
   137     inline TBool IsCharFlagChanged();
       
   138     
       
   139     inline void SetNumericOnly( TBool aIsNumberOnly );
       
   140     
       
   141     inline TBool IsNumericOnly() const;
       
   142 	
       
   143     TMenuItem* GetMenuItem(TInt aCommand); 
       
   144     void SetChineseSpellFlag( TBool aFlag );
       
   145     
       
   146     TBool IsChineseSpellMode();
       
   147     	
       
   148 	TPoint iSelectionTl;
       
   149     TSize iSelectionItemSize;
       
   150     TInt iSelectionItemMargin;
       
   151     TInt iSelectionHorMargin;
       
   152     TInt iSelectionVerMargin;
       
   153     TSize iSelectionNaviSize;
       
   154     TSize iSelectionNaviInnerSize;
       
   155     TAknTextLineLayout iSelectionTextLine;
       
   156     TAknTextLineLayout iSelectionPageTextLine;
       
   157     
       
   158     TInt iIcfTextLeftMargin;
       
   159 	TInt iIcfTextRightMargin;
       
   160 	TInt iIcfTextTopMargin;
       
   161 	TInt iIcfTextBottomMargin;
       
   162 	TInt iIcfTextLineSpaceMargin;
       
   163 	TInt iIcfTextHeight;
       
   164 	
       
   165 	TInt iIcfTextLeftMarginCn;
       
   166 	TInt iIcfTextRightMarginCn;
       
   167 	TInt iIcfTextTopMarginCn;
       
   168 	TInt iIcfTextBottomMarginCn;
       
   169 	TInt iIcfTextLineSpaceMarginCn;
       
   170 	TInt iIcfTextHeightCn;
       
   171 	
       
   172 	TRect iShiftIconRect;
       
   173 	TInt iIcfTextLeftMarginForPrtWest;
       
   174     TInt iIcfTextRightMarginForPrtWest;
       
   175     TInt iIcfTextTopMarginForPrtWest;
       
   176     TInt iIcfTextBottomMarginForPrtWest;
       
   177     TInt iIcfTextLineSpaceMarginForPrtWest;
       
   178     TInt iIcfTextHeightForPrtWest;
       
   179     TRect iShiftIconRectForPrtWest;
       
   180     TRect iStarIconRectForPrtWest;
       
   181     TInt iSpellIcfTextHeightForPrtWest;
       
   182     
       
   183 	TInt iSpellIcfTextLeftMarginForPrtWest;
       
   184     TInt iSpellIcfTextRightMarginForPrtWest;
       
   185     TInt iSpellIcfTextTopMarginForPrtWest;
       
   186     TInt iSpellIcfTextBottomMarginForPrtWest;
       
   187     TInt iSpellIcfTextLineSpaceMarginForPrtWest;
       
   188 private:
       
   189     CGenericItutDataMgr(MItutLayoutContext* aLayoutContext, CPtiEngine* aPtiEngine );
       
   190 
       
   191     void ConstructL();
       
   192 
       
   193     void NotifySubscriber( MItutPropertySubscriber::TItutProperty aPropertyName, 
       
   194                            const TDesC& aValue);
       
   195 
       
   196     // return current script index
       
   197     TInt GetConfigResFileName(TInt aLang);
       
   198     
       
   199     // return index in aArray
       
   200     TInt FindLang(const TInt* aArray, TInt aEndIdx, TInt aLang);
       
   201     
       
   202     static const TDesC& ResFileExtByScriptIdx(const TScriptExtIndex aIndex);
       
   203 
       
   204     // whether both of aMode1 & aMode2 are chinese mode, or both of them are western mode
       
   205    
       
   206     void CalWesternIndicator();
       
   207     
       
   208     TInt ChineseKeypadResourceId();
       
   209     
       
   210     TInt HindiKeypadResourceId();
       
   211     TInt KoreanKeypadResourceId();
       
   212     void ReadLafInfoForPrtWest();
       
   213     
       
   214 private: // data member
       
   215     RPointerArray<MItutPropertySubscriber> iSubscriberList;
       
   216     CPtiEngine* iPtiEngine;
       
   217     TInt iLanguage;
       
   218     TInt iInputMode;
       
   219     TInt iCase;
       
   220     TBool iIsChineseSpell;
       
   221 
       
   222     TSize iScreenSize;
       
   223 
       
   224     // offset of layout, compare to screen
       
   225     TPoint iLayoutOffset;
       
   226     TRect iLayoutRect;
       
   227 
       
   228     TRect iIcfWesRect;
       
   229     TRect iIcfChnRect;
       
   230     CFont* iIcfFont;
       
   231     CFont* iIcfFontCn;
       
   232     TInt iIcfTextAlignment;
       
   233 
       
   234     TRect iBackspaceRect;
       
   235     TRect iBackspaceInnerRect;
       
   236     TRect iBackspaceCnRect;
       
   237     TRect iBackspaceInnerCnRect;
       
   238     TRect iSwitchRect;
       
   239     TRect iSwitchInnerRect;
       
   240     TRect iSwitchCnRect;
       
   241     TRect iSwitchInnerCnRect;
       
   242     TRect iArrowLeftRect;
       
   243     TRect iArrowLeftInnerRect;
       
   244     TRect iArrowLeftCnRect;
       
   245     TRect iArrowLeftInnerCnRect;
       
   246     TRect iArrowRightRect;
       
   247     TRect iArrowRightInnerRect;
       
   248     TRect iArrowRightCnRect;
       
   249     TRect iArrowRightInnerCnRect;
       
   250     TRect iArrowUpRect;
       
   251     TRect iArrowDownRect;  
       
   252     TRect iArrowUpInnerRect;
       
   253     TRect iArrowDownInnerRect;
       
   254     
       
   255 
       
   256     TRect iImIndicatorWesRect;
       
   257     TRect iCalindwesternRect;
       
   258     TRect iImIndiOuterRect;
       
   259     TRect iImIndiOuterRectCn;
       
   260     TRect iImIndicatorChnRect;
       
   261 
       
   262     TRect iSendRect;
       
   263     TRect iDisconnRect;
       
   264 
       
   265     TRect iKeypadRect;  
       
   266     TRect iKeypadRectCn;
       
   267     TRect iKeypadRectQuery;
       
   268     RArray<TRect> iKeypadCellRects;
       
   269     RArray<TRect> iKeypadCellRectsCn;
       
   270     RArray<TRect> iKeypadCellRectsQuery;
       
   271 	
       
   272     // properties of candidate list
       
   273     TInt iCandsUnitWidth;
       
   274     TInt iCandsUnitHeight;
       
   275     TInt iCandsHorizontalMargin;
       
   276     TInt iCandsVerticalMargin;
       
   277     TInt iCandsNaviWidth;
       
   278     TInt iCandsSpinBtnHeight;    
       
   279     TPoint iCandsSpellLTPos;
       
   280     TPoint iCandsLTPos;
       
   281     TPoint iCandsPuncLTPos;
       
   282     CFont* iCandsFont;
       
   283     TInt iCandsTextMargin;
       
   284     TRgb iCandsTextColor;    
       
   285 
       
   286 
       
   287 
       
   288     TRect iSpellRect;
       
   289     CFont* iSpellFont;
       
   290     TRgb iSpellTextColor;
       
   291 
       
   292     TAknTextLineLayout iVkAlphaText1;
       
   293     TAknTextLineLayout iVkAlphaText2;
       
   294     TAknTextLineLayout iVkAlphaText3;
       
   295     TAknTextLineLayout iVkNumText;
       
   296     
       
   297     // Layout for Thai
       
   298     TAknTextLineLayout iVkAlphaText1ForThai;
       
   299     TAknTextLineLayout iVkAlphaText2ForThai;
       
   300     TAknTextLineLayout iVkAlphaText3ForThai;
       
   301 
       
   302     // resource id for generic itut resource file
       
   303     TInt iCommonResId;
       
   304     /**
       
   305      * resource id for current input language
       
   306      */    
       
   307     TInt iConfigResId;
       
   308     /**
       
   309      * resource id for special controls in Chinese/Korean variant
       
   310      */  
       
   311     TInt iSpecialResId;
       
   312 
       
   313     TInt iAvkonResId;
       
   314     
       
   315     // not own
       
   316     MItutLayoutContext* iLayoutContext;
       
   317 
       
   318     // chinese related candidates
       
   319     RPointerArray<HBufC> iCandidates;
       
   320     RPointerArray<HBufC> iPuncCandidates;
       
   321 
       
   322     TRect iOptionsRect;
       
   323     TRect iCloseRect;
       
   324     TRect iCloseInnerRect;
       
   325     TRect iOptionInnerRect;
       
   326     TRect iSpellIndiRect;
       
   327     TRect iOptionsRectCn;
       
   328     TRect iCloseRectCn;    
       
   329     TRect iCloseInnerRectCn;
       
   330     TRect iOptionInnerRectCn;
       
   331     
       
   332     // preview bubble
       
   333     TRect iPreviewWndRect;
       
   334     TRect iPreviewWndInnerRect;
       
   335     CFont* iBubbleFont;
       
   336 	TAknTextLineLayout iPreviewWndText;
       
   337 
       
   338     TBuf<KMaxFileLength> iResourceFilename;
       
   339     TBool iLangCaseSensitive;
       
   340     TInt iCurrentScriptIdx;
       
   341 
       
   342     TBool iLandScape;
       
   343     TBool iSpellMode;
       
   344     
       
   345     // spell popup window data
       
   346     TRect iSpellQueryPaneRect;
       
   347     TRect iSpellICFRect;
       
   348     TRect iSpellClrRect;
       
   349     TRect iSpellClrInnerRect;
       
   350     TRect iOkRect;
       
   351     TRect iCancelRect;
       
   352     TRect iSpellEditIndicator;
       
   353     TAknTextLineLayout iBtnTextFormat;
       
   354     TAknTextLineLayout iBtnTextFormat1; 
       
   355     TFepIndicatorInfo iIndicatorData; 
       
   356     
       
   357     TRect iSpellQueryPaneRectForPrtWest;
       
   358     TRect iOKRectForPrtWest;
       
   359     TRect iCancelRectForPrtWest;
       
   360     TAknTextLineLayout iBtnOKTextForPrtWest;
       
   361     TAknTextLineLayout iBtnCancelTextForPrtWest;
       
   362     TRect iSpellICFRectForPrtWest;
       
   363     TRect iSpellICFBtnRectForPrtWest;
       
   364     TRect iSpellICFBtnInnerRectForPrtWest;
       
   365     TAknTextLineLayout iSpellText1ForPrtWest;
       
   366     TAknTextLineLayout iSpellText2ForPrtWest;
       
   367     TAknTextLineLayout iSpellText3ForPrtWest;
       
   368     TRect iSpellIndiPaneWithoutTextForPrtWest;
       
   369     TRect iSpellIndiIconWithoutTextForPrtWest;
       
   370     CFont* iSpellIcfFontForPrtWest;
       
   371     TRect iSpellArrowLeftRectForPrtWest;
       
   372     TRect iSpellArrowLeftInnerRectForPrtWest;
       
   373     TRect iSpellArrowRightRectForPrtWest;
       
   374     TRect iSpellArrowRightInnerRectForPrtWest;
       
   375     RPointerArray<TMenuItem> iMenuItemList;
       
   376 
       
   377     TBool iNeedUpdate;
       
   378     TBool iLatinOnly;
       
   379 	
       
   380 	TBool iIsLangDirectionSwitch;    
       
   381 	
       
   382 	TInt iNumericKeymap;
       
   383 	HBufC* iNumericKeymapData;
       
   384 	TBool iExistPlusChar;
       
   385 	TBool iPlusCharFlagChanged;
       
   386 	TBool iNumberOnly;
       
   387 
       
   388 	TRect iLayoutRectForPrtWest;
       
   389 	TPoint iLayoutOffsetForPrtWest;
       
   390 	RArray<TRect> iKeypadCellRectsForPrtWest;
       
   391 	TRect iKeypadRectForPrtWest;
       
   392     TAknTextLineLayout iVkAlphaText1ForPrtWest;
       
   393     TAknTextLineLayout iVkAlphaText2ForPrtWest;
       
   394     TAknTextLineLayout iVkAlphaText3ForPrtWest;
       
   395     TAknTextLineLayout iVkNumTextForPrtWest;
       
   396     TAknTextLineLayout iVkBigNumTextForPrtWest;
       
   397     TAknTextLineLayout iVkTextPlusForNumbericOnlyForPrtWest;
       
   398     TRect iCloseRectForPrtWest;
       
   399     TRect iCloseInnerRectForPrtWest;
       
   400     TRect iArrowLeftRectForPrtWest;
       
   401     TRect iArrowLeftInnerRectForPrtWest;
       
   402     TRect iOptionsRectForPrtWest;
       
   403     TRect iOptionInnerRectForPrtWest;
       
   404     TRect iArrowRightRectForPrtWest;
       
   405     TRect iArrowRightInnerRectForPrtWest;
       
   406     TRect iBackspaceRectForPrtWest;
       
   407     TRect iBackspaceInnerRectForPrtWest;
       
   408     TRect iPreviewWndRectForPrtWest;
       
   409     TRect iPreviewWndInnerRectForPrtWest;
       
   410     TAknTextLineLayout iPreviewWndTextForPrtWest;
       
   411     CFont* iBubbleFontForPrtWest;
       
   412     TRect iIcfRectForPrtWest;
       
   413     CFont* iIcfFontForPrtWest;
       
   414     TInt iIcfTextAlignmentForPrtWest;
       
   415     
       
   416     TRect iIndiPaneRectWithTextForPrtWest;
       
   417     TRect iIndiPaneRectWithoutTextForPrtWest;
       
   418     TRect iIndiIconRectWithTextForPrtWest;
       
   419     TRect iIndiIconRectWithoutTextForPrtWest;
       
   420     TAknTextLineLayout iIndiTextForPrtWest;
       
   421     };
       
   422 
       
   423 inline CPtiEngine* CGenericItutDataMgr::PtiEngine()
       
   424     {
       
   425     return iPtiEngine;
       
   426     }
       
   427     
       
   428 inline TInt CGenericItutDataMgr::InputMode()
       
   429     {
       
   430     return iInputMode;
       
   431     }
       
   432     
       
   433 inline TInt CGenericItutDataMgr::InputLanguage()
       
   434     {
       
   435     return iLanguage;
       
   436     }
       
   437 
       
   438 inline TInt CGenericItutDataMgr::TextCase()
       
   439     {
       
   440     return iCase;
       
   441     }
       
   442 
       
   443 inline TBool CGenericItutDataMgr::IsLandScape()
       
   444     {
       
   445     return iLandScape;
       
   446     }
       
   447 
       
   448 inline TBool CGenericItutDataMgr::IsSpellMode()
       
   449     {
       
   450     return iSpellMode;
       
   451     }
       
   452 
       
   453 inline void CGenericItutDataMgr::SetSpellMode(TBool aSpellMode)
       
   454     {
       
   455     iSpellMode = aSpellMode;
       
   456     }
       
   457     
       
   458 inline void CGenericItutDataMgr::SetIndicatorData(TFepIndicatorInfo &aIndicatorData)
       
   459     {
       
   460     iIndicatorData.iIndicatorImgID = aIndicatorData.iIndicatorImgID;
       
   461     iIndicatorData.iIndicatorMaskID = aIndicatorData.iIndicatorMaskID;
       
   462     iIndicatorData.iIndicatorTextImgID = aIndicatorData.iIndicatorTextImgID;
       
   463     iIndicatorData.iIndicatorTextMaskID = aIndicatorData.iIndicatorTextMaskID;
       
   464     }
       
   465     
       
   466 inline TFepIndicatorInfo CGenericItutDataMgr::IndicatorData()
       
   467     {
       
   468     return iIndicatorData;
       
   469     } 
       
   470     
       
   471 
       
   472 inline void CGenericItutDataMgr::SetLatinOnly( TBool aLatinOnly )
       
   473     {
       
   474     iLatinOnly = aLatinOnly;
       
   475     } 
       
   476 
       
   477 inline TBool CGenericItutDataMgr::IsPortraitWest()
       
   478     {
       
   479     return !iLandScape && !IsChinese() && !IsKorean();
       
   480     }
       
   481 inline TBool CGenericItutDataMgr::IsValidLanguage(TInt aLanguage)
       
   482 	{
       
   483 	return (aLanguage != ELangTest && aLanguage != ELangNone);	
       
   484 	}
       
   485 	
       
   486 inline void CGenericItutDataMgr::SetLangDirectionSwitch( TBool aIsChange )
       
   487 	{
       
   488 	iIsLangDirectionSwitch = aIsChange;
       
   489 	}
       
   490 
       
   491 inline TBool CGenericItutDataMgr::IsCharFlagChanged()
       
   492     {
       
   493     if( iExistPlusChar != IsExistPlusChar() )
       
   494     	{
       
   495     	iExistPlusChar = IsExistPlusChar();
       
   496         iPlusCharFlagChanged = ETrue;
       
   497     	}
       
   498     else
       
   499     	{
       
   500         iPlusCharFlagChanged = EFalse;
       
   501     	}
       
   502     return iPlusCharFlagChanged;
       
   503     }
       
   504 
       
   505 inline void CGenericItutDataMgr::SetNumericOnly( TBool aIsNumberOnly )
       
   506 	{
       
   507 	iNumberOnly = aIsNumberOnly;
       
   508 	}
       
   509 
       
   510 inline TBool CGenericItutDataMgr::IsNumericOnly() const
       
   511 	{
       
   512 	return iNumberOnly;
       
   513 	}
       
   514 
       
   515 #endif // C_GENERICITUTDATAMGR_H