don't discard iframe children.
[kdelibs.git] / khtml / khtml_ext.h
blobe8f0d134e2dfc17192bddd9a193eb87d0f16eabb
1 /* This file is part of the KDE project
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>
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.
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.
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.
27 #ifndef __khtml_ext_h__
28 #define __khtml_ext_h__
30 #include "khtml_part.h"
32 #include <QtCore/QPointer>
34 #include <kselectaction.h>
35 #include <kio/global.h>
37 /**
38 * This is the BrowserExtension for a KHTMLPart document. Please see the KParts documentation for
39 * more information about the BrowserExtension.
41 class KHTMLPartBrowserExtension : public KParts::BrowserExtension
43 Q_OBJECT
44 friend class KHTMLPart;
45 friend class KHTMLView;
46 public:
47 KHTMLPartBrowserExtension( KHTMLPart *parent );
49 virtual int xOffset();
50 virtual int yOffset();
52 virtual void saveState( QDataStream &stream );
53 virtual void restoreState( QDataStream &stream );
55 // internal
56 void editableWidgetFocused( QWidget *widget );
57 void editableWidgetBlurred( QWidget *widget );
59 void setExtensionProxy( KParts::BrowserExtension *proxyExtension );
61 public Q_SLOTS:
62 void cut();
63 void copy();
64 void paste();
65 void searchProvider();
66 void reparseConfiguration();
67 void print();
68 void disableScrolling();
70 // internal . updates the state of the cut/copt/paste action based
71 // on whether data is available in the clipboard
72 void updateEditActions();
74 private Q_SLOTS:
75 // connected to a frame's browserextensions enableAction signal
76 void extensionProxyActionEnabled( const char *action, bool enable );
77 void extensionProxyEditableWidgetFocused();
78 void extensionProxyEditableWidgetBlurred();
80 Q_SIGNALS:
81 void editableWidgetFocused();
82 void editableWidgetBlurred();
83 private:
84 void callExtensionProxyMethod( const char *method );
86 KHTMLPart *m_part;
87 QPointer<QWidget> m_editableFormWidget;
88 QPointer<KParts::BrowserExtension> m_extensionProxy;
89 bool m_connectedToClipboard;
92 class KHTMLPartBrowserHostExtension : public KParts::BrowserHostExtension
94 public:
95 KHTMLPartBrowserHostExtension( KHTMLPart *part );
96 virtual ~KHTMLPartBrowserHostExtension();
98 virtual QStringList frameNames() const;
100 virtual const QList<KParts::ReadOnlyPart*> frames() const;
102 virtual BrowserHostExtension* findFrameParent( KParts::ReadOnlyPart *callingPart, const QString &frame );
104 virtual bool openUrlInFrame(const KUrl &url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments &browserArguments);
106 private:
107 KHTMLPart *m_part;
111 * @internal
112 * INTERNAL class. *NOT* part of the public API.
114 class KHTMLPopupGUIClient : public QObject
116 Q_OBJECT
117 public:
118 KHTMLPopupGUIClient( KHTMLPart *khtml, const KUrl &url );
119 virtual ~KHTMLPopupGUIClient();
121 KParts::BrowserExtension::ActionGroupMap actionGroups() const;
123 static void saveURL( QWidget *parent, const QString &caption, const KUrl &url,
124 const QMap<QString, QString> &metaData = KIO::MetaData(),
125 const QString &filter = QString(), long cacheId = 0,
126 const QString &suggestedFilename = QString() );
128 static void saveURL( QWidget* parent, const KUrl &url, const KUrl &destination,
129 const QMap<QString, QString> &metaData = KIO::MetaData(),
130 long cacheId = 0 );
131 private Q_SLOTS:
132 void slotSaveLinkAs();
133 void slotSaveImageAs();
134 void slotCopyLinkLocation();
135 void slotSendImage();
136 void slotStopAnimations();
137 void slotCopyImageLocation();
138 void slotCopyImage();
139 void slotViewImage();
140 void slotReloadFrame();
141 void slotFrameInWindow();
142 void slotFrameInTop();
143 void slotFrameInTab();
144 void slotBlockImage();
145 void slotBlockHost();
146 void slotBlockIFrame();
147 void openSelection();
149 private:
150 QString selectedTextAsOneLine() const;
151 void addSearchActions(QList<QAction *>& editActions);
153 class KHTMLPopupGUIClientPrivate;
154 KHTMLPopupGUIClientPrivate* const d;
157 class KHTMLZoomFactorAction : public KSelectAction
159 Q_OBJECT
160 public:
161 KHTMLZoomFactorAction(KHTMLPart *part, bool direction, const QString& iconName, const QString& text, QObject *parent);
162 virtual ~KHTMLZoomFactorAction();
164 protected Q_SLOTS:
165 void slotTriggered(QAction* action);
166 private:
167 void init(KHTMLPart *part, bool direction);
168 private:
169 bool m_direction;
170 KHTMLPart *m_part;
173 #endif