textinput/peninputfingerhwr/inc/peninputfingerhwrlayout.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2009 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:  header for finger hwr UiLayout
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_PENINPUTFINGERHWRLAYOUT_H
       
    19 #define C_PENINPUTFINGERHWRLAYOUT_H
       
    20 
       
    21 // INCLUDES
       
    22 #include "peninputpluginutils.h"
       
    23 #include "peninputlayout.h"
       
    24 #include "peninputfingerhwrstoreconstants.h"
       
    25 #include "peninputfingerhwrcontrolid.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CPeninputFingerHwrStateManagerBase;
       
    29 class CPeninputFingerHwrDataStore;
       
    30 class CRepository;
       
    31 class CPeninputFingerHwrWnd;
       
    32 
       
    33 // class DECLARATIONS
       
    34 
       
    35 /**
       
    36  *  class CPeninputHwrfscnLayout.
       
    37  *
       
    38  *  Chinese full screen handwriting ui layout class.
       
    39  *
       
    40  *  @lib peninputfingerhwr.lib
       
    41  *  @since S60 v5.0
       
    42  */
       
    43 class CPeninputFingerHwrLayout : public CFepUiLayout
       
    44     {
       
    45 public:
       
    46     /**
       
    47      * The writing speed.
       
    48      *
       
    49      *@since S60 v5.0
       
    50      */
       
    51     enum TWritingSpeed
       
    52         {
       
    53         EWritingSpeedVeryFast = 1,
       
    54         EWritingSpeedFast,
       
    55         EWritingSpeedNormal,
       
    56         EWritingSpeedSlow,
       
    57         EWritingSpeedVerySlow
       
    58         };
       
    59 public:
       
    60     /** 
       
    61      * Symbian constructor.
       
    62      *
       
    63      * @since S60 5.0
       
    64      * 
       
    65      * @param aLayoutOwner The MLayoutOwner
       
    66      * @param aInitData Init data for layout
       
    67      * @return Pointer to created CPeninputHwrfscnLayout object
       
    68      */
       
    69     static CPeninputFingerHwrLayout* NewL(MLayoutOwner* aLayoutOwner,
       
    70             const TAny* aInitData);
       
    71 
       
    72 public:
       
    73     //from CFepUiLayout
       
    74     /**
       
    75      * From CFepUiLayout.
       
    76      * Handle layout command event
       
    77      *
       
    78      * @since Series 60 5.0
       
    79      * @param aCmd Command Id.
       
    80      * @param aData Data for command.
       
    81      * @return Errors when return value small than 0.    
       
    82      */
       
    83     TInt HandleCommand(const TInt aCmd, TUint8* aData);
       
    84     
       
    85     /**
       
    86      * From CFepUiLayout.
       
    87      * Handle layout command event
       
    88      *
       
    89      * @since Series 60 5.0
       
    90      * @param aCmd Command Id.
       
    91      * @param aData Data for command.
       
    92      * @return Errors when return value small than 0.    
       
    93      */
       
    94     TInt HandleCommandL(const TInt aCmd, TUint8* aData);
       
    95 
       
    96     /**
       
    97      * From CFepUiLayout.
       
    98      * Inform layout the size changing event
       
    99      *
       
   100      * @since Series 60 5.0
       
   101      * @param pData The event data.
       
   102      * @return KErrNone if successfully size changing. 
       
   103      */
       
   104     TInt SizeChanged(const TAny* pData);
       
   105 
       
   106     /**
       
   107      * From CFepUiLayout.
       
   108      * Handle editor text coming
       
   109      * Called by animation dll when app editor text is coming.
       
   110      * If a ui layout has a editor area, it must implements this function to get the text
       
   111      *
       
   112      * @since Series 60 5.0
       
   113      * @param aData The fep input context field data
       
   114      * @return KErrNone is operation succeeded.    
       
   115      */
       
   116     TInt OnAppEditorTextComing(const TFepInputContextFieldData& aData);
       
   117 
       
   118     /**
       
   119      * From CFepUiLayout.
       
   120      * Handle application info change
       
   121      *
       
   122      * @since Series 60 5.0
       
   123      * @param aInfo The information.
       
   124      * @param aType The information type.
       
   125      * @return none
       
   126      */
       
   127     void HandleAppInfoChange(const TDesC& aInfo, TPeninputAppInfo aType);
       
   128 
       
   129     
       
   130     /**
       
   131      * From CFepUiLayout
       
   132      * Called by owner when the system resource changed event.
       
   133      *
       
   134      * @since S60 v4.0
       
   135      * @param aType the event type
       
   136      * @return KErrNone if successfully size changing. 
       
   137      */
       
   138     TInt OnResourceChange(TInt aType);
       
   139     
       
   140     /**
       
   141      * From MPenUiLayoutBase
       
   142      * Return the peninput ui type
       
   143      *
       
   144      * @since Series 60 5.0
       
   145      * @return The ui type @see TPenInputUiType
       
   146      */
       
   147     TInt PenInputType();
       
   148 
       
   149     /**
       
   150      * From MFepLayoutBase        
       
   151      * Called by owner when the layout is going to be hidden
       
   152      *
       
   153      * @since S60 5.0
       
   154      * @return none
       
   155      */
       
   156     void OnDeActivate();
       
   157     
       
   158 public:
       
   159     //from MEventObserver;    
       
   160     /**
       
   161      * From MEventObserver 
       
   162      * handle control event.
       
   163      * 
       
   164      * @since Series 60 5.0
       
   165      * @param aEventType The event type
       
   166      * @param aCtrl The control who sends the event
       
   167      * @param aEventData The event data
       
   168      * @return none
       
   169      */
       
   170     void HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl,
       
   171             const TDesC& aEventData);
       
   172     void HandleControlEventL(TInt aEventType, CFepUiBaseCtrl* aCtrl,
       
   173             const TDesC& aEventData);
       
   174 
       
   175 public:
       
   176 
       
   177     /**
       
   178      * Get the data stroe object.
       
   179      * 
       
   180      * @since Series 60 5.0
       
   181      * @return The CPeninputHwrfscnDataStore reference
       
   182      */
       
   183     CPeninputFingerHwrDataStore& DataStore();
       
   184 
       
   185     /**
       
   186      * Replace the char before the cursor in forground app with a new char.
       
   187      *
       
   188      * @since S60 5.0
       
   189      * @param aOldCharCode The old char need to be replaced
       
   190      * @param aNewCharCode The new char for replacing the old char
       
   191      * @return none
       
   192      */
       
   193     void Replace(const TDesC& aOldCharCode, const TDesC& aNewCharCode,
       
   194             const TBool aIsPart = EFalse);
       
   195 
       
   196     /**
       
   197      * Submit string to layout owner.
       
   198      *
       
   199      * @since S60 5.0
       
   200      * @param aCharCode The buffer needed to be submitted.
       
   201      * @return none
       
   202      */
       
   203     void SubmitStringToFep(const TDesC& aCharCode);
       
   204 
       
   205     /**
       
   206      * Submit char to layout owner.
       
   207      *
       
   208      * @since S60 5.0
       
   209      * @param aCharCode The buffer needed to be submitted.
       
   210      * @return none
       
   211      */    
       
   212     void SubmitCharToFep(const TInt aCharCode);
       
   213 
       
   214 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   215     /**
       
   216      * Submit char to layout owner.
       
   217      *
       
   218      * @since S60 5.0
       
   219      * @param aSetPosFlag The buffer needed to be submitted.
       
   220      * @return none
       
   221      */    
       
   222     void SubmitStartPosToFep(TBool aSetPosFlag);
       
   223 #endif
       
   224 
       
   225     /**
       
   226      * repository callback for settings.
       
   227      *
       
   228      * @since S60 5.0
       
   229      * @param aPtr callback data.
       
   230      * @return error code.
       
   231      */
       
   232     static TInt HandleGSRepositoryCallBack(TAny* aPtr);
       
   233     
       
   234     /**
       
   235      * load default settings.
       
   236      * 
       
   237      * @since S60 5.0
       
   238      * @param aSetPosFlag The buffer needed to be submitted.
       
   239      * @return none
       
   240      */
       
   241     void LoadAndPublishDefaultL();
       
   242     
       
   243 
       
   244     /**
       
   245      * sync stroke end mark of writingbox with hwr engine.
       
   246      * 
       
   247      * @param aEndMark a TPoint object as new stroke end mark.
       
   248      * @return none   
       
   249      */
       
   250     void SyncHwrStrokeEndMark(const TPoint&  aEndMark);
       
   251 
       
   252 #ifndef RD_INTELLIGENT_TEXT_INPUT 
       
   253     /**
       
   254      * hide or show fixed english symbol list. 
       
   255      * 
       
   256      * @since S60 5.0
       
   257      * @param aIsHide ETrue to hide lists, EFalse to show lists.
       
   258      * @return none
       
   259      */
       
   260     void HideTwoRowEngSymbolList(const TBool aIsHide);
       
   261 #endif
       
   262 
       
   263 private:
       
   264     /**
       
   265      * C++ constructor
       
   266      *
       
   267      * @since S60 5.0
       
   268      * @param aLayoutOwner The MLayoutOwner pointer.
       
   269      * @return none
       
   270      */
       
   271     CPeninputFingerHwrLayout(MLayoutOwner* aLayoutOwner);
       
   272 
       
   273     /**
       
   274      * standard c++ destructor.
       
   275      *
       
   276      * @since S60 5.0
       
   277      * @return none
       
   278      */
       
   279     ~CPeninputFingerHwrLayout();
       
   280 
       
   281     /**
       
   282      * Symbian second-phase constructor
       
   283      *
       
   284      * @since S60 5.0
       
   285      * @param aInitData The init data passed by layout engine.
       
   286      * @return none
       
   287      */
       
   288     void ConstructL(const TAny* aInitData);
       
   289 
       
   290 
       
   291     /**
       
   292      * Create the hwr box window
       
   293      *
       
   294      * @since S60 5.0
       
   295      * @return none
       
   296      */
       
   297     void CreateHwrWindowL();
       
   298 
       
   299     /**
       
   300      * Create the state manager
       
   301      *
       
   302      * @since S60 5.0
       
   303      * @return none
       
   304      */
       
   305     void CreateStateManagerL();
       
   306 
       
   307     
       
   308 private:
       
   309     /**
       
   310      * handler of button down event.
       
   311      *  
       
   312      * @since S60 5.0
       
   313      * @param aEventType event type id.
       
   314      * @param aCtrl event src.
       
   315      * @param aEventData event data.
       
   316      * @return none
       
   317      */
       
   318     void OnCtrlButtonDownL(TInt aEventType, CFepUiBaseCtrl* aCtrl,  
       
   319             const TDesC& aEventData);
       
   320 
       
   321     /**
       
   322      * handler of button up event.
       
   323      *  
       
   324      * @since S60 5.0
       
   325      * @param aEventType event type id.
       
   326      * @param aCtrl event src.
       
   327      * @param aEventData event data.
       
   328      * @return none
       
   329      */
       
   330     void OnCtrlButtonUpL(TInt aEventType, CFepUiBaseCtrl* aCtrl, 
       
   331             const TDesC& aEventData);
       
   332 
       
   333     /**
       
   334      * handler of rep-button clicked event.
       
   335      *  
       
   336      * @since S60 5.0
       
   337      * @param aCtrl event src.
       
   338      * @param aData event data.
       
   339      * @return none
       
   340      */    
       
   341     void OnRepButtonClickedL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   342 
       
   343     /**
       
   344      * clicked event handler of the BACKSPACE button.
       
   345      *  
       
   346      * @since S60 5.0
       
   347      * @return none
       
   348      */     
       
   349     void OnBackspaceClickedL();
       
   350     
       
   351     /**
       
   352      * handler of virtual key down event.
       
   353      *  
       
   354      * @since S60 5.0
       
   355      * @param aCtrl event src.
       
   356      * @param aData event data.
       
   357      * @return none
       
   358      */ 
       
   359     void OnVirtualKeyDownL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   360     
       
   361     /**
       
   362      * handler of virtual key up event.
       
   363      *  
       
   364      * @since S60 5.0
       
   365      * @param aCtrl event src.
       
   366      * @param aData event data.
       
   367      * @return none
       
   368      */     
       
   369     void OnVirtualKeyUpL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   370     
       
   371     /**
       
   372      * handler of candidate list event.
       
   373      *  
       
   374      * @since S60 5.0
       
   375      * @param aCtrl event src.
       
   376      * @param aData event data.
       
   377      * @return none
       
   378      */     
       
   379     void OnCandidateSelectedL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   380     
       
   381     /**
       
   382      * handler of predictive list event.
       
   383      *  
       
   384      * @since S60 5.0
       
   385      * @param aCtrl event src.
       
   386      * @param aData event data.
       
   387      * @return none
       
   388      */     
       
   389     void OnPredictSelectedL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   390 
       
   391 
       
   392 
       
   393     /**
       
   394      * clicked event handler of icf.
       
   395      *  
       
   396      * @since S60 5.0
       
   397      * @return none
       
   398      */
       
   399     void OnIcfClicked();
       
   400     
       
   401     /**
       
   402      * handler of ime selector event.
       
   403      *  
       
   404      * @since S60 5.0
       
   405      * @param aEventType event type id.
       
   406      * @param aCtrl event src.
       
   407      * @param aEventData event data.
       
   408      * @return none
       
   409      */    
       
   410     void OnImeSelected(TInt aEventType, CFepUiBaseCtrl* aCtrl, 
       
   411             const TDesC& aEventData);
       
   412 
       
   413     /**
       
   414      * handler of StrokeStarted event.
       
   415      *  
       
   416      * @since S60 5.0
       
   417      * @return none
       
   418      */
       
   419     void OnHwrStrokeStartedL();
       
   420 
       
   421     /**
       
   422      * handler of StrokeFinished event.
       
   423      *  
       
   424      * @since S60 5.0
       
   425      * @return none
       
   426      */    
       
   427     void OnHwrStrokeFinishedL();
       
   428     
       
   429     /**
       
   430      * handler of CharacterFinished event.
       
   431      *  
       
   432      * @since S60 5.0
       
   433      * @return none
       
   434      */    
       
   435     void OnHwrCharacterFinishedL();
       
   436 
       
   437 
       
   438     /**
       
   439      * handler of NumMapping changed event.
       
   440      *  
       
   441      * @since S60 5.0
       
   442      * @return none
       
   443      */
       
   444     void OnNumMappingChangedL();
       
   445     
       
   446     /**
       
   447      * Handle the candidate list events.
       
   448      *
       
   449      * @since S60 5.0
       
   450      * @param aEventType The event type
       
   451      * @param aEventData The event data 
       
   452      * @return none   
       
   453      */
       
   454     void OnCandidateWndEventL();
       
   455 
       
   456 
       
   457 private:
       
   458     /**
       
   459      * Notify the layout owner the primary has changed.
       
   460      *
       
   461      * @since S60 v5.0
       
   462      * @param aPrimaryRange The range which will be changed to
       
   463      * @return none
       
   464      */
       
   465     void NotifyPrimaryRangeChanged(TInt aPrimaryRange);
       
   466 
       
   467     /**
       
   468      * get value from repository
       
   469      * 
       
   470      * @since S60 v5.0
       
   471      * @param aWatcher repository reader.
       
   472      * @param aId value id.
       
   473      * @return value
       
   474      */
       
   475     TInt GetNewValue(CAknFepRepositoryWatcher* aWatcher, const TInt aId);
       
   476     
       
   477     /**
       
   478      * get hwr trail color from repository
       
   479      * 
       
   480      * @since S60 v5.0
       
   481      * @return color value.
       
   482      */    
       
   483     TInt GetPenTrailColor();
       
   484     
       
   485 
       
   486     /**
       
   487      * set hwr writing speed.
       
   488      * 
       
   489      * @since S60 v5.0
       
   490      * @param aWritingSpeed speed
       
   491      * @return none
       
   492      */    
       
   493     void SetWritingSpeed(const TInt aWritingSpeed);
       
   494     
       
   495     /**
       
   496      * set hwr writing pen width.
       
   497      * 
       
   498      * @since S60 v5.0
       
   499      * @param aWritingSpeed speed
       
   500      * @return none
       
   501      */     
       
   502     void SetBoxPenSize(const TSize aPenSize);
       
   503     
       
   504     /**
       
   505      * set hwr writing pen color.
       
   506      * 
       
   507      * @since S60 v5.0
       
   508      * @param aWritingSpeed speed
       
   509      * @return none
       
   510      */    
       
   511     void SetBoxPenColor(const TInt aPenColor);
       
   512 
       
   513     /**
       
   514      * restore the range before sct popup. 
       
   515      * 
       
   516      * @since S60 v5.0
       
   517      * @return none    
       
   518      */
       
   519     void RestoreRange();
       
   520 
       
   521     /**
       
   522      * get current state manager. 
       
   523      * 
       
   524      * @since S60 v5.0
       
   525      * @return current state manager  
       
   526      */
       
   527     CPeninputFingerHwrStateManagerBase* CurStateManager();
       
   528     
       
   529     /**
       
   530      * change current state manager to standby state.
       
   531      * 
       
   532      * @since S60 v5.0
       
   533      * @return none 
       
   534      */
       
   535     void ChangeCurStateManagerToStandby();
       
   536 
       
   537 private:
       
   538     
       
   539     /**
       
   540      * main window.
       
   541      * not own
       
   542      */
       
   543     CPeninputFingerHwrWnd* iHwrWnd;
       
   544     
       
   545     /**
       
   546      * The data store
       
   547      * Own
       
   548      */
       
   549     CPeninputFingerHwrDataStore* iDataStore;
       
   550 
       
   551     /**
       
   552      * The state manager
       
   553      * Own
       
   554      */
       
   555     RPointerArray<CPeninputFingerHwrStateManagerBase> iStateMgrArray;
       
   556 
       
   557     /**
       
   558      * The resource Id
       
   559      * 
       
   560      */
       
   561     TInt iResId;
       
   562 
       
   563     /**
       
   564      * Repository watcher
       
   565      */
       
   566     CAknFepRepositoryWatcher* iGSRepositoryWatcher;
       
   567     
       
   568     /**
       
   569      * Repository object.
       
   570      */
       
   571     CRepository* iRepositorySetting;
       
   572     
       
   573     /**
       
   574      * Last overlap index.
       
   575      */
       
   576     TInt iLastOverlapIdx;
       
   577     
       
   578     /**
       
   579      * Open Finger HWR flag
       
   580      */
       
   581     TBool iIsOpenFingerHWR;
       
   582     };
       
   583 #endif //C_PENINPUTFINGERHWRLAYOUT_H