textinput/peninputgenerichwr/inc/peninputgenericrecognizer.h
branchRCL_3
changeset 21 ecbabf52600f
parent 0 eb1f2e154e89
equal deleted inserted replaced
20:ebd48d2de13c 21:ecbabf52600f
       
     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:  peninput generic hwr handwriting recognition class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PENINPUTGENERICRECOGNIZER_H
       
    20 #define C_PENINPUTGENERICRECOGNIZER_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 #include <PtiEngine.h>
       
    25 #include <PtiHwrRecognizer.h>
       
    26 
       
    27 // Forward declarations
       
    28 class CPtiEngine;
       
    29 
       
    30 /**
       
    31  *  This class uses ptiengine to recognize handwriting
       
    32  *
       
    33  *  @lib peninputgenerichwr.lib
       
    34  *  @since S60 v3.2
       
    35  */
       
    36 class CPeninputGenericRecognizer : public CBase
       
    37   {
       
    38 
       
    39   public: 
       
    40     
       
    41     /**
       
    42      * Two-phased constructor
       
    43      *
       
    44      * @since S60 v3.2
       
    45      * @return The pointer to CPeninputGenericRecognizer object
       
    46      */
       
    47     static CPeninputGenericRecognizer* NewL(CPtiEngine* aPtiEngine);
       
    48   
       
    49     /**
       
    50      * Two-phased constructor
       
    51      *
       
    52      * @since S60 v3.2
       
    53      * @return The pointer to CPeninputGenericRecognizer object
       
    54      */
       
    55     static CPeninputGenericRecognizer* NewL( TInt aLanguage );
       
    56   
       
    57     /**
       
    58      * Destructor
       
    59      *
       
    60      * @since S60 v3.2
       
    61      * @return None
       
    62      */
       
    63     virtual ~CPeninputGenericRecognizer();    
       
    64       
       
    65     /**
       
    66       * Do the recognition using the PtiEngine
       
    67       *
       
    68       * @since S60 v3.2
       
    69       * @param aTraceData The point array of curve
       
    70       * @param aResult The result of recognition
       
    71       * @return Error code
       
    72       */
       
    73     TInt Recognize( const RArray<TPoint>& aTraceData, 
       
    74                      RPointerArray<HBufC>& aResult );
       
    75       
       
    76     /**
       
    77      * Set language
       
    78      *
       
    79      * @since S60 v3.2
       
    80      * @param aLanguage Language id
       
    81      * @return None
       
    82      */
       
    83     void SetLanguage( TInt aLanguage );
       
    84 
       
    85     /**
       
    86      * Get language
       
    87      *
       
    88      * @return iLanguage
       
    89      */
       
    90     TInt GetLanguage();
       
    91        
       
    92     /**
       
    93      * Set recognition mode 
       
    94      *
       
    95      * @since S60 v3.2
       
    96      * @param aMode Recognition mode
       
    97      * @return None
       
    98      */
       
    99     void SetMode( TInt aMode );
       
   100        
       
   101     /**
       
   102      * Set recognition case
       
   103      *
       
   104      * @since S60 v3.2
       
   105      * @param aCase Recognition case 
       
   106      * @return None
       
   107      */
       
   108     void SetCase( TInt aCase );
       
   109 
       
   110     /**
       
   111      * Set case sensitive
       
   112      *
       
   113      * @since S60 v3.2
       
   114      * @param aCaseSensitive Sensitive flag
       
   115      * @return None
       
   116      */
       
   117     void SetCaseSensitive( TBool aCaseSensitive );
       
   118 
       
   119     /**
       
   120      * Set writing area size
       
   121      *
       
   122      * @since S60 v3.2
       
   123      * @param aSize Size of input area
       
   124      * @return None
       
   125      */         
       
   126     void SetInputAreaSize( TSize& aSize );
       
   127         
       
   128     /**
       
   129      * Set word recognition on/off
       
   130      *
       
   131      * @since S60 v3.2
       
   132      * @param aValue Word recognition flag
       
   133      * @return None
       
   134      */         
       
   135     void EnableWordRecognition( const TBool aValue = ETrue );
       
   136         
       
   137     /**
       
   138      * Set number mode
       
   139      *
       
   140      * @since S60 v3.2
       
   141      * @param aNumberMode Number mode to set
       
   142      * @return None
       
   143      */  
       
   144     void SetNumberMode( const TAknEditorNumericKeymap aNumberMode );
       
   145     
       
   146     /**
       
   147      * Set position of HWR top guideline
       
   148      * 
       
   149      * @param aPos Position to be set
       
   150      * @return None
       
   151      */
       
   152     void GetTopGuideLinePos( TInt& aPos );
       
   153     
       
   154     /**
       
   155      * Set position of HWR bottom guideline
       
   156      * 
       
   157      * @param aPos Position to be set
       
   158      * @return None
       
   159      */
       
   160     void GetBottomGuideLinePos( TInt& aPos );
       
   161 
       
   162     /**
       
   163      * Set permitted character set that can be recognized by hwr engine
       
   164      * 
       
   165      * @param aSymbolSet Permitted character set
       
   166      * @return None
       
   167      */
       
   168     void SetPermittedCharSet( const TDesC& aSymbolSet);
       
   169     
       
   170     static TInt BackgroundTaskL(TAny* aPtr);
       
   171     /**
       
   172      * Tell the HWR engine whether guideline is on.
       
   173      * 
       
   174      *
       
   175      * @param aFlag ETrue to enable guideline, and EFalse to diable.
       
   176      * @return KErrNone means operation succeed, otherwise system wide error codes
       
   177      */  
       
   178     TInt EnableGuideline(const TBool aFlag);     
       
   179 private: 
       
   180 
       
   181     /**
       
   182      * Constructor
       
   183      *
       
   184      * @since S60 v3.2
       
   185      * @return None
       
   186      */
       
   187     CPeninputGenericRecognizer(CPtiEngine* aPtiEngine);
       
   188 
       
   189     /**
       
   190      * Constructor
       
   191      *
       
   192      * @since S60 v3.2
       
   193      * @param aLayoutContext The language id
       
   194      * @return None
       
   195      */
       
   196     CPeninputGenericRecognizer( TInt aLanguage );
       
   197     
       
   198     /**
       
   199      * Sencond phase constructor
       
   200      *
       
   201      * @since S60 v3.2
       
   202      * @return None
       
   203      */
       
   204     void ConstructL();
       
   205     
       
   206     /**
       
   207      * Initialize recognizer
       
   208      *
       
   209      * @since S60 v3.2
       
   210      * @return None
       
   211      */
       
   212     void InitRecognizerL();
       
   213     
       
   214     /**
       
   215      * Adjust result case
       
   216      *
       
   217      * @since S60 v3.2
       
   218      * @param aResult The recognition result array
       
   219      * @return None
       
   220      */
       
   221     void AdjustResultCase( RPointerArray<HBufC>& aResult );
       
   222     
       
   223     void DoIdleConstructL();
       
   224       
       
   225 private: // Data
       
   226     
       
   227     /**
       
   228      * The pti engine
       
   229      * Not own
       
   230      */
       
   231     CPtiEngine* iPtiEngine; 
       
   232     
       
   233     /**
       
   234      * The hwr recognizer engine
       
   235      * Not own
       
   236      */
       
   237     MPtiHwrRecognizer* iHwrEngine;
       
   238     
       
   239     /**
       
   240      * The language id
       
   241      */
       
   242     TInt iLanguage;
       
   243     
       
   244     /**
       
   245      * The recognizer engine mode
       
   246      */
       
   247     TInt iMode;
       
   248     
       
   249     /**
       
   250      * The recognizer engine case
       
   251      */
       
   252     TInt iCase;
       
   253     
       
   254     /**
       
   255      * The recognizer engine case sensitive
       
   256      */
       
   257     TInt iCaseSensitive;
       
   258     
       
   259     /**
       
   260      * The recognizer engine enable/disable flag
       
   261      */
       
   262     TBool iEnabled;
       
   263     
       
   264     CIdle* iIdle;
       
   265     TBool iRecognizerInited;
       
   266   };
       
   267 
       
   268 #endif   // C_PENINPUTGENERICRECOGNIZER_H