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