KHtml

khtml_ext.h
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2000-2003 Simon Hausmann <[email protected]>
4  * 2001-2003 George Staikos <[email protected]>
5  * 2001-2003 Laurent Montel <[email protected]>
6  * 2001-2003 Dirk Mueller <[email protected]>
7  * 2001-2003 Waldo Bastian <[email protected]>
8  * 2001-2003 David Faure <[email protected]>
9  * 2001-2003 Daniel Naber <[email protected]>
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 <QPointer>
33 
34 #include <kselectaction.h>
35 #include <kparts/textextension.h>
36 #include <kparts/htmlextension.h>
37 #include <kparts/selectorinterface.h>
38 #include <kparts/htmlsettingsinterface.h>
39 #include <kio/global.h>
40 
46 {
47  Q_OBJECT
48  friend class KHTMLPart;
49  friend class KHTMLView;
50 public:
52 
53  int xOffset() override;
54  int yOffset() override;
55 
56  void saveState(QDataStream &stream) override;
57  void restoreState(QDataStream &stream) override;
58 
59  // internal
60  void editableWidgetFocused(QWidget *widget);
61  void editableWidgetBlurred(QWidget *widget);
62 
63  void setExtensionProxy(KParts::BrowserExtension *proxyExtension);
64 
65 public Q_SLOTS:
66  void cut();
67  void copy();
68  void paste();
69  void searchProvider();
70  void reparseConfiguration();
71  void print();
72  void disableScrolling();
73 
74  // internal . updates the state of the cut/copt/paste action based
75  // on whether data is available in the clipboard
76  void updateEditActions();
77 
78 private Q_SLOTS:
79  // connected to a frame's browserextensions enableAction signal
80  void extensionProxyActionEnabled(const char *action, bool enable);
81  void extensionProxyEditableWidgetFocused();
82  void extensionProxyEditableWidgetBlurred();
83 
84 Q_SIGNALS:
85  void editableWidgetFocused();
86  void editableWidgetBlurred();
87 private:
88  void callExtensionProxyMethod(const char *method);
89 
90  KHTMLPart *m_part;
91  QPointer<QWidget> m_editableFormWidget;
92  QPointer<KParts::BrowserExtension> m_extensionProxy;
93  bool m_connectedToClipboard;
94 };
95 
96 class KHTMLPartBrowserHostExtension : public KParts::BrowserHostExtension
97 {
98 public:
99  KHTMLPartBrowserHostExtension(KHTMLPart *part);
100  virtual ~KHTMLPartBrowserHostExtension();
101 
102  QStringList frameNames() const override;
103 
104  const QList<KParts::ReadOnlyPart *> frames() const override;
105 
106  BrowserHostExtension *findFrameParent(KParts::ReadOnlyPart *callingPart, const QString &frame) override;
107 
108  bool openUrlInFrame(const QUrl &url, const KParts::OpenUrlArguments &arguments, const KParts::BrowserArguments &browserArguments) override;
109 
110 private:
111  KHTMLPart *m_part;
112 };
113 
119 {
120  Q_OBJECT
121 public:
122  KHTMLPopupGUIClient(KHTMLPart *khtml, const QUrl &url);
123  virtual ~KHTMLPopupGUIClient();
124 
125  KParts::BrowserExtension::ActionGroupMap actionGroups() const;
126 
127  static void saveURL(QWidget *parent, const QString &caption, const QUrl &url,
128  const QMap<QString, QString> &metaData = KIO::MetaData(),
129  const QString &filter = QString(), long cacheId = 0,
130  const QString &suggestedFilename = QString());
131 
132  static void saveURL(QWidget *parent, const QUrl &url, const QUrl &destination,
133  const QMap<QString, QString> &metaData = KIO::MetaData(),
134  long cacheId = 0);
135 
136  static QString selectedTextAsOneLine(KHTMLPart *part);
137 
138 private Q_SLOTS:
139  void slotSaveLinkAs();
140  void slotSaveImageAs();
141  void slotCopyLinkLocation();
142  void slotSendImage();
143  void slotStopAnimations();
144  void slotCopyImageLocation();
145  void slotCopyImage();
146  void slotViewImage();
147  void slotReloadFrame();
148  void slotFrameInWindow();
149  void slotFrameInTop();
150  void slotFrameInTab();
151  void slotBlockImage();
152  void slotBlockHost();
153  void slotBlockIFrame();
154  void openSelection();
155 
156 private:
157  void addSearchActions(QList<QAction *> &editActions);
158 
159  class KHTMLPopupGUIClientPrivate;
160  KHTMLPopupGUIClientPrivate *const d;
161 };
162 
163 class KHTMLZoomFactorAction : public KSelectAction
164 {
165  Q_OBJECT
166 public:
167  KHTMLZoomFactorAction(KHTMLPart *part, bool direction, const QString &iconName, const QString &text, QObject *parent);
168  virtual ~KHTMLZoomFactorAction();
169 
170 protected Q_SLOTS:
171  void slotTriggered(QAction *action);
172 private:
173  void init(KHTMLPart *part, bool direction);
174 private:
175  bool m_direction;
176  KHTMLPart *m_part;
177 };
178 
184 {
185  Q_OBJECT
186 public:
188 
189  bool hasSelection() const override;
190  QString selectedText(Format format) const override;
191  QString completeText(Format format) const override;
192 
193  KHTMLPart *part() const;
194 };
195 
203 {
204  Q_OBJECT
207 
208 public:
210 
211  // HtmlExtension
212  QUrl baseUrl() const override;
213  bool hasSelection() const override;
214 
215  // SelectorInterface
216  QueryMethods supportedQueryMethods() const override;
217  Element querySelector(const QString &query, QueryMethod method) const override;
218  QList<Element> querySelectorAll(const QString &query, QueryMethod method) const override;
219 
220  // SettingsInterface
221  QVariant htmlSettingsProperty(HtmlSettingsType type) const override;
222  bool setHtmlSettingsProperty(HtmlSettingsType type, const QVariant &value) override;
223 
224  KHTMLPart *part() const;
225 };
226 
227 #endif
QWidget * widget() const const
This file is part of the HTML rendering engine for KDE.
This class is khtml&#39;s main class.
Definition: khtml_part.h:208
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:97
Q_SIGNALSQ_SIGNALS
BrowserArguments browserArguments() const
Q_OBJECTQ_OBJECT
QCA_EXPORT void init()
Q_INTERFACES(...)
This is the BrowserExtension for a KHTMLPart document.
Definition: khtml_ext.h:45
void print(bool quick=false)
Prints the HTML document.
Definition: khtmlview.cpp:3096
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jul 9 2020 22:45:27 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.