textinput/peninputsplititut/inc/peninputsplititutdatamgr.h
changeset 0 eb1f2e154e89
child 3 f5a1e66df979
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:  split itut data manager
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SPLITITUTDATAMGR_H
       
    20 #define C_SPLITITUTDATAMGR_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <ptidefs.h>
       
    24 #include <aknlayout2def.h>
       
    25 
       
    26 #include "peninputsplititutpropertysubscriber.h"
       
    27 #include "peninputsplititutdata.h"
       
    28 
       
    29 class CPtiEngine;
       
    30 class CFont;
       
    31 class MSplitItutLayoutContext;
       
    32 class CSplitItutWindowManager;
       
    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  CSplitItutDataMgr
       
    41 *  
       
    42 * Wrapper of L&F data.
       
    43 *
       
    44 * @lib peninputsplititut.lib
       
    45 * @since S60 v5.0
       
    46 */
       
    47 
       
    48 class CSplitItutDataMgr : public CBase
       
    49     {  
       
    50 public:
       
    51     /**
       
    52      * Symbian constructor.
       
    53      *
       
    54      * @since S60 v5.0
       
    55      * @return Pointer to created object.
       
    56      */ 
       
    57     static CSplitItutDataMgr* NewL( MSplitItutLayoutContext* aLayoutContext, 
       
    58                                     CPtiEngine* aPtiEngine );
       
    59 
       
    60     /**
       
    61      * standard c++ destructor.
       
    62      *
       
    63      * @since S60 v5.0
       
    64      * @return None
       
    65      */ 
       
    66     ~CSplitItutDataMgr();
       
    67 
       
    68     /**
       
    69      * Add subscriber
       
    70      *
       
    71      * @since S60 v5.0
       
    72      * @param aSubscriber sub scriber
       
    73      * @return None
       
    74      */
       
    75     void AddSubscriber(MItutPropertySubscriber* aSubscriber);
       
    76 
       
    77     /**
       
    78      * read laf data.
       
    79      *
       
    80      * @since S60 v5.0
       
    81      * @return None
       
    82      */
       
    83     void ReadLafInfo();
       
    84 
       
    85     /**
       
    86      * Set input language
       
    87      *
       
    88      * @since S60 v5.0
       
    89      * @param aLanguage input language
       
    90      * @return None
       
    91      */
       
    92     void SetLanguageL(TInt aLanguage);
       
    93 
       
    94     /**
       
    95      * read laf data.
       
    96      *
       
    97      * @since S60 v5.0
       
    98      * @param aMode input mode  
       
    99      * @return None
       
   100      */
       
   101     void SetInputModeL(TInt aMode);
       
   102 
       
   103     /**
       
   104      * Set input case
       
   105      *
       
   106      * @since S60 v5.0
       
   107      * @param aCase input case  
       
   108      * @return None
       
   109      */
       
   110     void SetCase(TInt aCase);
       
   111 
       
   112     /**
       
   113      * Request data
       
   114      *
       
   115      * @since S60 v5.0
       
   116      * @param aDataType data type 
       
   117      * @return date
       
   118      */
       
   119     TAny* RequestData(TInt aDataType);
       
   120 
       
   121     /**
       
   122      * Get ptiengine pointer
       
   123      *
       
   124      * @since S60 v5.0
       
   125      * @return ptiengine
       
   126      */
       
   127     inline CPtiEngine* PtiEngine();
       
   128 
       
   129     /**
       
   130      * Notify change control layout
       
   131      *
       
   132      * @since S60 v5.0
       
   133      * @param aPropertyName property name
       
   134      * @param aCtrlResId control id  
       
   135      * @return None
       
   136      */
       
   137     void NotifyChangeControlLayout(MItutPropertySubscriber::TItutProperty aPropertyName, 
       
   138                                    TInt aCtrlResId);
       
   139 
       
   140     /**
       
   141      * Get input language
       
   142      *
       
   143      * @since S60 v5.0
       
   144      * @return language id
       
   145      */
       
   146     inline TInt InputLanguage();
       
   147     
       
   148     /**
       
   149      * Is valid language
       
   150      *
       
   151      * @since S60 v5.0
       
   152      * @param aLanguage language id    
       
   153      * @return TBool
       
   154      */
       
   155 	inline TBool IsValidLanguage(TInt aLanguage);
       
   156 	
       
   157     /**
       
   158      * Get input mode
       
   159      *
       
   160      * @since S60 v5.0
       
   161      * @return input mode
       
   162      */
       
   163     inline TInt InputMode();
       
   164     
       
   165     /**
       
   166      * Get text case
       
   167      *
       
   168      * @since S60 v5.0
       
   169      * @return text case
       
   170      */
       
   171     inline TInt TextCase();
       
   172 
       
   173     /**
       
   174      * Is exist plus char
       
   175      *
       
   176      * @since S60 v5.0
       
   177      * @return TBool
       
   178      */
       
   179     TBool IsExistPlusChar();
       
   180     
       
   181     /**
       
   182      * Set latin only flag
       
   183      *
       
   184      * @since S60 v5.0
       
   185      * @param aLatinOnly latin only flag
       
   186      * @return TBool
       
   187      */
       
   188     inline void SetLatinOnly( TBool aLatinOnly );
       
   189 
       
   190     /**
       
   191      * Set update flag
       
   192      *
       
   193      * @since S60 v5.0
       
   194      * @param aNeedUpdate need update flag
       
   195      * @return None
       
   196      */
       
   197 	void SetUpdate(TBool aNeedUpdate);
       
   198 
       
   199     /**
       
   200      * get update flag
       
   201      *
       
   202      * @since S60 v5.0
       
   203      * @return update flag
       
   204      */
       
   205 	TBool IsUpdate() const;
       
   206 
       
   207 //    TInt GetNextPageCandidateL(RPointerArray<HBufC>& aList);
       
   208 
       
   209 //    TBool NextPageCandidateExist();
       
   210 
       
   211 //    void ClearChnCandidates(TInt aCmd);
       
   212 
       
   213     /**
       
   214      * get keypad resource id
       
   215      *
       
   216      * @since S60 v5.0
       
   217      * @return keypad resource id
       
   218      */
       
   219     TInt KeypadResourceId();
       
   220     
       
   221     /**
       
   222      * Is chinese
       
   223      *
       
   224      * @since S60 v5.0
       
   225      * @return TBool
       
   226      */
       
   227     TBool IsChinese();
       
   228     
       
   229     /**
       
   230      * Is Hindi
       
   231      *
       
   232      * @since S60 v5.0
       
   233      * @return TBool
       
   234      */
       
   235     TBool IsHindi();
       
   236     
       
   237     /**
       
   238      * Is Thai
       
   239      *
       
   240      * @since S60 v5.0
       
   241      * @return TBool
       
   242      */
       
   243     TBool IsThai();
       
   244 
       
   245     /**
       
   246      * Is right to left language
       
   247      *
       
   248      * @since S60 v5.0
       
   249      * @return TBool
       
   250      */
       
   251     TBool IsRtoLLanguage();
       
   252     
       
   253     /**
       
   254      * Is right to left language
       
   255      *
       
   256      * @since S60 v5.0
       
   257      * @param aLanguage language id
       
   258      * @return TBool
       
   259      */
       
   260     TBool IsRtoLLanguage( TInt aLanguage );
       
   261     
       
   262     /**
       
   263      * Is language direction switch
       
   264      *
       
   265      * @since S60 v5.0
       
   266      * @return TBool
       
   267      */
       
   268     TBool IsLangDirectionSwitch() const;
       
   269     
       
   270     /**
       
   271      * set language direction switch
       
   272      *
       
   273      * @since S60 v5.0
       
   274      * @param aIsChange change flag
       
   275      * @return None
       
   276      */
       
   277     inline void SetLangDirectionSwitch( TBool aIsChange );
       
   278     
       
   279     /**
       
   280      * set numeric keymap
       
   281      *
       
   282      * @since S60 v5.0
       
   283      * @param aKeymap
       
   284      * @return None
       
   285      */
       
   286     void SetNumericKeymap( const TInt aKeymap );
       
   287     
       
   288     /**
       
   289      * set numeric keymap data
       
   290      *
       
   291      * @since S60 v5.0
       
   292      * @param aKeymapData
       
   293      * @return None
       
   294      */
       
   295     void SetNumericKeymapData( TInt* aKeymapData );
       
   296     
       
   297     /**
       
   298      * is char flag changed
       
   299      *
       
   300      * @since S60 v5.0
       
   301      * @return TBool
       
   302      */
       
   303     inline TBool IsCharFlagChanged();
       
   304     
       
   305     /**
       
   306      * set numeric only
       
   307      *
       
   308      * @since S60 v5.0
       
   309      * @param aIsNumberOnly
       
   310      * @return None
       
   311      */
       
   312     inline void SetNumericOnly( TBool aIsNumberOnly );
       
   313     
       
   314     /**
       
   315      * get numeric only flag
       
   316      *
       
   317      * @since S60 v5.0
       
   318      * @return TBool
       
   319      */
       
   320     inline TBool IsNumericOnly() const;
       
   321 	
       
   322 	TRect iShiftIconRect;
       
   323 	
       
   324 private:
       
   325     /**
       
   326      * C++ constructor
       
   327      *
       
   328      * @since S60 v5.0
       
   329      * @return None
       
   330      */
       
   331     CSplitItutDataMgr(MSplitItutLayoutContext* aLayoutContext, CPtiEngine* aPtiEngine );
       
   332 
       
   333     /**
       
   334      * Symbian second-phase constructor
       
   335      *
       
   336      * @since S60 v5.0
       
   337      * @return None
       
   338      */
       
   339     void ConstructL();
       
   340 
       
   341     /**
       
   342      * Notify subscriber
       
   343      * 
       
   344      * @since S60 v5.0
       
   345      * @param aPropertyName
       
   346      * @param aValue
       
   347      * @return None
       
   348      */
       
   349     void NotifySubscriber( MItutPropertySubscriber::TItutProperty aPropertyName, 
       
   350                            const TDesC& aValue);
       
   351 
       
   352     /**
       
   353      * Get config resource file name
       
   354      * 
       
   355      * @since S60 v5.0
       
   356      * @param aLang Language id
       
   357      * @return None
       
   358      */
       
   359     TInt GetConfigResFileName(TInt aLang);
       
   360     
       
   361     /**
       
   362      * Find language in an array
       
   363      * 
       
   364      * @since S60 v5.0
       
   365      * @param aArray
       
   366      * @param aEndIdx
       
   367      * @param aLang
       
   368      * @return index in the array
       
   369      */
       
   370     TInt FindLang(const TInt* aArray, TInt aEndIdx, TInt aLang);
       
   371     
       
   372     /**
       
   373      * get resource file string
       
   374      * 
       
   375      * @since S60 v5.0
       
   376      * @param aIndex
       
   377      * @return resource file
       
   378      */
       
   379     static const TDesC& ResFileExtByScriptIdx(const TScriptExtIndex aIndex);
       
   380    
       
   381     /**
       
   382      * Get chinese keypad resource id
       
   383      * 
       
   384      * @since S60 v5.0
       
   385      * @return resource id
       
   386      */
       
   387     TInt ChineseKeypadResourceId();
       
   388     
       
   389     /**
       
   390      * Get chinese keypad resource id
       
   391      * 
       
   392      * @since S60 v5.0
       
   393      * @return resource id
       
   394      */
       
   395     TInt HindiKeypadResourceId();
       
   396     
       
   397 private: // data member
       
   398     RPointerArray<MItutPropertySubscriber> iSubscriberList;
       
   399     CPtiEngine* iPtiEngine;
       
   400     TInt iLanguage;
       
   401     TInt iInputMode;
       
   402     TInt iCase;
       
   403 
       
   404     TSize iScreenSize;
       
   405 
       
   406     // offset of layout, compare to screen
       
   407     TPoint iLayoutOffset;
       
   408     TRect iLayoutRect;
       
   409     TRect iBackgroundRect;
       
   410 
       
   411     TRect iBackspaceRect;
       
   412     TRect iBackspaceInnerRect;
       
   413     TRect iBackspaceCnRect;
       
   414     TRect iBackspaceInnerCnRect;
       
   415     TRect iArrowLeftRect;
       
   416     TRect iArrowLeftInnerRect;
       
   417     TRect iArrowLeftCnRect;
       
   418     TRect iArrowLeftInnerCnRect;
       
   419     TRect iArrowRightRect;
       
   420     TRect iArrowRightInnerRect;
       
   421     TRect iArrowRightCnRect;
       
   422     TRect iArrowRightInnerCnRect;
       
   423     TRect iArrowUpRect;
       
   424     TRect iArrowDownRect;  
       
   425     TRect iArrowUpInnerRect;
       
   426     TRect iArrowDownInnerRect;
       
   427 
       
   428     TRect iKeypadRect;  
       
   429     TRect iKeypadRectCn;
       
   430     TRect iKeypadRectQuery;
       
   431     RArray<TRect> iKeypadCellRects;
       
   432 //    RArray<TRect> iKeypadCellRectsCn;
       
   433 	
       
   434     // properties of candidate list
       
   435     /*
       
   436     TInt iCandsUnitWidth;
       
   437     TInt iCandsUnitHeight;
       
   438     TInt iCandsHorizontalMargin;
       
   439     TInt iCandsVerticalMargin;
       
   440     TInt iCandsNaviWidth;
       
   441     TInt iCandsSpinBtnHeight;    
       
   442     TPoint iCandsSpellLTPos;
       
   443     TPoint iCandsLTPos;
       
   444     TPoint iCandsPuncLTPos;
       
   445     CFont* iCandsFont;
       
   446     TInt iCandsTextMargin;
       
   447     TRgb iCandsTextColor;    
       
   448     */
       
   449 
       
   450     TAknTextLineLayout iVkAlphaText1;
       
   451     TAknTextLineLayout iVkAlphaText2;
       
   452     TAknTextLineLayout iVkAlphaText3;
       
   453     TAknTextLineLayout iVkNumText;
       
   454 
       
   455     // resource id for generic itut resource file
       
   456     TInt iCommonResId;
       
   457     TInt iConfigResId;
       
   458 
       
   459     TInt iAvkonResId;
       
   460     
       
   461     // not own
       
   462     MSplitItutLayoutContext* iLayoutContext;
       
   463 
       
   464     // chinese related candidates
       
   465 //    RPointerArray<HBufC> iCandidates;
       
   466 //    RPointerArray<HBufC> iPuncCandidates;
       
   467 
       
   468     TRect iOptionsRect;
       
   469     TRect iCloseRect;
       
   470     TRect iCloseInnerRect;
       
   471     TRect iOptionInnerRect;
       
   472     TRect iOptionsRectCn;
       
   473     TRect iCloseRectCn;    
       
   474     TRect iCloseInnerRectCn;
       
   475     TRect iOptionInnerRectCn;
       
   476     
       
   477     // preview bubble
       
   478     TRect iPreviewWndRect;
       
   479     TRect iPreviewWndInnerRect;
       
   480     CFont* iBubbleFont;
       
   481 	TAknTextLineLayout iPreviewWndText;
       
   482 
       
   483     TBuf<KMaxFileLength> iResourceFilename;
       
   484     TBool iLangCaseSensitive;
       
   485     TInt iCurrentScriptIdx;
       
   486 
       
   487     TAknTextLineLayout iBtnTextFormat;
       
   488     TAknTextLineLayout iBtnTextFormat1; 
       
   489     
       
   490 
       
   491     TBool iNeedUpdate;
       
   492     TBool iLatinOnly;
       
   493 	
       
   494 	TBool iIsLangDirectionSwitch;    
       
   495 	
       
   496 	TInt iNumericKeymap;
       
   497 	HBufC* iNumericKeymapData;
       
   498 	TBool iExistPlusChar;
       
   499 	TBool iPlusCharFlagChanged;
       
   500 	TBool iNumberOnly;
       
   501 
       
   502     };
       
   503 
       
   504 // ---------------------------------------------------------------------------
       
   505 // CSplitItutDataMgr::PtiEngine
       
   506 // ---------------------------------------------------------------------------
       
   507 //
       
   508 inline CPtiEngine* CSplitItutDataMgr::PtiEngine()
       
   509     {
       
   510     return iPtiEngine;
       
   511     }
       
   512 
       
   513 // ---------------------------------------------------------------------------
       
   514 // CSplitItutDataMgr::InputMode
       
   515 // ---------------------------------------------------------------------------
       
   516 //
       
   517 inline TInt CSplitItutDataMgr::InputMode()
       
   518     {
       
   519     return iInputMode;
       
   520     }
       
   521     
       
   522 // ---------------------------------------------------------------------------
       
   523 // CSplitItutDataMgr::InputLanguage
       
   524 // ---------------------------------------------------------------------------
       
   525 //
       
   526 inline TInt CSplitItutDataMgr::InputLanguage()
       
   527     {
       
   528     return iLanguage;
       
   529     }
       
   530 
       
   531 // ---------------------------------------------------------------------------
       
   532 // CSplitItutDataMgr::TextCase
       
   533 // ---------------------------------------------------------------------------
       
   534 //
       
   535 inline TInt CSplitItutDataMgr::TextCase()
       
   536     {
       
   537     return iCase;
       
   538     }
       
   539     
       
   540 // ---------------------------------------------------------------------------
       
   541 // CSplitItutDataMgr::SetLatinOnly
       
   542 // ---------------------------------------------------------------------------
       
   543 //
       
   544 inline void CSplitItutDataMgr::SetLatinOnly( TBool aLatinOnly )
       
   545     {
       
   546     iLatinOnly = aLatinOnly;
       
   547     } 
       
   548 
       
   549 // ---------------------------------------------------------------------------
       
   550 // CSplitItutDataMgr::IsValidLanguage
       
   551 // ---------------------------------------------------------------------------
       
   552 //
       
   553 inline TBool CSplitItutDataMgr::IsValidLanguage(TInt aLanguage)
       
   554 	{
       
   555 	return (aLanguage != ELangTest && aLanguage != ELangNone);	
       
   556 	}
       
   557 	
       
   558 // ---------------------------------------------------------------------------
       
   559 // CSplitItutDataMgr::SetLangDirectionSwitch
       
   560 // ---------------------------------------------------------------------------
       
   561 //
       
   562 inline void CSplitItutDataMgr::SetLangDirectionSwitch( TBool aIsChange )
       
   563 	{
       
   564 	iIsLangDirectionSwitch = aIsChange;
       
   565 	}
       
   566 
       
   567 // ---------------------------------------------------------------------------
       
   568 // CSplitItutDataMgr::IsCharFlagChanged
       
   569 // ---------------------------------------------------------------------------
       
   570 //
       
   571 inline TBool CSplitItutDataMgr::IsCharFlagChanged()
       
   572     {
       
   573     if( iExistPlusChar != IsExistPlusChar() )
       
   574     	{
       
   575     	iExistPlusChar = IsExistPlusChar();
       
   576         iPlusCharFlagChanged = ETrue;
       
   577     	}
       
   578     else
       
   579     	{
       
   580         iPlusCharFlagChanged = EFalse;
       
   581     	}
       
   582     return iPlusCharFlagChanged;
       
   583     }
       
   584 
       
   585 // ---------------------------------------------------------------------------
       
   586 // CSplitItutDataMgr::SetNumericOnly
       
   587 // ---------------------------------------------------------------------------
       
   588 //
       
   589 inline void CSplitItutDataMgr::SetNumericOnly( TBool aIsNumberOnly )
       
   590 	{
       
   591 	iNumberOnly = aIsNumberOnly;
       
   592 	}
       
   593 
       
   594 // ---------------------------------------------------------------------------
       
   595 // CSplitItutDataMgr::IsNumericOnly
       
   596 // ---------------------------------------------------------------------------
       
   597 //
       
   598 inline TBool CSplitItutDataMgr::IsNumericOnly() const
       
   599 	{
       
   600 	return iNumberOnly;
       
   601 	}
       
   602 
       
   603 #endif // C_SPLITITUTDATAMGR_H