00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _PTI_ENGINE_H
00021 #define _PTI_ENGINE_H
00022
00023
00024 #include <e32base.h>
00025 #include <badesca.h>
00026 #include "PtiDefs.h"
00027 #include "PtiObserver.h"
00028 #include "PtiLanguage.h"
00029
00030
00031 class CPtiUserDictionary;
00032 class MPtiUserDictionary;
00033 class MPtiEngineCompositionDataInterface;
00034 class MPtiUserDictionaryEntry;
00035 class CPtiEngineImpl;
00036 class MPtiHwrRecognizer;
00037
00108 NONSHARABLE_CLASS(CPtiEngine) : public CBase
00109 {
00110 public:
00117 IMPORT_C static CPtiEngine* NewL(TBool aUseDefaultUserDictionary = EFalse);
00118
00124 IMPORT_C static CPtiEngine* NewL(const TDesC& aCoreName, TBool aUseDefaultUserDictionary = EFalse);
00125
00133 IMPORT_C static CPtiEngine* NewL(const TUid aCoreUid, TBool aUseDefaultUserDictionary = EFalse);
00134
00138 IMPORT_C ~CPtiEngine();
00139
00150 IMPORT_C TInt ActivateLanguageL(TInt aEpocLanguageID, TPtiEngineInputMode aMode = EPtiEngineInputModeNone);
00151
00161 IMPORT_C void CloseCurrentLanguageL();
00162
00171 IMPORT_C MPtiCoreInfo* CoreInfo(TPtiEngineInputMode aMode) const;
00172
00180 IMPORT_C MPtiLanguage* CurrentLanguage();
00181
00191 IMPORT_C MPtiLanguage* GetLanguage(TInt aCode) const;
00192
00200 IMPORT_C TInt NumberOfCandidates();
00201
00213 IMPORT_C TPtrC AppendKeyPress(TPtiKey aKey);
00214
00222 IMPORT_C TPtrC DeleteKeyPress();
00223
00227 IMPORT_C TInt AddCoreL(const TDesC& aFileName, TBool aUseDefaultUserDictionary = EFalse);
00228
00240 IMPORT_C TInt AddCoreL(const TUid aCoreUid, TBool aUseDefaultUserDictionary = EFalse);
00241
00253 IMPORT_C TInt GetCandidateListL(CDesCArray& aList);
00254
00267 IMPORT_C TInt GetNextWordCandidateListL(CDesCArray& aList);
00268
00277 IMPORT_C TPtrC FirstCandidate();
00278
00289 IMPORT_C TPtrC NextCandidate();
00290
00301 IMPORT_C TPtrC PreviousCandidate();
00302
00311 IMPORT_C TInt SetInputMode(TPtiEngineInputMode aMode);
00312
00319 IMPORT_C TPtiEngineInputMode InputMode() const;
00320
00334 IMPORT_C TInt SetReordering(TBool aStatus);
00335
00345 IMPORT_C TInt SetCurrentWord(TPtrC aWord);
00346
00353 IMPORT_C TPtrC CurrentWord();
00354
00363 IMPORT_C void ClearCurrentWord();
00364
00372 IMPORT_C void SetCase(TPtiTextCase aCase);
00373
00380 IMPORT_C TPtiTextCase Case() const;
00381
00388 IMPORT_C void GetAvailableLanguagesL(CArrayFix<TInt>* aResult);
00389
00396 IMPORT_C void GetAvailableLanguagesL(RArray<TInt>& aResult);
00397
00404 IMPORT_C TInt NumberOfLanguages() const;
00405
00420 IMPORT_C TInt CreateUserDictionaryL(TDesC& aFileName, CDesCArrayFlat* aWords, TPtiEngineInputMode aMode);
00421
00430 IMPORT_C MPtiUserDictionary* AttachUserDictionaryL(TDesC& aFileName);
00431
00440 IMPORT_C MPtiUserDictionary* AttachDefaultUserDictionaryL(TUid aCoreUid, TInt aSymbolClass);
00441
00449 IMPORT_C TInt DetachUserDictionary(TDesC& aFileName);
00450
00458 IMPORT_C TInt DetachUserDictionary(TInt aId);
00459
00471 IMPORT_C void GetLocalizedLanguageName(TInt aLangCode, TDes& aResult);
00472
00483 IMPORT_C TInt CommitCurrentWord();
00484
00505 IMPORT_C TInt CharConversion(TPtiCharConversion aType,
00506 TAny* aInput,
00507 TInt aInputLength,
00508 TAny* aOutput);
00509
00519 IMPORT_C TUint32 AvailableCharConversions() const;
00520
00530 IMPORT_C TInt SetExternalKeyMapL(TPtiEngineInputMode aMode,
00531 TPtiKey aKey,
00532 TDesC& aKeyMap,
00533 TPtiTextCase aCase);
00534
00541 IMPORT_C TPtiKey LastEnteredKey() const;
00542
00550 IMPORT_C TPtrC8 CurrentInputSequence() const;
00551
00562 IMPORT_C TInt GetSpelling(TUint16 aInput, TDes& aOutput, TPtiSpelling aType);
00563
00573 IMPORT_C TInt CancelTimerActivity();
00574
00584 IMPORT_C TPtiKey CharacterToKey(TUint16 aChar);
00585
00594 IMPORT_C TInt AddUserDictionaryEntry(MPtiUserDictionaryEntry& aEntry);
00595
00604 IMPORT_C TInt AddUserDictionaryEntry(MPtiUserDictionaryEntry& aEntry, TInt aId);
00605
00614 IMPORT_C TInt RemoveEntryFromUserDictionary(MPtiUserDictionaryEntry& aEntry);
00615
00624 IMPORT_C TInt RemoveEntryFromUserDictionary(MPtiUserDictionaryEntry& aEntry, TInt aId);
00625
00633 IMPORT_C TInt NumberOfEntriesInUserDictionary();
00634
00643 IMPORT_C TInt GetUserDictionaryEntry(TInt aIndex, MPtiUserDictionaryEntry& aResult);
00644
00652 IMPORT_C MPtiUserDictionary* DefaultUserDictionary(TPtiEngineInputMode aMode);
00653
00660 IMPORT_C void SetObserver(MPtiObserver* aObserver);
00661
00668 IMPORT_C MPtiObserver* Observer();
00669
00680 IMPORT_C TInt HandleCommandL(TPtiEngineCommand aCommand, TAny* aParams = NULL);
00681
00688 IMPORT_C TPtrC CandidatePage();
00689
00697 IMPORT_C TBool NextCandidatePage();
00698
00706 IMPORT_C TBool PreviousCandidatePage();
00707
00716 IMPORT_C TBool MoreCandidatePages();
00717
00724 IMPORT_C void SetCandidatePageLength(TInt aLength);
00725
00733 IMPORT_C TPtrC GetPhoneticSpelling(TInt aIndex) const;
00734
00743 IMPORT_C TInt PhoneticSpellingCount() const;
00744
00751 IMPORT_C TBool SelectPhoneticSpelling(TInt aIndex);
00752
00761 IMPORT_C TInt SelectedPhoneticSpelling() const;
00762
00770 IMPORT_C void EnableToneMarks(TBool aValue);
00771
00777 IMPORT_C void ResetToneMark();
00778
00787 IMPORT_C TBool ToneMark(TText& aToneMark) const;
00788
00797 IMPORT_C TBool IsToneMarkValidForSpelling() const;
00798
00808 IMPORT_C TBool IncrementToneMark(TBool aOverrideInvalid);
00809
00821 IMPORT_C TBool SetPredictiveChineseChar(const TDesC& aChar);
00822
00829 IMPORT_C MPtiEngineCompositionDataInterface* CompositionData();
00830
00837 IMPORT_C TPtrC ReadingTextL();
00838
00846 IMPORT_C void GetModeNameIndexL(TPtiChineseVariant aVariant, RArray<TInt>& aResult);
00847
00857 IMPORT_C TInt GetPhoneticSpellingsL(CDesCArray& aList);
00858
00868 IMPORT_C TInt GetChinesePhraseCandidatesL(CDesCArray& aList);
00869
00880 IMPORT_C TBool SetToneMark(TInt aToneMark);
00881
00890 inline TBool IsQwertyBasedMode(TPtiEngineInputMode aMode) const;
00891
00902 IMPORT_C void CreateDefaultUserDictionaryFileL(TUid aCoreUid, TInt aSymbolClass);
00903
00915 IMPORT_C void WriteSecondaryDataFileL(TUid aCoreUid, TInt aIndexNumber, HBufC8* aData);
00916
00927 IMPORT_C HBufC8* ReadSecondaryDataFileL(TUid aCoreUid, TInt aIndexNumber);
00928
00938 IMPORT_C void MappingDataForKey(TPtiKey aKey, TDes& aResult, TPtiTextCase aCase);
00939
00957 IMPORT_C void GetNumericModeKeysForQwertyL(TInt aLanguage, RArray<TPtiNumericKeyBinding>& aResult);
00958
00959 IMPORT_C HBufC* GetCandidatesByInputString(const TDesC& aInputString,
00960 RPointerArray<HBufC>& aList,
00961 const TBool aIsPredictive);
00962
00970 IMPORT_C MPtiHwrRecognizer* GetHwrRecognizerL(TLanguage aLanguage);
00971
00979 IMPORT_C MPtiHwrRecognizer* GetHwrRecognizerL(TInt aImpId);
00980
00988 IMPORT_C RArray<TUid>& ListHwrRecognizerL(TLanguage aLanguage);
00989
00997 IMPORT_C void GetHwrAvailableLanguagesL(RArray<TInt>& aResult);
00998
00999 private:
01000 CPtiEngine();
01001 void ConstructL(TBool aUseDefaultUserDictionary);
01002 void ConstructL(const TUid aCoreUid, TBool aUseDefaultUserDictionary);
01003
01004 private:
01005 CPtiEngineImpl* iImpl;
01006 };
01007
01008
01009 inline TBool CPtiEngine::IsQwertyBasedMode(TPtiEngineInputMode aMode) const
01010 {
01011 if ((aMode == EPtiEngineQwerty) ||
01012 (aMode == EPtiEngineZhuyinQwerty) ||
01013 (aMode == EPtiEngineZhuyinPhraseQwerty) ||
01014 (aMode == EPtiEnginePinyinQwerty) ||
01015 (aMode == EPtiEnginePinyinPhraseQwerty) ||
01016 (aMode == EPtiEngineStrokeQwerty) ||
01017 (aMode == EPtiEngineStrokePhraseQwerty) ||
01018 (aMode == EPtiEngineNormalCangjieQwerty) ||
01019 (aMode == EPtiEngineEasyCangjieQwerty) ||
01020 (aMode == EPtiEngineAdvCangjieQwerty) ||
01021 (aMode == EPtiEngineHiraganaKanjiQwerty) ||
01022 (aMode == EPtiEngineHiraganaKanjiPredictiveQwerty) ||
01023 (aMode == EPtiEngineKatakanaQwerty) ||
01024 (aMode == EPtiEngineFullWidthKatakanaQwerty) ||
01025 (aMode == EPtiEngineFullWidthNumericQwerty) ||
01026 (aMode == EPtiEngineFullWidthAlphabetQwerty) ||
01027 (aMode == EPtiEngineHiraganaQwerty)
01028 || (aMode == EPtiEngineInputModeIndicPhoneticQwerty)
01029 )
01030 {
01031 return ETrue;
01032 }
01033
01034 return EFalse;
01035 }
01036
01037 #endif _PTI_ENGINE_H
01038
01039