|
1 /* |
|
2 * Copyright (c) 2006 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: Input method related functionality. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPHONEQWERTYHANDLER_H |
|
21 #define CPHONEQWERTYHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "mphoneqwertymodeobserver.h" |
|
26 #include "mphonelangsettingobserver.h" |
|
27 #include <PtiDefs.h> |
|
28 #include <w32std.h> |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CPhoneLangSettingMonitor; |
|
34 class CPhoneQwertyModeMonitor; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Input method related functionality. |
|
40 * |
|
41 */ |
|
42 class CPhoneQwertyHandler : public CBase, |
|
43 private MPhoneLangSettingObserver, |
|
44 private MPhoneQwertyModeObserver |
|
45 { |
|
46 friend class T_CPhoneQwertyHandlerUT; |
|
47 |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 */ |
|
53 IMPORT_C static CPhoneQwertyHandler* NewL(); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 IMPORT_C virtual ~CPhoneQwertyHandler(); |
|
59 |
|
60 /** |
|
61 * Checks if qwerty input is used. |
|
62 * @return ETrue if in qwerty mode. |
|
63 */ |
|
64 IMPORT_C TBool IsQwertyInput() const; |
|
65 |
|
66 /** |
|
67 * Gets keycode according to current keyboard mapping. |
|
68 */ |
|
69 IMPORT_C TInt NumericKeyCode( const TKeyEvent& aKeyEvent ); |
|
70 |
|
71 /** |
|
72 * Converts the key code of the event to numeric mode code and removes |
|
73 * any modifiers so that editor component will not do any more conversions. |
|
74 * Does nothing if the key doesn't map to any numeric mode characters. |
|
75 * @return ETrue if key contained any numeric mode character |
|
76 */ |
|
77 IMPORT_C TBool ConvertToNumeric( TKeyEvent& aKeyEvent ); |
|
78 |
|
79 /** |
|
80 * Add qwerty mode observer. |
|
81 */ |
|
82 IMPORT_C void AddQwertyModeObserverL( MPhoneQwertyModeObserver& aObserver ); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * @see MIdleLangSettingObserver. |
|
88 */ |
|
89 void HandleInputLanguageSettingChange( TInt aLanguage ); |
|
90 |
|
91 /** |
|
92 * @see MIdleQwertyModeObserver. |
|
93 */ |
|
94 void HandleQwertyModeChange( TInt aMode ); |
|
95 |
|
96 /** |
|
97 * @see MIdleQwertyModeObserver. |
|
98 */ |
|
99 void HandleKeyboardLayoutChange(); |
|
100 |
|
101 /** |
|
102 * C++ default constructor. |
|
103 */ |
|
104 CPhoneQwertyHandler(); |
|
105 |
|
106 /** |
|
107 * By default Symbian 2nd phase constructor is private. |
|
108 */ |
|
109 void ConstructL(); |
|
110 |
|
111 /** |
|
112 * LoadNumericKeyBindings |
|
113 */ |
|
114 void LoadNumericKeyBindings( TInt aLanguage, TInt aKeyboard ); |
|
115 |
|
116 /** |
|
117 * Check if given character is a number character |
|
118 */ |
|
119 TBool IsNumber( TText aChar ) const; |
|
120 |
|
121 |
|
122 private: // Data |
|
123 |
|
124 // Input language |
|
125 TInt iInputLanguageId; |
|
126 |
|
127 // Qwerty mode |
|
128 TInt iQwertyMode; |
|
129 |
|
130 // Language setting monitor |
|
131 CPhoneLangSettingMonitor* iLangSettingMonitor; |
|
132 |
|
133 // Qwerty mode monitor |
|
134 CPhoneQwertyModeMonitor* iQwertyModeMonitor; |
|
135 |
|
136 // RArray |
|
137 RArray<TPtiNumericKeyBinding> iNumericKeys; |
|
138 }; |
|
139 |
|
140 #endif // CPHONEQWERTYHANDLER_H |
|
141 |
|
142 // End of File |