Qt 4.8
qcoefepinputcontext_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
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 #include <eikccpu.h>
67 #include <eikedwin.h>
68 #include <aknedformaccessor.h>
69 
70 class CAknExtendedInputCapabilities;
71 
73 
75 {
76 public:
77  QCoeFepInputMaskHandler(const QString &mask);
79  bool canPasteClipboard(const QString &text);
80 private:
81  bool isValidInput(QChar key, QChar mask) const;
82 private:
83  struct MaskInputData {
86  bool separator;
88  };
92 };
93 
95  public MCoeFepAwareTextEditor,
96  public MCoeFepAwareTextEditor_Extension1,
97  public MObjectProvider,
98  public MEikCcpuEditor
99 
100 {
101  Q_OBJECT
102 
103 public:
104  QCoeFepInputContext(QObject *parent = 0);
106 
107  QString identifierName() { return QLatin1String("coefep"); }
108  QString language();
109 
110  void reset();
111  void update();
112 
113  bool filterEvent(const QEvent *event);
114  bool symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event);
115  void mouseHandler( int x, QMouseEvent *event);
116  bool isComposing() const { return !m_preeditString.isEmpty(); }
117 
118  void setFocusWidget(QWidget * w);
119  void widgetDestroyed(QWidget *w);
120 
121  TCoeInputCapabilities inputCapabilities();
122 
123  void resetSplitViewWidget(bool keepInputWidget = false);
124  void ensureFocusWidgetVisible(QWidget *widget);
125 
126 protected:
127  void timerEvent(QTimerEvent *timerEvent);
128 
129 private:
130  void commitCurrentString(bool cancelFepTransaction);
131  void updateHints(bool mustUpdateInputCapabilities);
132  void applyHints(Qt::InputMethodHints hints);
133  void applyFormat(QList<QInputMethodEvent::Attribute> *attributes);
134  void queueInputCapabilitiesChanged();
135  bool needsInputPanel();
136  void commitTemporaryPreeditString();
137  bool isWidgetVisible(QWidget *widget, int offset = 0);
138  bool isPartialKeyboardSupported();
139  bool vietCharConversion(const QEvent *event);
140 
141 private Q_SLOTS:
142  void ensureInputCapabilitiesChanged();
143  void translateInputWidget();
144  void ensureWidgetVisibility();
145 
146  // From MCoeFepAwareTextEditor
147 public:
148  void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText,
149  TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw,
150  MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
151  MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit);
152  void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText);
153  void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility);
154  void CancelFepInlineEdit();
155  TInt DocumentLengthForFep() const;
156  TInt DocumentMaximumLengthForFep() const;
157  void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection);
158  void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const;
159  void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const;
160  void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const;
161  void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent,
162  TInt aDocumentPosition) const;
163 private:
164  void DoCommitFepInlineEditL();
165  MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue);
166  void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType);
167  void enableSymbianCcpuSupport();
168  void changeCBA(bool showCopyAndOrPaste);
169  void copyOrCutTextToClipboard(const char *operation);
170  void getScreenCoordinatesForFepX(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent,
171  TInt aDocumentPosition) const;
172 
173  //From MEikCcpuEditor interface
174 public:
175  TBool CcpuIsFocused() const;
176  TBool CcpuCanCut() const;
177  void CcpuCutL();
178  TBool CcpuCanCopy() const;
179  void CcpuCopyL();
180  TBool CcpuCanPaste() const;
181  void CcpuPasteL();
182  TBool CcpuCanUndo() const;
183  void CcpuUndoL();
184 
185 private slots:
186  void copy();
187  void paste();
188 
189  // From MCoeFepAwareTextEditor_Extension1
190 public:
191  void SetStateTransferingOwnershipL(MCoeFepAwareTextEditor_Extension1::CState* aState, TUid aTypeSafetyUid);
192  MCoeFepAwareTextEditor_Extension1::CState* State(TUid aTypeSafetyUid);
193 
194  // From MObjectProvider
195 public:
196  TTypeUid::Ptr MopSupplyObject(TTypeUid id);
197  MObjectProvider *MopNext();
198 
199 private:
200  QSymbianControl *m_parent;
201  CAknEdwinState *m_fepState;
203  Qt::InputMethodHints m_lastImHints;
210  MFepInlineTextFormatRetriever *m_formatRetriever;
211  MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler;
216 
220  QGraphicsItem *m_splitViewPreviousFocusItem; //can't use QPointer<> since QGraphicsItem is not a QObject.
221 
222  CAknCcpuSupport *m_ccpu;
227 
228  CAknExtendedInputCapabilities *m_extendedInputCapabilities;
229 
232 
233  friend class tst_QInputContext;
234 };
235 
238 Q_GUI_EXPORT void qt_s60_setEditorFlags(int flags);
239 
241 
242 #endif // QT_NO_IM
243 
244 #endif // QCOEFEPINPUTCONTEXT_P_H
QString identifierName()
This function must be implemented in any subclasses to return the identifier name of the input method...
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
EventRef event
QPointer< QWidget > widget
QScopedPointer< CEikEdwin > m_dummyEditor
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool canPasteClipboard(const QString &text)
CAknExtendedInputCapabilities * m_extendedInputCapabilities
#define Q_SLOTS
Definition: qobjectdefs.h:71
The QString class provides a Unicode character string.
Definition: qstring.h:83
QCoeFepInputMaskHandler(const QString &mask)
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
CAknCcpuSupport * m_ccpu
CAknEdwinState * m_fepState
QLocale::Language language
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
Q_GUI_EXPORT void qt_s60_setEditorFlags(int flags)
Qt::InputMethodHints m_lastImHints
MFepPointerEventHandlerDuringInlineEdit * m_pointerHandler
#define Q_OBJECT
Definition: qobjectdefs.h:157
bool isComposing() const
This function indicates whether InputMethodStart event had been sent to the current focus widget...
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
QGraphicsItem * m_splitViewPreviousFocusItem
QScopedPointer< CAknEdwinFormAccessor > m_formAccessor
QBasicTimer m_tempPreeditStringTimeout
QPointer< QWidget > m_lastFocusedEditor
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
State
Definition: qaudio.h:59
int key
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
Q_GUI_EXPORT void qt_s60_setPartialScreenAutomaticTranslation(bool enable)
bool isValidInput(QChar key, QChar mask) const
The QBasicTimer class provides timer events for objects.
Definition: qbasictimer.h:55
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83
#define slots
Definition: qobjectdefs.h:68
Qt::WindowStates m_splitViewPreviousWindowStates
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
QPointer< QObject > m_lastFocusedObject
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
#define text
Definition: qobjectdefs.h:80
QSymbianControl * m_parent
MFepInlineTextFormatRetriever * m_formatRetriever