2004-08-26 21:17:24 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2002 by Wilco Greven <greven@kde.org> *
|
|
|
|
* Copyright (C) 2003-2004 by Christophe Devriese *
|
|
|
|
* <Christophe.Devriese@student.kuleuven.ac.be> *
|
|
|
|
* Copyright (C) 2003 by Andy Goossens <andygoossens@telenet.be> *
|
|
|
|
* Copyright (C) 2003 by Laurent Montel <montel@kde.org> *
|
|
|
|
* Copyright (C) 2004 by Dominique Devriese <devriese@kde.org> *
|
|
|
|
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
#ifndef _KPDF_PART_H_
|
|
|
|
#define _KPDF_PART_H_
|
|
|
|
|
2004-09-04 22:28:14 +00:00
|
|
|
#include <qmutex.h>
|
2002-08-30 09:14:01 +00:00
|
|
|
|
2002-09-02 21:56:00 +00:00
|
|
|
#include <kparts/browserextension.h>
|
2002-08-30 09:14:01 +00:00
|
|
|
#include <kparts/part.h>
|
|
|
|
|
|
|
|
class QWidget;
|
|
|
|
|
|
|
|
class KAboutData;
|
|
|
|
class KAction;
|
2004-09-07 22:35:33 +00:00
|
|
|
class KPrinter;
|
2002-08-30 09:14:01 +00:00
|
|
|
class KURL;
|
|
|
|
class KToggleAction;
|
2003-09-15 21:57:19 +00:00
|
|
|
class KSelectAction;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
|
|
|
class LinkAction;
|
|
|
|
class LinkDest;
|
|
|
|
class PDFDoc;
|
|
|
|
class XOutputDev;
|
|
|
|
|
2004-09-07 22:35:33 +00:00
|
|
|
class ThumbnailList;
|
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-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();
|
|
|
|
|
2004-08-28 09:27:38 +00:00
|
|
|
void displayPage(int pageNumber, float zoomFactor = 1.0);
|
|
|
|
/*void displayDestination(LinkDest*);*/
|
2003-09-15 09:35:55 +00:00
|
|
|
void updateActionPage();
|
2003-09-15 12:44:23 +00:00
|
|
|
PageWidget* pageWidget() const {return m_outputDev;}
|
|
|
|
|
2004-01-02 17:46:06 +00:00
|
|
|
public slots:
|
|
|
|
void print();
|
|
|
|
|
2004-09-07 22:35:33 +00:00
|
|
|
signals:
|
|
|
|
void rightClick();
|
|
|
|
|
2004-01-02 17:46:06 +00:00
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* This must be implemented by each part
|
|
|
|
*/
|
|
|
|
virtual bool openFile();
|
|
|
|
|
2003-09-14 20:46:38 +00:00
|
|
|
void update();
|
|
|
|
void readSettings();
|
|
|
|
void writeSettings();
|
2003-09-14 21:53:40 +00:00
|
|
|
bool nextPage();
|
|
|
|
bool previousPage();
|
2003-09-15 09:35:55 +00:00
|
|
|
void updateAction();
|
2003-09-15 21:09:49 +00:00
|
|
|
void goToPage( int page );
|
2004-01-02 17:46:06 +00:00
|
|
|
void doPrint( KPrinter& printer );
|
2003-09-15 09:35:55 +00:00
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
protected slots:
|
2004-08-26 23:25:52 +00:00
|
|
|
void find();
|
2004-08-28 14:18:45 +00:00
|
|
|
void findNext();
|
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 */ };
|
2004-08-28 09:27:38 +00:00
|
|
|
void slotNextPage();
|
|
|
|
void slotPreviousPage();
|
|
|
|
void slotGotoEnd();
|
|
|
|
void slotGotoStart();
|
|
|
|
void slotGoToPage();
|
2004-01-02 17:46:06 +00:00
|
|
|
void printPreview();
|
2002-08-30 09:14:01 +00:00
|
|
|
|
2004-08-28 09:27:38 +00:00
|
|
|
/*void executeAction(LinkAction*);*/
|
2002-08-30 09:14:01 +00:00
|
|
|
|
2003-09-14 20:23:01 +00:00
|
|
|
void showScrollBars( bool );
|
|
|
|
void showMarkList( bool );
|
2003-09-14 21:49:26 +00:00
|
|
|
void slotReadUp();
|
|
|
|
void slotReadDown();
|
2003-09-15 13:47:59 +00:00
|
|
|
void slotOpenUrlDropped( const KURL & );
|
2003-09-15 21:57:19 +00:00
|
|
|
void slotZoom( const QString& );
|
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
private:
|
2004-08-28 14:18:45 +00:00
|
|
|
void doFind(QString s, bool next);
|
2004-09-07 22:35:33 +00:00
|
|
|
|
|
|
|
ThumbnailList *m_thumbnailList;
|
|
|
|
// TODO rename to something else
|
2004-08-28 14:18:45 +00:00
|
|
|
PageWidget* m_outputDev;
|
2004-09-07 22:35:33 +00:00
|
|
|
|
|
|
|
PDFDoc* m_doc;
|
|
|
|
|
2004-08-28 14:18:45 +00:00
|
|
|
KAction* m_firstPage;
|
|
|
|
KAction* m_lastPage;
|
|
|
|
KAction* m_prevPage;
|
|
|
|
KAction* m_nextPage;
|
2003-09-15 21:09:49 +00:00
|
|
|
KAction *m_gotoPage;
|
2004-08-28 14:18:45 +00:00
|
|
|
KToggleAction* m_showScrollBars;
|
|
|
|
KToggleAction* m_showPageList;
|
2003-09-15 21:57:19 +00:00
|
|
|
KSelectAction *m_zoomTo;
|
2003-09-14 16:51:29 +00:00
|
|
|
KToggleAction* m_fitToWidth;
|
2004-08-28 14:18:45 +00:00
|
|
|
KAction *m_find;
|
|
|
|
KAction *m_findNext;
|
|
|
|
|
|
|
|
QString m_findText;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
2004-08-28 09:27:38 +00:00
|
|
|
// first page is page 1
|
2002-08-30 09:14:01 +00:00
|
|
|
int m_currentPage;
|
2004-09-04 22:28:14 +00:00
|
|
|
QMutex m_docMutex;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
|
|
|
ZoomMode m_zoomMode;
|
|
|
|
float m_zoomFactor;
|
|
|
|
|
2004-08-26 16:54:06 +00:00
|
|
|
static unsigned int m_count;
|
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
private slots:
|
2004-08-28 09:27:38 +00:00
|
|
|
void slotFitToWidthToggled();
|
2003-06-28 01:59:03 +00:00
|
|
|
void redrawPage();
|
2004-04-15 18:36:43 +00:00
|
|
|
void pageClicked ( int );
|
2004-08-28 17:59:17 +00:00
|
|
|
void fileSaveAs();
|
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
|