author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:15:33 +0300 | |
branch | RCL_3 |
changeset 85 | 38bb213f60ba |
parent 63 | f4a778e096c2 |
permissions | -rw-r--r-- |
63 | 1 |
/* |
2 |
* Copyright (c) 2006-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: Class to hold the character to key mappings |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef __CPCS_KEY_MAP_ALGORITHM_2_H__ |
|
19 |
#define __CPCS_KEY_MAP_ALGORITHM_2_H__ |
|
20 |
||
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
21 |
// The macro is used for a hack which fix a problem of PtiEngine with Sonja keyboard. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
22 |
// The problem is that J/# key can't returned character code ('J', 'j', '#') |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
23 |
#define HACK_FOR_E72_J_KEY |
63 | 24 |
|
25 |
// INCLUDES |
|
26 |
#include <e32base.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
27 |
#include <PtiEngine.h> |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
28 |
#include <PtiKeyMappings.h> |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
29 |
#include <AvkonInternalCRKeys.h> |
63 | 30 |
#include <e32property.h> |
31 |
||
32 |
class CPcsAlgorithm2; |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
33 |
class CPtiEngine; |
63 | 34 |
|
35 |
class TKeyMappingData |
|
36 |
{ |
|
37 |
public: |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
38 |
TPtiKey key; // key |
63 | 39 |
RArray<TInt> iKeyMappingArray; // All the characters mapped to the key |
40 |
}; |
|
41 |
||
42 |
// CLASS DECLARATION |
|
43 |
class CPcsKeyMap : public CBase |
|
44 |
{ |
|
45 |
||
46 |
public: |
|
47 |
||
48 |
/** |
|
49 |
* Two phase construction |
|
50 |
*/ |
|
51 |
static CPcsKeyMap* NewL(CPcsAlgorithm2* aAlgorithm); |
|
52 |
||
53 |
/** |
|
54 |
* Destructor |
|
55 |
*/ |
|
56 |
virtual ~CPcsKeyMap(); |
|
57 |
||
58 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
59 |
* Converts the alphanumeric string to numeric string |
63 | 60 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
61 |
void GetNumericKeyString(const TDesC& alphaNumericStr, TDes& numericStr); |
63 | 62 |
|
63 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
64 |
* Returns the numeric key id corresponding to a specific character |
63 | 65 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
66 |
TInt KeyForCharacter(const TChar& aChar); |
63 | 67 |
|
68 |
/** |
|
69 |
* Returns ETrue if this language is supported |
|
70 |
*/ |
|
71 |
TBool IsLanguageSupportedL(const TUint32 aLanguage); |
|
72 |
||
73 |
void ReconstructKeymapL(); |
|
74 |
||
75 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
76 |
* Returns the pool Id for a Character |
63 | 77 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
78 |
TInt PoolIdForCharacter(TChar aChar); |
63 | 79 |
|
80 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
81 |
* Returns total number of pools |
63 | 82 |
*/ |
83 |
TInt PoolCount(); |
|
84 |
||
85 |
private: |
|
86 |
||
87 |
/** |
|
88 |
* Constructor |
|
89 |
*/ |
|
90 |
CPcsKeyMap(); |
|
91 |
||
92 |
/** |
|
93 |
* Second phase constructor |
|
94 |
*/ |
|
95 |
void ConstructL(CPcsAlgorithm2* aAlgorithm); |
|
96 |
||
97 |
/** |
|
98 |
* Helper function to construct keyboard specific mappings |
|
99 |
*/ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
100 |
void ContructForItutKeyboardL(TLanguage aLanguage); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
101 |
void ContructForHalfQwertyKeyboardL(TLanguage aLanguage); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
102 |
void ContructFor4x10QwertyKeyboardL(TLanguage aLanguage); |
63 | 103 |
|
104 |
/** |
|
105 |
* Helper function to populate Itut key mappings |
|
106 |
*/ |
|
107 |
void AddKeyMapforItutL(TLanguage aLanguage); |
|
108 |
||
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
109 |
void AddDataForItutKeyboardL(CPtiKeyMappings* aPtiKeyMappings, |
63 | 110 |
TPtiKey aKey, TKeyMappingData& aKeyDataList); |
111 |
/** |
|
112 |
* Helper function to populate 4x10 Qwerty Keyboard key mappings |
|
113 |
*/ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
114 |
void AddKeyMapfor4x10QwertyKeyboardL(TLanguage aLanguage); |
63 | 115 |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
116 |
void AddDataFor4x10QwertyKeyboardL( |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
117 |
CPtiQwertyKeyMappings* aPtiKeyMappings, TPtiKey aKey, |
63 | 118 |
TKeyMappingData& aKeyDataList); |
119 |
||
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
120 |
#ifdef HACK_FOR_E72_J_KEY |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
121 |
void AddDataFor4x10QwertyKeyboardE72HackL(); // Hack for E72 (J/# key) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
122 |
#endif // HACK_FOR_E72_J_KEY |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
123 |
|
63 | 124 |
/** |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
125 |
* Helper function to populate alfQwerty Keyboard key mappings |
63 | 126 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
127 |
void AddKeyMapforHalfQwertyKeyboardL(TLanguage aLanguage); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
128 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
129 |
void AddDataForHalfQwertyKeyboardL(CPtiHalfQwertyKeyMappings* aPtiKeyMappings, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
130 |
TPtiKey aKey, TKeyMappingData& aKeyDataList); |
63 | 131 |
|
132 |
void ResetKeyMap(); |
|
133 |
/** |
|
134 |
* Function to construct key mappings for a particula language |
|
135 |
* |
|
136 |
*/ |
|
137 |
void ConstructKeymapL(); |
|
138 |
||
139 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
140 |
* Get the current keyboard type. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
141 |
* @return current keyboard type. |
63 | 142 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
143 |
TInt CurrentKeyBoardTypeL(); |
63 | 144 |
|
145 |
/** |
|
146 |
* |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
147 |
* Construct keymap by type and language |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
148 |
* @ aKeyboardType, the current keyboard type. |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
149 |
* @ aLanguage, the keymap construct language. |
63 | 150 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
151 |
void ConstructConcreteKeyMapL( TInt aKeyboardType, TLanguage aLanguage ); |
63 | 152 |
|
153 |
/** |
|
154 |
* |
|
155 |
* Add keymap for keyboard by type and language |
|
156 |
* @ aKeyboardType, the current keyboard type. |
|
157 |
* @ aLanguage, the keymap construct language. |
|
158 |
*/ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
159 |
void AddKeyMapforConcreteKeyboardL( TInt aKeyboardType, TLanguage aLanguage ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
160 |
|
63 | 161 |
/** |
162 |
* In case the given character is a Chinese characer, give the first |
|
163 |
* character of it's first spelling using the current spelling mode. |
|
164 |
* Otherwise, the character is returned unmodified. |
|
165 |
*/ |
|
166 |
TChar FirstCharFromSpellingL( TChar aChar ) const; |
|
167 |
||
168 |
private: |
|
169 |
CPtiEngine* iPtiEngine; |
|
170 |
||
171 |
CPcsAlgorithm2* iAlgorithm; |
|
172 |
/** |
|
173 |
* Array to hold the list of languages not supported |
|
174 |
*/ |
|
175 |
RArray<TLanguage> iLanguageNotSupported; |
|
176 |
||
177 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
178 |
* Flag to indicate if Phone is Chinese variant |
63 | 179 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
180 |
RArray<TPtiKey> iKeysForPoolFormation; |
63 | 181 |
|
182 |
/** |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
183 |
* Contains all the keys and the characters mapped to each key |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
184 |
* own |
63 | 185 |
*/ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
186 |
RPointerArray<TKeyMappingData> iAllKeyMappingsPtrArr; |
63 | 187 |
|
188 |
}; |
|
189 |
||
190 |
#endif // __CPCS_KEY_MAP_ALGORITHM_2_H__ |
|
191 |
||
192 |
// End of file |