|
1 /* |
|
2 * Copyright (c) 2008 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: This is the implementation of application class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "su8russianint.h" |
|
20 #include "hiddebug.h" |
|
21 #include "hidlayoutids.h" |
|
22 |
|
23 // CONSTANTS |
|
24 |
|
25 // Look-up tables to translate HID keyboard usage codes (usage page 7) |
|
26 // to the corresponding Symbian "TKeyCode" (Unicode) values: |
|
27 |
|
28 const TInt CSu8RussianIntLayout::KColumnMap[] = |
|
29 { |
|
30 THidModifier::EUnmodified, |
|
31 THidModifier::EShift, |
|
32 THidModifier::EAltCtrl, |
|
33 THidModifier::EAltCtrlShift |
|
34 }; |
|
35 |
|
36 const TUint16 CSu8RussianIntLayout::KKeyCodes[] = |
|
37 |
|
38 { |
|
39 //---- ---S AC ACS // Hex Dec Usage name (UK) |
|
40 0, 0, 0, 0, // 0x00 0 Reserved (no event) |
|
41 0, 0, 0, 0, // 0x01 1 Rollover error |
|
42 0, 0, 0, 0, // 0x02 2 POST Fail |
|
43 0, 0, 0, 0, // 0x03 3 Undefined error |
|
44 0x444, 0x424, 'a', 'A', // 0x04 4 a |
|
45 0x438, 0x418, 'b', 'B', // 0x05 5 b |
|
46 'c', 'C', 'c', 'C', // 0x06 6 c |
|
47 0x432, 0x412, 'd', 'D', // 0x07 7 d |
|
48 0x443, 0x423, 'e', 'E', // 0x08 8 e |
|
49 0x430, 0x410, 'f', 'F', // 0x09 9 f |
|
50 0x43f, 0x41f, 'g', 'G', // 0x0a 10 g |
|
51 0x440, 0x420, 'h', 'H', // 0x0b 11 h |
|
52 0x448, 0x428, 'i', 'I', // 0x0c 12 i |
|
53 0x43e, 0x41e, 'j', 'J', // 0x0d 13 j |
|
54 0x43b, 0x41b, 'k', 'K', // 0x0e 14 k |
|
55 0x434, 0x414, 'l', 'L', // 0x0f 15 l |
|
56 0x44c, 0x42c, 'm', 'M', // 0x10 16 m |
|
57 0x442, 0x422, 'n', 'N', // 0x11 17 n |
|
58 0x449, 0x429, 'o', 'O', // 0x12 18 o |
|
59 0x437, 0x417, 'p', 'P', // 0x13 19 p |
|
60 0x439, 0x419, 'q', 'Q', // 0x14 20 q |
|
61 0x43a, 0x41a, 'r', 'R', // 0x15 21 r |
|
62 0x44b, 0x42b, 's', 'S', // 0x16 22 s |
|
63 0x435, 0x415, 't', 'T', // 0x17 23 t |
|
64 0x433, 0x413, 'u', 'U', // 0x18 24 u |
|
65 0x43c, 0x41c, 'v', 'V', // 0x19 25 v |
|
66 0x446, 0x426, 'w', 'W', // 0x1a 26 w |
|
67 0x447, 0x427, 'x', 'X', // 0x1b 27 x |
|
68 0x43d, 0x41d, 'y', 'Y', // 0x1c 28 y |
|
69 0x44f, 0x42f, 'z', 'Z', // 0x1d 29 z |
|
70 '1', '!', '!', '!', // 0x1e 30 1 |
|
71 '2', '@', '"', '@', // 0x1f 31 2 |
|
72 '3', '#', '#', '#', // 0x20 32 3 |
|
73 '4', '$', 0x00a4, '$', // 0x21 33 4 |
|
74 '5', '%', '%', '%', // 0x22 34 5 |
|
75 '6', '^', '&', '^', // 0x23 35 6 |
|
76 '7', '&', '/', '&', // 0x24 36 7 |
|
77 '8', '*', '(', '*', // 0x25 37 8 |
|
78 '9', '(', ')', '(', // 0x26 38 9 |
|
79 '0', ')', '=', ')', // 0x27 39 0 |
|
80 0x000d, 0xf845, 0,0, // 0x28 40 Enter |
|
81 0x001b, 0x001b, 0,0, // 0x29 41 Escape |
|
82 0x0008, 0x0008, 0,0, // 0x2a 42 Backspace |
|
83 0x0009, 0x0009, 0,0, // 0x2b 43 Tab |
|
84 ' ', ' ', 0,0, // 0x2c 44 Space |
|
85 '-', '_', '+', '?', // 0x2d 45 |
|
86 '=', '+', '=', '+', // 0x2e 46 |
|
87 0x445, 0x425, '[', '{', // 0x2f 47 |
|
88 0x44a, 0x42a, ']', '}', // 0x30 48 |
|
89 '\\', '|', '\\','|', // 0x31 49 |
|
90 0, 0, 0,0, // 0x32 50 |
|
91 0x436, 0x416, ';', ':', // 0x33 51 |
|
92 0x44d, 0x42d, '\'','"', // 0x34 52 |
|
93 0x451, 0x401, '`', '~', // 0x35 53 |
|
94 0x431, 0x411, ',', '<', // 0x36 54 |
|
95 0x44e, 0x42e, '.', '>', // 0x37 55 |
|
96 '/', '?', '/', '?' // 0x38 56 |
|
97 }; |
|
98 /* |
|
99 //---- ---S -AC- // Hex Dec |
|
100 0, 0, 0, // 0x00 0 |
|
101 0, 0, 0, // 0x01 1 |
|
102 0, 0, 0, // 0x02 2 |
|
103 0, 0, 0, // 0x03 3 |
|
104 'a', 'A', 0, // 0x04 4 |
|
105 'b', 'B', 0, // 0x05 5 |
|
106 'c', 'C', 0, // 0x06 6 |
|
107 'd', 'D', 0, // 0x07 7 |
|
108 'e', 'E', 0x20ac, // 0x08 8 |
|
109 'f', 'F', 0, // 0x09 9 |
|
110 'g', 'G', 0, // 0x0a 10 |
|
111 'h', 'H', 0, // 0x0b 11 |
|
112 'i', 'I', '[', // 0x0c 12 |
|
113 'j', 'J', 0, // 0x0d 13 |
|
114 'k', 'K', 0, // 0x0e 14 |
|
115 'l', 'L', 0, // 0x0f 15 |
|
116 'm', 'M', 0, // 0x10 16 |
|
117 'n', 'N', 0, // 0x11 17 |
|
118 'o', 'O', ']', // 0x12 18 |
|
119 'p', 'P', '}', // 0x13 19 |
|
120 'q', 'Q', 0x005e, // 0x14 20 |
|
121 'r', 'R', '$', // 0x15 21 |
|
122 's', 'S', 0, // 0x16 22 |
|
123 't', 'T', 0x00a3, // 0x17 23 |
|
124 'u', 'U', '{', // 0x18 24 |
|
125 'v', 'V', 0, // 0x19 25 |
|
126 'w', 'W', '@', // 0x1a 26 |
|
127 'x', 'X', 0, // 0x1b 27 |
|
128 'z', 'Z', 0, // 0x1c 28 |
|
129 'y', 'Y', 0, // 0x1d 29 |
|
130 '1', '!', 0x005e, // 0x1e 30 |
|
131 '2', '"', '@', // 0x1f 31 |
|
132 '3', '#', 0x20ac, // 0x20 32 |
|
133 '4', 0x00a4, '$', // 0x21 33 |
|
134 '5', '%', 0x00a3, // 0x22 34 |
|
135 '6', '&', 0, // 0x23 35 |
|
136 '7', '/', '{', // 0x24 36 |
|
137 '8', '(', '[', // 0x25 37 |
|
138 '9', ')', ']', // 0x26 38 |
|
139 '0', '=', '}', // 0x27 39 |
|
140 0x000d, 0xf845, 0, // 0x28 40 |
|
141 0x001b, 0x001b, 0, // 0x29 41 |
|
142 0x0008, 0x0008, 0, // 0x2a 42 |
|
143 0x0009, 0x0009, 0, // 0x2b 43 |
|
144 ' ', ' ', 0, // 0x2c 44 |
|
145 '+', '?', 0, // 0x2d 45 |
|
146 0x00b4, 0x0060, '\\', // 0x2e 46 |
|
147 0x00fc, 0x00dc, 0, // 0x2f 47 |
|
148 0x00df, 0x00df, '\\', // 0x30 48 |
|
149 0x00e4, 0x00c4, 0, // 0x31 49 |
|
150 0, 0, 0, // 0x32 50 |
|
151 0x00f6, 0x00d6, 0, // 0x33 51 |
|
152 0x00e4, 0x00c4, 0, // 0x34 52 |
|
153 0x0027, 0x002a, 0x007e, // 0x35 53 |
|
154 ',', ';', '<', // 0x36 54 |
|
155 '.', ':', '>', // 0x37 55 |
|
156 '-', '_', 0x00a8 // 0x38 56 |
|
157 }; |
|
158 */ |
|
159 |
|
160 // ---------------------------------------------------------------------- |
|
161 // Other codes not included in the KKeyCodes table: |
|
162 |
|
163 const CStandardKeyboardLayout::TSpecialKey |
|
164 CSu8RussianIntLayout::KSpecialCases[] = |
|
165 { |
|
166 // HID usage, modifiers, Unicode |
|
167 { 0x28, THidModifier::ECtrl, 0xf845 }, // Ctrl-enter (Return) |
|
168 { 0x2c, THidModifier::ECtrl, 0x0020 }, // Ctrl-spacebar |
|
169 { 0x2b, THidModifier::EAlt, 0xf852 }, // Alt-tab |
|
170 { 0x4c, THidModifier::EUnmodified, 0x007f }, // Delete |
|
171 { 0x4c, THidModifier::EShift, 0x007f }, // Shift-Delete |
|
172 { 0x4c, THidModifier::EAltCtrl, 0xf844 }, // Alt-ctrl-delete |
|
173 { 0x4f, THidModifier::EUnmodified, 0xf808 }, // Right arrow |
|
174 { 0x4f, THidModifier::EShift, 0xf808 }, // Shift-right arrow |
|
175 { 0x50, THidModifier::EUnmodified, 0xf807 }, // Left arrow |
|
176 { 0x50, THidModifier::EShift, 0xf807 }, // Shift-left arrow |
|
177 { 0x51, THidModifier::EUnmodified, 0xf80a }, // Down arrow |
|
178 { 0x51, THidModifier::EShift, 0xf80a }, // Shift-down arrow |
|
179 { 0x52, THidModifier::EUnmodified, 0xf809 }, // Up arrow |
|
180 { 0x52, THidModifier::EShift, 0xf809 }, // Shift-up arrow |
|
181 { 0xe3, THidModifier::EFunc, 0xf842 }, // Left GUI key |
|
182 { 0xe7, THidModifier::EFunc, 0xf843 }, // Right GUI key |
|
183 { 0xe3, THidModifier::EFuncShift, 0xf862 }, // Left GUI key |
|
184 { 0xe7, THidModifier::EFuncShift, 0xf863 }, // Right GUI key |
|
185 { 0x76, THidModifier::EUnmodified, 0xf852 }, // App switch to App0 |
|
186 { 0x76, THidModifier::EShift, 0xf852 }, // Shift-App switch to App0 |
|
187 { 0x77, THidModifier::EUnmodified, 0xf845 }, // MSK to OK |
|
188 { 0x77, THidModifier::EShift, 0xf845 }, // Shift-MSK to OK |
|
189 // |
|
190 { 0x00 } // end of table |
|
191 }; |
|
192 |
|
193 // ---------------------------------------------------------------------- |
|
194 |
|
195 // 0x00b4 (Acute accent) |
|
196 // |
|
197 const CDeadKeyLayout::TKeyPair CSu8RussianIntLayout::KDeadKeyAcute[] = |
|
198 { |
|
199 { 0x0020, 0x00b4 }, // space |
|
200 { 0x0041, 0x00c1 }, // A |
|
201 { 0x0045, 0x00c9 }, // E |
|
202 { 0x0049, 0x00cd }, // I |
|
203 { 0x004f, 0x00d3 }, // O |
|
204 { 0x0055, 0x00da }, // U |
|
205 { 0x0059, 0x00dd }, // Y |
|
206 { 0x0061, 0x00e1 }, // a |
|
207 { 0x0065, 0x00e9 }, // e |
|
208 { 0x0069, 0x00ed }, // i |
|
209 { 0x006f, 0x00f3 }, // o |
|
210 { 0x0075, 0x00fa }, // u |
|
211 { 0x0079, 0x00fd }, // y |
|
212 { 0x0000 } // end of table |
|
213 }; |
|
214 |
|
215 // 0x0060 (Grave accent) |
|
216 // |
|
217 const CDeadKeyLayout::TKeyPair CSu8RussianIntLayout::KDeadKeyGrave[] = |
|
218 { |
|
219 { 0x0020, 0x0060 }, // space |
|
220 { 0x0041, 0x00c0 }, // A |
|
221 { 0x0045, 0x00c8 }, // E |
|
222 { 0x0049, 0x00cc }, // I |
|
223 { 0x004f, 0x00d2 }, // O |
|
224 { 0x0055, 0x00d9 }, // U |
|
225 { 0x0061, 0x00e0 }, // a |
|
226 { 0x0065, 0x00e8 }, // e |
|
227 { 0x0069, 0x00ec }, // i |
|
228 { 0x006f, 0x00f2 }, // o |
|
229 { 0x0075, 0x00f9 }, // u |
|
230 { 0x0000 } // end of table |
|
231 }; |
|
232 |
|
233 // 0x005e (Circumflex accent) |
|
234 // |
|
235 const CDeadKeyLayout::TKeyPair CSu8RussianIntLayout::KDeadKeyCircumflex[] = |
|
236 { |
|
237 { 0x0020, 0x005e }, // space |
|
238 { 0x0041, 0x00c2 }, // A |
|
239 { 0x0045, 0x00ca }, // E |
|
240 { 0x0049, 0x00ce }, // I |
|
241 { 0x004f, 0x00d4 }, // O |
|
242 { 0x0055, 0x00db }, // U |
|
243 { 0x0061, 0x00e2 }, // a |
|
244 { 0x0065, 0x00ea }, // e |
|
245 { 0x0069, 0x00ee }, // i |
|
246 { 0x006f, 0x00f4 }, // o |
|
247 { 0x0075, 0x00fb }, // u |
|
248 { 0x0000 } // end of table |
|
249 }; |
|
250 |
|
251 // ---------------------------------------------------------------------- |
|
252 |
|
253 const CDeadKeyLayout::TIndexPair CSu8RussianIntLayout::KDeadKeyIndex[] = |
|
254 { |
|
255 { 0x00b4, KDeadKeyAcute }, |
|
256 { 0x0060, KDeadKeyGrave }, |
|
257 { 0x005e, KDeadKeyCircumflex }, |
|
258 { 0x0000 } // end of table |
|
259 }; |
|
260 |
|
261 // ---------------------------------------------------------------------- |
|
262 |
|
263 CSu8RussianIntLayout::CSu8RussianIntLayout() |
|
264 : CDeadKeyLayout(KColumnMap, sizeof (KColumnMap), |
|
265 KKeyCodes, sizeof (KKeyCodes), KSpecialCases, KDeadKeyIndex) |
|
266 { |
|
267 // nothing else to do |
|
268 } |
|
269 |
|
270 TBool CSu8RussianIntLayout::ChangesWithCapsLock(TInt aHidKey, |
|
271 THidModifier aModifiers) const |
|
272 { |
|
273 if (aModifiers.None() || aModifiers.ShiftOnly()) |
|
274 { |
|
275 // Additional keys that should behave as if shift is pressed |
|
276 // whenever caps lock is active: |
|
277 // |
|
278 TBool isExtraCapsKey = |
|
279 (aHidKey == 0x1e) || (aHidKey == 0x1f) || (aHidKey == 0x20) || |
|
280 (aHidKey == 0x21) || (aHidKey == 0x22) || (aHidKey == 0x23) || |
|
281 (aHidKey == 0x24) || (aHidKey == 0x25) || (aHidKey == 0x26) || |
|
282 (aHidKey == 0x27) || (aHidKey == 0x2d) || (aHidKey == 0x2f) || |
|
283 (aHidKey == 0x31) || (aHidKey == 0x33) || (aHidKey == 0x34) || |
|
284 (aHidKey == 0x36) || (aHidKey == 0x37); |
|
285 |
|
286 if (isExtraCapsKey) |
|
287 return ETrue; |
|
288 } |
|
289 |
|
290 return CDeadKeyLayout::ChangesWithCapsLock(aHidKey, aModifiers); |
|
291 } |
|
292 |
|
293 TInt CSu8RussianIntLayout::RawScanCode(TInt aHidKey, |
|
294 TInt aUsagePage, THidModifier aModifiers) const |
|
295 { |
|
296 TInt result = EStdKeyNull; |
|
297 |
|
298 const TInt KKeyboardUsagePage = 0x07; |
|
299 if (aUsagePage == KKeyboardUsagePage) |
|
300 { |
|
301 // Application switch key is HID "Keyboard Menu" usage: |
|
302 // |
|
303 const TInt KHidKeyboardMenu = 0x76; |
|
304 if (aHidKey == KHidKeyboardMenu) |
|
305 { |
|
306 result = EStdKeyApplication0; |
|
307 } |
|
308 |
|
309 // Middle soft key is HID "Keyboard Select" usage: |
|
310 // |
|
311 const TInt KHidKeyboardSelect = 0x77; |
|
312 if (aHidKey == KHidKeyboardSelect) |
|
313 { |
|
314 result = EStdKeyDevice3; |
|
315 } |
|
316 } |
|
317 |
|
318 if (result == EStdKeyNull) |
|
319 { |
|
320 result = CDeadKeyLayout::RawScanCode(aHidKey, |
|
321 aUsagePage, aModifiers); |
|
322 } |
|
323 |
|
324 return result; |
|
325 } |
|
326 |
|
327 TInt CSu8RussianIntLayout::LayoutId() const |
|
328 { |
|
329 DBG(RDebug::Print(_L("[HID]\tCSu8RussianIntLayout::LayoutId()"))); |
|
330 return ESu8Russian; |
|
331 } |
|
332 |
|
333 CKeyboardLayout* CSu8RussianIntLayout::NewL() |
|
334 { |
|
335 DBG(RDebug::Print(_L("[HID]\tCSu8RussianIntLayout::NewL()"))); |
|
336 CKeyboardLayout* layout = new (ELeave) CSu8RussianIntLayout; |
|
337 return layout; |
|
338 } |
|
339 |
|
340 // End of file |
|
341 |