S60 3rd Edition API Reference: ptiengine.h Source File

ptiengine.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name       : PtiEngine.h
00004 *  Part of    : PtiEngine
00005 *  Description: Predective text input engine API header
00006 *  Version:
00007 *
00008 *  Copyright ?2003-2006 Nokia Corporation.
00009 *  This material, including documentation and any related 
00010 *  computer programs, is protected by copyright controlled by 
00011 *  Nokia Corporation. All rights are reserved. Copying, 
00012 *  including reproducing, storing,  adapting or translating, any 
00013 *  or all of this material requires the prior written consent of 
00014 *  Nokia Corporation. This material also contains confidential 
00015 *  information which may not be disclosed to others without the 
00016 *  prior written consent of Nokia Corporation.
00017 * ============================================================================
00018 */
00019 
00020 #ifndef _PTI_ENGINE_H
00021 #define _PTI_ENGINE_H
00022 
00023 // INCLUDES
00024 #include <e32base.h>
00025 #include <badesca.h> 
00026 #include "PtiDefs.h"
00027 #include "PtiObserver.h"
00028 #include "PtiCore.h"
00029 #include "PtiLanguage.h"
00030 
00031 // FORWARD DECLARATIONS
00032 class CPtiUserDictionary;
00033 class MPtiUserDictionary;
00034 class MPtiEngineCompositionDataInterface;
00035 class MPtiUserDictionaryEntry;
00036 class CPtiEngineImpl;
00037 #start_since SINCE_3_1_SDK
00038 class MPtiHwrRecognizer;
00039 #end_since SINCE_3_1_SDK
00040 
00092 NONSHARABLE_CLASS(CPtiEngine) : public CBase
00093     {
00094     public:
00101         IMPORT_C static CPtiEngine* NewL(TBool aUseDefaultUserDictionary = EFalse);
00102 
00108         IMPORT_C static CPtiEngine* NewL(const TDesC& aCoreName, TBool aUseDefaultUserDictionary = EFalse);
00109 
00117         IMPORT_C static CPtiEngine* NewL(const TUid aCoreUid, TBool aUseDefaultUserDictionary = EFalse);
00118 
00122         IMPORT_C ~CPtiEngine();
00123 
00134         IMPORT_C TInt ActivateLanguageL(TInt aEpocLanguageID, TPtiEngineInputMode aMode = EPtiEngineInputModeNone);
00135 
00145         IMPORT_C void CloseCurrentLanguageL();
00146         
00155         IMPORT_C MPtiCoreInfo* CoreInfo(TPtiEngineInputMode aMode) const;
00156 
00164         IMPORT_C MPtiLanguage* CurrentLanguage();
00165 
00175         IMPORT_C MPtiLanguage* GetLanguage(TInt aCode) const;
00176 
00184         IMPORT_C TInt NumberOfCandidates();
00185 
00197         IMPORT_C TPtrC AppendKeyPress(TPtiKey aKey);
00198 
00206         IMPORT_C TPtrC DeleteKeyPress();
00207 
00211         IMPORT_C TInt AddCoreL(const TDesC& aFileName, TBool aUseDefaultUserDictionary = EFalse);
00212 
00224         IMPORT_C TInt AddCoreL(const TUid aCoreUid, TBool aUseDefaultUserDictionary = EFalse);
00225 
00237         IMPORT_C TInt GetCandidateListL(CDesCArray& aList);
00238 
00251         IMPORT_C TInt GetNextWordCandidateListL(CDesCArray& aList);
00252 
00261         IMPORT_C TPtrC FirstCandidate();        
00262 
00272         IMPORT_C TPtrC NextCandidate();
00273 
00283         IMPORT_C TPtrC PreviousCandidate();
00284 
00294         IMPORT_C TInt SetInputMode(TPtiEngineInputMode aMode);
00295 
00302         IMPORT_C TPtiEngineInputMode InputMode() const;
00303 
00317         IMPORT_C TInt SetReordering(TBool aStatus);
00318 
00328         IMPORT_C TInt SetCurrentWord(TPtrC aWord);
00329         
00336         IMPORT_C TPtrC CurrentWord();
00337 
00346         IMPORT_C void ClearCurrentWord();
00347 
00355         IMPORT_C void SetCase(TPtiTextCase aCase);
00356 
00363         IMPORT_C TPtiTextCase Case() const;
00364         
00371         IMPORT_C void GetAvailableLanguagesL(CArrayFix<TInt>* aResult);
00372                 
00379         IMPORT_C void GetAvailableLanguagesL(RArray<TInt>& aResult);
00380         
00387         IMPORT_C TInt NumberOfLanguages() const;
00388 
00403         IMPORT_C TInt CreateUserDictionaryL(TDesC& aFileName, CDesCArrayFlat* aWords, TPtiEngineInputMode aMode); 
00404 
00413         IMPORT_C MPtiUserDictionary* AttachUserDictionaryL(TDesC& aFileName);
00414         
00423         IMPORT_C MPtiUserDictionary* AttachDefaultUserDictionaryL(TUid aCoreUid, TInt aSymbolClass);        
00424 
00432         IMPORT_C TInt DetachUserDictionary(TDesC& aFileName);
00433 
00441         IMPORT_C TInt DetachUserDictionary(TInt aId);
00442 
00454         IMPORT_C void GetLocalizedLanguageName(TInt aLangCode, TDes& aResult);
00455 
00466         IMPORT_C TInt CommitCurrentWord();
00467 
00488         IMPORT_C TInt CharConversion(TPtiCharConversion aType,
00489                                      TAny* aInput,
00490                                      TInt aInputLength,
00491                                      TAny* aOutput);
00492 
00502         IMPORT_C TUint32 AvailableCharConversions() const;
00503 
00513         IMPORT_C TInt SetExternalKeyMapL(TPtiEngineInputMode aMode,
00514                                          TPtiKey aKey,
00515                                          TDesC& aKeyMap,
00516                                          TPtiTextCase aCase);
00517 
00524         IMPORT_C TPtiKey LastEnteredKey() const;
00525 
00533         IMPORT_C TPtrC8 CurrentInputSequence() const;
00534 
00545         IMPORT_C TInt GetSpelling(TUint16 aInput, TDes& aOutput, TPtiSpelling aType);
00546 
00556         IMPORT_C TInt CancelTimerActivity();
00557 
00567         IMPORT_C TPtiKey CharacterToKey(TUint16 aChar);
00568 
00577         IMPORT_C TInt AddUserDictionaryEntry(MPtiUserDictionaryEntry& aEntry);
00578 
00587         IMPORT_C TInt AddUserDictionaryEntry(MPtiUserDictionaryEntry& aEntry, TInt aId);
00588 
00597         IMPORT_C TInt RemoveEntryFromUserDictionary(MPtiUserDictionaryEntry& aEntry);
00598 
00607         IMPORT_C TInt RemoveEntryFromUserDictionary(MPtiUserDictionaryEntry& aEntry, TInt aId);
00608 
00616         IMPORT_C TInt NumberOfEntriesInUserDictionary();
00617 
00626         IMPORT_C TInt GetUserDictionaryEntry(TInt aIndex, MPtiUserDictionaryEntry& aResult);
00627 
00635         IMPORT_C MPtiUserDictionary* DefaultUserDictionary(TPtiEngineInputMode aMode);
00636 
00643         IMPORT_C void SetObserver(MPtiObserver* aObserver);
00644 
00651         IMPORT_C MPtiObserver* Observer();
00652 
00663         IMPORT_C TInt HandleCommandL(TPtiEngineCommand aCommand, TAny* aParams = NULL);
00664 
00671         IMPORT_C TPtrC CandidatePage();
00672 
00680         IMPORT_C TBool NextCandidatePage();
00681 
00689         IMPORT_C TBool PreviousCandidatePage();
00690 
00699         IMPORT_C TBool MoreCandidatePages();
00700 
00707         IMPORT_C void SetCandidatePageLength(TInt aLength);
00708 
00716         IMPORT_C TPtrC GetPhoneticSpelling(TInt aIndex) const; 
00717 
00726         IMPORT_C TInt PhoneticSpellingCount() const;    
00727 
00734         IMPORT_C TBool SelectPhoneticSpelling(TInt aIndex);
00735 
00744         IMPORT_C TInt SelectedPhoneticSpelling() const; 
00745 
00753         IMPORT_C void EnableToneMarks(TBool aValue);
00754 
00760         IMPORT_C void ResetToneMark();
00761 
00770         IMPORT_C TBool ToneMark(TText& aToneMark) const;
00771 
00780         IMPORT_C TBool IsToneMarkValidForSpelling() const;
00781 
00791         IMPORT_C TBool IncrementToneMark(TBool aOverrideInvalid);
00792 
00804         IMPORT_C TBool SetPredictiveChineseChar(const TDesC& aChar);
00805 
00812         IMPORT_C MPtiEngineCompositionDataInterface* CompositionData();
00813 
00820         IMPORT_C TPtrC ReadingTextL();
00821 
00829         IMPORT_C void GetModeNameIndexL(TPtiChineseVariant aVariant, RArray<TInt>& aResult);
00830 
00840         IMPORT_C TInt GetPhoneticSpellingsL(CDesCArray& aList);
00841 
00851         IMPORT_C TInt GetChinesePhraseCandidatesL(CDesCArray& aList);
00852 
00863         IMPORT_C TBool SetToneMark(TInt aToneMark);
00864                 
00873         inline TBool IsQwertyBasedMode(TPtiEngineInputMode aMode) const;
00874         
00885         IMPORT_C void CreateDefaultUserDictionaryFileL(TUid aCoreUid, TInt aSymbolClass);
00886         
00898         IMPORT_C void WriteSecondaryDataFileL(TUid aCoreUid, TInt aIndexNumber, HBufC8* aData);
00899         
00910         IMPORT_C HBufC8* ReadSecondaryDataFileL(TUid aCoreUid, TInt aIndexNumber);
00911         
00921         IMPORT_C void MappingDataForKey(TPtiKey aKey, TDes& aResult, TPtiTextCase aCase);
00922                         
00937                 IMPORT_C void GetNumericModeKeysForQwertyL(TInt aLanguage, RArray<TPtiNumericKeyBinding>& aResult);                        
00938 
00939 #start_since SINCE_3_1_SDK              
00940 
00943         IMPORT_C HBufC* GetCandidatesByInputString(const TDesC& aInputString, 
00944                                                          RPointerArray<HBufC>& aList, 
00945                                                          const TBool aIsPredictive);            
00953     IMPORT_C MPtiHwrRecognizer* GetHwrRecognizerL(TLanguage aLanguage);
00954                 
00962     IMPORT_C MPtiHwrRecognizer* GetHwrRecognizerL(TInt aImpId);
00963                 
00971     IMPORT_C RArray<TUid>& ListHwrRecognizerL(TLanguage aLanguage);
00972 
00980     IMPORT_C void GetHwrAvailableLanguagesL(RArray<TInt>& aResult);
00981 #end_since SINCE_3_1_SDK
00982                 
00983     private:
00984         CPtiEngine();
00985         void ConstructL(TBool aUseDefaultUserDictionary);
00986         void ConstructL(const TUid aCoreUid, TBool aUseDefaultUserDictionary);
00987     
00988     private:        
00989         CPtiEngineImpl* iImpl;
00990         };
00991         
00992         
00993 inline TBool CPtiEngine::IsQwertyBasedMode(TPtiEngineInputMode aMode) const
00994     {
00995     if ((aMode == EPtiEngineQwerty) ||
00996         (aMode == EPtiEngineZhuyinQwerty) ||
00997         (aMode == EPtiEngineZhuyinPhraseQwerty) ||
00998         (aMode == EPtiEnginePinyinQwerty) ||
00999         (aMode == EPtiEnginePinyinPhraseQwerty) ||
01000         (aMode == EPtiEngineStrokeQwerty) ||
01001 #start_since SINCE_3_1_SDK
01002         (aMode == EPtiEngineStrokePhraseQwerty) ||
01003 #end_since SINCE_3_1_SDK
01004         (aMode == EPtiEngineNormalCangjieQwerty) ||
01005         (aMode == EPtiEngineEasyCangjieQwerty) ||
01006         (aMode == EPtiEngineAdvCangjieQwerty) ||
01007         (aMode == EPtiEngineHiraganaKanjiQwerty) ||
01008         (aMode == EPtiEngineHiraganaKanjiPredictiveQwerty) ||
01009         (aMode == EPtiEngineKatakanaQwerty) ||
01010         (aMode == EPtiEngineFullWidthKatakanaQwerty) ||
01011         (aMode == EPtiEngineFullWidthNumericQwerty) ||
01012         (aMode == EPtiEngineFullWidthAlphabetQwerty) ||
01013         (aMode == EPtiEngineHiraganaQwerty))
01014         {
01015         return ETrue;   
01016         }
01017         
01018     return EFalse;
01019     }       
01020 
01021 #endif  _PTI_ENGINE_H
01022 
01023 // End of file

Copyright © Nokia Corporation 2001-2007
Back to top