1 /* This file is part of the KDE project
2 Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef __khtmlimage_h__
21 #define __khtmlimage_h__
23 #include "khtml_part.h"
24 #include <kparts/factory.h>
25 #include <kparts/browserextension.h>
27 #include "misc/loader_client.h"
40 class KHTMLImageFactory
: public KParts::Factory
45 virtual ~KHTMLImageFactory();
47 virtual KParts::Part
*createPartObject( QWidget
*parentWidget
,
49 const char *className
, const QStringList
&args
);
51 static const KComponentData
&componentData() { return *s_componentData
; }
54 static KComponentData
*s_componentData
;
60 class KHTMLImage
: public KParts::ReadOnlyPart
, public khtml::CachedObjectClient
64 KHTMLImage( QWidget
*parentWidget
,
65 QObject
*parent
, KHTMLPart::GUIProfile prof
);
66 virtual ~KHTMLImage();
68 virtual bool openFile() { return true; } // grmbl, should be non-pure in part.h, IMHO
70 virtual bool openUrl( const KUrl
&url
);
72 virtual bool closeUrl();
74 KHTMLPart
*doc() const { return m_khtml
; }
76 virtual void notifyFinished( khtml::CachedObject
*o
);
79 virtual void guiActivateEvent( KParts::GUIActivateEvent
*e
);
82 void restoreScrollPosition();
84 void slotPopupMenu( const QPoint
&global
, const KUrl
&url
, mode_t mode
,
85 const KParts::OpenUrlArguments
&args
,
86 const KParts::BrowserArguments
&browserArgs
,
87 KParts::BrowserExtension::PopupFlags flags
,
88 const KParts::BrowserExtension::ActionGroupMap
& actionGroups
);
90 // void slotImageJobFinished( KIO::Job *job );
92 // void updateWindowCaption();
97 QPointer
<KHTMLPart
> m_khtml
;
98 KParts::BrowserExtension
*m_ext
;
100 khtml::CachedImage
*m_image
;
101 int m_xOffset
, m_yOffset
;
107 class KHTMLImageBrowserExtension
: public KParts::BrowserExtension
111 KHTMLImageBrowserExtension( KHTMLImage
*parent
);
113 virtual int xOffset();
114 virtual int yOffset();
118 void reparseConfiguration();
119 void disableScrolling();
122 KHTMLImage
*m_imgPart
;