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_
|
|
|
|
|
2002-09-02 21:56:00 +00:00
|
|
|
#include <kparts/browserextension.h>
|
2002-08-30 09:14:01 +00:00
|
|
|
#include <kparts/part.h>
|
|
|
|
|
2004-10-12 11:08:09 +00:00
|
|
|
#include "kpdf_dcop.h"
|
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
class QWidget;
|
2004-09-11 15:59:32 +00:00
|
|
|
class QSplitter;
|
2004-09-23 21:49:00 +00:00
|
|
|
class QToolBox;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
|
|
|
class KURL;
|
2004-09-11 15:59:32 +00:00
|
|
|
class KAction;
|
2004-11-01 21:56:08 +00:00
|
|
|
class KConfig;
|
2002-08-30 09:14:01 +00:00
|
|
|
class KToggleAction;
|
2003-09-15 21:57:19 +00:00
|
|
|
class KSelectAction;
|
2004-09-11 15:59:32 +00:00
|
|
|
class KAboutData;
|
|
|
|
class KPrinter;
|
2002-08-30 09:14:01 +00:00
|
|
|
|
|
|
|
class LinkAction;
|
|
|
|
class LinkDest;
|
|
|
|
|
2004-09-07 22:35:33 +00:00
|
|
|
class ThumbnailList;
|
2004-09-23 17:16:04 +00:00
|
|
|
class PageView;
|
2004-09-16 21:27:34 +00:00
|
|
|
class SearchWidget;
|
2004-09-08 12:41:14 +00:00
|
|
|
class KPDFDocument;
|
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
namespace KPDF {
|
|
|
|
|
|
|
|
class BrowserExtension;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.2
|
|
|
|
*/
|
2004-10-12 11:08:09 +00:00
|
|
|
class Part : public KParts::ReadOnlyPart, virtual public kpdf_dcop
|
2002-08-30 09:14:01 +00:00
|
|
|
{
|
2004-10-09 08:10:56 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Default constructor
|
2004-09-08 12:41:14 +00:00
|
|
|
Part(QWidget* parentWidget, const char* widgetName,
|
|
|
|
QObject* parent, const char* name, const QStringList& args);
|
2002-08-30 09:14:01 +00:00
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
// Destructor
|
|
|
|
~Part();
|
2002-08-30 12:10:02 +00:00
|
|
|
|
2004-09-08 12:41:14 +00:00
|
|
|
static KAboutData* createAboutData();
|
2004-10-12 11:08:09 +00:00
|
|
|
|
|
|
|
ASYNC goToPage(uint page);
|
|
|
|
ASYNC openDocument(KURL doc);
|
|
|
|
uint pages();
|
2004-01-02 17:46:06 +00:00
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
protected:
|
2004-09-08 12:41:14 +00:00
|
|
|
// reimplemented from KParts::ReadOnlyPart
|
2004-10-09 08:10:56 +00:00
|
|
|
bool openFile();
|
|
|
|
bool openURL(const KURL &url);
|
2004-09-08 12:41:14 +00:00
|
|
|
bool closeURL();
|
2003-09-15 09:35:55 +00:00
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
protected slots:
|
2004-09-08 12:41:14 +00:00
|
|
|
// connected to actions
|
|
|
|
void slotGoToPage();
|
|
|
|
void slotPreviousPage();
|
|
|
|
void slotNextPage();
|
2004-09-11 15:59:32 +00:00
|
|
|
void slotGotoFirst();
|
|
|
|
void slotGotoLast();
|
2004-09-08 12:41:14 +00:00
|
|
|
void slotFind();
|
|
|
|
void slotFindNext();
|
2004-10-27 14:15:27 +00:00
|
|
|
void slotSaveFileAs();
|
|
|
|
void slotPreferences();
|
|
|
|
void slotNewConfig();
|
|
|
|
void slotPrintPreview();
|
2004-09-11 15:59:32 +00:00
|
|
|
// can be connected to widget elements
|
2004-09-08 12:41:14 +00:00
|
|
|
void updateActions();
|
2004-09-23 21:49:00 +00:00
|
|
|
void enableTOC(bool enable);
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
public slots:
|
2004-09-08 12:41:14 +00:00
|
|
|
// connected to Shell action (and browserExtension), not local one
|
2004-09-18 16:41:23 +00:00
|
|
|
void slotPrint();
|
2004-11-01 21:56:08 +00:00
|
|
|
void restoreDocument(const KURL &url, int page);
|
|
|
|
void saveDocumentRestoreInfo(KConfig* config);
|
2003-09-15 21:57:19 +00:00
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
private:
|
|
|
|
void doPrint( KPrinter& printer );
|
|
|
|
|
2004-09-08 12:41:14 +00:00
|
|
|
// the document
|
|
|
|
KPDFDocument * document;
|
|
|
|
|
|
|
|
// main widgets
|
2004-09-11 15:59:32 +00:00
|
|
|
QSplitter *m_splitter;
|
2004-09-27 21:36:25 +00:00
|
|
|
QToolBox *m_toolBox;
|
2004-09-08 12:41:14 +00:00
|
|
|
ThumbnailList *m_thumbnailList;
|
2004-09-23 17:16:04 +00:00
|
|
|
PageView *m_pageView;
|
2004-09-16 21:27:34 +00:00
|
|
|
SearchWidget *m_searchWidget;
|
2004-09-08 12:41:14 +00:00
|
|
|
|
|
|
|
// static instances counter
|
|
|
|
static unsigned int m_count;
|
|
|
|
|
|
|
|
// actions
|
|
|
|
KAction *m_gotoPage;
|
|
|
|
KAction *m_prevPage;
|
|
|
|
KAction *m_nextPage;
|
|
|
|
KAction *m_firstPage;
|
|
|
|
KAction *m_lastPage;
|
|
|
|
KAction *m_find;
|
|
|
|
KAction *m_findNext;
|
2004-10-09 08:10:56 +00:00
|
|
|
};
|
2002-09-02 21:56:00 +00:00
|
|
|
|
2003-09-14 14:22:37 +00:00
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
class BrowserExtension : public KParts::BrowserExtension
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2004-09-08 12:41:14 +00:00
|
|
|
BrowserExtension(Part*);
|
2002-09-02 21:56:00 +00:00
|
|
|
|
2004-10-09 08:10:56 +00:00
|
|
|
public slots:
|
2004-09-08 12:41:14 +00:00
|
|
|
// Automatically detected by the host.
|
|
|
|
void print();
|
2004-10-09 08:10:56 +00:00
|
|
|
};
|
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
|