textinput/ptienginev2/inc/PtiDefaultCore.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Default english multitapping core for PtiEngine
       
    15 *               This core implementation is always available.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef _PTI_DEFAULT_CORE_H
       
    21 #define _PTI_DEFAULT_CORE_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "PtiCore.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CPtiKeyMappings;
       
    29 //class CPtiKeyMapData;
       
    30 class CPtiKeyMapDataFactory;
       
    31 
       
    32 const TInt KDefaulCoreMaximumWordLength = 100;
       
    33 const TInt32 KDefaultCoreUid = 0xffffffff;
       
    34 	
       
    35 const TUid KPtiEnginePSUid = {0x101F8610}; // Same as PtiEngine dll
       
    36 enum TPtiEnginePSKeys
       
    37     {
       
    38     EKeyMapPropertyCount,
       
    39     EKeyMapPropertyData
       
    40     };
       
    41 
       
    42 //
       
    43 // TPtiDataFactoryBinding
       
    44 //
       
    45 class TPtiDataFactoryBinding
       
    46     {
       
    47     public:
       
    48         inline TPtiDataFactoryBinding();
       
    49         inline TPtiDataFactoryBinding(TInt aLanguage, TInt aImplUid);        
       
    50     
       
    51     public:
       
    52         TInt iLanguage;
       
    53         TInt iFactoryImplUid;      
       
    54     };
       
    55 
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // TPtiDataFactoryBinding::TPtiDataFactoryBinding
       
    59 // 
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 inline TPtiDataFactoryBinding::TPtiDataFactoryBinding() :
       
    63 		iLanguage(0), iFactoryImplUid(0)
       
    64 	{    
       
    65 	}
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // TPtiDataFactoryBinding::TPtiDataFactoryBinding
       
    69 // 
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 inline TPtiDataFactoryBinding::TPtiDataFactoryBinding(TInt aLanguage, TInt aImplUid) 
       
    73                                  : iLanguage(aLanguage), iFactoryImplUid(aImplUid)
       
    74     {    
       
    75     }
       
    76 
       
    77 
       
    78 //
       
    79 // CMultiTapTimer
       
    80 //
       
    81 NONSHARABLE_CLASS(CMultiTapTimer) : public CTimer
       
    82 	{
       
    83 	public:
       
    84 		static CMultiTapTimer* NewL(TCallBack aCallback);
       
    85 		void After(TTimeIntervalMicroSeconds32 aInterval);
       
    86 	private:
       
    87 		CMultiTapTimer(TCallBack aCallback);
       
    88 		void ConstructL();
       
    89 		// from CActive
       
    90 		virtual void RunL();
       
    91 	private:
       
    92 		TCallBack iCallback;
       
    93 	};
       
    94 
       
    95 
       
    96 /**
       
    97 Default multitapping & qwerty core. 	
       
    98 */
       
    99 NONSHARABLE_CLASS(CPtiDefaultCore) : public CPtiCore
       
   100 	{
       
   101 	public:
       
   102 		static CPtiDefaultCore* NewL(CPtiEngine* aOwner, TDes* aTextBuffer);
       
   103 		~CPtiDefaultCore();
       
   104 
       
   105 		 // From MPtiCore
       
   106 		 void InitializeL(CPtiEngine* aOwner, TDes* aTextBuffer, CArrayPtrFlat<CPtiCoreLanguage>* aLanguageList, TBool aUseDefautUserDictionary);
       
   107 		 void DropLanguages(CArrayPtrFlat<CPtiCoreLanguage>* aLanguageList);
       
   108 		 TInt OpenLanguageL(CPtiCoreLanguage *aLanguage);
       
   109 		 TInt CloseLanguageL();
       
   110 		 TPtrC GetCurrentWord() const;
       
   111 		 TInt CommitCurrentWord();
       
   112 		 TInt NumberOfCandidates();
       
   113 		 MPtiCoreInfo* GetCoreInfo();		 
       
   114 		 TInt SetReordering(TBool aStatus);
       
   115 		 void AppendKeyPress(TPtiKey aKey);
       
   116 		 void DeleteKeyPress();
       
   117 		 void ClearBuffer();
       
   118 		 TInt SetCurrentInputSequence(TPtrC8 aInput);			
       
   119 		 TInt Convert(TPtiCharConversion aType,
       
   120 					  TAny* aInput,
       
   121 					  TInt aInputLength,
       
   122 					  TAny* aOutput);
       
   123 		TInt SetExternalKeyMapL(TPtiEngineInputMode aMode,
       
   124                                 TPtiKey aKey,
       
   125     						    TDesC& aKeyMap,
       
   126 								TPtiTextCase aCase);
       
   127 		TInt GetSpelling(TUint16 aInput, TDes& aOutput, TPtiSpelling aType);
       
   128 		TInt CancelTimerActivity();
       
   129 		TInt HandleCommandL(TPtiEngineCommand aCommand, TAny* aParams);
       
   130 		void ListDataFactoryLanguagesL(CPtiKeyMapDataFactory* aDataFactory,
       
   131 		                               TInt aImplUid,
       
   132 		                               CArrayPtrFlat<CPtiCoreLanguage>* aLanguageList);		
       
   133 		void LoadFactoryForLanguageL(TInt aLanguage);
       
   134    		   
       
   135 	private:
       
   136 		 CPtiDefaultCore();
       
   137 		 CPtiDefaultCore(CPtiEngine* aOwner, TDes* aTextBuffer);
       
   138 		 void ConstructL();
       
   139 		 static TInt TimerExpire(TAny* aPtr);
       
   140 		 TInt DoTimerExpire(); 
       
   141 		 void FillCoreInfo();
       
   142 		 void ClearVowelSequence();
       
   143 		 void ShutDownKeymapFactory();
       
   144 
       
   145 	private:
       
   146 	     enum 
       
   147 	     	{
       
   148 	     	EPtiDeadKeyRootFlag = 0x01,
       
   149 	     	EPtiGetAllFlag      = 0x02,
       
   150 	     	EPtiFlagVowelSeq   	= 0x04,   
       
   151    			EPtiDoubleWideEntry = 0x08     		     	  	
       
   152 	      	};
       
   153 	     inline void SetFlag(TInt aFlag);
       
   154 	     inline TBool IsFlagSet(TInt aFlag) const;
       
   155 	     inline void ClearFlag(TInt aFlag); 	
       
   156 
       
   157 	private:
       
   158 		CPtiEngine*      iOwner;            // Not owned.
       
   159 		TDes*            iTextBuffer;		// Not owned.
       
   160 		CMultiTapTimer*  iTimer;
       
   161 		TPtiCoreInfo     iCoreInfo;
       
   162 		CPtiKeyMappings* iNumericMappings;
       
   163 		CPtiKeyMapData*  iNumericData;		
       
   164 		TInt             iFlags;
       
   165         CPtiKeyMapDataFactory* iKeyMapDataFactory;		     
       
   166         RArray<TPtiDataFactoryBinding> iFactoryBindings;  
       
   167         CArrayPtrFlat<CPtiCoreLanguage>* iLanguageList;   // Not owned                    			
       
   168 	};
       
   169 
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // CPtiDefaultCore::SetFlag
       
   173 // 
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 inline void CPtiDefaultCore::SetFlag(TInt aFlag)
       
   177 	{
       
   178 	iFlags |= aFlag;
       
   179 	}
       
   180 	
       
   181 // ---------------------------------------------------------------------------
       
   182 // CPtiDefaultCore::IsFlagSet
       
   183 // 
       
   184 // ---------------------------------------------------------------------------
       
   185 //	
       
   186 inline TBool CPtiDefaultCore::IsFlagSet(TInt aFlag) const
       
   187 	{
       
   188 	return (iFlags & aFlag) != 0;	
       
   189 	}
       
   190 	
       
   191 // ---------------------------------------------------------------------------
       
   192 // CPtiDefaultCore::ClearFlag
       
   193 // 
       
   194 // ---------------------------------------------------------------------------
       
   195 //	
       
   196 inline void CPtiDefaultCore::ClearFlag(TInt aFlag)
       
   197 	{
       
   198     iFlags &= ~aFlag;	
       
   199 	}
       
   200 
       
   201 #endif  // _PTI_DEFAULT_CORE_H
       
   202 
       
   203 // End of file