fep/aknfep/peninputplugins/peninputimeplugincn/inc/pluginfepmanagerbase.h
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     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:            Layout UI interface base class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 #ifndef C_PLUGINFEPMANAGERBASE_H
       
    29 #define C_PLUGINFEPMANAGERBASE_H
       
    30 
       
    31 // System includes
       
    32 #include <e32base.h>
       
    33 #include <frmtlay.h>
       
    34 #include <eikon.hrh>
       
    35 #include <AknFepManagerInterface.h>
       
    36 #include <peninputcmd.h>
       
    37 
       
    38 //Forward declaration
       
    39 class CPenInputImePluginCn;
       
    40 class RPeninputServer;
       
    41 class CAknEdwinState;
       
    42 class CRepository;
       
    43 /**
       
    44  *  CPluginFepManagerBase is the layout UI interface base class. 
       
    45  *  It is something like a "proxy" class of layout UI plugin, sending
       
    46  *  commands from FEP to layout UI plugin.
       
    47  *
       
    48  *  @lib peninputimeplugincn.lib
       
    49  *  @since S60 v3.2
       
    50  */
       
    51 class CPluginFepManagerBase: public CBase, public MAknFepManagerInterface
       
    52     {
       
    53 public: 
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     ~CPluginFepManagerBase();
       
    59 
       
    60     /**
       
    61      * Initalize UI when first time starting up. 
       
    62      * The first time means when the instance created.
       
    63      * 
       
    64      * @since S60 v3.2
       
    65      *
       
    66      * @return None.
       
    67      */
       
    68     virtual void OnInit();
       
    69 
       
    70     /**
       
    71      * Explicitly get ICF max length from layout UI and save the 
       
    72      * value to iMaxEditorLength.
       
    73      * 
       
    74      * @since S60 v3.2
       
    75      *
       
    76      * @return None.
       
    77      */
       
    78     void RetrieveEditorMaxLength();
       
    79 
       
    80     /**
       
    81      * Update local copy of case mode when 
       
    82      * user change case in layout UI.
       
    83      * 
       
    84      * @since S60 v3.2
       
    85      *
       
    86      * @param aCaseMode The case mode to save locally.
       
    87      * @return None.
       
    88      */
       
    89     void UpdateCaseMode( TInt aCaseMode );
       
    90 
       
    91 // From MAknFepManagerInterface
       
    92 
       
    93     /**
       
    94      * Set layout UI current number mode key mapping.
       
    95      * For example, 0-9 ; 0-9,*,# and etc.
       
    96      * 
       
    97      * @since S60 v3.2
       
    98      *
       
    99      * @param aAknEditorNumericKeymap Key mapping enum value.
       
   100      * @return None.
       
   101      */
       
   102     void SetNumberModeKeyMappingL( TAknEditorNumericKeymap aAknEditorNumericKeymap );
       
   103 
       
   104     /**
       
   105      * Handle key event.
       
   106      * Since most plugin layout UIs are based on animation, they receive 
       
   107      * key and process key events before this function. 
       
   108      * 
       
   109      * @since S60 v3.2
       
   110      *
       
   111      * @param aKey Key event code.
       
   112      * @param aLength Key press length.
       
   113      * @return ETrue if processed, EFalse otherwise.
       
   114      */
       
   115     TBool HandleKeyL( TInt aKey, TKeyPressLength aLength, TEventCode aEventCode = EEventKey );
       
   116 
       
   117     /**
       
   118      * Handle command come from FEP.
       
   119      * 
       
   120      * @since S60 v3.2
       
   121      *
       
   122      * @param aCommandId Command id.
       
   123      * @return None
       
   124      */
       
   125     void HandleCommandL( TInt aCommandId );
       
   126 
       
   127     /**
       
   128      * Handle command come from FEP.
       
   129      * 
       
   130      * @since S60 v3.2
       
   131      *
       
   132      * @param aCommandId Command id.
       
   133      * @param aParam  Command parameter.
       
   134      * @return None.
       
   135      */
       
   136     void HandleCommandL( TInt aCommandId, TInt aParam );
       
   137 
       
   138     /**
       
   139      * Close plugin layout UI.
       
   140      * 
       
   141      * @since S60 v3.2
       
   142      *
       
   143      * @return None.
       
   144      */
       
   145     void CloseUI();
       
   146 
       
   147     /**
       
   148      * Activate plugin layout UI.
       
   149      * 
       
   150      * @since S60 v3.2
       
   151      *
       
   152      * @return None.
       
   153      */
       
   154     void ActivateUI();
       
   155 
       
   156     /**
       
   157      * Get max text length of layout UI ICF control.
       
   158      * 
       
   159      * @since S60 v3.2
       
   160      * @return Max ICF text length.
       
   161      */
       
   162     TInt EditorMaxLength();
       
   163 
       
   164     /**
       
   165      * When screen size changes, SizeChanged is called by FEP.
       
   166      * 
       
   167      * @since S60 v3.2
       
   168      * @return None.
       
   169      */
       
   170     void ResourceChanged( TInt aType );
       
   171 
       
   172     /**
       
   173      * Set underlining UI.
       
   174      * Since plugin layout UI and HKB can be used at same time,
       
   175      * HKB UI layout need to be notified after plugin layout UI 
       
   176      * processes some events
       
   177      * 
       
   178      * @since S60 v3.2
       
   179      * @param aNextUI The underlining UI pointer.
       
   180      * @return None.
       
   181      */
       
   182     void SetNextFepUI( MAknFepManagerInterface* aNextUi );
       
   183     
       
   184     /**
       
   185      * Get support language in sepecfied mode.
       
   186      * The method leaves here only for compatibility.
       
   187      * 
       
   188      * @since S60 v3.2
       
   189      *
       
   190      * @param aMode Input mode.
       
   191      * @return Language supported.
       
   192      */
       
   193     TInt SupportLanguage( TInt aMode ) const;
       
   194 
       
   195     /**
       
   196      * Set current language, which is required by editor
       
   197      * 
       
   198      * @since S60 v3.2
       
   199      *
       
   200      * @param aLanguage Language to set.
       
   201      * @return None.
       
   202      */
       
   203     void SetInputLanguageL( TLanguage aLanguage );
       
   204 
       
   205     /**
       
   206      * Set editor text and cursor information to layout UI 
       
   207      * ICF control.
       
   208      * 
       
   209      * @since S60 v3.2
       
   210      * @param aTotalTextLen Total text length in eidtor.
       
   211      * @param aStartPos Offset of aText to the start of editor text.
       
   212      * @param aCursorSel Cursor position.
       
   213      * @param aText A part of editor text start from aStartPos.
       
   214      *
       
   215      * @return None.
       
   216      */
       
   217     void SetFepAwareEditorText( const TFepInputContextFieldData& aIcfData );
       
   218 
       
   219     /**
       
   220      * Set layout UI mode.
       
   221      * The method leaves here only for compatibility
       
   222      * 
       
   223      * @since S60 v3.2
       
   224      *
       
   225      * @param aMode Mode to set.
       
   226      * @param aPredictive Whether the current mode support predictive.
       
   227      * @param aWwertyInputMode Whether the current HKB is qwerty.
       
   228      * @return None.
       
   229      */
       
   230 #ifdef RD_INTELLIGENT_TEXT_INPUT          
       
   231     void SetMode(TInt aMode, TBool aPredictive, TBool aQwertyInputMode, TInt aKeyboardType);
       
   232 #else
       
   233     void SetMode(TInt aMode, TBool aPredictive, TBool aQwertyInputMode);
       
   234 #endif   
       
   235 
       
   236 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   237     virtual TBool IsValidFnKeyPress() const;
       
   238     virtual TBool IsValidLongChrKeyPress() const;
       
   239 #endif
       
   240 
       
   241     /**
       
   242      * Set layout UI current case.
       
   243      * The method leaves here only for compatibility. Since plugin layout 
       
   244      * UI is different from HKB tranditional UI, they use something like 
       
   245      * "case mode" other than case which is set by a FEP command.
       
   246      * 
       
   247      * @since S60 v3.2
       
   248      *
       
   249      * @param aCase Case to set.
       
   250      * @return None.
       
   251      */
       
   252     void SetCase( TCase aCase );
       
   253 
       
   254     /**
       
   255      * The method leaves here only for compatibility.
       
   256      * 
       
   257      * @since S60 v3.2
       
   258      *
       
   259      * @return None.
       
   260      */
       
   261     void ExpireMultitapTimer();
       
   262 
       
   263     /**
       
   264      * The method leaves here only for compatibility.
       
   265      * 
       
   266      * @since S60 v3.2
       
   267      * 
       
   268      * @param aKey The key presssed.
       
   269      * @return ETrue if long press, EFalse otherwise.
       
   270      */
       
   271     TBool IsValidNumericLongKeyPress( TInt aKey ) const;
       
   272 
       
   273     /**
       
   274      * The method leaves here only for compatibility.
       
   275      * 
       
   276      * @since S60 v3.2
       
   277      *
       
   278      * @param aText Text to add to user dictionary.
       
   279      * @return None.
       
   280      */
       
   281     void AddTextToUserDictionaryL( const TDesC& aText );
       
   282 
       
   283     /**
       
   284      * The method leaves here only for compatibility.
       
   285      * 
       
   286      * @since S60 v3.2
       
   287      *
       
   288      * @param aFormat On return, contains the formatting to 
       
   289      *        apply to the inline text (or to a portion of it). 
       
   290      * @param aNumberOfCharactersWithSameFormat  On return, 
       
   291               contains the number of characters in the inline 
       
   292               text (starting at aPositionOfCharacter) 
       
   293               which have the same formatting
       
   294      * @param aPositionOfCharacter Start position within the inline text
       
   295      * @return None.
       
   296      */
       
   297     void GetFormatOfFepInlineText( TCharFormat& aFormat, 
       
   298                                    TInt& aNumberOfCharactersWithSameFormat, 
       
   299                                    TInt aPositionOfCharacter ) const;
       
   300 
       
   301     /**
       
   302      * The method leaves here only for compatibility.
       
   303      * 
       
   304      * @since S60 v3.2
       
   305      *
       
   306      * @return ETrue if valid, EFalse otherwise.
       
   307      */
       
   308     TBool IsValidShiftKeyPress() const;
       
   309 
       
   310     /**
       
   311      * The method leaves here only for compatibility.
       
   312      * 
       
   313      * @since S60 v3.2
       
   314      *
       
   315      * @return None.
       
   316      */
       
   317     void SetEditorContext( TInt aContext );
       
   318 
       
   319 	/**
       
   320 	 * Set the Star key flag
       
   321 	 *
       
   322      * @param aSet TBool.
       
   323      * @return None
       
   324 	 */
       
   325 	void SetStarKeyFlag( TBool aSet );
       
   326 protected:
       
   327    
       
   328     /**
       
   329      * C++ default constructor.
       
   330      *
       
   331      * @since S60 v3.2
       
   332      * @param aOwner IME plugin pointer.
       
   333      * @param aPenInputServer Pen input server pointer
       
   334      */
       
   335     CPluginFepManagerBase(CPenInputImePluginCn& aOwner, 
       
   336                           RPeninputServer* aPenInputServer);
       
   337 
       
   338     /**
       
   339      * By default Symbian 2nd phase constructor.
       
   340      *
       
   341      * @since S60 v3.2
       
   342      * @return None
       
   343      */
       
   344     void BaseConstructL();
       
   345 
       
   346     /**
       
   347      * Set layout permited ranges.
       
   348      *
       
   349      * @param aPermittedMode Ranges of current editor allowed.
       
   350      * @return None
       
   351      */
       
   352     virtual void SetLayoutPermitedRanges( TInt aPermittedRanges );
       
   353 
       
   354     /**
       
   355      * Set layout primary range.
       
   356      *
       
   357      * @since S60 v3.2
       
   358      * @param aEditorState Current editor state.
       
   359      * @return None
       
   360      */
       
   361     virtual void SetLayoutRange( const CAknEdwinState* aEditorState );
       
   362 
       
   363     /**
       
   364      * Send command to pen input server utility function.
       
   365      *
       
   366      * @since S60 v3.2
       
   367      * @param aCommandId The command id to sent.
       
   368      * @return None
       
   369      */
       
   370     void SendCommandToServer( TInt aCommandId );
       
   371 
       
   372     /**
       
   373      * Send command to pen input server utility function.
       
   374      *
       
   375      * @since S60 v3.2
       
   376      * @param aCommandId The command id to sent.
       
   377      * @param aParam The command param.
       
   378      * @return None
       
   379      */
       
   380     void SendCommandToServer( TInt aCommandId, TInt aParam );
       
   381 
       
   382     /**
       
   383      * Send command to pen input server utility function.
       
   384      *
       
   385      * @since S60 v3.2
       
   386      * @param aCommandId The command id to sent.
       
   387      * @param aParam The command param.
       
   388      * @return None
       
   389      */
       
   390     void SendCommandToServer( TInt aCommandId, const TDesC8& aParam );
       
   391 
       
   392     /**
       
   393      * Get layout UI last used range.
       
   394      *
       
   395      * @since S60 v3.2
       
   396      * @return Range last used.
       
   397      */
       
   398     TInt LayoutLastUsedRange();
       
   399 
       
   400     /**
       
   401      * Set layout UI position.
       
   402      * Move layout UI not to overlap with some editors.
       
   403      *
       
   404      * @since S60 v3.2
       
   405      * @param aBottomRight The bottom right position of layout UI.
       
   406      *        The value is only a suggest value, layout UI may adjust it.
       
   407      * @return None.
       
   408      */
       
   409     void SetLayoutPosition( const TRect& aParam );
       
   410 
       
   411     /**
       
   412      * Get Editor's local language.
       
   413      *
       
   414      * @since S60 v3.2
       
   415      * @param aEditorState The editor's .CAknEdwinState pointer
       
   416      * @return Language code the editor requires.
       
   417      */
       
   418     TLanguage GetLocalLanguage( const CAknEdwinState* aEditorState ) const;
       
   419    
       
   420 protected:
       
   421 
       
   422     /**
       
   423      * IME plugin reference.
       
   424      */
       
   425     CPenInputImePluginCn& iOwner;
       
   426 
       
   427     /**
       
   428      * Pen input server pointer. Not own.
       
   429      */
       
   430     RPeninputServer* iPenInputServer;
       
   431 
       
   432     /**
       
   433      * The premitted range of current editor.
       
   434      */
       
   435     TInt iPermittedRange;
       
   436     
       
   437     TInt iHkbMode;
       
   438     /**
       
   439      * The fep suggested range. The suggested value comes from
       
   440      * previous touch input method.
       
   441      */
       
   442     TInt iSuggestedRange;
       
   443     
       
   444     /**
       
   445      * Current language.
       
   446      */
       
   447     TLanguage iLanguage;   
       
   448     
       
   449 private:
       
   450 
       
   451     /**
       
   452      * Repository object used to get last used range.
       
   453      */
       
   454     CRepository* iRepository;
       
   455 
       
   456     /**
       
   457      * Local copy of ICF max text length.
       
   458      */
       
   459     TInt iMaxEditorLength;
       
   460 
       
   461     /**
       
   462      * Local copy of layout current case mode
       
   463      */
       
   464     TInt iLastCase;
       
   465 
       
   466     /**
       
   467      * Underlineing UI interface
       
   468      */
       
   469     MAknFepManagerInterface* iHkbUi;
       
   470     };
       
   471 #endif // C_PLUGINFEPMANAGERBASE_H
       
   472 
       
   473 // End Of File