tdehtml_ext.h
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 __tdehtml_ext_h__ 00028 #define __tdehtml_ext_h__ 00029 00030 #include "tdehtml_part.h" 00031 00032 #include <tqguardedptr.h> 00033 00034 #include <tdeaction.h> 00035 #include <tdeio/global.h> 00036 00041 class TDEHTMLPartBrowserExtension : public KParts::BrowserExtension 00042 { 00043 Q_OBJECT 00044 friend class TDEHTMLPart; 00045 friend class TDEHTMLView; 00046 public: 00047 TDEHTMLPartBrowserExtension( TDEHTMLPart *parent, const char *name = 0L ); 00048 00049 virtual int xOffset(); 00050 virtual int yOffset(); 00051 00052 virtual void saveState( TQDataStream &stream ); 00053 virtual void restoreState( TQDataStream &stream ); 00054 00055 // internal 00056 void editableWidgetFocused( TQWidget *widget ); 00057 void editableWidgetBlurred( TQWidget *widget ); 00058 00059 void setExtensionProxy( KParts::BrowserExtension *proxyExtension ); 00060 00061 public slots: 00062 void cut(); 00063 void copy(); 00064 void paste(); 00065 void searchProvider(); 00066 void openSelection(); 00067 void reparseConfiguration(); 00068 void print(); 00069 void disableScrolling(); 00070 00071 // internal . updates the state of the cut/copt/paste action based 00072 // on whether data is available in the clipboard 00073 void updateEditActions(); 00074 00075 private slots: 00076 // connected to a frame's browserextensions enableAction signal 00077 void extensionProxyActionEnabled( const char *action, bool enable ); 00078 void extensionProxyEditableWidgetFocused(); 00079 void extensionProxyEditableWidgetBlurred(); 00080 00081 signals: 00082 void editableWidgetFocused(); 00083 void editableWidgetBlurred(); 00084 private: 00085 void callExtensionProxyMethod( const char *method ); 00086 00087 TDEHTMLPart *m_part; 00088 TQGuardedPtr<TQWidget> m_editableFormWidget; 00089 TQGuardedPtr<KParts::BrowserExtension> m_extensionProxy; 00090 bool m_connectedToClipboard; 00091 }; 00092 00093 class TDEHTMLPartBrowserHostExtension : public KParts::BrowserHostExtension 00094 { 00095 public: 00096 TDEHTMLPartBrowserHostExtension( TDEHTMLPart *part ); 00097 virtual ~TDEHTMLPartBrowserHostExtension(); 00098 00099 virtual TQStringList frameNames() const; 00100 00101 virtual const TQPtrList<KParts::ReadOnlyPart> frames() const; 00102 00103 virtual bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs ); 00104 00105 protected: 00106 virtual void virtual_hook( int id, void* data ); 00107 private: 00108 TDEHTMLPart *m_part; 00109 }; 00110 00115 class TDEHTMLPopupGUIClient : public TQObject, public KXMLGUIClient 00116 { 00117 Q_OBJECT 00118 public: 00119 TDEHTMLPopupGUIClient( TDEHTMLPart *tdehtml, const TQString &doc, const KURL &url ); 00120 virtual ~TDEHTMLPopupGUIClient(); 00121 00122 static void saveURL( TQWidget *parent, const TQString &caption, const KURL &url, 00123 const TQMap<TQString, TQString> &metaData = TDEIO::MetaData(), 00124 const TQString &filter = TQString::null, long cacheId = 0, 00125 const TQString &suggestedFilename = TQString::null ); 00126 00127 static void saveURL( const KURL &url, const KURL &destination, 00128 const TQMap<TQString, TQString> &metaData = TDEIO::MetaData(), 00129 long cacheId = 0 ); 00130 private slots: 00131 void slotSaveLinkAs(); 00132 void slotSaveImageAs(); 00133 void slotCopyLinkLocation(); 00134 void slotSendImage(); 00135 void slotStopAnimations(); 00136 void slotCopyImageLocation(); 00137 void slotCopyImage(); 00138 void slotViewImage(); 00139 void slotReloadFrame(); 00140 void slotFrameInWindow(); 00141 void slotFrameInTop(); 00142 void slotFrameInTab(); 00143 void slotBlockImage(); 00144 void slotBlockHost(); 00145 void slotBlockIFrame(); 00146 00147 private: 00148 class TDEHTMLPopupGUIClientPrivate; 00149 TDEHTMLPopupGUIClientPrivate *d; 00150 }; 00151 00152 class TDEHTMLZoomFactorAction : public TDEAction 00153 { 00154 Q_OBJECT 00155 public: 00156 //BCI: remove in KDE 4 00157 TDEHTMLZoomFactorAction( TDEHTMLPart *part, bool direction, const TQString &text, const TQString &icon, const TQObject *receiver, const char *slot, TQObject *parent, const char *name ); 00158 TDEHTMLZoomFactorAction( TDEHTMLPart *part, bool direction, const TQString &text, 00159 const TQString &icon, const TDEShortcut& cut, const TQObject *receiver, 00160 const char *slot, TQObject *parent, const char *name ); 00161 virtual ~TDEHTMLZoomFactorAction(); 00162 00163 virtual int plug( TQWidget *widget, int index ); 00164 00165 private slots: 00166 void slotActivated( int ); 00167 protected slots: 00168 void slotActivated() { TDEAction::slotActivated(); } 00169 private: 00170 void init(TDEHTMLPart *part, bool direction); 00171 private: 00172 TQPopupMenu *m_popup; 00173 bool m_direction; 00174 TDEHTMLPart *m_part; 00175 }; 00176 00177 #endif