2002-08-30 09:14:01 +00:00
|
|
|
#ifndef _KPDF_PART_H_
|
|
|
|
#define _KPDF_PART_H_
|
|
|
|
|
|
|
|
#include <qpainter.h>
|
|
|
|
#include <qpixmap.h>
|
|
|
|
#include <qwidget.h>
|
|
|
|
|
2002-09-02 21:56:00 +00:00
|
|
|
#include <kparts/browserextension.h>
|
2002-08-30 09:14:01 +00:00
|
|
|
#include <kparts/part.h>
|
|
|
|
|
2003-08-24 16:45:58 +00:00
|
|
|
#include "QOutputDev.h"
|
2003-04-15 12:14:00 +00:00
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
class QPainter;
|
|
|
|
class QPixmap;
|
|
|
|
class QWidget;
|
2003-06-28 01:59:03 +00:00
|
|
|
class QListBoxItem;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
|
|
|
class KAboutData;
|
|
|
|
class KAction;
|
|
|
|
class KURL;
|
|
|
|
class KToggleAction;
|
|
|
|
|
|
|
|
class LinkAction;
|
|
|
|
class LinkDest;
|
|
|
|
class PDFDoc;
|
|
|
|
class XOutputDev;
|
|
|
|
|
2003-06-28 01:59:03 +00:00
|
|
|
class PDFPartView;
|
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
namespace KPDF
|
|
|
|
{
|
2002-09-02 21:56:00 +00:00
|
|
|
class BrowserExtension;
|
2002-09-02 19:47:18 +00:00
|
|
|
class Canvas;
|
2002-08-30 09:14:01 +00:00
|
|
|
class PageWidget;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a "Part". It that does all the real work in a KPart
|
|
|
|
* application.
|
|
|
|
*
|
|
|
|
* @short Main Part
|
|
|
|
* @author Wilco Greven <greven@kde.org>
|
|
|
|
* @version 0.1
|
|
|
|
*/
|
|
|
|
class Part : public KParts::ReadOnlyPart
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Do with these first. We can always add the other zoommodes which can
|
|
|
|
// be specified in a Destination later.
|
|
|
|
enum ZoomMode { FitInWindow, FitWidth, FitVisible, FixedFactor };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default constructor
|
|
|
|
*/
|
|
|
|
Part(QWidget* parentWidget, const char* widgetName,
|
|
|
|
QObject* parent, const char* name, const QStringList& args);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
|
|
|
virtual ~Part();
|
|
|
|
|
|
|
|
static KAboutData* createAboutData();
|
|
|
|
|
2002-08-30 12:10:02 +00:00
|
|
|
bool closeURL();
|
|
|
|
|
2002-09-02 21:56:00 +00:00
|
|
|
void print();
|
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
void displayPage(int pageNumber, float zoomFactor = 1.0);
|
|
|
|
void displayDestination(LinkDest*);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* This must be implemented by each part
|
|
|
|
*/
|
|
|
|
virtual bool openFile();
|
|
|
|
|
2003-06-28 01:59:03 +00:00
|
|
|
void update();
|
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
protected slots:
|
2002-09-13 13:56:35 +00:00
|
|
|
void find() { /* stub */ };
|
|
|
|
void findNext() { /* stub */ };
|
2003-06-28 01:59:03 +00:00
|
|
|
void zoomIn() { m_zoomFactor += 0.1; update(); };
|
|
|
|
void zoomOut() { m_zoomFactor -= 0.1; update(); };
|
2002-09-14 14:45:53 +00:00
|
|
|
void back() { /* stub */ };
|
|
|
|
void forward() { /* stub */ };
|
2003-09-14 14:22:37 +00:00
|
|
|
void slotNextPage();
|
|
|
|
void slotPreviousPage();
|
2003-09-14 14:54:16 +00:00
|
|
|
void slotGotoEnd();
|
|
|
|
void slotGotoStart();
|
2002-09-13 13:56:35 +00:00
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
void displayNextPage();
|
|
|
|
void displayPreviousPage();
|
|
|
|
|
|
|
|
void executeAction(LinkAction*);
|
|
|
|
|
|
|
|
private:
|
2002-09-02 19:47:18 +00:00
|
|
|
PDFDoc* m_doc;
|
2003-07-01 06:08:27 +00:00
|
|
|
PageWidget* m_outputDev;
|
2003-06-28 01:59:03 +00:00
|
|
|
PDFPartView * pdfpartview;
|
2003-09-14 14:54:16 +00:00
|
|
|
KAction* m_firstPage;
|
|
|
|
KAction* m_lastPage;
|
2003-09-14 16:51:29 +00:00
|
|
|
KAction* m_prevPage;
|
|
|
|
KAction* m_nextPage;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
2003-09-14 16:51:29 +00:00
|
|
|
KToggleAction* m_fitToWidth;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
|
|
|
int m_currentPage;
|
|
|
|
|
|
|
|
ZoomMode m_zoomMode;
|
|
|
|
float m_zoomFactor;
|
|
|
|
|
|
|
|
private slots:
|
2002-09-14 14:45:53 +00:00
|
|
|
void slotFitToWidthToggled();
|
2003-06-28 01:59:03 +00:00
|
|
|
void redrawPage();
|
|
|
|
void pageClicked ( QListBoxItem * );
|
2002-08-30 09:14:01 +00:00
|
|
|
};
|
2002-09-02 21:56:00 +00:00
|
|
|
|
|
|
|
class BrowserExtension : public KParts::BrowserExtension
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2003-09-14 14:22:37 +00:00
|
|
|
|
2002-09-02 21:56:00 +00:00
|
|
|
public:
|
|
|
|
BrowserExtension(Part*);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
// Automatically detected by the host.
|
|
|
|
void print();
|
|
|
|
};
|
2003-09-14 14:22:37 +00:00
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// vim:ts=2:sw=2:tw=78:et
|