textinput/peninputfingerhwr/inc/peninputfingerhwrengine.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:  HWR Engine
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_PENINPUTFINGERHWRENGINE_H
       
    19 #define C_PENINPUTFINGERHWRENGINE_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32cmn.h>
       
    23 #include <eikon.hrh>
       
    24 #include <ptiengine.h>
       
    25 
       
    26 class CPeninputFingerHwrDataStore;
       
    27 
       
    28 /**
       
    29  *  CAknFepHwrEngine
       
    30  *
       
    31  *  @lib peninputfingerhwr.lib
       
    32  *  @since S60 v3.2
       
    33  */
       
    34 class CAknFepHwrEngine: public CBase
       
    35     {
       
    36 public:
       
    37 
       
    38     /**
       
    39      * Symbian constructor.
       
    40      *
       
    41      * @since S60 v3.2
       
    42      * @return Pointer to created CAknFepHwrEngine object
       
    43      */
       
    44     static CAknFepHwrEngine* NewL( CPtiEngine* aPtiEngine, 
       
    45         CPeninputFingerHwrDataStore* aOwner );
       
    46 
       
    47     /**
       
    48      * destructor
       
    49      *
       
    50      * @since S60 v3.2
       
    51      * @return None
       
    52      */
       
    53     virtual ~CAknFepHwrEngine();
       
    54 
       
    55     /**
       
    56      * Do recoginize by engine
       
    57      *
       
    58      * @since S60 v3.2
       
    59      * @param aTraceData The trace data.
       
    60      * @param aCandidates The candidates recognized.
       
    61      * @param aRangeStartPos The range index of candidates.
       
    62      * @return None
       
    63      */            
       
    64     void DoRecognizeL( const RArray<TPoint>& aTraceData, RPointerArray<HBufC>& aCandidates );
       
    65 
       
    66 
       
    67     /**
       
    68      * Do predictive using trigger string
       
    69      *
       
    70      * @since S60 v3.2
       
    71      * @param aTriggerStr The trigger string to do predictive.
       
    72      * @param aPredictives The candidates predictived.
       
    73      * @param aNextPage Whether it is to get next page
       
    74      * @return None
       
    75      */            
       
    76     void DoPredictiveL( const TDesC& aTriggerStr, 
       
    77                         RPointerArray<HBufC>& aPredictives,
       
    78                         TBool aNextPage = EFalse );
       
    79      
       
    80 #ifdef RD_INTELLIGENT_TEXT_INPUT     
       
    81     /**
       
    82      * Do Auto Complete using trigger string
       
    83      *
       
    84      * @since S60 v3.2
       
    85      * @param aTriggerStr The trigger string to do predictive.
       
    86      * @param aPredictives The candidates predictived.
       
    87      * @return None
       
    88      */
       
    89     void DoEngPredictiveL( const TDesC& aTriggerStr, 
       
    90                            RPointerArray<HBufC>& aPredictives);   
       
    91 #endif
       
    92     
       
    93     /**
       
    94      * Notify hwr engine to set primary range and auxiliary ranges
       
    95      *
       
    96      * @since S60 v3.2
       
    97      * @param aPermittedRanges The permitted ranges and the first range is primary range.
       
    98      * @return None
       
    99      */
       
   100     void SetRanges( const RArray<TInt>& aPermittedRanges );
       
   101     
       
   102     /**
       
   103      * Notify hwr engine to set primary range and auxiliary ranges
       
   104      * 
       
   105      * @since S60 v3.2
       
   106      * @param aPermittedRanges The permitted ranges and the first range is primary range.
       
   107      * @return None
       
   108      */    
       
   109     void SetRangesL( const RArray<TInt>& aPermittedRanges );
       
   110 
       
   111     /**
       
   112      * Set case
       
   113      *
       
   114      * @since S60 v3.2
       
   115      * @param aCase The case
       
   116      * @return None
       
   117      */            
       
   118     void SetCase( const TInt aCase );
       
   119 
       
   120     /**
       
   121      * Set number mode
       
   122      *
       
   123      * @since S60 v3.2
       
   124      * @param aNumberMode Given number mode
       
   125      * @return None
       
   126      */
       
   127     void SetNumberMode( const TAknEditorNumericKeymap& aNumberMode );
       
   128 
       
   129     /**
       
   130      * Get stroke end mark from hwr engine
       
   131      *
       
   132      * @since S60 v3.2
       
   133      * @return Stroke end mark
       
   134      */
       
   135     TPoint StrokeEndMark() const ;
       
   136 
       
   137     /**
       
   138      * Set primary candidate num that hwr engine should return each time
       
   139      *
       
   140      * @since S60 v3.2
       
   141      * @param aNum The primary candidate num to be set
       
   142      * @return KErrNone if operation successfully,otherwise system wide error codes
       
   143      */
       
   144     TInt SetPrimaryCandidateNum( const TInt aNum );
       
   145 
       
   146     /**
       
   147      * Set total candidate number that can be shown
       
   148      *
       
   149      * @since S60 v3.2
       
   150      * @param aNum The total candidate number that should be shown
       
   151      * @return None
       
   152      */
       
   153     void SetCandidatesMaxCount( const TInt aCount );       
       
   154     
       
   155     /**
       
   156      * Set language
       
   157      *
       
   158      * @since S60 v3.2
       
   159      * @param aLanguage The language
       
   160      * @return None
       
   161      */            
       
   162     void SetLanguageL( const TInt aLanguage );
       
   163     
       
   164     /**
       
   165      * Set custom key mapping
       
   166      *
       
   167      * @since S60 v3.2
       
   168      * @param aKeyMap The key mapping
       
   169      * @return None
       
   170      */            
       
   171     void SetCustomKeymapL( const TDesC& aKeyMap );
       
   172     
       
   173     /**
       
   174      * Clear custom key mapping
       
   175      *
       
   176      * @since S60 v3.2
       
   177      * @return None
       
   178      */            
       
   179     void ResetCustomKeyMap();
       
   180     
       
   181     /**
       
   182      * Do background construct
       
   183      *
       
   184      * @since S60 v3.2
       
   185      * @return None
       
   186      */            
       
   187     static TBool BackgroundTaskL( TAny* aPtr );
       
   188     
       
   189     /**
       
   190      * Set hand writing area size
       
   191      *
       
   192      * @since S60 v3.2
       
   193      * @param aSize The area size.
       
   194      * @return None
       
   195      */            
       
   196     TInt SetInputAreaSize(TSize& aSize);
       
   197     
       
   198     /**
       
   199      * Set hand screen size
       
   200      *
       
   201      * @since S60 v3.2
       
   202      * @param aSize The screen size.
       
   203      * @return None
       
   204      */            
       
   205     TInt SetScreenSize(TSize& aSize);
       
   206     
       
   207     void ResetKeyboardType();
       
   208     
       
   209     void SetKeyboardToQwerty();
       
   210     
       
   211     void GetKeyboardType();
       
   212     
       
   213 private:
       
   214     
       
   215     /**
       
   216      * C++ constructor
       
   217      *
       
   218      * @since S60 v3.2
       
   219      * @return None
       
   220      */            
       
   221     CAknFepHwrEngine();
       
   222 
       
   223     /**
       
   224      * Second phase constructor
       
   225      *
       
   226      * @since S60 v3.2
       
   227      * @return None
       
   228      */
       
   229     void ConstructL( CPtiEngine* aPtiEngine, CPeninputFingerHwrDataStore* aOwner );
       
   230     
       
   231     /**
       
   232      * Notify hwr engine to set correct range by language
       
   233      *
       
   234      * @since S60 v3.2
       
   235      * @param aRange Current range need to be set
       
   236      * @param aRecognitionRange Recognition range need to be set for hwr engine
       
   237      * @return None
       
   238      */
       
   239     void SetRecognitionRange( const TInt aRange, TRecognitionRange& aRecognitionRange );
       
   240     
       
   241     /**
       
   242      * Do background construct
       
   243      *
       
   244      * @since S60 v3.2
       
   245      * @return None
       
   246      */            
       
   247     void DoIdleConstructL();
       
   248     
       
   249     /**
       
   250      * Convert the stroke end mark of point array to another point
       
   251      *
       
   252      * @since S60 v3.2
       
   253      * @param aTraceData Point array
       
   254      * @param aPnt1 Stroke end mark to be replaced
       
   255      * @param aPnt2 Stroke end mark to be used
       
   256      * @return None
       
   257      */
       
   258     void ConvertStrokeEndMark( RArray<TPoint>& aTraceData, TPoint aPnt1, TPoint aPnt2 );
       
   259      
       
   260 
       
   261 private: //data
       
   262 
       
   263     /**
       
   264      * Engine
       
   265      * Ownership is determined by flag
       
   266      */
       
   267     CPtiEngine* iPtiEngine;
       
   268     
       
   269     /**
       
   270      * iPtiEngine ownership flag
       
   271      */
       
   272     TBool iOwnPtiEngine;
       
   273 
       
   274     /**
       
   275      * Hwr recognizer (Now own)
       
   276      */
       
   277     MPtiHwrRecognizer* iRecognizer;
       
   278     
       
   279     /**
       
   280      * Total candidate number that can be shown
       
   281      */
       
   282     TInt iTotalCandidateNum;
       
   283 
       
   284     /**
       
   285      * Current case
       
   286      */
       
   287     TInt iCase;
       
   288 
       
   289     /**
       
   290      * Current language
       
   291      */
       
   292     TInt iLanguage;
       
   293     
       
   294     /**
       
   295      * Range count
       
   296      */
       
   297     TInt iRangeCount;
       
   298     
       
   299     /**
       
   300      * Premary range
       
   301      */
       
   302     TInt iPremaryRange;
       
   303 
       
   304     /**
       
   305      * Custom key mapping
       
   306      */
       
   307     HBufC* iCustomKeymap;
       
   308     
       
   309     /**
       
   310      * Idle (own)
       
   311      */
       
   312     CIdle* iIdle;
       
   313     
       
   314     /**
       
   315      * Data store (Not own)
       
   316      */
       
   317     CPeninputFingerHwrDataStore* iOwner;
       
   318     
       
   319     /**
       
   320      * Set number mode flag
       
   321      */
       
   322     TBool iNeedSetNumberMode;
       
   323     
       
   324     /**
       
   325      * Set case flag
       
   326      */
       
   327     TBool iNeedSetCase;
       
   328     
       
   329     /**
       
   330      * Set range flag
       
   331      */
       
   332     TBool iNeedSetRange;
       
   333     
       
   334     /**
       
   335      * Permitted range array
       
   336      */
       
   337     RArray<TInt> iNeedPermittedRanges;
       
   338     
       
   339     /**
       
   340      * The number mode
       
   341      */
       
   342     TInt iNumberMode;
       
   343     
       
   344     TInt iKeyboardType;
       
   345     };
       
   346 
       
   347 #endif //C_PENINPUTFINGERHWRENGINE_H
       
   348 
       
   349 //End Of File