ptidefs.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name       : PtiDefs.h
00004 *  Part of    : PtiEngine
00005 *  Description: Predective text input engine definitions
00006 *  Version:
00007 *
00008 *  Copyright ?2003-2005 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 #ifndef _PTI_DEFS_H
00020 #define _PTI_DEFS_H
00021 
00022 #include <e32keys.h>
00023 
00024 const TInt KMaxLanguageNameLength = 50;
00025 
00026 const TInt KErrPtiEngineBase = (-1000); //based on the value of leave in PtiEngine
00027 enum TPtiError
00028     {
00029     KErrNoActiveLanguage = KErrPtiEngineBase-1,
00030     KErrLanguageNotFound = KErrPtiEngineBase-2,
00031     KErrNoSuitableCore = KErrPtiEngineBase-3,
00032     KErrNotAllowed = KErrPtiEngineBase-4,
00033     KErrTooLongWord = KErrPtiEngineBase-5,
00034     KErrInvalidWord = KErrPtiEngineBase-6,
00035     KErrTooLongReading = KErrPtiEngineBase-7,
00036     KErrInvalidReading = KErrPtiEngineBase-8,
00037     KErrUserDic = KErrPtiEngineBase-9
00038     };
00039 
00040 
00117 enum TPtiEngineInputMode
00118     {
00119     EPtiEngineInputModeNone = 0,
00120     EPtiEngineMultitapping,             // Basic multitapping input for latin languages.
00121     EPtiEnginePredictive,               // Predictive input for latin languages.
00122     EPtiEngineWordCompletion,           // Predictive input with word completion for latin languages.
00123     EPtiEngineNumeric,                  // Latin numeric input mode.
00124     EPtiEngineQwerty,                   // Basic qwerty input mode.
00125     EPtiEnginePinyin,                   // Chinese pinyin mode.
00126     EPtiEngineStroke,                   // Chinese stroke mode.
00127     EPtiEngineZhuyin,                   // Chinese zhuyin mode.
00128     EPtiEngineHiraganaKanji,            // Hiragana/Kanji mode.
00129     EPtiEngineHiraganaKanjiPredictive,  // Predictive Hiragana/Kanji mode.
00130     EPtiEngineKatakana,                 // Half-width Katakana mode.
00131     EPtiEngineFullWidthKatakana,        // Full-width Katakana mode.
00132     EPtiEngineFullWidthNumeric,         // Full-width Alphabet mode (for Japanese input).
00133     EPtiEngineFullWidthAlphabet,        // Full-width Alphabet mode (for Japanese input).
00134     EPtiEngineHiragana,                 // Hiragana only mode.
00135     EPtiEnginePinyinByPhrase,           // Pinyin phrase input.
00136     EPtiEngineZhuyinByPhrase,           // Zhuyin phrase input.
00137     EPtiEngineZhuyinQwerty,             // Zhuyin qwerty input.
00138     EPtiEngineZhuyinPhraseQwerty,       // Zhuyin phrase qwerty input.
00139     EPtiEnginePinyinQwerty,             // Pinyin qwerty input.
00140     EPtiEnginePinyinPhraseQwerty,       // Pinyin phrase qwerty input.
00141     EPtiEngineStrokeQwerty,             // Stroke qwerty input.
00142     EPtiEngineNormalCangjieQwerty,      // Normal Cangjie qwerty input
00143     EPtiEngineEasyCangjieQwerty,        // Easy Cangjie qwerty input
00144     EPtiEngineAdvCangjieQwerty,         // Advanced Cangjie qwerty input
00145     EPtiEngineHiraganaKanjiQwerty,      // Hiragana/Kanji qwerty input mode.
00146     EPtiEngineHiraganaKanjiPredictiveQwerty,  // Predictive Hiragana/Kanji qwerty input mode.
00147     EPtiEngineKatakanaQwerty,           // Half-width Katakana qwerty input mode.
00148     EPtiEngineFullWidthKatakanaQwerty,  // Full-width Katakana qwerty input mode.
00149     EPtiEngineFullWidthNumericQwerty,   // Full-width Alphabet qwerty input mode (for Japanese input).
00150     EPtiEngineFullWidthAlphabetQwerty,  // Full-width Alphabet qwerty input mode (for Japanese input).
00151     EPtiEngineHiraganaQwerty,           // Hiragana only qwerty input mode.
00152     //EPtiEngineMaxInputModes = EPtiEngineHiraganaQwerty,
00153     EPtiEnginePinyinVkb,                   // Chinese pinyin mode.
00154     EPtiEngineStrokeVkb,                   // Chinese stroke mode.
00155     EPtiEngineZhuyinVkb,                    // Chinese zhuyin mode.
00156     EPtiEngineStrokeByPhrase,           // Stroke phrase input.
00157     EPtiEngineStrokePhraseQwerty,       // Stroke phrase qwerty input.
00158     EPtiEngineHiraganaKanjiVkb,           // Hiragana/Kanji mode for VKB.
00159     EPtiEngineHiraganaKanjiPredictiveVkb, // Predictive Hiragana/Kanji mode for VKB.
00160     EPtiEngineHiraganaKanjiHwr,           // Hiragana/Kanji mode for HWR.
00161     EPtiEngineHiraganaKanjiPredictiveHwr, // Predictive Hiragana/Kanji mode for HWR.
00162     EPtiEngineKatakanaVkb,                // Half-width Katakana mode for VKB.
00163     EPtiEngineFullWidthKatakanaVkb,       // Full-width Katakana mode for VKB.
00164     EPtiEngineHiraganaVkb,                // Hiragana only qwerty input mode for VKB.
00165     EPtiEngineNormalCangjieVkb,  
00166     EPtiEngineEasyCangjieVkb,    
00167     EPtiEngineAdvCangjieVkb,     
00168     EPtiEngineInputModeIndicPhoneticMultitap,
00169     EPtiEngineInputModeIndicPhoneticQwerty,
00170     EPtiEngineMaxInputModes = EPtiEngineInputModeIndicPhoneticQwerty
00171     };
00172 
00173 
00187 enum TPtiKey
00188     {
00189     EPtiKeyNone = 0,
00190 
00191     EPtiKey1    = '1',
00192     EPtiKey2    = '2',
00193     EPtiKey3    = '3',
00194     EPtiKey4    = '4',
00195     EPtiKey5    = '5',
00196     EPtiKey6    = '6',
00197     EPtiKey7    = '7',
00198     EPtiKey8    = '8',
00199     EPtiKey9    = '9',
00200     EPtiKeyStar = '*',
00201     EPtiKey0    = '0',
00202     EPtiKeyHash = '#',
00203 
00204     // alternate names
00205     EPtiKeyPunct = EPtiKey1,
00206     EPtiKeyABC   = EPtiKey2,
00207     EPtiKeyDEF   = EPtiKey3,
00208     EPtiKeyGHI   = EPtiKey4,
00209     EPtiKeyJKL   = EPtiKey5,
00210     EPtiKeyMNO   = EPtiKey6,
00211     EPtiKeyPQRS  = EPtiKey7,
00212     EPtiKeyTUV   = EPtiKey8,
00213     EPtiKeyWXYZ  = EPtiKey9,
00214 
00215     // qwerty keys
00216     EPtiKeyQwerty1     = 0x31,   // key (1,2)
00217     EPtiKeyQwerty2     = 0x32,   // key (1,3)
00218     EPtiKeyQwerty3     = 0x33,   // key (1,4)
00219     EPtiKeyQwerty4     = 0x34,   // key (1,5)
00220     EPtiKeyQwerty5     = 0x35,   // key (1,6)
00221     EPtiKeyQwerty6     = 0x36,   // key (1,7)
00222     EPtiKeyQwerty7     = 0x37,   // key (1,8)
00223     EPtiKeyQwerty8     = 0x38,   // key (1,9)
00224     EPtiKeyQwerty9     = 0x39,   // key (1,10)
00225     EPtiKeyQwerty0     = 0x30,   // key (1,11)
00226 
00227         EPtiKeyQwertyPlus  = 0x2b,                      // key (2,1)
00228     EPtiKeyQwertyMinus = EStdKeyMinus,              // key (2,12)
00229     EPtiKeyQwertyComma = EStdKeyComma,              // key (4,9)
00230     EPtiKeyQwertySemicolon = EStdKeySemiColon,      // key (3,11)
00231     EPtiKeyQwertyFullstop = EStdKeyFullStop,        // key (4,10)
00232     EPtiKeyQwertyHash = EStdKeyHash,                // key (3,1)
00233     EPtiKeyQwertySlash = EStdKeyForwardSlash,       // key (4,11)
00234     EPtiKeyQwertyApostrophe = EStdKeySingleQuote,   // key (3,12)
00235     EPtiKeyQwertySpace = EStdKeySpace,              
00236 
00237     EPtiKeyQwertyA = 0x41,     // key (3,2)
00238     EPtiKeyQwertyB = 0x42,     // key (4,6)
00239     EPtiKeyQwertyC = 0x43,     // key (4,4)
00240     EPtiKeyQwertyD = 0x44,     // key (3,4)
00241     EPtiKeyQwertyE = 0x45,     // key (2,4)
00242     EPtiKeyQwertyF = 0x46,     // key (3,5)
00243     EPtiKeyQwertyG = 0x47,     // key (3,6)
00244     EPtiKeyQwertyH = 0x48,     // key (3,7)
00245     EPtiKeyQwertyI = 0x49,     // key (2,9) 
00246     EPtiKeyQwertyJ = 0x4a,     // key (3,8) 
00247     EPtiKeyQwertyK = 0x4b,     // key (3,9) 
00248     EPtiKeyQwertyL = 0x4c,     // key (3,10)
00249     EPtiKeyQwertyM = 0x4d,     // key (4,8)
00250     EPtiKeyQwertyN = 0x4e,     // key (4,7)
00251     EPtiKeyQwertyO = 0x4f,     // key (2,10) 
00252     EPtiKeyQwertyP = 0x50,     // key (2,11)
00253     EPtiKeyQwertyQ = 0x51,     // key (2,1) 
00254     EPtiKeyQwertyR = 0x52,     // key (2,5)
00255     EPtiKeyQwertyS = 0x53,     // key (3,3)
00256     EPtiKeyQwertyT = 0x54,     // key (2,6) 
00257     EPtiKeyQwertyU = 0x55,     // key (2,8)
00258     EPtiKeyQwertyV = 0x56,     // key (4,5)
00259     EPtiKeyQwertyW = 0x57,     // key (2,3)
00260     EPtiKeyQwertyX = 0x58,     // key (4,3)  
00261     EPtiKeyQwertyY = 0x59,     // key (2,7)
00262     EPtiKeyQwertyZ = 0x5a      // key (4,2)
00263     };
00264 
00265 
00291 enum TPtiEngineCapsBits
00292     {
00293     EWordCompletion          = 0x01,
00294     EReordering              = 0x02,
00295     ENextWordPrediction      = 0x04,
00296     ESupportUserDictionaries = 0x08,
00297     ESupportSCTToneMarks     = 0x10,
00298     ESupportCangjieInput     = 0x20,
00299     EPreferedSpelling        = 0x40
00300     };
00301 
00302 
00306 enum TPtiTextCase
00307     {
00308     EPtiCaseLower = 0,    // Normal lower case input
00309     EPtiCaseUpper,        // Normal upper case input.
00310     EPtiCaseChrLower,     // Qwerty chr-key lower case input.
00311     EPtiCaseChrUpper      // Qwerty chr-key upper case input.  
00312     };
00313 
00314 
00315 enum TPtiCharConversion
00316     {
00317     EPtiSimplifiedToComplex = 0x01,  // Chinese simplified to Chinese complex
00318     EPtiUcs2ToUtf8 = 0x02,           // Unicode to utf8
00319     EPtiUcs2ToBig5 = 0x04,           // Unicode to big5
00320     EPtiUcs2ToGB = 0x08,             // Unicode to Guo-Biao
00321     EPtiUtf8ToUcs2 = 0x10,           // Utf8 to Unicode
00322     EPtiKo2ToWc = 0x20,              // KSC5601 to Hangul Syllable
00323     EPtiWcToKo2 = 0x30,              // Hangul Syllable to KSC5601
00324     EPtiBig5ToUcs2 = 0x40,           // Big5 to Unicode
00325     EPtiComplexToSimplified = 0x80   // Chinese complex to Chinese simplified
00326     };
00327 
00328 
00329 enum TPtiSpelling
00330     {
00331     EPtiStrokes = 0x01,
00332     EPtiPinyin = 0x02,
00333     EPtiBopomofo = 0x04,
00334     EPtiZhuyin = 0x08,
00335     EPtiCangJie = 0x16
00336     };
00337 
00338 
00339 enum TPtiChineseVariant
00340     {
00341     EPtiChineseVariantPrc = 0,
00342     EPtiChineseVariantHk,
00343     EPtiChineseVariantTw
00344     };
00345 
00346 
00347 enum TPtiEngineCommand
00348     {
00349     EPtiCommandNone,
00350     EPtiCommandUserActionLeft,
00351     EPtiCommandUserActionRight,
00352     EPtiCommandUserActionConvert,
00353     EPtiCommandUserActionPrevious,
00354     EPtiCommandUserActionLengthen,
00355     EPtiCommandUserActionShorten,
00356     EPtiCommandUserActionCancel,
00357     EPtiCommandUserActionComplete,
00358     EPtiCommandUserActionAllComplete,
00359     EPtiCommandUserActionGetCurrentIndexOfCandidates,
00360     EPtiCommandUserActionCompleteCandidate,
00361     EPtiCommandUserActionCompleteFull0,
00362     EPtiCommandUserActionCompleteFull1,
00363     EPtiCommandUserActionCompleteFull2,
00364     EPtiCommandUserActionCompleteFull3,
00365     EPtiCommandUserActionCompleteFull4,
00366     EPtiCommandUserActionCompleteFull5,
00367     EPtiCommandUserActionCompleteFull6,
00368     EPtiCommandUserActionCompleteFull7,
00369     EPtiCommandUserActionCompleteFull8,
00370     EPtiCommandUserActionCompleteFull9,
00371     EPtiCommandUserActionCompleteHalf0,
00372     EPtiCommandUserActionCompleteHalf1,
00373     EPtiCommandUserActionCompleteHalf2,
00374     EPtiCommandUserActionCompleteHalf3,
00375     EPtiCommandUserActionCompleteHalf4,
00376     EPtiCommandUserActionCompleteHalf5,
00377     EPtiCommandUserActionCompleteHalf6,
00378     EPtiCommandUserActionCompleteHalf7,
00379     EPtiCommandUserActionCompleteHalf8,
00380     EPtiCommandUserActionCompleteHalf9,
00381     EPtiCommandEnableToneMarks,
00382     EPtiCommandDisableToneMarks,
00383     EPtiCommandResetToneMark,
00384     EPtiCommandIncrementToneMark,
00385     EPtiCommandIncrementToneMarkOverrideInvalid,
00386     EPtiCommandReloadLearningInfo,
00387     EPtiCommandUserDictionaryDelaySaving,
00388     EPtiCommandUserDictionarySaveNow,
00389     EPtiCommandUserActionSetCurrentIndexOfCandidates,
00390     EPtiCommandUseLatinDefaultKeyMap,
00391     EPtiCommandUseLatinCaseUpperOnlyKeyMap,
00392     EPtiCommandUseLatinCaseLowerOnlyKeyMap,
00393     EPtiCommandResetLearningInfo,
00394     EPtiCommandPollQwertyDeadKeyRootFlag,             // Indicates that dead key root char was added to buffer.
00395     EPtiCommandGetAndClearDeadKeyRootChar,
00396     EPtiCommandDeadKeyWaiting,
00397     EPtiCommandQueryAndClearGetAllFlag,
00398     EPtiCommandGetAndClearVowelSequence,
00399     EPtiCommandSetMultitapTimer,         // Set multitap timer for japanese varint only
00400     EPtiCommandVowelSeqFlag,
00401     EPtiCommandClearVowelSeq,
00402     EPtiCommandSetJapaneseQwertyFlags,   // Set Japanese Qwerty flags for japanese varint only
00403     EPtiCommandGetAndClearLastVietnameseChar,
00404     EPtiCommandSetVietnameseLastChar,
00405     EPtiCommandQueryReplacePrevious,
00406     EPtiCommandSetLastKeyForVietnamese,
00407     EPtiCommandResetVietnameseVowelSeqAndToneMark,
00408     EPtiCommandGetVietnameseLastKey,
00409     EPtiCommandDoubleWideEntry,
00410     EPtiCommandSetClearFunction,         // Set the behavior of clear key for japanese varint only
00411     EPtiCommandUserActionRetroActiveCandidateHalf,
00412     EPtiCommandUserActionRetroActiveCandidateFull,
00413     EPtiCommandUserActionRetroActiveClear,
00414     EPtiCommandUserActionRetroActiveCommit,
00415     EPtiCommandAppendCharacter,          // Append a character for Japanese varint only
00416     EPtiCommandBackSpaceByForce,          // BackSpace by force for Japanese varint only
00417     EPtiCommandGetPhoneticText,
00418     EPtiCommandClearPhoneticBuffer,
00419     EPtiCommandBreakSyllable,
00420     EPtiCommandAllowPictographCandidate // Allow the candidates with pictograph cahracter for Japanese variant only
00421     // More commands can be added here...
00422     };
00423 
00424 
00425 class TPtiLangName
00426     {
00427     public:
00428         TInt iLanguageCode;
00429         TBuf<KMaxLanguageNameLength> iName;
00430     };
00431 
00432 
00438 #define ELangNumeric 0x5000
00439 
00440 
00441 class MPtiCoreInfo 
00442     {
00443     public: 
00452         virtual TBool WordCompletion() const = 0;
00453         
00462         virtual TBool Reordering() const = 0;
00463         
00470         virtual TInt MaximumWordLength() const = 0;
00471         
00480         virtual TInt MaximumNumberOfCandidates() const = 0;
00481         
00490         virtual TBool NextWordPrediction() const = 0;
00491         
00498         virtual TPtrC VendorString() const = 0;
00499         
00507         virtual TUint32 CapsBits() const = 0;
00508         
00515         virtual TInt32 Uid() const = 0;
00516         
00524         virtual TUint32 CharConversions() const = 0;
00525         
00533         virtual TUint32 Spellings() const = 0;
00534     };
00535 
00536 
00537 
00538 class TPtiCoreInfo : public MPtiCoreInfo
00539     {
00540     public:
00541         inline TBool WordCompletion() const;
00542         inline TBool Reordering() const;
00543         inline TInt MaximumWordLength() const;
00544         inline TInt MaximumNumberOfCandidates() const;
00545         inline TBool NextWordPrediction() const;
00546         inline TPtrC VendorString() const;
00547         inline TInt32 Uid() const;
00548         inline TUint32 CharConversions() const;
00549         inline TUint32 Spellings() const;
00550 
00551         inline TUint32 CapsBits() const;
00552         inline void SetCapsBits(TUint32 aBits);
00553         inline void SetVendorString(const TDesC& aStr);
00554         inline void SetMaxWordLength(TInt aMaxLen);
00555         inline void SetUid(TInt32 aUid);
00556         inline void SetSpellings(TUint32 aSpellings);
00557         inline void SetMaxNumberOfCandidates(TInt aMax);
00558         inline void SetCharConversions(TUint32 aConvs);
00559 
00560     private:
00561         TUint32 iCapsBits;
00562         TPtrC iVendorIdStr;
00563         TInt iMaxWordLength;
00564         TInt iMaxNumberOfCandidates;
00565         TInt32 iUid;
00566         TUint32 iCharConversions;
00567         TUint32 iSpellings;
00568     };
00569 
00570 
00571 #define KPtiEngineChineseSeparator 0x0027
00572 
00573 // Tone marks for pinyin input
00574 enum
00575     {
00576     KPtiPinyinTone0 = 0x02C9,
00577     KPtiPinyinTone1 = 0x02CA,
00578     KPtiPinyinTone2 = 0x02C7,
00579     KPtiPinyinTone3 = 0x02CB,
00580     KPtiPinyinTone4 = 0x02D9
00581     };
00582 
00583 // Tone marks for zhuyin input
00584 enum
00585     {
00586     KPtiZhuyinTone0 = 0x0020,
00587     KPtiZhuyinTone1 = 0x02CA,
00588     KPtiZhuyinTone2 = 0x02C7,
00589     KPtiZhuyinTone3 = 0x02CB,
00590     KPtiZhuyinTone4 = 0x02D9
00591     };
00592 
00593 
00594 class TPtiNumericKeyBinding
00595     {
00596     public:
00597         TUint16 iChar;
00598         TPtiKey iKey;
00599         TPtiTextCase iCase;
00600     };
00601 
00602 // type definition for HWR
00603 typedef struct TRecognitionRangeTag
00604     {
00605     TLanguage iLanguage;
00606     TUint     iSubRange;
00607     } TRecognitionRange;
00608 
00609 enum TRecognitionSubRanges
00610     {
00611     EPtiRangePRCChinese,
00612     EPtiRangeHKChinese,
00613     EPtiRangeTWChinese,
00614     EPtiRangeLatin,
00615     EPtiRangeSymbol,
00616     EPtiRangeNumber,
00617     EPtiRangeNative, // native text of a language, EPtiRangeLatin also belong to it
00618     EPtiRangeHiraganaKanji,
00619     EPtiRangeKatakana,
00620     EPtiRangeFullWidthKatakana,
00621     EPtiRangeFullWidthEnglish,
00622     EPtiRangeFullWidthNumeric,
00623     EPtiRangeHiraganaOnly,
00624     EPtiRangeNativeNumber,
00625     EPtiRangeNone
00626     };
00627 
00628 enum TLatinLetterOrder
00629     {
00630     EUpperFirst,
00631     ELowerFirst
00632     };
00633 
00634 #include "PtiDefs.inl"
00635 
00636 // _PTI_DEFS_H
00637 #endif
00638 
00639 // End od file

Copyright © Nokia Corporation 2001-2008
Back to top