1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
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 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
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 Q_AUTOTEST_EXPORT 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 | bool symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event);
|
---|
88 | void mouseHandler( int x, QMouseEvent *event);
|
---|
89 | bool isComposing() const { return !m_preeditString.isEmpty(); }
|
---|
90 |
|
---|
91 | void setFocusWidget(QWidget * w);
|
---|
92 | void widgetDestroyed(QWidget *w);
|
---|
93 |
|
---|
94 | TCoeInputCapabilities inputCapabilities();
|
---|
95 |
|
---|
96 | protected:
|
---|
97 | void timerEvent(QTimerEvent *timerEvent);
|
---|
98 |
|
---|
99 | private:
|
---|
100 | void commitCurrentString(bool cancelFepTransaction);
|
---|
101 | void updateHints(bool mustUpdateInputCapabilities);
|
---|
102 | void applyHints(Qt::InputMethodHints hints);
|
---|
103 | void applyFormat(QList<QInputMethodEvent::Attribute> *attributes);
|
---|
104 | void queueInputCapabilitiesChanged();
|
---|
105 | bool needsInputPanel();
|
---|
106 | void commitTemporaryPreeditString();
|
---|
107 |
|
---|
108 | private Q_SLOTS:
|
---|
109 | void ensureInputCapabilitiesChanged();
|
---|
110 |
|
---|
111 | // From MCoeFepAwareTextEditor
|
---|
112 | public:
|
---|
113 | void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText,
|
---|
114 | TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw,
|
---|
115 | MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
|
---|
116 | MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit);
|
---|
117 | void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText);
|
---|
118 | void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility);
|
---|
119 | void CancelFepInlineEdit();
|
---|
120 | TInt DocumentLengthForFep() const;
|
---|
121 | TInt DocumentMaximumLengthForFep() const;
|
---|
122 | void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection);
|
---|
123 | void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const;
|
---|
124 | void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const;
|
---|
125 | void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const;
|
---|
126 | void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent,
|
---|
127 | TInt aDocumentPosition) const;
|
---|
128 | private:
|
---|
129 | void DoCommitFepInlineEditL();
|
---|
130 | MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue);
|
---|
131 | void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType);
|
---|
132 |
|
---|
133 | // From MCoeFepAwareTextEditor_Extension1
|
---|
134 | public:
|
---|
135 | void SetStateTransferingOwnershipL(MCoeFepAwareTextEditor_Extension1::CState* aState, TUid aTypeSafetyUid);
|
---|
136 | MCoeFepAwareTextEditor_Extension1::CState* State(TUid aTypeSafetyUid);
|
---|
137 |
|
---|
138 | // From MObjectProvider
|
---|
139 | public:
|
---|
140 | TTypeUid::Ptr MopSupplyObject(TTypeUid id);
|
---|
141 | MObjectProvider *MopNext();
|
---|
142 |
|
---|
143 | private:
|
---|
144 | QSymbianControl *m_parent;
|
---|
145 | CAknEdwinState *m_fepState;
|
---|
146 | QString m_preeditString;
|
---|
147 | Qt::InputMethodHints m_lastImHints;
|
---|
148 | TUint m_textCapabilities;
|
---|
149 | bool m_inDestruction;
|
---|
150 | bool m_pendingInputCapabilitiesChanged;
|
---|
151 | int m_cursorVisibility;
|
---|
152 | int m_inlinePosition;
|
---|
153 | MFepInlineTextFormatRetriever *m_formatRetriever;
|
---|
154 | MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler;
|
---|
155 | QBasicTimer m_tempPreeditStringTimeout;
|
---|
156 | bool m_hasTempPreeditString;
|
---|
157 |
|
---|
158 | friend class tst_QInputContext;
|
---|
159 | };
|
---|
160 |
|
---|
161 | QT_END_NAMESPACE
|
---|
162 |
|
---|
163 | #endif // QT_NO_IM
|
---|
164 |
|
---|
165 | #endif // QCOEFEPINPUTCONTEXT_P_H
|
---|