|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtGui module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QCOEFEPINPUTCONTEXT_P_H |
|
43 #define QCOEFEPINPUTCONTEXT_P_H |
|
44 |
|
45 // |
|
46 // W A R N I N G |
|
47 // ------------- |
|
48 // |
|
49 // This file is not part of the Qt API. It exists purely as an |
|
50 // implementation detail. This header file may change from version to |
|
51 // version without notice, or even be removed. |
|
52 // |
|
53 // We mean it. |
|
54 // |
|
55 |
|
56 #ifndef QT_NO_IM |
|
57 |
|
58 #include "qinputcontext.h" |
|
59 #include <qhash.h> |
|
60 #include <qtimer.h> |
|
61 #include <private/qcore_symbian_p.h> |
|
62 #include <private/qt_s60_p.h> |
|
63 |
|
64 #include <fepbase.h> |
|
65 #include <aknedsts.h> |
|
66 |
|
67 QT_BEGIN_NAMESPACE |
|
68 |
|
69 class QCoeFepInputContext : public QInputContext, |
|
70 public MCoeFepAwareTextEditor, |
|
71 public MCoeFepAwareTextEditor_Extension1, |
|
72 public MObjectProvider |
|
73 { |
|
74 Q_OBJECT |
|
75 |
|
76 public: |
|
77 QCoeFepInputContext(QObject *parent = 0); |
|
78 ~QCoeFepInputContext(); |
|
79 |
|
80 QString identifierName() { return QLatin1String("coefep"); } |
|
81 QString language(); |
|
82 |
|
83 void reset(); |
|
84 void update(); |
|
85 |
|
86 bool filterEvent(const QEvent *event); |
|
87 void mouseHandler( int x, QMouseEvent *event); |
|
88 bool isComposing() const { return !m_preeditString.isEmpty(); } |
|
89 |
|
90 void setFocusWidget(QWidget * w); |
|
91 void widgetDestroyed(QWidget *w); |
|
92 |
|
93 TCoeInputCapabilities inputCapabilities(); |
|
94 |
|
95 protected: |
|
96 void timerEvent(QTimerEvent *timerEvent); |
|
97 |
|
98 private: |
|
99 void commitCurrentString(bool cancelFepTransaction); |
|
100 void updateHints(bool mustUpdateInputCapabilities); |
|
101 void applyHints(Qt::InputMethodHints hints); |
|
102 void applyFormat(QList<QInputMethodEvent::Attribute> *attributes); |
|
103 void queueInputCapabilitiesChanged(); |
|
104 bool needsInputPanel(); |
|
105 void commitTemporaryPreeditString(); |
|
106 |
|
107 private Q_SLOTS: |
|
108 void ensureInputCapabilitiesChanged(); |
|
109 |
|
110 // From MCoeFepAwareTextEditor |
|
111 public: |
|
112 void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, |
|
113 TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw, |
|
114 MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, |
|
115 MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit); |
|
116 void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText); |
|
117 void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility); |
|
118 void CancelFepInlineEdit(); |
|
119 TInt DocumentLengthForFep() const; |
|
120 TInt DocumentMaximumLengthForFep() const; |
|
121 void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection); |
|
122 void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const; |
|
123 void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const; |
|
124 void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const; |
|
125 void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, |
|
126 TInt aDocumentPosition) const; |
|
127 private: |
|
128 void DoCommitFepInlineEditL(); |
|
129 MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue); |
|
130 void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType); |
|
131 |
|
132 // From MCoeFepAwareTextEditor_Extension1 |
|
133 public: |
|
134 void SetStateTransferingOwnershipL(MCoeFepAwareTextEditor_Extension1::CState* aState, TUid aTypeSafetyUid); |
|
135 MCoeFepAwareTextEditor_Extension1::CState* State(TUid aTypeSafetyUid); |
|
136 |
|
137 // From MObjectProvider |
|
138 public: |
|
139 TTypeUid::Ptr MopSupplyObject(TTypeUid id); |
|
140 MObjectProvider *MopNext(); |
|
141 |
|
142 private: |
|
143 QSymbianControl *m_parent; |
|
144 CAknEdwinState *m_fepState; |
|
145 QString m_preeditString; |
|
146 Qt::InputMethodHints m_lastImHints; |
|
147 TUint m_textCapabilities; |
|
148 bool m_inDestruction; |
|
149 bool m_pendingInputCapabilitiesChanged; |
|
150 int m_cursorVisibility; |
|
151 int m_inlinePosition; |
|
152 MFepInlineTextFormatRetriever *m_formatRetriever; |
|
153 MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; |
|
154 int m_cursorPos; |
|
155 QBasicTimer m_tempPreeditStringTimeout; |
|
156 bool m_hasTempPreeditString; |
|
157 }; |
|
158 |
|
159 QT_END_NAMESPACE |
|
160 |
|
161 #endif // QT_NO_IM |
|
162 |
|
163 #endif // QCOEFEPINPUTCONTEXT_P_H |