fep/aknfep/inc/aknfepuiinputminiqwertypinyinphrasebase.h
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2008 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:           
       
    15 *      Provides the TAknFepInputMiniQwertyPinyinPhraseBase definition.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #ifndef T_AKNFEPUIINPUTMINIQWERTYPINYINPHRASEBASE_H
       
    31 #define T_AKNFEPUIINPUTMINIQWERTYPINYINPHRASEBASE_H
       
    32 
       
    33 //#include "AknFepUiInputStateChineseBase.h"
       
    34 #include "AknFepUiInputStateCandidateQwertyBaseChinesePhrase.h"
       
    35 
       
    36 class TAknFepInputMiniQwertyPinyinPhraseBase : public TAknFepInputStateCandidateQwertyBaseChinesePhrase
       
    37     {
       
    38 public:
       
    39     
       
    40     /**
       
    41      * change state flag.
       
    42      */
       
    43     enum TAknFepStrokePhraseChange
       
    44         {
       
    45         EManualChangeState,
       
    46         EAutoChangeStateFromInput,
       
    47         EAutoChangeStateFromCandidate
       
    48         };
       
    49     
       
    50     /**
       
    51      * C++ default constructor
       
    52      *
       
    53      * @since S60 v3.2.3
       
    54      * @param aOwner Pointer to UI manager state interface
       
    55      * @param aUIContainer Pointer to Chinese UI container
       
    56      */
       
    57     TAknFepInputMiniQwertyPinyinPhraseBase(
       
    58         MAknFepUIManagerStateInterface* aOwner,
       
    59         MAknFepUICtrlContainerChinese* aUIContainer
       
    60         );
       
    61     
       
    62     /**
       
    63      * Handle system key press event
       
    64      *
       
    65      * @since S60 v3.2.3
       
    66      * @param aKey System key
       
    67      * @param aLength Key press length
       
    68      * @return ETrue if handle, otherwise this class do not handle this key
       
    69      */
       
    70     TBool HandleKeyL( TInt aKey, TKeyPressLength aLength );
       
    71     /**
       
    72      * get the spell of least delimiter
       
    73      *
       
    74      * @since S60 v3.2.3
       
    75      * @return the spell of least delimiter
       
    76      */
       
    77     TPtrC getCurrentLeastDLTSpell();
       
    78     /**
       
    79      * Update input window
       
    80      *
       
    81      * @since S60 v3.2.3
       
    82      * @param aRefresh, if ETRue need to get the screen position, other need not.      
       
    83      * @return None
       
    84      */
       
    85     void RefreshUI( TBool aRefresh = EFalse );
       
    86     
       
    87     /**
       
    88      * check the first group stroke of keystroke.
       
    89      *
       
    90      * @since S60 v3.2.3
       
    91      * @param None
       
    92      * @return ETrue if the first group stroke is valid, others return EFalse.
       
    93      */
       
    94     TBool CheckFirstGroupStroke();
       
    95 
       
    96     /**
       
    97      * Add phrase to the UDB.
       
    98      *  
       
    99      * @since S60 v3.2.3.
       
   100      * @param aPhraseAdd that need to be added to the UDB.
       
   101      * @return None.
       
   102      */ 
       
   103     void AddPhraseToDB( const TDesC& aPhraseAdd );    
       
   104 
       
   105     
       
   106     /**
       
   107      * Refresh candidate
       
   108      *
       
   109      * @since S60 v3.2.3
       
   110      * @param None
       
   111      * @return none
       
   112      */
       
   113     void RefreshCandidate();
       
   114     
       
   115     /**
       
   116      * Check key whether need repeat.
       
   117      * 
       
   118      * @since S60 v3.2.3
       
   119      * @param aLength, the key press length.
       
   120      * @return ETrue if the key need repeat, EFalse others.
       
   121      */
       
   122     TBool CheckKeyNeedRepeat( TKeyPressLength aLength );
       
   123     
       
   124     /**
       
   125      * Commint text to EEP or editor
       
   126      *
       
   127      * @since S60 V3.2.3
       
   128      * @param aDes Text had been select from candidate pane
       
   129      * @return ETrue if keep state, otherwise need to change to pridictive or editor
       
   130      */
       
   131     TBool CommitInlineEEPL( const TDesC& aDes );
       
   132     
       
   133     /**
       
   134      * Update indicator
       
   135      *
       
   136      * @since S60 v3.2.3
       
   137      * @param None
       
   138      * @return None.
       
   139      */
       
   140     void UpdateIndicator();
       
   141     
       
   142     /**
       
   143       * Do action afer commit, change state to predictive or not.
       
   144       *
       
   145       * @since S60 v3.2.3
       
   146       * @param None
       
   147       * @return None.
       
   148       */
       
   149     void DoActionAfterCommit();
       
   150     
       
   151     /**
       
   152      * Handling Command events.
       
   153      * This Method is called by CAknFepUIManagerJapanese.
       
   154      *
       
   155      * @param aCommandId Command ID value
       
   156      */
       
   157     void HandleCommandL( TInt aCommandId );
       
   158     
       
   159 private:
       
   160     
       
   161     /**
       
   162      * The pinyin tone mark. 
       
   163      */
       
   164     enum PinyinToneMark
       
   165         {
       
   166         EToneMark1 = 1,
       
   167         EToneMark2 = 2,
       
   168         EToneMark3 = 3,
       
   169         EToneMark4 = 4,
       
   170         EToneMark5 = 5,
       
   171         EOthers = -1
       
   172         };
       
   173     
       
   174     /**
       
   175      * Get the cursor's pos of show keystroke.
       
   176      *
       
   177      * @since S60 v3.2.3
       
   178      * @param None
       
   179      * @return cursor's pos of show keystroke.
       
   180      */
       
   181     TInt GetCursorPos();
       
   182     
       
   183     /**
       
   184      * Handle Enter key press.
       
   185      *
       
   186      * @since S60 v3.2.3
       
   187      * @param None
       
   188      * @return None
       
   189      */
       
   190     void HandlEnterKeyL();
       
   191     
       
   192     /**
       
   193      * Handle space key press.
       
   194      *
       
   195      * @since S60 v3.2.3
       
   196      * @param None
       
   197      * @return None
       
   198      */
       
   199     void HandlSpaceKeyL();
       
   200     
       
   201     /**
       
   202      * Handle key from candidate.
       
   203      *
       
   204      * @since S60 v3.2.3
       
   205      * @param aKey System key
       
   206      * @param aLength Key press length
       
   207      * return None
       
   208      */
       
   209     void HandleKeyFromCandidateL(TInt aKey, TKeyPressLength aLength );
       
   210     
       
   211     /**
       
   212      * Handle tone mark key press.
       
   213      *
       
   214      * @since S60 v3.2.3
       
   215      * @param None
       
   216      * @return None
       
   217      */
       
   218     void HandlToneMarkL();
       
   219     
       
   220     /**
       
   221      * Check the delimiter that wether is manual delimiter.
       
   222      *
       
   223      * @since S60 v3.2.3
       
   224      * @param aCount the count of keystroke except delimiter.
       
   225      * @param aKeystroke that put to the Pti keystroke. 
       
   226      * @return ETrue if the deimiter is manual delimiter, EFalse others.
       
   227      */
       
   228     TBool CheckManualDelimiter( const TInt aCount,
       
   229                                 const TDesC& aKeystroke );
       
   230     
       
   231     /**
       
   232      * Analyse Pinyin spelling.
       
   233      * 
       
   234      * @since S60 v3.2.3
       
   235      * @param aKeystroke that put to the Pti keystroke.
       
   236      * @param aSpelling get the spelling from Pti.
       
   237      * @param the show keystroke array. 
       
   238      * @return None.
       
   239      */
       
   240     void AnalyseSpellingL( const TDesC& aKeystroke, 
       
   241                            const TDesC& aSpelling,
       
   242                            CDesCArrayFlat* aShowKeystroke );
       
   243     
       
   244     /**
       
   245      * Analyse spelling after user press tone mark.
       
   246      * 
       
   247      * @since S60 v3.2.3
       
   248      * @param None.
       
   249      * @return None.
       
   250      */
       
   251     void AnalyseSpellingAddToneMarkL( 
       
   252                                     TInt aI,
       
   253                                     TInt aToneMarkCount,
       
   254                                     CDesCArrayFlat* aKeystroke,
       
   255                                     CDesCArrayFlat* showKeystroke );
       
   256     
       
   257     /**
       
   258      * Analyse spelling after user press key that is not tone mark.
       
   259      * 
       
   260      * @since S60 v3.2.3
       
   261      * @param None.
       
   262      * @return None.
       
   263      */
       
   264     void AnalyseSpellingAddKeyL( 
       
   265                                TInt& aI,
       
   266                                TInt aDelimterPos,
       
   267                                CDesCArrayFlat* aKeystroke,
       
   268                                CDesCArrayFlat* aShowKeystroke );
       
   269     
       
   270     /**
       
   271      * Analyse spelling after user press key.
       
   272      * 
       
   273      * @since S60 v3.2.3
       
   274      * @param None.
       
   275      * @return None.
       
   276      */
       
   277     void AnalyseL();
       
   278     
       
   279     /**
       
   280      * Handle CBA1 or select event.
       
   281      * 
       
   282      * @since S60 v3.2.3
       
   283      * @param None.
       
   284      * @return None.
       
   285      */
       
   286     void HandleCommitL();
       
   287     
       
   288     /**
       
   289      * Handle KeyBackspace event.
       
   290      * 
       
   291      * @since S60 v3.2.3
       
   292      * @param aLength Key press length 
       
   293      * @return ETrue if handle, otherwise this class do not handle this key
       
   294      */
       
   295     void HandleKeyBackspaceL( TKeyPressLength aLength );
       
   296     
       
   297     /**
       
   298      * Handle default key press event.
       
   299      *
       
   300      * @since S60 v3.2.3
       
   301      * @param aKey System key
       
   302      * @param aLength Key press length
       
   303      * @return ETrue if handle, otherwise this class do not handle this key
       
   304      */
       
   305     void HandleDefaultKeyL( TInt aKey );
       
   306     
       
   307     /**
       
   308      * Show the showinfo on the EEP ctrl.
       
   309      * 
       
   310      * @since S60 v3.2.3.
       
   311      * @param None.
       
   312      * @return None.
       
   313      */
       
   314     void ShowInfoOnEEPPane();
       
   315     
       
   316     /**
       
   317      * Show the showinfo on the candidate ctrl.
       
   318      * 
       
   319      * @since S60 v3.2.3.
       
   320      * @param None.
       
   321      * @return None.
       
   322      */
       
   323     void ShowInfoOnCandidatePane();
       
   324     
       
   325     /**
       
   326      * get the show keystroke.
       
   327      * 
       
   328      * @since S60 v3.2.3.
       
   329      * @param aKey, the input keystroke.
       
   330      * @param aKeystroke the show keystroke.
       
   331      * @return None.
       
   332      */
       
   333     void GetShowKeystroke( TInt aKey, TDes& aKeystroke );
       
   334     
       
   335     /**
       
   336      * Handle horizontal navigation.
       
   337      * 
       
   338      * @since S60 v3.2.3.
       
   339      * @param aKey the input keystroke.
       
   340      * @return ETrue if high light can move, EFase others.
       
   341      */ 
       
   342     TBool HandleHorizontalNavigation( TInt aKey );
       
   343     
       
   344     /**
       
   345      * Add keystroke.
       
   346      * 
       
   347      * @since S60 v3.2.3.
       
   348      * @param aKey the input keystroke.
       
   349      * @return ETrue if that the key can add to the current keystroke, EFase others.
       
   350      */            
       
   351     TBool AddKeystrokeL( TInt aKey );
       
   352     
       
   353     /**
       
   354      * Add tone mark.
       
   355      * 
       
   356      * @since S60 v3.2.3.
       
   357      * @param None.
       
   358      * @return ETrue if that the key can add to the current keystroke, EFase others.
       
   359      */            
       
   360     TBool AddToneMarkL();
       
   361     
       
   362     /**
       
   363      * Get the candidate info.
       
   364      * 
       
   365      * @since S60 v3.2.3.
       
   366      * @param None.
       
   367      * @return none.
       
   368      */            
       
   369     void GetCandidateL();
       
   370     
       
   371     /**
       
   372      * Change CBA.
       
   373      *
       
   374      * @since S60 v3.2.3
       
   375      * @param None.
       
   376      * @return None.
       
   377      */        
       
   378     void ChangeCbaL();
       
   379     
       
   380     /**
       
   381      * Delete more keystroke than max leng.
       
   382      * 
       
   383      * @since S60 v3.2.3.
       
   384      * @param None.
       
   385      * @return None.
       
   386      */            
       
   387     void DeleteMoreKeystrokeL();
       
   388     
       
   389     /**
       
   390      * Delete current keystroke.
       
   391      * 
       
   392      * @since S60 v3.2.3.
       
   393      * @param None.
       
   394      * @return ETrue if that can be deleted, EFase others.
       
   395      */            
       
   396     TBool DeleteKeystrokeL();
       
   397     
       
   398     /**
       
   399      * Clear Keystroke of PtiEngine.
       
   400      *
       
   401      * @since S60 v3.2.3.
       
   402      * @param None.
       
   403      * @return None.
       
   404      */
       
   405     void ClearPtiEngineKeystroke();
       
   406 
       
   407     /**
       
   408      * get the key code.
       
   409      * 
       
   410      * @since S60 v3.2.3
       
   411      * @param aKey, the keycode.
       
   412      * @param aKeystroke, the show keystroke.
       
   413      * @return none.
       
   414      */
       
   415     void GetKeystrokeCode( TInt& aKey, const TDesC& aKeystroke );
       
   416     
       
   417     /**
       
   418      * Revert the phrase to keystroke.
       
   419      * 
       
   420      * @since S60 v3.2.3
       
   421      * @param None.
       
   422      * @return none.
       
   423      */
       
   424     void RevertPhraseToKeystrokeL();
       
   425     
       
   426     /**
       
   427      * set warning color.
       
   428      * 
       
   429      * @since S60 v3.2.3.
       
   430      * @param aCount, the count of key.
       
   431      * @param aIndex, the index of key.
       
   432      * @param aPhraseCount, the count of phrase.
       
   433      * @param aToneMark, the tone mark.
       
   434      * @param aValid, the key whether is valid.
       
   435      * @param aShowKeystroke, the show key stroke array.
       
   436      * 
       
   437      * @return none.
       
   438      */         
       
   439     void SetWarningColor(
       
   440                         TInt aCount,
       
   441                         TInt aIndex,
       
   442                         TInt aI,
       
   443                         TInt aPhraseCount,
       
   444                         TInt aToneMark,
       
   445                         TBool aValid,
       
   446                         CDesCArrayFlat* aShowKeystroke );
       
   447     
       
   448     /**
       
   449      * set warning color.
       
   450      * 
       
   451      * @since S60 v3.2.3.
       
   452      * @param None.
       
   453      * @return none.
       
   454      */         
       
   455     void SetWarningColor();
       
   456     
       
   457     /**
       
   458      * Move the cursor to Left.
       
   459      * 
       
   460      * @since S60 v3.2.3.
       
   461      * @param None.
       
   462      * @return none.
       
   463      */         
       
   464     void MoveCursorLeft();
       
   465     
       
   466     /**
       
   467      * Move the cursor to Right.
       
   468      * 
       
   469      * @since S60 v3.2.3.
       
   470      * @param None.
       
   471      * @return none.
       
   472      */         
       
   473     void MoveCursorRight();
       
   474 
       
   475     /**
       
   476      * Check the special keystroke( i,u,v ).
       
   477      * 
       
   478      * @since S60 v3.2.3.
       
   479      * @param aKeystroke the key code.
       
   480      * @return ETrue if the param is special key, EFalse others.
       
   481      */         
       
   482     TBool CheckSpecialKey( const TInt aKeystroke );
       
   483     
       
   484     /**
       
   485      * Check the delimiter of spelling.
       
   486      * 
       
   487      * @since S60 v3.2.3.
       
   488      * @param aKeystroke the keystroke.
       
   489      * @return ETrue if the param is delimiter, EFalse others.
       
   490      */         
       
   491     TBool CheckSpellingDLT( const TDesC& aKeystroke );
       
   492     
       
   493     /**
       
   494      * Get pinyin tone mark.
       
   495      * 
       
   496      * @since S60 v3.2.3.
       
   497      * @param aKeystroke,The tone mark.
       
   498      * @return pinyin tone mark.
       
   499      */         
       
   500     TInt ToneMark( const TDesC& aKeystroke );
       
   501     
       
   502     /**
       
   503      * Check the spelling after add tone mark to the PTI.
       
   504      * 
       
   505      * @since S60 v3.2.3.
       
   506      * @param aToneMark,The tone mark.
       
   507      * @return ETue,if the splling is not phrase spelling,EFalse others.
       
   508      */         
       
   509     TBool CheckSpellingAddToneMarkToPTIL( const TInt aToneMark );
       
   510 
       
   511     /**
       
   512      * Check the spelling after add key to the PTI.
       
   513      * 
       
   514      * @since S60 v3.2.3.
       
   515      * @param aToneMark,The tone mark.
       
   516      * @return o,if the splling is not phrase spelling,other the position of delimiter.
       
   517      */         
       
   518     TInt CheckSpellingAddKeyToPTIL( const TDesC& aKeystroke );
       
   519     
       
   520     /**
       
   521      * check the all group stroke of keystroke.
       
   522      *
       
   523      * @since S60 v3.2.3
       
   524      * @param None.
       
   525      * @return ETrue if the first group stroke is valid, others return EFalse.
       
   526      */
       
   527     TBool CheckAllGroupStroke();
       
   528     
       
   529     /**
       
   530       * Do action afer commit, change state to predictive or not.
       
   531       *
       
   532       * @since S60 v3.2.3
       
   533       * @param None.
       
   534       * @return None.
       
   535       */
       
   536     void DoActionAfterCommitL();
       
   537     
       
   538     };		
       
   539 
       
   540 #endif //T_AKNFEPUIINPUTMINIQWERTYPINYINPHRASEBASE_H
       
   541 
       
   542 // End of file