KHTML
khtml_ext.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2000-2003 Simon Hausmann <hausmann@kde.org> 00004 * 2001-2003 George Staikos <staikos@kde.org> 00005 * 2001-2003 Laurent Montel <montel@kde.org> 00006 * 2001-2003 Dirk Mueller <mueller@kde.org> 00007 * 2001-2003 Waldo Bastian <bastian@kde.org> 00008 * 2001-2003 David Faure <faure@kde.org> 00009 * 2001-2003 Daniel Naber <dnaber@kde.org> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Library General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Library General Public License 00022 * along with this library; see the file COPYING.LIB. If not, write to 00023 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00024 * Boston, MA 02110-1301, USA. 00025 */ 00026 00027 #ifndef __khtml_ext_h__ 00028 #define __khtml_ext_h__ 00029 00030 #include "khtml_part.h" 00031 00032 #include <QtCore/QPointer> 00033 00034 #include <kselectaction.h> 00035 #include <kparts/textextension.h> 00036 #include <kparts/htmlextension.h> 00037 #include <kio/global.h> 00038 00043 class KHTMLPartBrowserExtension : public KParts::BrowserExtension 00044 { 00045 Q_OBJECT 00046 friend class KHTMLPart; 00047 friend class KHTMLView; 00048 public: 00049 KHTMLPartBrowserExtension( KHTMLPart *parent ); 00050 00051 virtual int xOffset(); 00052 virtual int yOffset(); 00053 00054 virtual void saveState( QDataStream &stream ); 00055 virtual void restoreState( QDataStream &stream ); 00056 00057 // internal 00058 void editableWidgetFocused( QWidget *widget ); 00059 void editableWidgetBlurred( QWidget *widget ); 00060 00061 void setExtensionProxy( KParts::BrowserExtension *proxyExtension ); 00062 00063 public Q_SLOTS: 00064 void cut(); 00065 void copy(); 00066 void paste(); 00067 void searchProvider(); 00068 void reparseConfiguration(); 00069 void print(); 00070 void disableScrolling(); 00071 00072 // internal . updates the state of the cut/copt/paste action based 00073 // on whether data is available in the clipboard 00074 void updateEditActions(); 00075 00076 private Q_SLOTS: 00077 // connected to a frame's browserextensions enableAction signal 00078 void extensionProxyActionEnabled( const char *action, bool enable ); 00079 void extensionProxyEditableWidgetFocused(); 00080 void extensionProxyEditableWidgetBlurred(); 00081 00082 Q_SIGNALS: 00083 void editableWidgetFocused(); 00084 void editableWidgetBlurred(); 00085 private: 00086 void callExtensionProxyMethod( const char *method ); 00087 00088 KHTMLPart *m_part; 00089 QPointer<QWidget> m_editableFormWidget; 00090 QPointer<KParts::BrowserExtension> m_extensionProxy; 00091 bool m_connectedToClipboard; 00092 }; 00093 00094 class KHTMLPartBrowserHostExtension : public KParts::BrowserHostExtension 00095 { 00096 public: 00097 KHTMLPartBrowserHostExtension( KHTMLPart *part ); 00098 virtual ~KHTMLPartBrowserHostExtension(); 00099 00100 virtual QStringList frameNames() const; 00101 00102 virtual const QList<KParts::ReadOnlyPart*> frames() const; 00103 00104 virtual BrowserHostExtension* findFrameParent( KParts::ReadOnlyPart *callingPart, const QString &frame ); 00105 00106 virtual bool openUrlInFrame(const KUrl &url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments &browserArguments); 00107 00108 private: 00109 KHTMLPart *m_part; 00110 }; 00111 00116 class KHTMLPopupGUIClient : public QObject 00117 { 00118 Q_OBJECT 00119 public: 00120 KHTMLPopupGUIClient( KHTMLPart *khtml, const KUrl &url ); 00121 virtual ~KHTMLPopupGUIClient(); 00122 00123 KParts::BrowserExtension::ActionGroupMap actionGroups() const; 00124 00125 static void saveURL( QWidget *parent, const QString &caption, const KUrl &url, 00126 const QMap<QString, QString> &metaData = KIO::MetaData(), 00127 const QString &filter = QString(), long cacheId = 0, 00128 const QString &suggestedFilename = QString() ); 00129 00130 static void saveURL( QWidget* parent, const KUrl &url, const KUrl &destination, 00131 const QMap<QString, QString> &metaData = KIO::MetaData(), 00132 long cacheId = 0 ); 00133 00134 static QString selectedTextAsOneLine(KHTMLPart* part); 00135 00136 private Q_SLOTS: 00137 void slotSaveLinkAs(); 00138 void slotSaveImageAs(); 00139 void slotCopyLinkLocation(); 00140 void slotSendImage(); 00141 void slotStopAnimations(); 00142 void slotCopyImageLocation(); 00143 void slotCopyImage(); 00144 void slotViewImage(); 00145 void slotReloadFrame(); 00146 void slotFrameInWindow(); 00147 void slotFrameInTop(); 00148 void slotFrameInTab(); 00149 void slotBlockImage(); 00150 void slotBlockHost(); 00151 void slotBlockIFrame(); 00152 void openSelection(); 00153 00154 private: 00155 void addSearchActions(QList<QAction *>& editActions); 00156 00157 class KHTMLPopupGUIClientPrivate; 00158 KHTMLPopupGUIClientPrivate* const d; 00159 }; 00160 00161 class KHTMLZoomFactorAction : public KSelectAction 00162 { 00163 Q_OBJECT 00164 public: 00165 KHTMLZoomFactorAction(KHTMLPart *part, bool direction, const QString& iconName, const QString& text, QObject *parent); 00166 virtual ~KHTMLZoomFactorAction(); 00167 00168 protected Q_SLOTS: 00169 void slotTriggered(QAction* action); 00170 private: 00171 void init(KHTMLPart *part, bool direction); 00172 private: 00173 bool m_direction; 00174 KHTMLPart *m_part; 00175 }; 00176 00181 class KHTMLTextExtension : public KParts::TextExtension 00182 { 00183 Q_OBJECT 00184 public: 00185 KHTMLTextExtension(KHTMLPart* part); 00186 00187 virtual bool hasSelection() const; 00188 virtual QString selectedText(Format format) const; 00189 virtual QString completeText(Format format) const; 00190 00191 KHTMLPart* part() const; 00192 }; 00193 00198 class KHTMLHtmlExtension : public KParts::HtmlExtension, 00199 public KParts::SelectorInterface 00200 { 00201 Q_OBJECT 00202 Q_INTERFACES(KParts::SelectorInterface) 00203 00204 public: 00205 KHTMLHtmlExtension(KHTMLPart* part); 00206 00207 // HtmlExtension 00208 virtual KUrl baseUrl() const; 00209 virtual bool hasSelection() const; 00210 00211 // SelectorInterface 00212 virtual QueryMethods supportedQueryMethods() const; 00213 virtual Element querySelector(const QString& query, QueryMethod method) const; 00214 virtual QList<Element> querySelectorAll(const QString& query, QueryMethod method) const; 00215 00216 KHTMLPart* part() const; 00217 }; 00218 00219 #endif
KDE 4.6 API Reference