epoc32/include/mw/ptiengine.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0""
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:               Predective text input engine API header
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
williamr@2
    25
williamr@2
    26
williamr@2
    27
williamr@2
    28
williamr@2
    29
williamr@2
    30
williamr@2
    31
williamr@2
    32
#ifndef _PTI_ENGINE_H
williamr@2
    33
#define _PTI_ENGINE_H
williamr@2
    34
williamr@2
    35
// INCLUDES
williamr@2
    36
#include <e32base.h>
williamr@2
    37
#include <badesca.h> 
williamr@2
    38
#include "PtiDefs.h"
williamr@2
    39
#include "PtiObserver.h"
williamr@2
    40
#include "PtiLanguage.h"
williamr@2
    41
williamr@2
    42
// FORWARD DECLARATIONS
williamr@2
    43
class CPtiUserDictionary;
williamr@2
    44
class MPtiUserDictionary;
williamr@2
    45
class MPtiEngineCompositionDataInterface;
williamr@2
    46
class MPtiUserDictionaryEntry;
williamr@2
    47
class CPtiEngineImpl;
williamr@2
    48
class MPtiHwrRecognizer;
williamr@2
    49
williamr@2
    50
/**
williamr@2
    51
* CPtiEngine class. 
williamr@2
    52
*
williamr@2
    53
* This is the main client side API for PtiEngine. The purpose of PtiEngine API is
williamr@2
    54
* to provide a single calling point for low level (below UI) text input functionality.
williamr@2
    55
* The API provides methods for querying and activating installed input languages, changing 
williamr@2
    56
* input modes and text cases and performing text input operations. The API contains 
williamr@2
    57
* set of methods for latin based, Chinese and Japanese text input. Some of the methods
williamr@2
    58
* are common to all of those variants. PtiEngine also provides access to predictive
williamr@2
    59
* text input functionality, in case there is need to use it directly without
williamr@2
    60
* standard CEikEdwin / FEP chain (hence the name 'predictive text input engine')
williamr@2
    61
* Predictive text engine integration is hidden behind PtiCore plugin API and is used
williamr@2
    62
* through PtiEngine main API. 
williamr@2
    63
*
williamr@2
    64
*  Usage:
williamr@2
    65
*          PtiEngine is created by calling CPtiEngine::NewL method. In typical use case
williamr@2
    66
*          there is no need to pass core uid parameter to NewL method.
williamr@2
    67
*          Constructor will load and set up available core objects.
williamr@2
    68
*
williamr@2
    69
*  Typical use cases:
williamr@2
    70
* 
williamr@2
    71
*     Entering text in latin multitapping mode
williamr@2
    72
*     ----------------------------------------
williamr@2
    73
* 
williamr@2
    74
*                 CPtiEngine* aEngine = CPtiEngine::NewL(); 
williamr@2
    75
*                 aEngine->ActivateLanguageL(ELangEnglish, EPtiEngineMultitapping);
williamr@2
    76
*                 aEngine->AppendKeyPress(EPtiKey3);
williamr@2
    77
*                 aEngine->AppendKeyPress(EPtiKey6);
williamr@2
    78
*                 aEngine->AppendKeyPress(EPtiKey6);
williamr@2
    79
*                 aEngine->AppendKeyPress(EPtiKey6);
williamr@2
    80
*                 aEngine->AppendKeyPress(EPtiKey4);
williamr@2
    81
*                 TBuf<100> temp;
williamr@2
    82
*                 temp.Copy(aEngine->CurrentWord());  // At this point temp would contain 
williamr@2
    83
*                                                     // word "dog".
williamr@2
    84
*
williamr@2
    85
*     Entering text in latin predictive mode 
williamr@2
    86
*     --------------------------------------
williamr@2
    87
*
williamr@2
    88
*                 CPtiEngine* aEngine = CPtiEngine::NewL(); 
williamr@2
    89
*                 aEngine->ActivateLanguageL(ELangEnglish, EPtiEnginePredicitve);
williamr@2
    90
*                 aEngine->AppendKeyPress(EPtiKey8);
williamr@2
    91
*                 aEngine->AppendKeyPress(EPtiKey4);
williamr@2
    92
*                 aEngine->AppendKeyPress(EPtiKey4);
williamr@2
    93
*                 aEngine->AppendKeyPress(EPtiKey7);
williamr@2
    94
*                 TBuf<100> temp;
williamr@2
    95
*                 temp.Copy(aEngine->CurrentWord());   // At this point temp would contain 
williamr@2
    96
*                                                      // (depending on the underlying engine)
williamr@2
    97
*                                                      // word "this".
williamr@2
    98
*                 temp.Copy(aEngine->NextCandidate()); // Move on to next candidate.
williamr@2
    99
*                 aEngine->CommitCurrentWord();        // Tell engine that current word was accepted,
williamr@2
   100
*                                                      // so that the underlyinbg engine keeps
williamr@2
   101
*                                                      // frequency information up-to-date.   
williamr@2
   102
*     Entering text in latin qwerty mode
williamr@2
   103
*     ----------------------------------
williamr@2
   104
*
williamr@2
   105
*                 CPtiEngine* aEngine = CPtiEngine::NewL(); 
williamr@2
   106
*                 aEngine->ActivateLanguageL(ELangEnglish, EPtiEngineQwerty);
williamr@2
   107
*                 aEngine->AppendKeyPress(EPtiKeyQwertyQ);
williamr@2
   108
*                 aEngine->AppendKeyPress(EPtiKeyQwertyW);
williamr@2
   109
*                 aEngine->AppendKeyPress(EPtiKeyQwertyE);
williamr@2
   110
*                 aEngine->AppendKeyPress(EPtiKeyQwertyR);
williamr@2
   111
*                 aEngine->AppendKeyPress(EPtiKeyQwertyT);
williamr@2
   112
*                 aEngine->AppendKeyPress(EPtiKeyQwertyY);
williamr@2
   113
*                 TBuf<100> temp;
williamr@2
   114
*                 temp.Copy(aEngine->CurrentWord());  // At this point temp would contain 
williamr@2
   115
*                                                     // word "qwerty".
williamr@2
   116
*                 // Next line requires that French key mappings are available in device.				 		
williamr@2
   117
*                 aEngine->ActivateLanguageL(ELangFrench, EPtiEngineQwerty);
williamr@2
   118
*                 aEngine->SetCase(EPtiCaseUpper);
williamr@2
   119
*                 aEngine->ClearCurrentWord();
williamr@2
   120
*                 aEngine->AppendKeyPress(EPtiKeyQwertyQ);
williamr@2
   121
*                 aEngine->AppendKeyPress(EPtiKeyQwertyW);
williamr@2
   122
*                 aEngine->AppendKeyPress(EPtiKeyQwertyE);
williamr@2
   123
*                 aEngine->AppendKeyPress(EPtiKeyQwertyR);
williamr@2
   124
*                 aEngine->AppendKeyPress(EPtiKeyQwertyT);
williamr@2
   125
*                 aEngine->AppendKeyPress(EPtiKeyQwertyY);
williamr@2
   126
*                 temp.Copy(aEngine->CurrentWord());  // At this point temp would contain 
williamr@2
   127
*                                                     // word "AZERTY".
williamr@2
   128
*   
williamr@2
   129
*     Entering text in preditcive latin qwerty mode
williamr@2
   130
*     ---------------------------------------------
williamr@2
   131
*                 CPtiEngine* aEngine = CPtiEngine::NewL(); 
williamr@2
   132
*                 aEngine->ActivateLanguageL(ELangEnglish, EPtiEngineQwertyPredictive);
williamr@2
   133
*                 aEngine->AppendKeyPress(EPtiKeyQwertyE);
williamr@2
   134
*                 aEngine->AppendKeyPress(EPtiKeyQwertyN);
williamr@2
   135
*                 aEngine->AppendKeyPress(EPtiKeyQwertyT);
williamr@2
   136
*                 aEngine->AppendKeyPress(EPtiKeyQwertyE);
williamr@2
   137
*                 aEngine->AppendKeyPress(EPtiKeyQwertyR);
williamr@2
   138
*                 aEngine->AppendKeyPress(EPtiKeyQwertyT);
williamr@2
   139
*                 aEngine->AppendKeyPress(EPtiKeyQwertyA);
williamr@2
   140
*                 TBuf<100> temp;
williamr@2
   141
*                 temp.Copy(aEngine->CurrentWord());  // At this point temp would contain 
williamr@2
   142
*                                                     // for example word "entertainment", assuming the.
williamr@2
   143
*                                                     // underlying prediction engine supports word completion.
williamr@2
   144
*               
williamr@2
   145
*/
williamr@2
   146
NONSHARABLE_CLASS(CPtiEngine) : public CBase
williamr@2
   147
    {
williamr@2
   148
    public:
williamr@2
   149
        /**
williamr@2
   150
        * Two phase constructor.
williamr@2
   151
        *
williamr@2
   152
        * @param  aUseDefaultUserDictionary
williamr@2
   153
        * @return 
williamr@2
   154
        */
williamr@2
   155
        IMPORT_C static CPtiEngine* NewL(TBool aUseDefaultUserDictionary = EFalse);
williamr@2
   156
williamr@2
   157
        /**
williamr@2
   158
        * Two phase constructor.
williamr@2
   159
        *
williamr@2
   160
        * NOTE: THIS METHOD IS DEPRECATED AND WILL LEAVE WHEN CALLED.        
williamr@2
   161
        */
williamr@2
   162
        IMPORT_C static CPtiEngine* NewL(const TDesC& aCoreName, TBool aUseDefaultUserDictionary = EFalse);
williamr@2
   163
williamr@2
   164
        /**
williamr@2
   165
        * Two phase constructor.
williamr@2
   166
        *
williamr@2
   167
        * @param  aCoreUid
williamr@2
   168
        * @param  aUseDefaultUserDictionary
williamr@2
   169
        * @return 
williamr@2
   170
        */
williamr@2
   171
        IMPORT_C static CPtiEngine* NewL(const TUid aCoreUid, TBool aUseDefaultUserDictionary = EFalse);
williamr@2
   172
williamr@2
   173
        /**
williamr@2
   174
        * Destructor.
williamr@2
   175
        */
williamr@2
   176
        IMPORT_C ~CPtiEngine();
williamr@2
   177
williamr@2
   178
        /**
williamr@2
   179
        * Activates language in requested input mode. After calling this method
williamr@2
   180
        * language is ready to be used with all input modes it supports.
williamr@2
   181
        *
williamr@2
   182
        * @since S60 V2.6                
williamr@2
   183
        * @param  aEpocLanguageID    Language to be activated.
williamr@2
   184
        * @param  aMode              Input mode after activation. If thise is left to default
williamr@2
   185
        *                             value, then default input mode is activated.
williamr@2
   186
        * @return KErrNone if success or system wide error code.
williamr@2
   187
        */
williamr@2
   188
        IMPORT_C TInt ActivateLanguageL(TInt aEpocLanguageID, TPtiEngineInputMode aMode = EPtiEngineInputModeNone);
williamr@2
   189
williamr@2
   190
        /**
williamr@2
   191
        * Closes active language. After calling this method there
williamr@2
   192
        * won't be active language and most PtiEngine API methods
williamr@2
   193
        * will return error until ActivateLanguageL is called again. 
williamr@2
   194
        * Core objects for active language are asked to release
williamr@2
   195
        * related resources.
williamr@2
   196
        *
williamr@2
   197
        * @since S60 V2.6                
williamr@2
   198
        */
williamr@2
   199
        IMPORT_C void CloseCurrentLanguageL();
williamr@2
   200
        
williamr@2
   201
        /**
williamr@2
   202
        * Returns core info structure for given input mode.  
williamr@2
   203
        * 
williamr@2
   204
        * @since S60 V2.6                
williamr@2
   205
        * @return  Pointer to core info object.
williamr@2
   206
        *          NULL if core for given input mode was not found.   
williamr@2
   207
        */
williamr@2
   208
        IMPORT_C MPtiCoreInfo* CoreInfo(TPtiEngineInputMode aMode) const;
williamr@2
   209
williamr@2
   210
        /**
williamr@2
   211
        * Returns pointer to currently active language.
williamr@2
   212
        *
williamr@2
   213
        * @since S60 V2.6                
williamr@2
   214
        * @return Pointer to currently active language object.
williamr@2
   215
        */
williamr@2
   216
        IMPORT_C MPtiLanguage* CurrentLanguage();
williamr@2
   217
williamr@2
   218
        /**
williamr@2
   219
        * Returns pointer to requested language. 
williamr@2
   220
        *
williamr@2
   221
        * @since S60 V2.6                
williamr@2
   222
        * @param   aCode  Language code for requested language.
williamr@2
   223
        * @return  Pointer to requested language object.
williamr@2
   224
        *          NULL if no language for given code. 
williamr@2
   225
        */
williamr@2
   226
        IMPORT_C MPtiLanguage* GetLanguage(TInt aCode) const;
williamr@2
   227
williamr@2
   228
        /**
williamr@2
   229
        * Returns number of candidate words for current
williamr@2
   230
        * input sequence. 
williamr@2
   231
        *
williamr@2
   232
        * @since S60 V2.6                
williamr@2
   233
        * @return number of cadidate words.
williamr@2
   234
        */
williamr@2
   235
        IMPORT_C TInt NumberOfCandidates();
williamr@2
   236
williamr@2
   237
        /**
williamr@2
   238
        * This method handles key press and forwards it to
williamr@2
   239
        * correct core object depending on active language and 
williamr@2
   240
        * input mode. The current word buffer is updated accordingly. 
williamr@2
   241
        * If input sequence buffer has reached its maximum length
williamr@2
   242
        * then nothing will be done.
williamr@2
   243
        *
williamr@2
   244
        * @since S60 V2.6                
williamr@2
   245
        * @param aKey    Key code.
williamr@2
   246
        * @return        Pointer to current word buffer.
williamr@2
   247
        */
williamr@2
   248
        IMPORT_C TPtrC AppendKeyPress(TPtiKey aKey);
williamr@2
   249
williamr@2
   250
        /**
williamr@2
   251
        * Deletes last character in current word buffer and updates
williamr@2
   252
        * candidate list accordingly.
williamr@2
   253
        *
williamr@2
   254
        * @since S60 V2.6                
williamr@2
   255
        * @return        Pointer to current word buffer.
williamr@2
   256
        */
williamr@2
   257
        IMPORT_C TPtrC DeleteKeyPress();
williamr@2
   258
williamr@2
   259
        /**
williamr@2
   260
        * DEPRECATED (will leave if called). 
williamr@2
   261
        */
williamr@2
   262
        IMPORT_C TInt AddCoreL(const TDesC& aFileName, TBool aUseDefaultUserDictionary = EFalse);
williamr@2
   263
williamr@2
   264
        /**
williamr@2
   265
        * Loads and constructs new core object. Core object is added
williamr@2
   266
        * to the list of available cores and is ready to be used
williamr@2
   267
        * after that.
williamr@2
   268
        *
williamr@2
   269
        * @since S60 V2.6                
williamr@2
   270
        * @param aCoreUid   Uid for core plugin.
williamr@2
   271
        * @param aUseDefaultUserDictionary  ....
williamr@2
   272
        * @return KErrNone  if operation was successful or system
williamr@2
   273
        *                   wide error code. 
williamr@2
   274
        */
williamr@2
   275
        IMPORT_C TInt AddCoreL(const TUid aCoreUid, TBool aUseDefaultUserDictionary = EFalse);
williamr@2
   276
williamr@2
   277
        /**
williamr@2
   278
        * Returns list of candidate words for current input sequence. 
williamr@2
   279
        * If word completion feature is on, then words accepted to
williamr@2
   280
        * result list may contain more letters than the number 
williamr@2
   281
        * of key presses in current input sequence.
williamr@2
   282
        * 
williamr@2
   283
        * @since S60 V2.6                
williamr@2
   284
        * @param  aList  a list to be filled with candidate words.
williamr@2
   285
        * @return KErrNone if success, otherwise system wide error
williamr@2
   286
        *                  code.
williamr@2
   287
        */ 
williamr@2
   288
        IMPORT_C TInt GetCandidateListL(CDesCArray& aList);
williamr@2
   289
williamr@2
   290
        /**
williamr@2
   291
        * Returns next word candidate list. This method requires that
williamr@2
   292
        * current core object supports next word prediction feature
williamr@2
   293
        * and it is turned on.
williamr@2
   294
        *
williamr@2
   295
        * @since S60 V2.6                
williamr@2
   296
        * @param aList  A List to be filled with next word cadidates.
williamr@2
   297
        * @return       KErrNone if list was successfully filled.
williamr@2
   298
        *               KErrNotSupported if current predictive core doesn't
williamr@2
   299
        *                                support next word prediction or
williamr@2
   300
        *                                the feature is not turned on.
williamr@2
   301
        */
williamr@2
   302
        IMPORT_C TInt GetNextWordCandidateListL(CDesCArray& aList);
williamr@2
   303
williamr@2
   304
        /**
williamr@2
   305
        * Returns pointer to first word in candidate list.
williamr@2
   306
        * If there isn't any candidate words the returned pointer
williamr@2
   307
        * will point to empty descriptor.
williamr@2
   308
        *
williamr@2
   309
        * @since S60 V2.6                
williamr@2
   310
        * @return  Pointer to first word in candidate list.
williamr@2
   311
        */
williamr@2
   312
        IMPORT_C TPtrC FirstCandidate();        
williamr@2
   313
williamr@2
   314
        /**
williamr@2
   315
        * Returns pointer to next word in candidate list.
williamr@2
   316
        * FirstCandidate() must be called before calling
williamr@2
   317
        * this method. Returns pointer to empty descriptor if there 
williamr@2
   318
        * isn't more candidates available.
williamr@2
   319
        *
williamr@2
   320
        * @since S60 V2.6                
williamr@2
   321
        * @return Pointer to next word in candidate list.
williamr@2
   322
        */
williamr@2
   323
        IMPORT_C TPtrC NextCandidate();
williamr@2
   324
williamr@2
   325
        /**
williamr@2
   326
        * Returns pointer to previous word in candidate list.
williamr@2
   327
        * If there isn't previous candidate available 
williamr@2
   328
        * (NextCandidate() wasn't succesfully called) then the
williamr@2
   329
        * return value will point to an empty string.
williamr@2
   330
        *
williamr@2
   331
        * @since S60 V2.6                
williamr@2
   332
        * @return Pointer to previous word in candidate list.
williamr@2
   333
        */
williamr@2
   334
        IMPORT_C TPtrC PreviousCandidate();
williamr@2
   335
williamr@2
   336
        /**
williamr@2
   337
        * Activates requested input mode for active language. 
williamr@2
   338
        *
williamr@2
   339
        * @since S60 V2.6                
williamr@2
   340
        * @param    aMode             requested input mode.
williamr@2
   341
        * @return   KErrNone          if input mode was activated.
williamr@2
   342
        *           KErrNotSupported  if current language doesn't
williamr@2
   343
        *                             support requested input mode. 
williamr@2
   344
        */
williamr@2
   345
        IMPORT_C TInt SetInputMode(TPtiEngineInputMode aMode);
williamr@2
   346
williamr@2
   347
        /**
williamr@2
   348
        * Returns active input mode.
williamr@2
   349
        *
williamr@2
   350
        * @since S60 V2.6                
williamr@2
   351
        * @return   Current input mode. 
williamr@2
   352
        */
williamr@2
   353
        IMPORT_C TPtiEngineInputMode InputMode() const;
williamr@2
   354
williamr@2
   355
        /**
williamr@2
   356
        * Turns reordering feature on or off. This method can be used only
williamr@2
   357
        * if active core object supports reordering feature.
williamr@2
   358
        * It is also possible that core object supports reordering feature,
williamr@2
   359
        * but it can't be turned off. Reordeing feature keeps track
williamr@2
   360
        * of usage frequency for entered words and promotes most frequently
williamr@2
   361
        * used words in the candidate list. Details depend on underlying
williamr@2
   362
        * prediction engine.
williamr@2
   363
        *
williamr@2
   364
        * @since S60 V2.6                
williamr@2
   365
        * @param  aStatus  New status for reordering feature.
williamr@2
   366
        * @return KErrNone if success, otherwise an error code.
williamr@2
   367
        */
williamr@2
   368
        IMPORT_C TInt SetReordering(TBool aStatus);
williamr@2
   369
williamr@2
   370
        /**
williamr@2
   371
        * Fills text buffer with given word, refreshes
williamr@2
   372
        * current input sequence and asks current core object
williamr@2
   373
        * to update candidate list accordingly.
williamr@2
   374
        *
williamr@2
   375
        * @since S60 V2.6                
williamr@2
   376
        * @param  aWord a word to be set as current word.
williamr@2
   377
        * @return KErrNone if success, otherwise system wide error code.
williamr@2
   378
        */
williamr@2
   379
        IMPORT_C TInt SetCurrentWord(TPtrC aWord);
williamr@2
   380
        
williamr@2
   381
        /**
williamr@2
   382
        * Returns pointer to current word buffer.
williamr@2
   383
        *
williamr@2
   384
        * @since S60 V2.6                
williamr@2
   385
        * @return  Pointer to current word buffer.
williamr@2
   386
        */
williamr@2
   387
        IMPORT_C TPtrC CurrentWord();
williamr@2
   388
williamr@2
   389
        /**
williamr@2
   390
        * Clears current word buffer. Calling this method means
williamr@2
   391
        * that current word was reject and will not be part of edited 
williamr@2
   392
        * text. Either this method or CommitCurrentWord() must be called
williamr@2
   393
        * before starting a new word.
williamr@2
   394
        *
williamr@2
   395
        * @since S60 V2.6                
williamr@2
   396
        */
williamr@2
   397
        IMPORT_C void ClearCurrentWord();
williamr@2
   398
williamr@2
   399
        /**
williamr@2
   400
        * Sets text case. 
williamr@2
   401
        *
williamr@2
   402
        * @since S60 V2.6                
williamr@2
   403
        * @param aCase   Text case to be set. Possible values are:
williamr@2
   404
        *
williamr@2
   405
        *   EPtiCaseLower     Normal lower text case             
williamr@2
   406
        *   EPtiCaseUpper     Normal capitalized text case 
williamr@2
   407
        *   EPtiCaseChrLower  Lower text case when Chr key is being held
williamr@2
   408
        *   EPtiCaseChrUpper  Upper text case when Chr key is being held
williamr@2
   409
        *   EPtiCaseFnLower   Lower text case when Fn key is being held
williamr@2
   410
        *   EPtiCaseFnUpper   Upper text case when Fn key is being held
williamr@2
   411
        */
williamr@2
   412
        IMPORT_C void SetCase(TPtiTextCase aCase);
williamr@2
   413
williamr@2
   414
        /**
williamr@2
   415
        * Returns active text case.
williamr@2
   416
        *
williamr@2
   417
        * @since S60 V2.6                
williamr@2
   418
        * @return    Current text case.
williamr@2
   419
        */
williamr@2
   420
        IMPORT_C TPtiTextCase Case() const;
williamr@2
   421
        
williamr@2
   422
        /**
williamr@2
   423
        * Returns list of available input languages.
williamr@2
   424
        *
williamr@2
   425
        * @since S60 V2.6                
williamr@2
   426
        * @param aResult  List to be filled with language codes.
williamr@2
   427
        */  
williamr@2
   428
        IMPORT_C void GetAvailableLanguagesL(CArrayFix<TInt>* aResult);
williamr@2
   429
                
williamr@2
   430
        /**
williamr@2
   431
        * Returns list of available input languages.
williamr@2
   432
        *
williamr@2
   433
        * @since S60 V2.6                
williamr@2
   434
        * @param aResult  List to be filled with language codes.
williamr@2
   435
        */  
williamr@2
   436
        IMPORT_C void GetAvailableLanguagesL(RArray<TInt>& aResult);
williamr@2
   437
        
williamr@2
   438
        /**
williamr@2
   439
        * Returns number of available input languages.
williamr@2
   440
        *
williamr@2
   441
        * @since S60 V2.6                
williamr@2
   442
        * @return  Number of available languages.
williamr@2
   443
        */
williamr@2
   444
        IMPORT_C TInt NumberOfLanguages() const;
williamr@2
   445
williamr@2
   446
        /**
williamr@2
   447
        * Creates new user dictionary file, inserts given list of 
williamr@2
   448
        * words into it and attaches it to active core
williamr@2
   449
        * object for requested input mode. Active language must
williamr@2
   450
        * support requested input mode.
williamr@2
   451
        *
williamr@2
   452
        * @since S60 V2.6                
williamr@2
   453
        * @param   aFileName File name for new user dictionary.
williamr@2
   454
        * @param   aWords    A list of words to be inserted to new
williamr@2
   455
        *                    user dictionary. 
williamr@2
   456
        * @param   aMode     Input mode for core object.
williamr@2
   457
        * @return  KErrNone  if success, otherwise system wide error 
williamr@2
   458
        *                    code.
williamr@2
   459
        */
williamr@2
   460
        IMPORT_C TInt CreateUserDictionaryL(TDesC& aFileName, CDesCArrayFlat* aWords, TPtiEngineInputMode aMode); 
williamr@2
   461
williamr@2
   462
        /**
williamr@2
   463
        * Attach user dictionary in given file to core for requested
williamr@2
   464
        * input mode.  
williamr@2
   465
        * 
williamr@2
   466
        * @since S60 V2.6                
williamr@2
   467
        * @param   aFileName  User dictionary file name.         
williamr@2
   468
        * @return  Pointer to user dictionary object. NULL if failure.
williamr@2
   469
        */
williamr@2
   470
        IMPORT_C MPtiUserDictionary* AttachUserDictionaryL(TDesC& aFileName);
williamr@2
   471
        
williamr@2
   472
        /**
williamr@2
   473
        * Attach default user dictionary.  
williamr@2
   474
        * 
williamr@2
   475
        * @since S60 V2.6                
williamr@2
   476
        * @param   aCoreUid  Uid for owner core object.      
williamr@2
   477
        * @param   aSymbolClass Symbol class for udb data.
williamr@2
   478
        * @return  Pointer to user dictionary object. NULL if failure.
williamr@2
   479
        */
williamr@2
   480
        IMPORT_C MPtiUserDictionary* AttachDefaultUserDictionaryL(TUid aCoreUid, TInt aSymbolClass);        
williamr@2
   481
williamr@2
   482
        /**
williamr@2
   483
        * Detaches currently attached user dictionary.
williamr@2
   484
        *
williamr@2
   485
        * @since S60 V2.6                
williamr@2
   486
        * @param   aFileName    User dictionary file name.
williamr@2
   487
        * @return  KErrNone if success, otherwise system wide error code.
williamr@2
   488
        */
williamr@2
   489
        IMPORT_C TInt DetachUserDictionary(TDesC& aFileName);
williamr@2
   490
williamr@2
   491
        /**
williamr@2
   492
        * Detaches currently attached user dictionary.
williamr@2
   493
        *
williamr@2
   494
        * @since S60 V2.6                
williamr@2
   495
        * @param   aId      User dictionary id.
williamr@2
   496
        * @return  KErrNone if success, otherwise system wide error code.
williamr@2
   497
        */
williamr@2
   498
        IMPORT_C TInt DetachUserDictionary(TInt aId);
williamr@2
   499
williamr@2
   500
        /**
williamr@2
   501
        * Returns localized language name for given language. This method
williamr@2
   502
        * is quite inefficient (always reads name table from resource file),
williamr@2
   503
        * when possible use Getlanguage()->LocalizedName() instead.
williamr@2
   504
        * This method can be used also when requested language is
williamr@2
   505
        * not among available input languages.
williamr@2
   506
        *
williamr@2
   507
        * @since S60 V2.6                
williamr@2
   508
        * @param   Epoc language code.
williamr@2
   509
        * @return  Localized language name.
williamr@2
   510
        */
williamr@2
   511
        IMPORT_C void GetLocalizedLanguageName(TInt aLangCode, TDes& aResult);
williamr@2
   512
williamr@2
   513
        /**
williamr@2
   514
        * Commits current word. Commiting means that core object is isntructed
williamr@2
   515
        * to end inline editing operation and accepted active word as part of edited 
williamr@2
   516
        * text. Core object may then update frequency information, add unrecognized
williamr@2
   517
        * word to user dictioary or perform any other operation related to commiting a word.
williamr@2
   518
        * Word buffer is cleared. Either this method or ClearCurrentWord() must
williamr@2
   519
        * be called before starting a new word.
williamr@2
   520
        *
williamr@2
   521
        * @since S60 V2.6                
williamr@2
   522
        * @return KErrNone             if success.
williamr@2
   523
        *         KErrNoActiveLanguage if no active language.
williamr@2
   524
        */
williamr@2
   525
        IMPORT_C TInt CommitCurrentWord();
williamr@2
   526
williamr@2
   527
        /**
williamr@2
   528
        * Converts given string of characters to one coding
williamr@2
   529
        * system to another. See definition of TPtiCharConversion
williamr@2
   530
        * for list of supported conversion types. It is possible
williamr@2
   531
        * that only a small subset of supported conversion types
williamr@2
   532
        * is actually available at run time (that depends on
williamr@2
   533
        * available core objects). AvailableCharConversions()
williamr@2
   534
        * method can be used for querying available conversion
williamr@2
   535
        * types before using this method. 
williamr@2
   536
        *
williamr@2
   537
        * @since S60 V2.6                
williamr@2
   538
        * @param aType         Requested conversion type. 
williamr@2
   539
        * @param aInput        Input string. This parameter may point to
williamr@2
   540
        *                      either 8-bit or 16-bit data depending
williamr@2
   541
        *                      on conversion type.
williamr@2
   542
        * @param aInputLength  Number of characters in input string.
williamr@2
   543
        * @param aOutput       Output string. This parameter may pint to
williamr@2
   544
        *                      either 8-bit or 16-bit data depending
williamr@2
   545
        *                      on conversion type.
williamr@2
   546
        */
williamr@2
   547
        IMPORT_C TInt CharConversion(TPtiCharConversion aType,
williamr@2
   548
                                     TAny* aInput,
williamr@2
   549
                                     TInt aInputLength,
williamr@2
   550
                                     TAny* aOutput);
williamr@2
   551
williamr@2
   552
        /**
williamr@2
   553
        * Returns value indicating currently available 
williamr@2
   554
        * character conversions. 
williamr@2
   555
        *
williamr@2
   556
        * @since S60 V2.6                
williamr@2
   557
        * @return Currently available character conversions. There
williamr@2
   558
        *         is a bit set for each available char conversion. 
williamr@2
   559
        *         See definition of TPtiCharConversion.
williamr@2
   560
        */
williamr@2
   561
        IMPORT_C TUint32 AvailableCharConversions() const;
williamr@2
   562
williamr@2
   563
        /**
williamr@2
   564
        * Replaces key map for single key. 
williamr@2
   565
        *
williamr@2
   566
        * @since S60 V2.6                
williamr@2
   567
        * @param  aMode   Input mode of key map.
williamr@2
   568
        * @param  aKey    Key to be replaced.
williamr@2
   569
        * @param  aKeyMap New key sequence for aKey.
williamr@2
   570
        * @return KErrNone if success, otherwise system wide error code.
williamr@2
   571
        */
williamr@2
   572
        IMPORT_C TInt SetExternalKeyMapL(TPtiEngineInputMode aMode,
williamr@2
   573
                                         TPtiKey aKey,
williamr@2
   574
                                         TDesC& aKeyMap,
williamr@2
   575
                                         TPtiTextCase aCase);
williamr@2
   576
williamr@2
   577
        /**
williamr@2
   578
        * Returns last entered key press.
williamr@2
   579
        *
williamr@2
   580
        * @since S60 V2.6                
williamr@2
   581
        * @return last entered key press.
williamr@2
   582
        */
williamr@2
   583
        IMPORT_C TPtiKey LastEnteredKey() const;
williamr@2
   584
williamr@2
   585
        /**
williamr@2
   586
        * Returns current input sequence (a list of key presses).
williamr@2
   587
        * Bytes in returned descriptor are TPtiKey enum values.
williamr@2
   588
        *
williamr@2
   589
        * @since S60 V2.6                
williamr@2
   590
        * @return  a descriptor containing current input sequence.
williamr@2
   591
        */
williamr@2
   592
        IMPORT_C TPtrC8 CurrentInputSequence() const;
williamr@2
   593
williamr@2
   594
        /**
williamr@2
   595
        * Returns alternate spelling for given character.
williamr@2
   596
        *
williamr@2
   597
        * @since S60 V2.6                
williamr@2
   598
        * @param  aInput  a character to be converted to requested spelling.
williamr@2
   599
        * @param  aOutput output will be stored to this descriptor.
williamr@2
   600
        * @param  aType   spelling type
williamr@2
   601
        * @return KErrNone if operation was successful,
williamr@2
   602
        *         KErrNotSupported if requested spelling type is not supported. 
williamr@2
   603
        */
williamr@2
   604
        IMPORT_C TInt GetSpelling(TUint16 aInput, TDes& aOutput, TPtiSpelling aType);
williamr@2
   605
williamr@2
   606
        /**
williamr@2
   607
        * Front end processeor uses this method for indicating 
williamr@2
   608
        * PtiEngine that all key press related timers should be
williamr@2
   609
        * canceled.
williamr@2
   610
        *
williamr@2
   611
        * @since S60 V2.6                
williamr@2
   612
        * @return  KErrNone      if timers were successfully canceled.
williamr@2
   613
        *          KErrNotFound  if no active timers were found.
williamr@2
   614
        */
williamr@2
   615
        IMPORT_C TInt CancelTimerActivity();
williamr@2
   616
williamr@2
   617
        /**
williamr@2
   618
        * Returns key for given character. Returned key
williamr@2
   619
        * depends on current language and input mode.
williamr@2
   620
        *
williamr@2
   621
        * @since S60 V2.6                
williamr@2
   622
        * @param aChar  Requested character.
williamr@2
   623
        * @return Key for requested character. EPtiKeyNone if
williamr@2
   624
        *         no key was found for given character.
williamr@2
   625
        */
williamr@2
   626
        IMPORT_C TPtiKey CharacterToKey(TUint16 aChar);
williamr@2
   627
williamr@2
   628
        /**
williamr@2
   629
        * Adds new entry (in most cases a word) to default user dictionary of
williamr@2
   630
        * currently active core object.
williamr@2
   631
        *
williamr@2
   632
        * @since S60 V2.6                
williamr@2
   633
        * @param  aEntry  An entry to be added to dictionary.
williamr@2
   634
        * @return KErrNone if success, otherwise system wide error code.
williamr@2
   635
        */
williamr@2
   636
        IMPORT_C TInt AddUserDictionaryEntry(MPtiUserDictionaryEntry& aEntry);
williamr@2
   637
williamr@2
   638
        /**
williamr@2
   639
        * Adds entry to specific user dictionary.
williamr@2
   640
        *
williamr@2
   641
        * @since S60 V2.6                
williamr@2
   642
        * @param aEntry  An entry to be added to dictionary.
williamr@2
   643
        * @param aId    User dictionary id.
williamr@2
   644
        * @return       KErrNone if success, otherwise system wide error code.
williamr@2
   645
        */
williamr@2
   646
        IMPORT_C TInt AddUserDictionaryEntry(MPtiUserDictionaryEntry& aEntry, TInt aId);
williamr@2
   647
williamr@2
   648
        /**
williamr@2
   649
        * Removes entry from default user dictionary of currently active core
williamr@2
   650
        * object.
williamr@2
   651
        *
williamr@2
   652
        * @since S60 V2.6                
williamr@2
   653
        * @param  aEntry  an entry to be removed from default dictionary.
williamr@2
   654
        * @return KErrNone if success, otherwise system wide error code.
williamr@2
   655
        */
williamr@2
   656
        IMPORT_C TInt RemoveEntryFromUserDictionary(MPtiUserDictionaryEntry& aEntry);
williamr@2
   657
williamr@2
   658
        /**
williamr@2
   659
        * Removes word from specific user dictionary.
williamr@2
   660
        *
williamr@2
   661
        * @since S60 V2.6                
williamr@2
   662
        * @param aEntry  an entry to be removed from default dictionary.
williamr@2
   663
        * @param aId    User dictionary id.
williamr@2
   664
        * @return       KErrNone if success, otherwise system wide error code.
williamr@2
   665
        */
williamr@2
   666
        IMPORT_C TInt RemoveEntryFromUserDictionary(MPtiUserDictionaryEntry& aEntry, TInt aId);
williamr@2
   667
williamr@2
   668
        /**
williamr@2
   669
        * Returns number of entries in default user dictionary.
williamr@2
   670
        * 
williamr@2
   671
        * @since S60 V2.6                
williamr@2
   672
        * @return Number of entries in default user dictionary.
williamr@2
   673
        *         KErrNotSupported if core can't return requested value.     
williamr@2
   674
        */
williamr@2
   675
        IMPORT_C TInt NumberOfEntriesInUserDictionary();
williamr@2
   676
williamr@2
   677
        /**
williamr@2
   678
        * Returns entry for given index in default user dictionary.
williamr@2
   679
        *
williamr@2
   680
        * @since S60 V2.6                
williamr@2
   681
        * @param  aIndex  An index for requested entry.
williamr@2
   682
        * @param  aResult Result will be stored here.
williamr@2
   683
        * @return KErrNone if success, otherwise system wide error code.
williamr@2
   684
        */
williamr@2
   685
        IMPORT_C TInt GetUserDictionaryEntry(TInt aIndex, MPtiUserDictionaryEntry& aResult);
williamr@2
   686
williamr@2
   687
        /**
williamr@2
   688
        * Returns default user dictionary for given input mode.
williamr@2
   689
        *
williamr@2
   690
        * @since S60 V2.6                
williamr@2
   691
        * @return User dictionary for given input mode.
williamr@2
   692
        *         NULL if wasn't found.  
williamr@2
   693
        */  
williamr@2
   694
        IMPORT_C MPtiUserDictionary* DefaultUserDictionary(TPtiEngineInputMode aMode);
williamr@2
   695
williamr@2
   696
        /**
williamr@2
   697
        * Sets observer. See PtiObserver.h for observer API details.
williamr@2
   698
        *
williamr@2
   699
        * @since S60 V2.6                        
williamr@2
   700
        * @param aObserver A observer to be set.
williamr@2
   701
        */
williamr@2
   702
        IMPORT_C void SetObserver(MPtiObserver* aObserver);
williamr@2
   703
williamr@2
   704
        /**
williamr@2
   705
        * Returns current observer.
williamr@2
   706
        *
williamr@2
   707
        * @since S60 V2.6                
williamr@2
   708
        * @return Pointer to current observer object.
williamr@2
   709
        */
williamr@2
   710
        IMPORT_C MPtiObserver* Observer();
williamr@2
   711
williamr@2
   712
        /**
williamr@2
   713
        * General command handling method. This method can be used for 
williamr@2
   714
        * controlling core objects that require more information than
williamr@2
   715
        * just sequence of key presses. 
williamr@2
   716
        *
williamr@2
   717
        * @since S60 V2.6                
williamr@2
   718
        * @param  aCommand    A command to be handled. 
williamr@2
   719
        * @param  aParams     Possible input data or parameters for command.
williamr@2
   720
        * @return KErrNone    if success, otherwise an error code. 
williamr@2
   721
        */
williamr@2
   722
        IMPORT_C TInt HandleCommandL(TPtiEngineCommand aCommand, TAny* aParams = NULL);
williamr@2
   723
williamr@2
   724
        /**
williamr@2
   725
        * Returns pointer to current Chinese candidate page.
williamr@2
   726
        *
williamr@2
   727
        * @since S60 V2.6                        
williamr@2
   728
        * @return Pointer to current Chinese candidate page.
williamr@2
   729
        */
williamr@2
   730
        IMPORT_C TPtrC CandidatePage();
williamr@2
   731
williamr@2
   732
        /**
williamr@2
   733
        * Changes to next Chinese candidate page.
williamr@2
   734
        *
williamr@2
   735
        * @since S60 V2.6                
williamr@2
   736
        * @return ETrue  if success.
williamr@2
   737
        *         EFalse if there are no more candidate pages.
williamr@2
   738
        */
williamr@2
   739
        IMPORT_C TBool NextCandidatePage();
williamr@2
   740
williamr@2
   741
        /**
williamr@2
   742
        * Changes to previous Chinese candidate page.
williamr@2
   743
        *
williamr@2
   744
        * @since S60 V2.6                
williamr@2
   745
        * @return ETrue  if success.
williamr@2
   746
        *         EFalse if current candidate page is first.
williamr@2
   747
        */
williamr@2
   748
        IMPORT_C TBool PreviousCandidatePage();
williamr@2
   749
williamr@2
   750
        /**
williamr@2
   751
        * Returns a boolean value indicating whether there are more
williamr@2
   752
        * candidate pages available.
williamr@2
   753
        *
williamr@2
   754
        * @since S60 V2.6                
williamr@2
   755
        * @return ETrue  if there are more candidate pages available.
williamr@2
   756
        *         EFalse otherwise.
williamr@2
   757
        */
williamr@2
   758
        IMPORT_C TBool MoreCandidatePages();
williamr@2
   759
williamr@2
   760
        /**
williamr@2
   761
        * Sets length of Chinese candidate page.
williamr@2
   762
        *
williamr@2
   763
        * @since S60 V2.6                
williamr@2
   764
        * @param aLength Length of Chinese candidate page.
williamr@2
   765
        */
williamr@2
   766
        IMPORT_C void SetCandidatePageLength(TInt aLength);
williamr@2
   767
williamr@2
   768
        /**
williamr@2
   769
        * Returns phonetic spelling for current input.
williamr@2
   770
        * 
williamr@2
   771
        * @since S60 V2.6                
williamr@2
   772
        * @param aIndex  Index of requested phonetic spelling.
williamr@2
   773
        * @return Pointer to phonetic spelling.
williamr@2
   774
        */
williamr@2
   775
        IMPORT_C TPtrC GetPhoneticSpelling(TInt aIndex) const; 
williamr@2
   776
williamr@2
   777
        /**
williamr@2
   778
        * Returns a value specifying how many phonetic spellings
williamr@2
   779
        * there is available for current input.
williamr@2
   780
        * 
williamr@2
   781
        * @since S60 V2.6                        
williamr@2
   782
        * @return Number of phonetic spellings available for
williamr@2
   783
        *         current input.
williamr@2
   784
        */
williamr@2
   785
        IMPORT_C TInt PhoneticSpellingCount() const;    
williamr@2
   786
williamr@2
   787
        /**
williamr@2
   788
        * Selects given phonetic spelling for current input.
williamr@2
   789
        * 
williamr@2
   790
        * @since S60 V2.6                
williamr@2
   791
        * @param aIndex Index of requested phonetic spelling.
williamr@2
   792
        */
williamr@2
   793
        IMPORT_C TBool SelectPhoneticSpelling(TInt aIndex);
williamr@2
   794
williamr@2
   795
        /**
williamr@2
   796
        * Returns the index of currently selected phonetic spelling.
williamr@2
   797
        *
williamr@2
   798
        * @since S60 V2.6                        
williamr@2
   799
        * @return The index of currently selected phonetic spelling.
williamr@2
   800
        *         Returned value is negative if there isn't phonetic
williamr@2
   801
        *         spelling available.
williamr@2
   802
        */
williamr@2
   803
        IMPORT_C TInt SelectedPhoneticSpelling() const; 
williamr@2
   804
williamr@2
   805
        /**
williamr@2
   806
        * Enables or disables tone marks.
williamr@2
   807
        *
williamr@2
   808
        * @since S60 V2.6                
williamr@2
   809
        * @param aValue A boolean value specifying whether tone marks
williamr@2
   810
        *               will be on or off.
williamr@2
   811
        */
williamr@2
   812
        IMPORT_C void EnableToneMarks(TBool aValue);
williamr@2
   813
williamr@2
   814
        /**
williamr@2
   815
        * Resets tone mark.
williamr@2
   816
        *
williamr@2
   817
        * @since S60 V2.6                
williamr@2
   818
        */      
williamr@2
   819
        IMPORT_C void ResetToneMark();
williamr@2
   820
williamr@2
   821
        /**
williamr@2
   822
        * Returns unicode value for current tone mark.
williamr@2
   823
        * 
williamr@2
   824
        * @since S60 V2.6                
williamr@2
   825
        * @param  aToneMark resulting tone mark is store here.
williamr@2
   826
        * @return ETrue if tone mark was available.
williamr@2
   827
        *         EFalse otherwise.
williamr@2
   828
        */
williamr@2
   829
        IMPORT_C TBool ToneMark(TText& aToneMark) const;
williamr@2
   830
williamr@2
   831
        /**
williamr@2
   832
        * Returns boolean value indicating whether current tone mark
williamr@2
   833
        * is valid for spelling.
williamr@2
   834
        *
williamr@2
   835
        * @since S60 V2.6                
williamr@2
   836
        * @return ETrue   if tone mark is valid for spelling.
williamr@2
   837
        *         EFalse  otherwise
williamr@2
   838
        */
williamr@2
   839
        IMPORT_C TBool IsToneMarkValidForSpelling() const;
williamr@2
   840
williamr@2
   841
        /**
williamr@2
   842
        * Cycles to next tone mark in core related tone mark list.
williamr@2
   843
        * 
williamr@2
   844
        * @since S60 V2.6                
williamr@2
   845
        * @param aOverrideInvalid Indicates whether invalid tone marks
williamr@2
   846
        *                         should be skipped.
williamr@2
   847
        * @return ETrue  If new tone mark was found and set.
williamr@2
   848
        *         EFalse Otherwise.
williamr@2
   849
        */
williamr@2
   850
        IMPORT_C TBool IncrementToneMark(TBool aOverrideInvalid);
williamr@2
   851
williamr@2
   852
        /**
williamr@2
   853
        * Selects Chinese character (meaning that user has accepted character to be
williamr@2
   854
        * inserted into editor). Predictive candidate lists will be updated with
williamr@2
   855
        * Chinese characters associated to selected character. Associated charcaters
williamr@2
   856
        * can be accessed via ...CandidatePage() -methods. Return value can be
williamr@2
   857
        * ignored in current implementation.
williamr@2
   858
        *
williamr@2
   859
        * @since S60 V2.6                                
williamr@2
   860
        * @param aChar A character to be selected.
williamr@2
   861
        * @return Please ignore the return value. 
williamr@2
   862
        */
williamr@2
   863
        IMPORT_C TBool SetPredictiveChineseChar(const TDesC& aChar);
williamr@2
   864
williamr@2
   865
        /**
williamr@2
   866
        * Returns pointer to composition data interface (used with Japanese input).
williamr@2
   867
        *
williamr@2
   868
        * @since S60 V2.6                
williamr@2
   869
        * @return Pointer to composition data interface.
williamr@2
   870
        */
williamr@2
   871
        IMPORT_C MPtiEngineCompositionDataInterface* CompositionData();
williamr@2
   872
williamr@2
   873
        /**
williamr@2
   874
        * Returns reading text for Japanese input.
williamr@2
   875
        * 
williamr@2
   876
        * @since S60 V2.6                
williamr@2
   877
        * @return Reading text for Japanese input.
williamr@2
   878
        */
williamr@2
   879
        IMPORT_C TPtrC ReadingTextL();
williamr@2
   880
williamr@2
   881
        /**
williamr@2
   882
        * Returns mode name index table for given Chinese variant.
williamr@2
   883
        *
williamr@2
   884
        * @since S60 V2.6                
williamr@2
   885
        * @param aVariant Chinese variant to be queried.
williamr@2
   886
        * @param aResult  Resulting index table. 
williamr@2
   887
        */
williamr@2
   888
        IMPORT_C void GetModeNameIndexL(TPtiChineseVariant aVariant, RArray<TInt>& aResult);
williamr@2
   889
williamr@2
   890
        /**
williamr@2
   891
        * Fills list with all the phonetic spellings for current
williamr@2
   892
        * input sequence.
williamr@2
   893
        *
williamr@2
   894
        * @since S60 V2.6                
williamr@2
   895
        * @param aList  A descriptor list to be filled with 
williamr@2
   896
        *               phonetic spellings. Any previous items in aList are cleared.
williamr@2
   897
        * @return       Number of items in list.
williamr@2
   898
        */
williamr@2
   899
        IMPORT_C TInt GetPhoneticSpellingsL(CDesCArray& aList);
williamr@2
   900
williamr@2
   901
        /**
williamr@2
   902
        * Fills list with phrase candidates for currently
williamr@2
   903
        * selected phonetic spelling.
williamr@2
   904
        *
williamr@2
   905
        * @since S60 V2.6        
williamr@2
   906
        * @param aList  A descriptor list to be filled with 
williamr@2
   907
        *               phrase candidates. Any previous items in aList are cleared.
williamr@2
   908
        * @return       Number of items in list.
williamr@2
   909
        */
williamr@2
   910
        IMPORT_C TInt GetChinesePhraseCandidatesL(CDesCArray& aList);
williamr@2
   911
williamr@2
   912
        /**
williamr@2
   913
        * Sets tone mark directly. This method is used if client wants
williamr@2
   914
        * to override default core dependant tone mark set or traditional 
williamr@2
   915
        * cycle-through tone mark system doesn't suit its porposes.
williamr@2
   916
        *
williamr@2
   917
        * @since S60 V2.8
williamr@2
   918
        * @param aToneMark  Tone mark to be set.
williamr@2
   919
        * @return ETrue     if tone mark was legal, ie. produced candidates.
williamr@2
   920
        *         EFalse    otherwise.          
williamr@2
   921
        */
williamr@2
   922
        IMPORT_C TBool SetToneMark(TInt aToneMark);
williamr@2
   923
                           
williamr@2
   924
        /**
williamr@2
   925
        * A convinience method for cheking qwerty based input mode.
williamr@2
   926
        *
williamr@2
   927
        * @since S60 V3.0
williamr@2
   928
        * @param aMode  Input mode to be checked.
williamr@2
   929
        * @return ETrue If aMode is qwerty based input mode.
williamr@2
   930
        *         EFalse Otherwise. 
williamr@2
   931
        */      
williamr@2
   932
        IMPORT_C TBool IsQwertyBasedMode(TPtiEngineInputMode aMode) const;
williamr@2
   933
        
williamr@2
   934
        /**
williamr@2
   935
        * Creates empty user default dictionary file for given core object
williamr@2
   936
        * and initializes it to PtiEngine user dictionary format. If file already
williamr@2
   937
        * exists, then this method does nothing. Normally this method is 
williamr@2
   938
        * only used by core objects.
williamr@2
   939
        *
williamr@2
   940
        * @since S60 V3.0        
williamr@2
   941
        * @param aCoreUid     Uid for requesting core object. 
williamr@2
   942
        * @param aSymbolClass Symbol class for udb data.
williamr@2
   943
        */
williamr@2
   944
        IMPORT_C void CreateDefaultUserDictionaryFileL(TUid aCoreUid, TInt aSymbolClass);
williamr@2
   945
        
williamr@2
   946
        /**
williamr@2
   947
        * Creates secondary data file for given core object. Existing file will be overwritten.
williamr@2
   948
        * This data file may contain any additional data that the core object needs to store
williamr@2
   949
        * between sessions (for example used word dictionary, if the engine keeps reordering data in
williamr@2
   950
        * separate memory area).
williamr@2
   951
        *
williamr@2
   952
        * @since S60 V3.0        
williamr@2
   953
        * @param aCoreUid     Uid number for requesting core object.
williamr@2
   954
        * @param aIndexNumber Index number. Core object may use this parameter for numerating data files
williamr@2
   955
        *                     if it needs more than one of then. Otherwise zero.  
williamr@2
   956
        */
williamr@2
   957
        IMPORT_C void WriteSecondaryDataFileL(TUid aCoreUid, TInt aIndexNumber, HBufC8* aData);
williamr@2
   958
        
williamr@2
   959
        /**
williamr@2
   960
        * Returns a heap buffer containing data from given secondary data file. 
williamr@2
   961
        * Returns null if file is not found.
williamr@2
   962
        *
williamr@2
   963
        * @since S60 V3.0        
williamr@2
   964
        * @param aCoreUid     Uid number for requesting core object.
williamr@2
   965
        * @param aIndexNumber Index number (see CreateDefaultUserDictionaryFileL).
williamr@2
   966
        * @return A heap buffer conataining requested data. 
williamr@2
   967
        *         NULL if file not found. 
williamr@2
   968
        */
williamr@2
   969
        IMPORT_C HBufC8* ReadSecondaryDataFileL(TUid aCoreUid, TInt aIndexNumber);
williamr@2
   970
        
williamr@2
   971
        /**
williamr@2
   972
        * Returns keymapping data for given key. Returned data depends on active
williamr@2
   973
        * language and input mode. Result string will be empty if there isn't 
williamr@2
   974
        * key mapping adta available.
williamr@2
   975
        *
williamr@2
   976
        * @since S60 V3.0
williamr@2
   977
        * @param aKey     A key to be queried.
williamr@2
   978
        * @param aResult  Resulting mapping data.
williamr@2
   979
        */      
williamr@2
   980
        IMPORT_C void MappingDataForKey(TPtiKey aKey, TDes& aResult, TPtiTextCase aCase);
williamr@2
   981
                        
williamr@2
   982
		/**
williamr@2
   983
		* Qwerty input mode has different keymapping layout for each language. Therefore
williamr@2
   984
		* the characters for numeric input mode may be mapped to different keys depending
williamr@2
   985
		* on language. There are several situations where client application needs to know
williamr@2
   986
		* which key and case combination produce numeric characters for given language. 
williamr@2
   987
		* This convinience method can be used for extracting that information easily
williamr@2
   988
		* (it is also possible to achieve same result directly via CPtiCoreLanguage object).
williamr@2
   989
		* Result array will be left empty if requested language is not available or it doesn't
williamr@2
   990
		* support qwerty input mode. 
williamr@2
   991
		* Returned list includes key bindings for characters: "0123456789pw+#*"
williamr@2
   992
		* (Not necessarily in this order).
williamr@2
   993
		* See also ExtendedNumericModeKeysForQwertyL.
williamr@2
   994
		*
williamr@2
   995
		* This version first tries to return mappings according to currently
williamr@2
   996
		* active physical keyboard. It current keyboard is not qwerty based,
williamr@2
   997
		* it searches data for the first qwerty based keyboard type it can find.
williamr@2
   998
		* That is done in same order as keyboard types are defined in PtiDefs.h.
williamr@2
   999
		* There is also another version this method, which gets keyboard type as a
williamr@2
  1000
		* parameter.
williamr@2
  1001
		*
williamr@2
  1002
		* @since S60 V3.1
williamr@2
  1003
		* @param aLanguage Language id for requested mappings.
williamr@2
  1004
		* @param aResult   Array for storing resulting mappings.		 
williamr@2
  1005
		*/                                             
williamr@2
  1006
		IMPORT_C void GetNumericModeKeysForQwertyL(TInt aLanguage, RArray<TPtiNumericKeyBinding>& aResult);                        
williamr@2
  1007
		
williamr@2
  1008
        IMPORT_C HBufC* GetCandidatesByInputString(const TDesC& aInputString, 
williamr@2
  1009
                                                         RPointerArray<HBufC>& aList, 
williamr@2
  1010
                                                         const TBool aIsPredictive);		
williamr@2
  1011
        /**
williamr@2
  1012
        * Get first hwr implementation support the specified language
williamr@2
  1013
        *
williamr@2
  1014
        * @since S60 V4.0
williamr@2
  1015
        * @param aLanguage The language that hwr implementation supported
williamr@2
  1016
        * @return The pointer points to hwr implementation instance
williamr@2
  1017
        */      
williamr@2
  1018
        IMPORT_C MPtiHwrRecognizer* GetHwrRecognizerL(TLanguage aLanguage);
williamr@2
  1019
		
williamr@2
  1020
        /**
williamr@2
  1021
        * Get hwr implementation by give implementation uid
williamr@2
  1022
        *
williamr@2
  1023
        * @since S60 V4.0
williamr@2
  1024
        * @param aImpId Given specific implementation uid
williamr@2
  1025
        * @return The pointer points to hwr implementation instance
williamr@2
  1026
        */      
williamr@2
  1027
        IMPORT_C MPtiHwrRecognizer* GetHwrRecognizerL(TInt aImpId);
williamr@2
  1028
		
williamr@2
  1029
        /**
williamr@2
  1030
        * Get hwr implementation uid list which support given language
williamr@2
  1031
        *  
williamr@2
  1032
        * @since S60 V4.0
williamr@2
  1033
        * @param aLanguage The language that hwr implementation supported
williamr@2
  1034
        * @return The array of implementation uid list
williamr@2
  1035
        */      
williamr@2
  1036
        IMPORT_C RArray<TUid>& ListHwrRecognizerL(TLanguage aLanguage);
williamr@2
  1037
williamr@2
  1038
        /**
williamr@2
  1039
        * Get hwr available languages list
williamr@2
  1040
        *
williamr@2
  1041
        * @since S60 V4.0
williamr@2
  1042
        * @param aResult Carry the hwr available languages list on return
williamr@2
  1043
        * @return None
williamr@2
  1044
        */      
williamr@2
  1045
        IMPORT_C void GetHwrAvailableLanguagesL(RArray<TInt>& aResult);
williamr@2
  1046
        
williamr@2
  1047
        /**
williamr@2
  1048
        * Returns a list containing keyboard type values for all available 
williamr@2
  1049
        * physical keyboards connected to the device. Keyboard doesn't have to be
williamr@2
  1050
        * active at calling time to be included in the output list.
williamr@2
  1051
        *
williamr@2
  1052
        * @since S60 V5.0
williamr@2
  1053
        * @param aResult An array to be filled with available keyboard types.                                     
williamr@2
  1054
        */                                                                             
williamr@2
  1055
        IMPORT_C static void ListAvailablePhysicalKeyboardsL(RArray<TPtiKeyboardType>& aResult);        
williamr@2
  1056
        
williamr@2
  1057
        /**
williamr@2
  1058
        * This method is same as GetNumericModeKeysForQwertyL, expect that instead of returning
williamr@2
  1059
        * strict list of key bindings used in phone number editor, it returns list of all
williamr@2
  1060
        * possible characters used in any of the "number only" editor variations. 
williamr@2
  1061
   	    * Returned list includes key bindings for characters: "*+pw#1234567890;.,-E?/"
williamr@2
  1062
   	    * (Not necessarily in this order).
williamr@2
  1063
	    * See also GetNumericModeKeysForQwertyL. 
williamr@2
  1064
       	*
williamr@2
  1065
        * This version first tries to return mappings according to currently
williamr@2
  1066
        * active physical keyboard. It current keyboard is not qwerty based,
williamr@2
  1067
        * it searches data for the first qwerty based keyboard type it can find.
williamr@2
  1068
        * That is done in same order as keyboard types are defined in PtiDefs.h.
williamr@2
  1069
        * There is also another version this method, which gets keyboard type as a
williamr@2
  1070
        * parameter.
williamr@2
  1071
        *
williamr@2
  1072
        * @since S60 V3.2
williamr@2
  1073
  	    * @param aLanguage Language id for requested mappings.
williamr@2
  1074
        * @param aResult   Array for storing resulting mappings.
williamr@2
  1075
        */
williamr@2
  1076
        IMPORT_C const RArray<TPtiNumericKeyBinding>& ExtendedNumericModeKeysForQwertyL(TInt aLanguage);
williamr@2
  1077
    
williamr@2
  1078
        /**
williamr@2
  1079
        * Turns auto substitution feature on or off. Auto substitution
williamr@2
  1080
        * feature replaces predefined strings with other strings. For example,
williamr@2
  1081
        * if user types xmas, it could be auto substituted with Christmas.
williamr@2
  1082
        *
williamr@2
  1083
        * @since S60 V5.0
williamr@2
  1084
        * @param aStatus New status for auto substituiton feature
williamr@2
  1085
        * @return KErrNone or system wide error code.
williamr@2
  1086
        */      
williamr@2
  1087
        IMPORT_C TInt SetAutoSubstitution(TBool aStatus);
williamr@2
  1088
     
williamr@2
  1089
        /**
williamr@2
  1090
        * Adds new auto substitution entry to database. If entry for given shorcut
williamr@2
  1091
        * already exists, then the old entry will be automatically deleted.
williamr@2
  1092
        *
williamr@2
  1093
        * @since S60 V5.0     
williamr@2
  1094
        * @param aShortcut Shortcut part for new entry.
williamr@2
  1095
        * @param aSubstitution Substitution part for new entry.
williamr@2
  1096
        * @return KErrNone or system wide error code.              
williamr@2
  1097
        */
williamr@2
  1098
        IMPORT_C TInt AddAutoSubstitutionEntry(const TDesC& aShortcut,
williamr@2
  1099
                                               const TDesC& aSubstituition);
williamr@2
  1100
     
williamr@2
  1101
        /**
williamr@2
  1102
        * Remove auto substitution entry.
williamr@2
  1103
        *
williamr@2
  1104
        * @since S60 V5.0               
williamr@2
  1105
        * @param aShortcut Shortcut for auto substitution entry to be removed.
williamr@2
  1106
        * @return KErrNone or system wide error code.
williamr@2
  1107
        *         KErrNotFound if given shortcut was nout found.              
williamr@2
  1108
        */          
williamr@2
  1109
        IMPORT_C TInt DeleteAutoSubstitutionEntry(const TDesC& aShortcut);
williamr@2
  1110
     
williamr@2
  1111
        /**
williamr@2
  1112
        * Returns the number of auto substitution entries in auto subst db.
williamr@2
  1113
        *
williamr@2
  1114
        * @since S60 V5.0     
williamr@2
  1115
        * @return Number of entries in auto substitution db. Zero if the
williamr@2
  1116
        *         feature is not supported or is not activated.         
williamr@2
  1117
        */                    
williamr@2
  1118
        IMPORT_C TInt NumberOfAutoSubstitutionEntries() const;
williamr@2
  1119
     
williamr@2
  1120
        /**
williamr@2
  1121
        * Return auto substitution entry for given index.
williamr@2
  1122
        *
williamr@2
  1123
        * @since S60 V5.0     
williamr@2
  1124
        * @param aIndex Index for entry to be returned.
williamr@2
  1125
        * @param aShortcut Shortcut part of the result entry will be stored here.
williamr@2
  1126
        * @param aSubstitution Substitution part of result entry will be stored here.
williamr@2
  1127
        * @return KErrNone or system wide error code.
williamr@2
  1128
        */
williamr@2
  1129
        IMPORT_C TInt GetAutoSubstitutionEntry(TInt aIndex, TDes& aShortcut,
williamr@2
  1130
                                               TDes& aSubstitution);
williamr@2
  1131
        /**
williamr@2
  1132
        * Returns currently selected qwerty keyboard type. 
williamr@2
  1133
        *
williamr@2
  1134
        * @since S60 V5.0
williamr@2
  1135
        * @return Currently selected keyboard type.
williamr@2
  1136
        */                                                                                       
williamr@2
  1137
        IMPORT_C TPtiKeyboardType KeyboardType() const;
williamr@2
  1138
     
williamr@2
  1139
        /**
williamr@2
  1140
        * Sets keyboard type for non-virtual keyboard. Keyboard type specifies which
williamr@2
  1141
        * set of key mapping data is used. 
williamr@2
  1142
        *
williamr@2
  1143
        * @since S60 V5.0
williamr@2
  1144
        * @param aType New keyboard type.
williamr@2
  1145
        * @return KErrNone if successful
williamr@2
  1146
        *         KErrNotSupported if currently selected language/input mode combination
williamr@2
  1147
        *                          does not allow given keyboard type, or mapping
williamr@2
  1148
        *                          data doesn't contain block for it.
williamr@2
  1149
        */                                           
williamr@2
  1150
        IMPORT_C TInt SetKeyboardType(TPtiKeyboardType aType);     
williamr@2
  1151
     
williamr@2
  1152
        /**
williamr@2
  1153
        * Lists keyboard blocks available in keymapping data for given language.
williamr@2
  1154
        *
williamr@2
  1155
        * @since S60 V5.0
williamr@2
  1156
        * @param aLanguage  A language to be queried.
williamr@2
  1157
        * @param aResult    Resulting list of keyboard types will we stored here.
williamr@2
  1158
        */
williamr@2
  1159
        IMPORT_C void KeyboardTypesSupportedByLanguageL(TInt aLanguage,
williamr@2
  1160
                                                     RArray<TPtiKeyboardType>& aResult);                                                     
williamr@2
  1161
        /**
williamr@2
  1162
        * Same as previous version of GetNumericModeKeysForQwertyL (see description above) but 
williamr@2
  1163
        * keyboard type is given as a parameter and mappings are return only for given keyboard
williamr@2
  1164
        * type.
williamr@2
  1165
        *
williamr@2
  1166
        * @since S60 V5.0
williamr@2
  1167
        * @param aLanguage Language id for requested mappings.
williamr@2
  1168
        * @param aResult   Array for storing resulting mappings.
williamr@2
  1169
        * @param aKeyboardType keyboard type.		 
williamr@2
  1170
        */                                                                                                  
williamr@2
  1171
        IMPORT_C void GetNumericModeKeysForQwertyL(TInt aLanguage,
williamr@2
  1172
 	                                               RArray<TPtiNumericKeyBinding>& aResult,
williamr@2
  1173
 	                                               TPtiKeyboardType aKeyboardType); 	                                                                                                                         
williamr@2
  1174
        /**
williamr@2
  1175
        * Same as previous version of ExtendedNumericModeKeysForQwertyL (see description above), but
williamr@2
  1176
        * keyboard type is given as a parameter and mappings are return only for given keyboard
williamr@2
  1177
        * type.
williamr@2
  1178
        *
williamr@2
  1179
        * @since S60 V5.0
williamr@2
  1180
  	    * @param aLanguage Language id for requested mappings.
williamr@2
  1181
	    * @param aKeyboardType keyboard type.		   	 
williamr@2
  1182
	    * @param aResult   Array for storing resulting mappings.
williamr@2
  1183
        */
williamr@2
  1184
        IMPORT_C const RArray<TPtiNumericKeyBinding>& ExtendedNumericModeKeysForQwertyL(TInt aLanguage,
williamr@2
  1185
                                                                                     TPtiKeyboardType aKeyboardType);                                                                                                           		
williamr@2
  1186
                                                                                     
williamr@2
  1187
        /**
williamr@2
  1188
        * Sets a boolean value indicating whether number candidates are included to
williamr@2
  1189
        * predictive candidate list. Number candidates are strings containing only digits.
williamr@2
  1190
        * Number candidate feature must be supported by active prediction engine,
williamr@2
  1191
        * otherwise this setting will be ignored.
williamr@2
  1192
        *
williamr@2
  1193
        * @since S60 V5.0
williamr@2
  1194
  	    * @param aStatus  A boolean value indicating whether number candidates
williamr@2
  1195
  	    *                 are included to cadidate list.
williamr@2
  1196
	    * @return KErrNone or a system wide error code.
williamr@2
  1197
        */                                                                                                                                                                                            		                                                                                                                                
williamr@2
  1198
        IMPORT_C TInt SetNumberCandidateStatus(TBool aStatus);     
williamr@2
  1199
williamr@2
  1200
        /**
williamr@2
  1201
        * Returns a boolean value indicating whether given scan code is allowed for
williamr@2
  1202
        * current input mode. 
williamr@2
  1203
        *
williamr@2
  1204
        * @since S60 V5.0
williamr@2
  1205
  	    * @param aKey A key to be queried.
williamr@2
  1206
  	    * @return ETrue if given scan code is allowed fore currently active input mode.
williamr@2
  1207
  	    *         EFalse otherwise.
williamr@2
  1208
  	    */  
williamr@2
  1209
        IMPORT_C TBool IsValidKey(TPtiKey aKey) const;                                                                                                              
williamr@2
  1210
williamr@2
  1211
        /**
williamr@2
  1212
        * Sets the maximum length for auto completed words. This method can be used when the
williamr@2
  1213
        * client needs to be sure that all provided word completions will fit into remaining
williamr@2
  1214
        * editor buffer. When the number of key presses in an input sequence exceeds the value
williamr@2
  1215
        * given in aMaxLength, core will automatically reset this value to "no limit". 
williamr@2
  1216
        *
williamr@2
  1217
        * @since S60 V5.0
williamr@2
  1218
  	    * @param aMaxLength The maximum length fo auto completed candinates. 
williamr@2
  1219
        *                   Value 0 means no limit.
williamr@2
  1220
  	    * @return KErrNone If the operation succeeded.
williamr@2
  1221
        *         Otherwise system wide error code. 
williamr@2
  1222
  	    */  
williamr@2
  1223
        IMPORT_C TInt SetMaxLengthForAutoCompletedCandidates(TInt aMaxLength);
williamr@2
  1224
                
williamr@2
  1225
        /**
williamr@2
  1226
        * Some core objects may provide different set of results depending on whether
williamr@2
  1227
        * the auto captitalization feature was used for entering the word or not. There is
williamr@2
  1228
        * now way to tell on core level whether the word was auto-capitalizedby FEP or
williamr@2
  1229
        * capitalized normally by the user. This method can be used to incicate
williamr@2
  1230
        * core object that auto-capitalization was used for current input sequence.
williamr@2
  1231
        * Clearing or commiting the word will cancel the effect of this method.
williamr@2
  1232
        *    
williamr@2
  1233
        * @since S60 V5.0  
williamr@2
  1234
        */             
williamr@2
  1235
        IMPORT_C void MarkAutoCapitalized();    
williamr@2
  1236
williamr@2
  1237
        /**
williamr@2
  1238
        * Returns text case buffer. Case buffer contains shift state
williamr@2
  1239
        * for each key press used for producing active word, ie. it remembers
williamr@2
  1240
        * case values for each AppendKeyPress call. Case buffer is 
williamr@2
  1241
        * cleared when active word is commited or cleared. Return
williamr@2
  1242
        * value is TPtrC8 containing string of EPtiTextCase values.
williamr@2
  1243
        *
williamr@2
  1244
        * @since S60 V5.0
williamr@2
  1245
        * @return A string of EPtiTextCase values.
williamr@2
  1246
        */        
williamr@2
  1247
        IMPORT_C TPtrC8 CaseSequence();
williamr@2
  1248
williamr@2
  1249
        /**
williamr@2
  1250
        * Some prediction engines support next word prediction feature but
williamr@2
  1251
        * require database to be pre-filled with suitable phrase data.
williamr@2
  1252
        * This method adds one new phrase or sentence to phrase dictionary.
williamr@2
  1253
        * Active core object needs to support phrase based next word prediction,
williamr@2
  1254
        * otherwise an error code is returned. 
williamr@2
  1255
        *
williamr@2
  1256
        * @since S60 V5.0
williamr@2
  1257
        * @param aNewPhrase New phrase to be added to phrase dictionary.
williamr@2
  1258
        * @return KErrNone or system wide error code.
williamr@2
  1259
        */
williamr@2
  1260
        IMPORT_C TInt AddPhrase(const TDesC& aNewPhrase);
williamr@2
  1261
        
williamr@4
  1262
#ifdef FF_DUAL_LANGUAGE_SUPPORT
williamr@2
  1263
        /**
williamr@2
  1264
        * Activates specified secondary input language in current input mode.
williamr@2
  1265
        *
williamr@2
  1266
        * @since S60 V5.0
williamr@2
  1267
        * @param  aEpocLanguageID    Language to be activated.
williamr@2
  1268
        * @return KErrNone if success or system wide error code.
williamr@2
  1269
        */
williamr@2
  1270
        IMPORT_C TInt SetSecondaryInputL(TInt aEpocLanguageID);
williamr@4
  1271
#endif //FF_DUAL_LANGUAGE_SUPPORT
williamr@2
  1272
    private:
williamr@2
  1273
        CPtiEngine();
williamr@2
  1274
        void ConstructL(TBool aUseDefaultUserDictionary);
williamr@2
  1275
        void ConstructL(const TUid aCoreUid, TBool aUseDefaultUserDictionary);
williamr@2
  1276
    
williamr@2
  1277
    private:        
williamr@2
  1278
        CPtiEngineImpl* iImpl;
williamr@2
  1279
        };
williamr@2
  1280
               
williamr@2
  1281
#endif  _PTI_ENGINE_H
williamr@2
  1282
williamr@2
  1283
// End of file