textinput/peninputarc/gsplugin/gspeninputplugin/inc/gspeninputmodel.h
changeset 0 eb1f2e154e89
child 7 6defe5d1bd39
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Model for gspeninputplugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef  C_GSPENINPUTMODEL_H
       
    20 #define  C_GSPENINPUTMODEL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <backgroundimage.h>
       
    24 #include <badesca.h>
       
    25 #include <bldvariant.hrh>
       
    26 #include <centralrepository.h>
       
    27 #include <e32base.h>
       
    28 #include <generalsettingsvariant.hrh>
       
    29 #include <e32property.h>
       
    30 #include <cenrepnotifyhandler.h>
       
    31 #include <peninputclient.h>
       
    32 
       
    33 #include "gspeninputplugin.hrh"
       
    34 
       
    35 _LIT(HLP_GS_PEN_INPUT, "CP_HLP_PEN_INPUT"); // temp fix for helps integration build break replace KCP_HLP_PEN_INPUT in cp.hlp.hrh;
       
    36 
       
    37 // FORWARD DECLARATION
       
    38 class CGSPenInputContainer;
       
    39 class CPtiEngine;
       
    40 class MGsCenRepNotifyHandlerCallback;
       
    41 
       
    42 // CONSTANTS
       
    43 const TInt KGSBufSize = 128;
       
    44 
       
    45 /**
       
    46  *  GSPenInputPlugin Repository Watcher class
       
    47  *
       
    48  *  This class provides a callback function for watchering repository key. 
       
    49  *
       
    50  *  @lib gspeninputplugin.dll
       
    51  *  @since S60 v3.2
       
    52  */
       
    53 class CGSRepositoryWatcher : public CBase, public MCenRepNotifyHandlerCallback
       
    54     {
       
    55     
       
    56 public:
       
    57 
       
    58     /**
       
    59      * Symbian constructor
       
    60      *
       
    61      * @since S60 v3.2
       
    62      * @param aCallBack Call back function 
       
    63      * @param aRepository Repository for watchering
       
    64      * @param aRepositoryUid The repository for each key
       
    65      * @return Pointer to created CGSRepositoryWatcher object
       
    66      */
       
    67     static CGSRepositoryWatcher* NewL(MGsCenRepNotifyHandlerCallback* aOwner,
       
    68                                          CRepository* aRepository,
       
    69                                          TUid aRepositoryUid );
       
    70 
       
    71     /**
       
    72      * Destructor
       
    73      *
       
    74      * @since S60 v3.2
       
    75      * @return None
       
    76      */
       
    77     virtual ~CGSRepositoryWatcher();
       
    78 
       
    79 // From MCenRepNotifyHandlerCallback
       
    80  
       
    81     /**
       
    82      * From MCenRepNotifyHandlerCallback
       
    83      * Notify call back function
       
    84      *
       
    85      * @since S60 v3.2
       
    86      * @param aKey Repository UID  
       
    87      * @param aNewValue Changed value
       
    88      * @return None
       
    89      */
       
    90     void HandleNotifyInt(TUint32 aKey, TInt aNewValue);
       
    91 
       
    92     void HandleNotifyGeneric(TUint32 aId);
       
    93     
       
    94 private:
       
    95     
       
    96     /**
       
    97      * C++ default constructor
       
    98      *
       
    99      * @since S60 v3.2
       
   100      * @param aCallBack Call back function 
       
   101      * @param aRepository Repository for watchering
       
   102      * @param aRepositoryUid The reposotory uid for each key
       
   103      * @return None
       
   104      */          
       
   105     CGSRepositoryWatcher(MGsCenRepNotifyHandlerCallback* aOwner,
       
   106                             CRepository* aRepository,
       
   107                             TUid aRepositoryUid );
       
   108 
       
   109     /**
       
   110      * Symbian second-phase constructor
       
   111      *
       
   112      * @since S60 v3.2
       
   113      * @return None
       
   114      */          
       
   115     void ConstructL();
       
   116 
       
   117 private:
       
   118 
       
   119     /**
       
   120      * Owner pointer for call back 
       
   121      */
       
   122     MGsCenRepNotifyHandlerCallback* iOwner;
       
   123 
       
   124     /**
       
   125      * The Repository for watchering (Not own)
       
   126      */
       
   127     CRepository* iRepository;
       
   128 
       
   129     /**
       
   130      * The handle of Repository notify (Own)
       
   131      */
       
   132     CCenRepNotifyHandler* iNotifyHandler;
       
   133     
       
   134     /**
       
   135      * The reposotory uid
       
   136      */
       
   137     TUid iRepositoryUid;
       
   138     
       
   139     };
       
   140     
       
   141 /**
       
   142  *  GSPenInputPlugin model class
       
   143  *
       
   144  *  This class is GSPenInputPlugin model class. It handle GSPenInputPlugin
       
   145  *  data and store value to Repository.
       
   146  *
       
   147  *  @lib gspeninputplugin.dll
       
   148  *  @since S60 v3.2
       
   149  */
       
   150 class CGSPenInputModel : public CBase
       
   151     {
       
   152    
       
   153 public:
       
   154 
       
   155     /**  DPI type for pen trail width */
       
   156     enum TDPIType 
       
   157         {
       
   158         EDPILow = 150, // low DPI    
       
   159         EDPIMiddle = 200, // middle DPI
       
   160         EDPIHigh = 250 // high DPI       
       
   161         };
       
   162     
       
   163     /**  List box item array length */        
       
   164     enum TPenInputArray
       
   165         {
       
   166         EWritingSpeedArrayLength = 5, 
       
   167         ETrailWidthArrayLength = 3, 
       
   168         };
       
   169 
       
   170     /**
       
   171      * Symbian constructor
       
   172      *
       
   173      * @since S60 v3.2
       
   174      * @param aOwner Pointer to owner 
       
   175      * @return Pointer to created CGSPenInputModel object
       
   176      */
       
   177     static CGSPenInputModel* NewL(MGsCenRepNotifyHandlerCallback* aOwner);
       
   178 
       
   179     /**
       
   180      * Symbian constructor
       
   181      *
       
   182      * @since S60 v3.2
       
   183      * @return Pointer to created CGSPenInputModel object
       
   184      */
       
   185     static CGSPenInputModel* NewL();
       
   186 
       
   187     /**
       
   188      * Set owner for call back
       
   189      *
       
   190      * @since S60 v3.2
       
   191      * @param aOwner Pointer to owner  
       
   192      * @return None
       
   193      */
       
   194     inline void SetOwner(MGsCenRepNotifyHandlerCallback* aOwner);
       
   195 
       
   196     /**
       
   197      * Destructor
       
   198      *
       
   199      * @since S60 v3.2
       
   200      * @return None
       
   201      */
       
   202     virtual ~CGSPenInputModel();
       
   203 
       
   204     /**
       
   205      * Get current input language index in list box item
       
   206      *
       
   207      * @since S60 v3.2
       
   208      * @return The index of input language setting page 
       
   209      */
       
   210     inline TInt InputLanguageIndex() const;
       
   211 
       
   212     /**
       
   213      * Set current input language index in list box item
       
   214      *
       
   215      * @since S60 v3.2
       
   216      * @param aIndex Language index in input language setting page
       
   217      * @return None 
       
   218      */
       
   219     inline void SetInputLanguageIndex(TInt aIndex);
       
   220 
       
   221     /**
       
   222      * Current input language name in list box item
       
   223      *
       
   224      * @since S60 v3.2
       
   225      * @param aLanguage Reference to current input language name
       
   226      * @return None
       
   227      */
       
   228     void InputLanguage(TDes& aLanguage);
       
   229 
       
   230     /**
       
   231      * Current input language ID
       
   232      *
       
   233      * @since S60 v3.2
       
   234      * @return Language ID
       
   235      */
       
   236     TInt InputLanguage(); 
       
   237     
       
   238     /**
       
   239      * Get languages from ptiengine    
       
   240      *
       
   241      * @since S60 v3.2
       
   242      * @param aLanguageNames Poniter to language name array from ptiengine
       
   243      * @param aISOCode ETrue language name with ISO code.
       
   244      * @return None
       
   245      */
       
   246     void GetLanguagesFromPtiL(TBool aISOCode,CDesCArray* aLanguageNames);
       
   247     
       
   248     /**
       
   249      * Get Popup Query languages from ptiengine    
       
   250      *
       
   251      * @since S60 v3.2
       
   252      * @param aLanguageNames Poniter to language name array from ptiengine
       
   253      * @return None
       
   254      */
       
   255     void GetPopupQuerylanguagesFromPtiL(CDesCArray* aLanguageNames);    
       
   256 
       
   257     /**
       
   258      * Store input language to Repository
       
   259      *
       
   260      * @since S60 v3.2
       
   261      * @return None 
       
   262      */
       
   263     void SetInputLanguageL();
       
   264     
       
   265     /**
       
   266      * Current writing speed index in list box item
       
   267      *
       
   268      * @since S60 v3.2
       
   269      * @return None 
       
   270      */
       
   271     TInt WritingSpeed();
       
   272 
       
   273     /**
       
   274      * Store writing speed to Repository
       
   275      *
       
   276      * @since S60 v3.2
       
   277      * @param aSpeed Index in list box item     
       
   278      * @return None 
       
   279      */
       
   280     void SetWritingSpeed(const TInt aSpeed);
       
   281 
       
   282     /**
       
   283      * Store guid line to Repository
       
   284      *
       
   285      * @since S60 v3.2
       
   286      * @return ETrue for guid line on; otherwise EFalse
       
   287      */
       
   288     void SetGuideLine(TInt aGuideLine);
       
   289     void SetRecognitionWithDictionary(TInt aRecognitionWithDictionary);
       
   290 
       
   291     /**
       
   292      * Get current guide line from Repository
       
   293      *
       
   294      * @since S60 v3.2
       
   295      * @return ETrue for guid line on; otherwise EFalse
       
   296      */
       
   297     TInt GuideLine();
       
   298     
       
   299     TInt RecognitionWithDictionary();
       
   300 
       
   301     /**
       
   302      * Store input method for find to Repository
       
   303      *
       
   304      * @since S60 v5.0
       
   305      */
       
   306     void SetInputMethodForFind(TInt aInputMethodForFind);
       
   307 
       
   308     /**
       
   309      * Get current input method for find from Repository
       
   310      *
       
   311      * @since S60 v5.0
       
   312      */
       
   313     TInt InputMethodForFind();
       
   314 
       
   315     /**
       
   316      * Get chinese find method resource id
       
   317      *
       
   318      * @since S60 v5.0
       
   319      */
       
   320     TInt ChineseFindMethodResourceID();
       
   321 
       
   322     /**
       
   323      * Store chinese find method to Repository
       
   324      *
       
   325      * @since S60 v5.0
       
   326      */
       
   327     void SetChineseFindMethod(TInt aChineseFindMethod);
       
   328 
       
   329     /**
       
   330      * Get chinese find method from Repository
       
   331      *
       
   332      * @since S60 v5.0
       
   333      */
       
   334     TInt ChineseFindMethod();
       
   335 
       
   336     /**
       
   337      * Current pen trail width index in list box item
       
   338      *
       
   339      * @since S60 v3.2
       
   340      * @return The index of writing speed item 
       
   341      */
       
   342     TInt TrailWidth();
       
   343 
       
   344     /**
       
   345      * Store pen trail width to Repository
       
   346      *
       
   347      * @since S60 v3.2
       
   348      * @param aWidth Index in list box item     
       
   349      * @return None 
       
   350      */
       
   351     void SetTrailWidth(const TInt aWidth);
       
   352         
       
   353     /**
       
   354      * Current pen trail colour index in list box item
       
   355      *
       
   356      * @since S60 v3.2
       
   357      * @return The index of trail colour item 
       
   358      */
       
   359     TInt TrailColour();
       
   360 
       
   361     /**
       
   362      * Store pen trail colour to Repository
       
   363      *
       
   364      * @since S60 v3.2
       
   365      * @param aColour Index in list box item     
       
   366      * @return None 
       
   367      */
       
   368     void SetTrailColour(const TInt aColour);
       
   369 
       
   370     /**
       
   371      * Set input mode.
       
   372      *
       
   373      * @since S60 v3.2
       
   374      * @param aIndex Item idex of setting page.
       
   375      * @return None
       
   376      */
       
   377     void SetInputModeBySettingPage(const TInt aIndex);    
       
   378     
       
   379     /**
       
   380      * Get input mode index in setting page
       
   381      *
       
   382      * @since S60 v3.2
       
   383      * @return None
       
   384      */
       
   385     TInt InputModeInSettingPage();
       
   386 
       
   387     /**
       
   388      * Get input mode resource id
       
   389      *
       
   390      * @since S60 v3.2
       
   391      * @return None
       
   392      */
       
   393     TInt InputModeResourceID();
       
   394 
       
   395     /**
       
   396      * Current language is chinese language
       
   397      *
       
   398      * @since S60 v3.2
       
   399      * @return ETrue for chinese language; otherwise EFalse
       
   400      */
       
   401     inline TBool ChineseLanguage();
       
   402     
       
   403     /**
       
   404      * Current language is chinese and Japanese language
       
   405      *
       
   406      * @since S60 v3.2
       
   407      * @return ETrue for chinese language; otherwise EFalse
       
   408      */
       
   409     inline TBool JapaneseLanguage();
       
   410     
       
   411     /**
       
   412      * Reset input mode destription array
       
   413      *
       
   414      * @since S60 v3.2
       
   415      * @param aIndex Item idex of setting page.  
       
   416      * @return None
       
   417      */
       
   418     void ResetInputModeArray(CDesCArrayFlat* aInputModeItems);
       
   419     
       
   420     /**
       
   421      * Reset input mode to default input mode when language changed 
       
   422      *
       
   423      * @since S60 v3.2
       
   424      * @return None
       
   425      */
       
   426     void ResetDefaultInputMode();
       
   427     
       
   428     /**
       
   429      * Set FEP default input mode when language changed 
       
   430      *
       
   431      * @since S60 v3.2
       
   432      * @param aInputMode Default input mode.     
       
   433      * @return None
       
   434      */
       
   435     void SetFepInputMode(TInt aInputMode);
       
   436         
       
   437     /**
       
   438      * Get FEP default input mode when language changed 
       
   439      *
       
   440      * @since S60 v3.2
       
   441      * @return Default input mode
       
   442      */
       
   443     TInt GetFepInputMode();
       
   444     
       
   445     /**
       
   446      * Get input mode from repository
       
   447      *
       
   448      * @since S60 v3.2
       
   449      * @return Current input mode
       
   450      */          
       
   451     TInt InputMode();    
       
   452     
       
   453     /**
       
   454      * Reset Fep input mode based on current input language
       
   455      *
       
   456      * @since S60 v3.2
       
   457      * @return None
       
   458      */          
       
   459     void ResetFepDefaultInputMode();
       
   460     
       
   461     TBool IsSettingItemAvailable( TInt aItemId );
       
   462     
       
   463 private: 
       
   464 
       
   465     /**
       
   466      * C++ default constructor
       
   467      *
       
   468      * @since S60 v3.2
       
   469      * @param aOwner Pointer to owner       
       
   470      * @return None
       
   471      */  
       
   472     CGSPenInputModel(MGsCenRepNotifyHandlerCallback* aOwner);
       
   473     
       
   474     /**
       
   475      * C++ default constructor
       
   476      *
       
   477      * @since S60 v3.2
       
   478      * @return None
       
   479      */  
       
   480     CGSPenInputModel();
       
   481 
       
   482     /**
       
   483      * Symbian second-phase constructor
       
   484      *
       
   485      * @since S60 v3.2
       
   486      * @return None
       
   487      */          
       
   488     void ConstructL();
       
   489 
       
   490     /**
       
   491      * Initializes Repository
       
   492      *
       
   493      * @since S60 v3.2
       
   494      * @return None
       
   495      */          
       
   496     void InitializeCentralRepositoriesL();
       
   497 
       
   498     /**
       
   499      * Initializes pen trail width array
       
   500      *
       
   501      * @since S60 v3.2
       
   502      * @return None
       
   503      */          
       
   504     void InitTrailWidthArrayL();
       
   505 
       
   506     /**
       
   507      * Initializes writing speed array
       
   508      *
       
   509      * @since S60 v3.2
       
   510      * @return None
       
   511      */          
       
   512     void InitWritingSpeedArray();
       
   513 
       
   514     /**
       
   515      * Initializes low dpi array
       
   516      *
       
   517      * @since S60 v3.2
       
   518      * @return None
       
   519      */          
       
   520     void InitLowDPI();
       
   521 
       
   522     /**
       
   523      * Initializes middle dpi array
       
   524      *
       
   525      * @since S60 v3.2
       
   526      * @return None
       
   527      */          
       
   528     void InitMiddleDPI();
       
   529 
       
   530     /**
       
   531      * Initializes high dpi array
       
   532      *
       
   533      * @since S60 v3.2
       
   534      * @return None
       
   535      */          
       
   536     void InitHighDPI();
       
   537     
       
   538     /**
       
   539      * Set input mode to repository
       
   540      *
       
   541      * @since S60 v3.2
       
   542      * @param aInputMode Input Mode
       
   543      * @return None
       
   544      */          
       
   545     void SetInputMode(TInt aInputMode);
       
   546     
       
   547     /**
       
   548      * The trail color got from key is available
       
   549      *
       
   550      * @since S60 v3.2
       
   551      * @return ETrue for Available; otherwise EFalse
       
   552      */
       
   553      inline TBool AvailableTrailColor(TRgb color);         
       
   554     
       
   555     /**
       
   556      * Adjust language name
       
   557      *
       
   558      * @since S60 v3.2
       
   559      * @param aLangId Language Id
       
   560      * @param aLangName Input/output of language name
       
   561      * @return None
       
   562      */          
       
   563     void AdjustLanguageName(TInt aLangId, TDes& aLangName);
       
   564 
       
   565     /**
       
   566      * Get chinese find method cenrep key id
       
   567      *
       
   568      * @since S60 v5.0
       
   569      */
       
   570     TUint ChineseFindMethodCRKey();
       
   571 
       
   572     /**
       
   573      * Return current application's uid
       
   574      *
       
   575      * @param aWndGrpId Current application's window group id
       
   576      * @since S60 v5.0
       
   577      */
       
   578     TUid AppUidFromWndGroupId( TInt aWndGrpId );
       
   579     
       
   580     TUid AppUidFromWndGroupIdL( TInt aWndGrpId );
       
   581     TBool IsTruiSupportedLanguage();
       
   582 
       
   583 private: 
       
   584 
       
   585     /**
       
   586      * Owner pointer for call back 
       
   587      */
       
   588     MGsCenRepNotifyHandlerCallback* iOwner;
       
   589 
       
   590     /**
       
   591      * The personalization repository (Own)
       
   592      */
       
   593     CRepository* iPersonalizationRepository;
       
   594 
       
   595     /**
       
   596      * The fep repository (Own)
       
   597      */
       
   598     CRepository* iAknfepRepository;
       
   599 
       
   600     /**
       
   601      * The avkon repository (Own)
       
   602      */
       
   603     CRepository* iAknRepository;
       
   604 
       
   605     /**
       
   606      * The input language index in setting page 
       
   607      */
       
   608     TInt iLanguageIndex;
       
   609 
       
   610     /**
       
   611      * The input language for storing in repository 
       
   612      */
       
   613     TInt iInputLanguage;
       
   614 
       
   615     /**
       
   616      * The writhing speed for storing in repository  
       
   617      */
       
   618     TInt iSpeed;
       
   619 
       
   620     /**
       
   621      * The pen input width for storing in repository 
       
   622      */
       
   623     TInt iWidth;
       
   624 
       
   625     /**
       
   626      * The pen color for storing in repository 
       
   627      */
       
   628     TInt iColor;
       
   629     
       
   630     /**
       
   631      * The input method for find for storing in repository 
       
   632      */
       
   633     TInt iInputMethodForFind;    
       
   634 
       
   635     /**
       
   636      * The input method for find for storing in repository 
       
   637      */
       
   638     TInt iChineseFindMethod;
       
   639 
       
   640     /**
       
   641      * The last used chinese find method item,
       
   642      * -1 == not queried from repo
       
   643      * 0 == not used
       
   644      * >0 == cenrep key id
       
   645      */
       
   646     TInt iLastChineseFindMethodItem;
       
   647 
       
   648     /**
       
   649      * The guid line for storing in repository 
       
   650      */
       
   651     TInt iGuideLine;    
       
   652     /**
       
   653      * Indicate HwrTraining is aviliable or not
       
   654      */
       
   655     TInt iIsRecognitionWithDictionary;      
       
   656     
       
   657     /**
       
   658      * The default input mode 
       
   659      */
       
   660     TInt iInputMode;    
       
   661 
       
   662     /**
       
   663      * The icon array of list box item 
       
   664      */
       
   665     TInt iTrailWidthValue[ETrailWidthArrayLength];
       
   666 
       
   667     /**
       
   668      * The icon array of list box item 
       
   669      */
       
   670     TInt iWritingSpeedValue[EWritingSpeedArrayLength];
       
   671 
       
   672     /**
       
   673      * The personalization watcher (Own)
       
   674      */
       
   675     CGSRepositoryWatcher* iPersonalizationWatcher;    
       
   676 
       
   677 
       
   678     /**
       
   679      * The Aknfep watcher (Own)
       
   680      */
       
   681     CGSRepositoryWatcher* iAknfepWatcher;    
       
   682 
       
   683     /**
       
   684      * The Akn watcher (Own)
       
   685      */
       
   686     CGSRepositoryWatcher* iAknWatcher;
       
   687     
       
   688     /**
       
   689     * Pti Engine (Own)
       
   690     */
       
   691     CPtiEngine* iPtiEngine;
       
   692     
       
   693     /**
       
   694      * Indicate HwrTraining is aviliable or not
       
   695      */
       
   696     TBool iIsHwrTrainingAviliable;
       
   697     
       
   698     /**
       
   699      * PeninputServer Client
       
   700      */
       
   701     RPeninputServer iPenInputServer;
       
   702     
       
   703     /**
       
   704      * PeninputServer connect error
       
   705      */
       
   706     TInt iConnectErr;
       
   707     
       
   708     };
       
   709     
       
   710 #include "gspeninputmodel.inl"    
       
   711 
       
   712 #endif // C_GSPENINPUTMODEL_H
       
   713 
       
   714 // End Of File