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