textinput/peninputfingerhwr/inc/peninputfingerhwrdatastore.h
changeset 0 eb1f2e154e89
child 3 f5a1e66df979
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:  Implementation for chinese peninput finger hwr
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_PENINPUTFINGERHWRDATASTORE_H
       
    19 #define C_PENINPUTFINGERHWRDATASTORE_H
       
    20 
       
    21 //SYSTEM INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <e32def.h>
       
    24 #include <w32std.h>
       
    25 #include <eikon.hrh>
       
    26 #include <aknutils.h>
       
    27 
       
    28 //FEP INCLUDES
       
    29 #include <ptiengine.h>
       
    30 #include <peninputpluginutils.h>
       
    31 
       
    32 
       
    33 //USER INCLUDES
       
    34 #include "peninputfingerhwrstoreconstants.h"
       
    35 
       
    36 //CONSTANTS
       
    37 const TInt KLanguageStringLength = 10;
       
    38 
       
    39 //FOWWARD CLASS
       
    40 class CPeninputFingerHwrLayout;
       
    41 class CAknFepHwrTriggerStr;
       
    42 class CRepository;
       
    43 class CAknFepHwrEngine;
       
    44 class CPtiEngine;
       
    45 
       
    46 
       
    47 /**
       
    48  *  CPeninputFingerHwrDataStore
       
    49  *
       
    50  *  @lib peninputfingerhwr.lib
       
    51  *  @since S60 v5.0
       
    52  */
       
    53 class CPeninputFingerHwrDataStore : public CBase
       
    54     {
       
    55 public:
       
    56     /**
       
    57      * Symbian constructor.
       
    58      *
       
    59      * @since S60 v5.0
       
    60      * @param aPtiEngine The PtiEngine
       
    61      * @param aLayout The Finger HWR layout
       
    62      * @return Pointer to created CPeninputFingerHwrDataStore object
       
    63      */
       
    64     static CPeninputFingerHwrDataStore* NewL( CPtiEngine* aPtiEngine, 
       
    65         CPeninputFingerHwrLayout* aLayout );
       
    66 
       
    67     /**
       
    68      * destructor
       
    69      *
       
    70      * @since S60 v5.0
       
    71      * @return None
       
    72      */
       
    73     virtual ~CPeninputFingerHwrDataStore();
       
    74 
       
    75 
       
    76 public:    
       
    77     /**
       
    78      * Is valid candidate
       
    79      *
       
    80      * @since S60 v5.0
       
    81      * @param aCandidateIndex The index the candidate in list.
       
    82      * @return ETrue if candidate is not empty; otherwise EFalse
       
    83      */    
       
    84     TBool IsValidCandidate( TInt aCandidateIndex ) const;
       
    85     
       
    86 
       
    87     /**
       
    88      * Is English letter
       
    89      *
       
    90      * @since S60 v5.0
       
    91      * @param aLetter The recognize character.
       
    92      * @return ETrue if the character is English letter; otherwise EFalse
       
    93      */   
       
    94     TBool IsEnglishLetter( const TDesC& aLetter);
       
    95          
       
    96     /**
       
    97      * Do recoginize by engine
       
    98      *
       
    99      * @since S60 v5.0
       
   100      * @param aTraceData The trace data.
       
   101      * @return None
       
   102      */            
       
   103     void DoChineseRecognizeL( const RArray<TPoint>& aTraceData );
       
   104 
       
   105     /**
       
   106      * Do recoginize in English range
       
   107      *
       
   108      * @since S60 v5.0
       
   109      * @param aTraceData The trace data.
       
   110      * @return None
       
   111      */
       
   112     void DoEngRecognizeL( const RArray<TPoint>& aTraceData);
       
   113 
       
   114     /**
       
   115      * Do predictive using trigger string
       
   116      *
       
   117      * @since S60 v5.0
       
   118      * @return None
       
   119      */          
       
   120     void DoPredictiveL();
       
   121     
       
   122     /**
       
   123      * Set Chinese symbol to writing candidate list
       
   124      *
       
   125      * @since S60 v5.0
       
   126      * @return None
       
   127      */      
       
   128     void SetChineseSymbolL();
       
   129     
       
   130     /**
       
   131      * Set fixed Chinese predictives to predictive list
       
   132      *
       
   133      * @since S60 v5.0
       
   134      * @return None
       
   135      */    
       
   136     void SetFixChinesePredictiveL();
       
   137     
       
   138     /**
       
   139      * Set fixed English symbol
       
   140      *
       
   141      * @since S60 v5.0
       
   142      * @param aRowCount The flag to confirm which row
       
   143      * @return None
       
   144      */   
       
   145     void SetFixEnglishSymbolL(TRowCount aRowCount = ERowOne);
       
   146     
       
   147        
       
   148     /**
       
   149      * Get the predictive count
       
   150      *
       
   151      * @since S60 v5.0
       
   152      * @return The count of predictives
       
   153      */            
       
   154     TInt PredictiveCount() const;
       
   155 
       
   156     /**
       
   157      * Get the trigger string
       
   158      *
       
   159      * @since S60 v5.0
       
   160      * @return Pointer to CAknFepHwrTriggerStr object
       
   161      */            
       
   162     CAknFepHwrTriggerStr* TriggerStr() const;
       
   163 
       
   164     /**
       
   165      * Set permitted ranges
       
   166      *
       
   167      * @since S60 v5.0
       
   168      * @param aPermittedRanges The permitted ranges.
       
   169      * @return None
       
   170      */            
       
   171     void SetPermittedRanges( TInt aPermittedRanges );  
       
   172     
       
   173     /**
       
   174      * Set permitted ranges
       
   175      *
       
   176      * @since S60 v5.0
       
   177      * @param aPermittedRanges The permitted ranges.
       
   178      * @return None
       
   179      */            
       
   180     void SetPermittedCases( TInt aPermittedCases );
       
   181     
       
   182    
       
   183     /**
       
   184      * Set Primary range
       
   185      *
       
   186      * @since S60 v5.0
       
   187      * @param aPrimaryRange The Primary range
       
   188      * @return None
       
   189      */            
       
   190     void SetPrimaryRange( TInt aPrimaryRange );
       
   191     
       
   192     /**
       
   193      * Get Primary range
       
   194      *
       
   195      * @since S60 v5.0
       
   196      * @return Primary range.
       
   197      */
       
   198     TInt PrimaryRange();
       
   199     
       
   200     /**
       
   201      * Get current range
       
   202      *
       
   203      * @since S60 v5.0
       
   204      * @return Current range.
       
   205      */   
       
   206     TFingerHwrRange CurrentRange();
       
   207     
       
   208      
       
   209     /**
       
   210      * Set case
       
   211      *
       
   212      * @since S60 v5.0
       
   213      * @param aCase The case
       
   214      * @return None
       
   215      */            
       
   216     void SetCase( TInt aCase );
       
   217     
       
   218     /**
       
   219      * Set language
       
   220      *
       
   221      * @since S60 v5.0
       
   222      * @param aLanguage The language
       
   223      * @return None
       
   224      */            
       
   225     void SetLanguageL( TInt aLanguage );
       
   226          
       
   227     /**
       
   228      * Set the candidate list.
       
   229      *
       
   230      * @since S60 v5.0
       
   231      * @return None
       
   232      */
       
   233     void SetCandidatesL();
       
   234     
       
   235 
       
   236     /**
       
   237      * Set auto complete candidate list.
       
   238      *
       
   239      * @since S60 v5.0
       
   240      * @return None
       
   241      */
       
   242     void SetAutoCompleteCandidatesL();
       
   243     
       
   244     /**
       
   245      * Set auto complete candidate list.
       
   246      *
       
   247      * @since S60 v5.0
       
   248      * @param aIsFirstStroke The first stroke flag
       
   249      * @return None
       
   250      */
       
   251     void SetFirstStroke( const TBool aIsFirstStroke);
       
   252     
       
   253     /**
       
   254      * Set auto complete candidate list.
       
   255      *
       
   256      * @since S60 v5.0
       
   257      * @return ETrue if it's the first stroke
       
   258      */
       
   259     TBool FirstStroke();   
       
   260  
       
   261     
       
   262     /**
       
   263      * Get the candidate.
       
   264      *
       
   265      * @since S60 v5.0
       
   266      * @param aIndex The index of candidate
       
   267      * @param aCharCode The result candidate
       
   268      * @return Candidate char code
       
   269      */
       
   270     const RPointerArray<HBufC>& Candidate() const;
       
   271     
       
   272     /**
       
   273      * Get the predictive.
       
   274      *
       
   275      * @since S60 v5.0
       
   276      * @param aIndex The index of predictive
       
   277      * @param aCharCode The result predictive
       
   278      * @return Predictive char code
       
   279      */
       
   280     const RPointerArray<HBufC>& Predictive();  
       
   281     
       
   282     /**
       
   283      * Set number mode
       
   284      *
       
   285      * @since S60 v5.0
       
   286      * @param aNumberMode Given number mode
       
   287      * @return None
       
   288      */
       
   289     void SetNumberMode( const TAknEditorNumericKeymap aNumberMode );
       
   290     
       
   291     /**
       
   292      * Set number mode
       
   293      *
       
   294      * @since S60 v5.0
       
   295      * @param aCustomMode The customized number key mapping, 0-9
       
   296      *                    are not included.
       
   297      * @return None
       
   298      */
       
   299     void SetCustomNumberModeL( const TDesC& aCustomMode );
       
   300 
       
   301     /**
       
   302      * Set the screen mode.
       
   303      *
       
   304      * @since S60 v5.0
       
   305      * @param aRange The range
       
   306      * @return None
       
   307      */
       
   308     void SaveRange( TInt aRange );
       
   309     
       
   310 
       
   311     
       
   312     /**
       
   313      * Get next predictive page
       
   314      *
       
   315      * @since S60 v5.0
       
   316      * @return None
       
   317      */            
       
   318     void GetNextPredictivePageL();
       
   319     
       
   320     /**
       
   321      * Set stroke end mark to stroke end mark control
       
   322      *
       
   323      * @since S60 v5.0
       
   324      * @return None
       
   325      */
       
   326     void SetStrokeEndMark();
       
   327 
       
   328     /**
       
   329      * Get the stroke end mark.
       
   330      *
       
   331      * @since S60 v5.0
       
   332      * @return TPoint
       
   333      */
       
   334     TPoint StrokeEndMark();
       
   335     
       
   336     /**
       
   337      * Get stroke end mark from control which handle it
       
   338      *
       
   339      * @since S60 v5.0
       
   340      * @return None
       
   341      */
       
   342     TPoint StrokeEndMarkFromControl();
       
   343 
       
   344     /**
       
   345      * Get number keymapping string
       
   346      *
       
   347      * @since S60 v5.0
       
   348      * @param aKeyMappingId Keymapping id
       
   349      * @return Pointer to keymapping string 
       
   350      */    
       
   351     HBufC* KeyMappingStringL() const;
       
   352     
       
   353     /**
       
   354      * Check if the char is the special display char
       
   355      * 
       
   356      * @since S60 v5.0
       
   357      * @param aChar The checked char
       
   358      * @return TBool Wheater or not the input char is the special display char
       
   359      */
       
   360     TBool IsSpecialDisplayChars( const TDesC& aChar ) const;
       
   361      
       
   362     /**
       
   363      * Check if the char is need to be sent to app directly which not need to be shown  in candidate window.
       
   364      * 
       
   365      * @since S60 v5.0
       
   366      * @param aChar The checked char
       
   367      * @return TBool Wheater or not the input char is the directly sent char
       
   368      */
       
   369     TBool IsDirectlySentCandidate( const TDesC& aChar ) const;
       
   370     
       
   371     /**
       
   372      * Convert the special display char to the keycode.
       
   373      *
       
   374      * @since S60 v5.0
       
   375      * @param aChar The special display char.
       
   376      * @return HBufC* The converted keycode char.
       
   377      */
       
   378     HBufC* ConvertDisplayChars( const TDesC& aChar ) const;
       
   379     
       
   380     /**
       
   381      * Get start writing char flag
       
   382      *
       
   383      * @since S60 v5.0
       
   384      * @return ETrue If begine writing.
       
   385      */   
       
   386     TBool StartCharacter();
       
   387 
       
   388     /**
       
   389      * Set start writing char flag
       
   390      *
       
   391      * @since S60 v5.0
       
   392      * @param aStartCharacter The start writing flag
       
   393      * @return ETrue If begine writing.
       
   394      */   
       
   395     void SetStartCharacter(const TBool aStartCharacter);
       
   396   
       
   397     /**
       
   398      * Set input area size to engine for recognize
       
   399      *
       
   400      * @since S60 v5.0
       
   401      * @param aStartCharacter The start writing flag
       
   402      * @return ETrue If begine writing.
       
   403      */   
       
   404     TInt SetInputAreaSize(TSize& aSize);
       
   405      
       
   406     /**
       
   407      * Set screen size to engine for recognize
       
   408      *
       
   409      * @since S60 v5.0
       
   410      * @param aStartCharacter The start writing flag
       
   411      * @return ETrue If begine writing.
       
   412      */        
       
   413     TInt SetScreenSize(TSize& aSize);
       
   414          
       
   415     /**
       
   416      * Clear predictive array
       
   417      *
       
   418      * @since S60 v5.0
       
   419      * @return None
       
   420      */    
       
   421     void ClearPredictive();
       
   422     
       
   423     /**
       
   424      * Set high light flag for candidate list
       
   425      *
       
   426      * @since S60 v5.0
       
   427      * @param aIsHighlight The flag to decide highlight default cell or not
       
   428      * @return None
       
   429      */   
       
   430     void SetHighlight(const TBool aIsHighlight);
       
   431 
       
   432     /**
       
   433      * Get high light flag for candidate list
       
   434      *
       
   435      * @since S60 v5.0
       
   436      * @return ETrue If highlight the default cell to candidate list
       
   437      */   
       
   438     TBool Highlight();
       
   439     
       
   440     /**
       
   441      * Remove duplicate candidate from predictive candidate list
       
   442      *
       
   443      * @since S60 v5.0
       
   444      * @param aSrc The punctuation candidate list
       
   445      * @param aTgt The predicative candidate list
       
   446      * @param aSrcStartIdx 
       
   447      * @param aTgtStartIdx 
       
   448      * @return last overlap index
       
   449      */   
       
   450     TInt RemoveDuplicateCand(const RPointerArray<HBufC>& aSrc,
       
   451                              RPointerArray<HBufC>& aTgt,
       
   452                              TInt aSrcStartIdx,
       
   453                              TInt aTgtStartIdx);
       
   454     
       
   455     /**
       
   456      * Reset key board type
       
   457      *
       
   458      * @since S60 v5.0
       
   459      */   
       
   460     void ResetKeyboardType();
       
   461     
       
   462     /**
       
   463      * Set key board type to qwerty
       
   464      *
       
   465      * @since S60 v5.0
       
   466      */   
       
   467     void SetKeyboardToQwerty();
       
   468     
       
   469     /**
       
   470      * Get key board type
       
   471      *
       
   472      * @since S60 v5.0
       
   473      */   
       
   474     void GetKeyboardType();
       
   475 private:  
       
   476 
       
   477     /**
       
   478      * C++ constructor
       
   479      *
       
   480      * @since S60 v5.0
       
   481      * @return None
       
   482      */            
       
   483     CPeninputFingerHwrDataStore(CPeninputFingerHwrLayout* aLayout);
       
   484     
       
   485     /**
       
   486      * Second phase constructor
       
   487      *
       
   488      * @since S60 v5.0
       
   489      * @return None
       
   490      */
       
   491     void ConstructL( CPtiEngine* aPtiEngine );
       
   492    
       
   493    /**
       
   494      * Initialize the key mapping list
       
   495      *
       
   496      * @since S60 v5.0
       
   497      * @return None
       
   498      */  
       
   499     void InitKeyMappingListL();    
       
   500     
       
   501     /**
       
   502      * Judge if a language is Chinese
       
   503      *
       
   504      * @since S60 v5.0
       
   505      * @param aLanguage Given language code
       
   506      * @return ETrue if aLanguage is Chinese, otherwise EFalse
       
   507      */
       
   508     TBool LanguageIsChinese( TInt aLanguage );
       
   509     
       
   510     /**
       
   511      * Set engine language
       
   512      *
       
   513      * @since S60 v5.0
       
   514      * @param aLanguage Given language code
       
   515      * @return None
       
   516      */
       
   517     void SetEngineLanguageL( TInt aLanguage );    
       
   518     
       
   519     /**
       
   520      * Set language show text
       
   521      *
       
   522      * @since S60 v5.0
       
   523      * @param aLanguage language code
       
   524      * @return None
       
   525      */
       
   526     void SetLanguageShowText( TInt aLanguage );   
       
   527     
       
   528     /**
       
   529      * Remove accent character
       
   530      *
       
   531      * @since S60 v5.0
       
   532      * @return None
       
   533      */
       
   534     void RemoveAccent();
       
   535       
       
   536 private:// data
       
   537         
       
   538     /**
       
   539      * Trigger string (Own)
       
   540      */
       
   541     CAknFepHwrTriggerStr* iTriggerStr;
       
   542     
       
   543     /**
       
   544      * predictive list (Own)
       
   545      */
       
   546     RPointerArray<HBufC> iPredictives;
       
   547 
       
   548     /**
       
   549      * candidate list (Own)
       
   550      */
       
   551     RPointerArray<HBufC> iCandidates;
       
   552     
       
   553     /**
       
   554      * The candidate range start index
       
   555      */
       
   556     RArray<TInt> iRangeStartPos;
       
   557 
       
   558     /**
       
   559      * Permitted ranges
       
   560      */
       
   561     RArray<TInt> iPermittedRanges;
       
   562     
       
   563     /**
       
   564      * Current range
       
   565      */
       
   566     TFingerHwrRange iCurrentRange;
       
   567     
       
   568     /**
       
   569      * Permitted range in int format
       
   570      */
       
   571     TInt iIntRange;
       
   572     
       
   573     /**
       
   574      * Current case
       
   575      */
       
   576     TInt iCase;
       
   577 
       
   578     /**
       
   579      * Current language
       
   580      */
       
   581     TInt iLanguage;
       
   582     
       
   583     /**
       
   584      * Pen size
       
   585      */
       
   586     TSize iPenSize;
       
   587 
       
   588     /**
       
   589      * Pen color
       
   590      */
       
   591     TRgb iPenColor;
       
   592     
       
   593     /**
       
   594      * The repository (Own);
       
   595      */
       
   596     CRepository* iRepositoryFep;
       
   597 
       
   598     /**
       
   599      * The engine (Own);
       
   600      */
       
   601     CAknFepHwrEngine* iHwrEngine;
       
   602     
       
   603     /**
       
   604      * The permited cases
       
   605      */
       
   606     TInt iPermittedCases;   
       
   607     
       
   608     /**
       
   609      * The current number key map
       
   610      */   
       
   611     TAknEditorNumericKeymap iCurrentNumberMode;
       
   612    
       
   613     /**
       
   614      * Keymapping id array
       
   615      */  
       
   616     RArray<TInt> iKeyMappingIdList;
       
   617     
       
   618     /**
       
   619      * Keymapping string array
       
   620      */          
       
   621     RPointerArray<HBufC> iKeyMappingStringList;
       
   622 
       
   623     /**
       
   624      * Language show text
       
   625      */
       
   626     TBuf<KLanguageStringLength> iLanguageShowText;
       
   627     
       
   628     /**
       
   629      * User defined key mapping (Own)
       
   630      */
       
   631     HBufC* iUserDefinedResource;
       
   632     
       
   633     /**
       
   634      * Finger hwr layout (not own)
       
   635      */
       
   636     CPeninputFingerHwrLayout* iLayout;
       
   637     
       
   638     /**
       
   639      * Start writing flag
       
   640      */
       
   641     TBool iStartCharacter;
       
   642     
       
   643     /**
       
   644      * Highlight default writing candidate flag
       
   645      */
       
   646     TBool iIsHighlightCell;
       
   647     
       
   648     /**
       
   649      * The first stroke flag
       
   650      */
       
   651     TBool iIsFirstStroke;
       
   652     
       
   653     /**
       
   654      * default key mapping for normal editor(not number-only).
       
   655      * Own
       
   656      */
       
   657     HBufC* iDefaultNumberMapping;
       
   658  };
       
   659 
       
   660 
       
   661 #endif	//C_PENINPUTFINGERHWRDATASTORE_H