1 | /* This file is part of the KDE project |
2 | * |
3 | * Copyright (C) 2000-2003 Simon Hausmann <hausmann@kde.org> |
4 | * 2001-2003 George Staikos <staikos@kde.org> |
5 | * 2001-2003 Laurent Montel <montel@kde.org> |
6 | * 2001-2003 Dirk Mueller <mueller@kde.org> |
7 | * 2001-2003 Waldo Bastian <bastian@kde.org> |
8 | * 2001-2003 David Faure <faure@kde.org> |
9 | * 2001-2003 Daniel Naber <dnaber@kde.org> |
10 | * |
11 | * This library is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU Library General Public |
13 | * License as published by the Free Software Foundation; either |
14 | * version 2 of the License, or (at your option) any later version. |
15 | * |
16 | * This library is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | * Library General Public License for more details. |
20 | * |
21 | * You should have received a copy of the GNU Library General Public License |
22 | * along with this library; see the file COPYING.LIB. If not, write to |
23 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 | * Boston, MA 02110-1301, USA. |
25 | */ |
26 | |
27 | #ifndef __khtml_ext_h__ |
28 | #define __khtml_ext_h__ |
29 | |
30 | #include "khtml_part.h" |
31 | |
32 | #include <QtCore/QPointer> |
33 | |
34 | #include <kselectaction.h> |
35 | #include <kparts/textextension.h> |
36 | #include <kparts/htmlextension.h> |
37 | #include <kio/global.h> |
38 | |
39 | /** |
40 | * This is the BrowserExtension for a KHTMLPart document. Please see the KParts documentation for |
41 | * more information about the BrowserExtension. |
42 | */ |
43 | class KHTMLPartBrowserExtension : public KParts::BrowserExtension |
44 | { |
45 | Q_OBJECT |
46 | friend class KHTMLPart; |
47 | friend class KHTMLView; |
48 | public: |
49 | KHTMLPartBrowserExtension( KHTMLPart *parent ); |
50 | |
51 | virtual int xOffset(); |
52 | virtual int yOffset(); |
53 | |
54 | virtual void saveState( QDataStream &stream ); |
55 | virtual void restoreState( QDataStream &stream ); |
56 | |
57 | // internal |
58 | void editableWidgetFocused( QWidget *widget ); |
59 | void editableWidgetBlurred( QWidget *widget ); |
60 | |
61 | void setExtensionProxy( KParts::BrowserExtension *proxyExtension ); |
62 | |
63 | public Q_SLOTS: |
64 | void cut(); |
65 | void copy(); |
66 | void paste(); |
67 | void searchProvider(); |
68 | void reparseConfiguration(); |
69 | void print(); |
70 | void disableScrolling(); |
71 | |
72 | // internal . updates the state of the cut/copt/paste action based |
73 | // on whether data is available in the clipboard |
74 | void updateEditActions(); |
75 | |
76 | private Q_SLOTS: |
77 | // connected to a frame's browserextensions enableAction signal |
78 | void extensionProxyActionEnabled( const char *action, bool enable ); |
79 | void extensionProxyEditableWidgetFocused(); |
80 | void extensionProxyEditableWidgetBlurred(); |
81 | |
82 | Q_SIGNALS: |
83 | void editableWidgetFocused(); |
84 | void editableWidgetBlurred(); |
85 | private: |
86 | void callExtensionProxyMethod( const char *method ); |
87 | |
88 | KHTMLPart *m_part; |
89 | QPointer<QWidget> m_editableFormWidget; |
90 | QPointer<KParts::BrowserExtension> m_extensionProxy; |
91 | bool m_connectedToClipboard; |
92 | }; |
93 | |
94 | class KHTMLPartBrowserHostExtension : public KParts::BrowserHostExtension |
95 | { |
96 | public: |
97 | KHTMLPartBrowserHostExtension( KHTMLPart *part ); |
98 | virtual ~KHTMLPartBrowserHostExtension(); |
99 | |
100 | virtual QStringList frameNames() const; |
101 | |
102 | virtual const QList<KParts::ReadOnlyPart*> frames() const; |
103 | |
104 | virtual BrowserHostExtension* findFrameParent( KParts::ReadOnlyPart *callingPart, const QString &frame ); |
105 | |
106 | virtual bool openUrlInFrame(const KUrl &url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments &browserArguments); |
107 | |
108 | private: |
109 | KHTMLPart *m_part; |
110 | }; |
111 | |
112 | /** |
113 | * @internal |
114 | * INTERNAL class. *NOT* part of the public API. |
115 | */ |
116 | class : public QObject |
117 | { |
118 | Q_OBJECT |
119 | public: |
120 | ( KHTMLPart *khtml, const KUrl &url ); |
121 | virtual (); |
122 | |
123 | KParts::BrowserExtension::ActionGroupMap () const; |
124 | |
125 | static void ( QWidget *parent, const QString &caption, const KUrl &url, |
126 | const QMap<QString, QString> &metaData = KIO::MetaData(), |
127 | const QString &filter = QString(), long cacheId = 0, |
128 | const QString &suggestedFilename = QString() ); |
129 | |
130 | static void ( QWidget* parent, const KUrl &url, const KUrl &destination, |
131 | const QMap<QString, QString> &metaData = KIO::MetaData(), |
132 | long cacheId = 0 ); |
133 | |
134 | static QString (KHTMLPart* part); |
135 | |
136 | private Q_SLOTS: |
137 | void (); |
138 | void (); |
139 | void (); |
140 | void (); |
141 | void (); |
142 | void (); |
143 | void (); |
144 | void (); |
145 | void (); |
146 | void (); |
147 | void (); |
148 | void (); |
149 | void (); |
150 | void (); |
151 | void (); |
152 | void (); |
153 | |
154 | private: |
155 | void (QList<QAction *>& editActions); |
156 | |
157 | class ; |
158 | KHTMLPopupGUIClientPrivate* const ; |
159 | }; |
160 | |
161 | class KHTMLZoomFactorAction : public KSelectAction |
162 | { |
163 | Q_OBJECT |
164 | public: |
165 | KHTMLZoomFactorAction(KHTMLPart *part, bool direction, const QString& iconName, const QString& text, QObject *parent); |
166 | virtual ~KHTMLZoomFactorAction(); |
167 | |
168 | protected Q_SLOTS: |
169 | void slotTriggered(QAction* action); |
170 | private: |
171 | void init(KHTMLPart *part, bool direction); |
172 | private: |
173 | bool m_direction; |
174 | KHTMLPart *m_part; |
175 | }; |
176 | |
177 | /** |
178 | * @internal |
179 | * Implements the TextExtension interface |
180 | */ |
181 | class KHTMLTextExtension : public KParts::TextExtension |
182 | { |
183 | Q_OBJECT |
184 | public: |
185 | KHTMLTextExtension(KHTMLPart* part); |
186 | |
187 | virtual bool hasSelection() const; |
188 | virtual QString selectedText(Format format) const; |
189 | virtual QString completeText(Format format) const; |
190 | |
191 | KHTMLPart* part() const; |
192 | }; |
193 | |
194 | /** |
195 | * @internal |
196 | * Implements the HtmlExtension interface |
197 | */ |
198 | class KHTMLHtmlExtension : public KParts::HtmlExtension, |
199 | public KParts::SelectorInterface, |
200 | public KParts::HtmlSettingsInterface |
201 | { |
202 | Q_OBJECT |
203 | Q_INTERFACES(KParts::SelectorInterface) |
204 | Q_INTERFACES(KParts::HtmlSettingsInterface) |
205 | |
206 | public: |
207 | KHTMLHtmlExtension(KHTMLPart* part); |
208 | |
209 | // HtmlExtension |
210 | virtual KUrl baseUrl() const; |
211 | virtual bool hasSelection() const; |
212 | |
213 | // SelectorInterface |
214 | virtual QueryMethods supportedQueryMethods() const; |
215 | virtual Element querySelector(const QString& query, QueryMethod method) const; |
216 | virtual QList<Element> querySelectorAll(const QString& query, QueryMethod method) const; |
217 | |
218 | // SettingsInterface |
219 | virtual QVariant htmlSettingsProperty(HtmlSettingsType type) const; |
220 | virtual bool setHtmlSettingsProperty(HtmlSettingsType type, const QVariant& value); |
221 | |
222 | KHTMLPart* part() const; |
223 | }; |
224 | |
225 | #endif |
226 | |