textinput/peninputfingerhwrar/inc/peninputfingerhwrarlayout.h
branchRCL_3
changeset 44 ecbabf52600f
child 56 8152b1f1763a
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     1 /*
       
     2 * Copyright (c) 2009-2010 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 
       
    19 #ifndef C_PENINPUTFINGERHWRARLAYOUT_H
       
    20 #define C_PENINPUTFINGERHWRARLAYOUT_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "peninputpluginutils.h"
       
    24 #include "peninputlayout.h"
       
    25 #include "peninputfingerhwrarstoreconstants.h"
       
    26 #include "peninputfingerhwrarcontrolid.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CPeninputFingerHwrArStateManagerBase;
       
    30 class CPeninputFingerHwrArDataStore;
       
    31 class CRepository;
       
    32 class CPeninputFingerHwrArWnd;
       
    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 CPeninputFingerHwrArLayout : 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 CPeninputFingerHwrArLayout* 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     void CallBackL();
       
   158 	
       
   159 	/**
       
   160 	 * Check if the First string will be allowed to submitted directly to editor without selection 
       
   161 	 */
       
   162 	TBool IsAllowedToSubmitDefaultCandiate();
       
   163 	
       
   164 public:
       
   165     //from MEventObserver;    
       
   166     /**
       
   167      * From MEventObserver 
       
   168      * handle control event.
       
   169      * 
       
   170      * @since Series 60 5.0
       
   171      * @param aEventType The event type
       
   172      * @param aCtrl The control who sends the event
       
   173      * @param aEventData The event data
       
   174      * @return none
       
   175      */
       
   176     void HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl,
       
   177             const TDesC& aEventData);
       
   178     void HandleControlEventL(TInt aEventType, CFepUiBaseCtrl* aCtrl,
       
   179             const TDesC& aEventData);
       
   180 
       
   181 public:
       
   182 
       
   183     /**
       
   184      * Get the data stroe object.
       
   185      * 
       
   186      * @since Series 60 5.0
       
   187      * @return The CPeninputHwrfscnDataStore reference
       
   188      */
       
   189     CPeninputFingerHwrArDataStore& DataStore();
       
   190 
       
   191     /**
       
   192      * Replace the char before the cursor in forground app with a new char.
       
   193      *
       
   194      * @since S60 5.0
       
   195      * @param aOldCharCode The old char need to be replaced
       
   196      * @param aNewCharCode The new char for replacing the old char
       
   197      * @return none
       
   198      */
       
   199     void Replace(const TDesC& aOldCharCode, const TDesC& aNewCharCode,
       
   200             const TBool aIsPart = EFalse);
       
   201 
       
   202     /**
       
   203      * Submit string to layout owner.
       
   204      *
       
   205      * @since S60 5.0
       
   206      * @param aCharCode The buffer needed to be submitted.
       
   207      * @return none
       
   208      */
       
   209     void SubmitStringToFep(const TDesC& aCharCode);
       
   210 
       
   211     /**
       
   212      * Submit char to layout owner.
       
   213      *
       
   214      * @since S60 5.0
       
   215      * @param aCharCode The buffer needed to be submitted.
       
   216      * @return none
       
   217      */    
       
   218     void SubmitCharToFep(const TInt aCharCode);
       
   219 
       
   220     /**
       
   221      * repository callback for settings.
       
   222      *
       
   223      * @since S60 5.0
       
   224      * @param aPtr callback data.
       
   225      * @return error code.
       
   226      */
       
   227     static TInt HandleGSRepositoryCallBack(TAny* aPtr);
       
   228     
       
   229     /**
       
   230      * load default settings.
       
   231      * 
       
   232      * @since S60 5.0
       
   233      * @param aSetPosFlag The buffer needed to be submitted.
       
   234      * @return none
       
   235      */
       
   236     void LoadAndPublishDefaultL();
       
   237     
       
   238 
       
   239     /**
       
   240      * sync stroke end mark of writingbox with hwr engine.
       
   241      * 
       
   242      * @param aEndMark a TPoint object as new stroke end mark.
       
   243      * @return none   
       
   244      */
       
   245     void SyncHwrStrokeEndMark(const TPoint&  aEndMark);
       
   246 
       
   247 private:
       
   248     /**
       
   249      * C++ constructor
       
   250      *
       
   251      * @since S60 5.0
       
   252      * @param aLayoutOwner The MLayoutOwner pointer.
       
   253      * @return none
       
   254      */
       
   255     CPeninputFingerHwrArLayout(MLayoutOwner* aLayoutOwner);
       
   256 
       
   257     /**
       
   258      * standard c++ destructor.
       
   259      *
       
   260      * @since S60 5.0
       
   261      * @return none
       
   262      */
       
   263     ~CPeninputFingerHwrArLayout();
       
   264 
       
   265     /**
       
   266      * Symbian second-phase constructor
       
   267      *
       
   268      * @since S60 5.0
       
   269      * @param aInitData The init data passed by layout engine.
       
   270      * @return none
       
   271      */
       
   272     void ConstructL(const TAny* aInitData);
       
   273 
       
   274 
       
   275     /**
       
   276      * Create the hwr box window
       
   277      *
       
   278      * @since S60 5.0
       
   279      * @return none
       
   280      */
       
   281     void CreateHwrWindowL();
       
   282 
       
   283     /**
       
   284      * Create the state manager
       
   285      *
       
   286      * @since S60 5.0
       
   287      * @return none
       
   288      */
       
   289     void CreateStateManagerL();
       
   290 
       
   291     
       
   292 private:
       
   293     /**
       
   294      * handler of button down event.
       
   295      *  
       
   296      * @since S60 5.0
       
   297      * @param aEventType event type id.
       
   298      * @param aCtrl event src.
       
   299      * @param aEventData event data.
       
   300      * @return none
       
   301      */
       
   302     void OnCtrlButtonDownL(TInt aEventType, CFepUiBaseCtrl* aCtrl,  
       
   303             const TDesC& aEventData);
       
   304 
       
   305     /**
       
   306      * handler of button up event.
       
   307      *  
       
   308      * @since S60 5.0
       
   309      * @param aEventType event type id.
       
   310      * @param aCtrl event src.
       
   311      * @param aEventData event data.
       
   312      * @return none
       
   313      */
       
   314     void OnCtrlButtonUpL(TInt aEventType, CFepUiBaseCtrl* aCtrl, 
       
   315             const TDesC& aEventData);
       
   316 
       
   317     /**
       
   318      * handler of rep-button clicked event.
       
   319      *  
       
   320      * @since S60 5.0
       
   321      * @param aCtrl event src.
       
   322      * @param aData event data.
       
   323      * @return none
       
   324      */    
       
   325     void OnRepButtonClickedL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   326 
       
   327     /**
       
   328      * clicked event handler of the BACKSPACE button.
       
   329      *  
       
   330      * @since S60 5.0
       
   331      * @return none
       
   332      */     
       
   333     void OnBackspaceClickedL();
       
   334     
       
   335     /**
       
   336      * handler of virtual key down event.
       
   337      *  
       
   338      * @since S60 5.0
       
   339      * @param aCtrl event src.
       
   340      * @param aData event data.
       
   341      * @return none
       
   342      */ 
       
   343     void OnVirtualKeyDownL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   344     
       
   345     /**
       
   346      * handler of virtual key up event.
       
   347      *  
       
   348      * @since S60 5.0
       
   349      * @param aCtrl event src.
       
   350      * @param aData event data.
       
   351      * @return none
       
   352      */     
       
   353     void OnVirtualKeyUpL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   354     
       
   355     /**
       
   356      * handler of candidate list event.
       
   357      *  
       
   358      * @since S60 5.0
       
   359      * @param aCtrl event src.
       
   360      * @param aData event data.
       
   361      * @return none
       
   362      */     
       
   363     void OnCandidateSelectedL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   364     
       
   365     /**
       
   366      * clicked event handler of icf.
       
   367      *  
       
   368      * @since S60 5.0
       
   369      * @return none
       
   370      */
       
   371     void OnIcfClicked();
       
   372 
       
   373     /**
       
   374      * handler of StrokeStarted event.
       
   375      *  
       
   376      * @since S60 5.0
       
   377      * @return none
       
   378      */
       
   379     void OnHwrStrokeStartedL();
       
   380 
       
   381     /**
       
   382      * handler of StrokeFinished event.
       
   383      *  
       
   384      * @since S60 5.0
       
   385      * @return none
       
   386      */    
       
   387     void OnHwrStrokeFinishedL();
       
   388     
       
   389     /**
       
   390      * handler of CharacterFinished event.
       
   391      *  
       
   392      * @since S60 5.0
       
   393      * @return none
       
   394      */    
       
   395     void OnHwrCharacterFinishedL();
       
   396 
       
   397 private:
       
   398     /**
       
   399      * get value from repository
       
   400      * 
       
   401      * @since S60 v5.0
       
   402      * @param aWatcher repository reader.
       
   403      * @param aId value id.
       
   404      * @return value
       
   405      */
       
   406     TInt GetNewValue(CAknFepRepositoryWatcher* aWatcher, const TInt aId);
       
   407     
       
   408     /**
       
   409      * get hwr trail color from repository
       
   410      * 
       
   411      * @since S60 v5.0
       
   412      * @return color value.
       
   413      */    
       
   414     TInt GetPenTrailColor();
       
   415     
       
   416 
       
   417     /**
       
   418      * set hwr writing speed.
       
   419      * 
       
   420      * @since S60 v5.0
       
   421      * @param aWritingSpeed speed
       
   422      * @return none
       
   423      */    
       
   424     void SetWritingSpeed(const TInt aWritingSpeed);
       
   425     
       
   426     /**
       
   427      * set hwr writing pen width.
       
   428      * 
       
   429      * @since S60 v5.0
       
   430      * @param aPenSize The pen size
       
   431      * @return none
       
   432      */     
       
   433     void SetBoxPenSize(const TSize aPenSize);
       
   434     
       
   435     /**
       
   436      * set hwr writing pen color.
       
   437      * 
       
   438      * @since S60 v5.0
       
   439      * @param aWritingSpeed speed
       
   440      * @return none
       
   441      */    
       
   442     void SetBoxPenColor(const TInt aPenColor);
       
   443 
       
   444     /**
       
   445      * set guide line on or off.
       
   446      * 
       
   447      * @since S60 v5.0
       
   448      * @param aGuideLineOn  guide line on or off.
       
   449      * @return none
       
   450      */    
       
   451     void SetGuideLineOn(const TBool aGuideLineOn);
       
   452     
       
   453     /**
       
   454      * change current state manager to standby state.
       
   455      * 
       
   456      * @since S60 v5.0
       
   457      * @return none 
       
   458      */
       
   459     void ChangeCurStateToStandby();
       
   460 	
       
   461     /**
       
   462      * handler of NumMapping changed event.
       
   463      *  
       
   464      * @since S60 5.0
       
   465      * @return none
       
   466      */
       
   467     void OnNumMappingChangedL();
       
   468     /**
       
   469      * revert special characters direction before sending to editor.
       
   470      * 
       
   471      * @since S60 v5.2
       
   472      * @return none 
       
   473      */
       
   474     TBool RevertSymbolDirection(TInt aInChar, TInt & aOutChar);
       
   475     
       
   476 private:
       
   477     
       
   478     /**
       
   479      * main window.
       
   480      * not own
       
   481      */
       
   482     CPeninputFingerHwrArWnd* iHwrWnd;
       
   483     
       
   484     /**
       
   485      * The data store
       
   486      * Own
       
   487      */
       
   488     CPeninputFingerHwrArDataStore* iDataStore;
       
   489 
       
   490     /**
       
   491      * The state manager
       
   492      * Own
       
   493      */
       
   494     CPeninputFingerHwrArStateManagerBase* iStateMgr;
       
   495 
       
   496     /**
       
   497      * The resource Id
       
   498      * 
       
   499      */
       
   500     TInt iResId;
       
   501 
       
   502     /**
       
   503      * Repository watcher
       
   504      */
       
   505     CAknFepRepositoryWatcher* iGSRepositoryWatcher;
       
   506     
       
   507     /**
       
   508      * Repository object.
       
   509      */
       
   510     CRepository* iRepositorySetting;
       
   511     
       
   512 	/**
       
   513 	 * Check if the stroke of drawing the character on the 
       
   514 	 * HWR box is started
       
   515 	 */
       
   516 	TBool iIsStrokeOfDrawingCharacerStarted;
       
   517 	
       
   518 	/**
       
   519 	 * Check if the editor is MFNE
       
   520 	 */
       
   521 	TBool iIsEditorMFNE;
       
   522 	
       
   523     /**
       
   524      * Last overlap index.
       
   525      */
       
   526     TInt iLastOverlapIdx; 
       
   527     };
       
   528 #endif //C_PENINPUTFINGERHWRARLAYOUT_H