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>
|
2005-01-28 11:04:03 +00:00
|
|
|
#include <qguardedptr.h>
|
2005-01-02 14:55:14 +00:00
|
|
|
#include "core/observer.h"
|
2005-01-02 14:29:37 +00:00
|
|
|
#include "dcop.h"
|
2004-10-12 11:08:09 +00:00
|
|
|
|
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;
|
2004-12-01 22:18:27 +00:00
|
|
|
class KDirWatch;
|
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
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
class KPDFDocument;
|
2004-09-07 22:35:33 +00:00
|
|
|
class ThumbnailList;
|
2005-01-03 15:51:05 +00:00
|
|
|
class ThumbnailController;
|
2004-09-23 17:16:04 +00:00
|
|
|
class PageView;
|
2005-01-28 11:04:03 +00:00
|
|
|
class PresentationWidget;
|
2004-09-16 21:27:34 +00:00
|
|
|
class SearchWidget;
|
2004-09-08 12:41:14 +00:00
|
|
|
|
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
|
|
|
|
*/
|
2005-01-09 23:37:07 +00:00
|
|
|
class Part : public KParts::ReadOnlyPart, public DocumentObserver, 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
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// inherited from DocumentObserver
|
2004-11-09 17:20:19 +00:00
|
|
|
uint observerId() const { return PART_ID; }
|
2005-01-09 23:37:07 +00:00
|
|
|
void notifyViewportChanged();
|
2004-11-09 17:20:19 +00:00
|
|
|
|
2004-09-08 12:41:14 +00:00
|
|
|
static KAboutData* createAboutData();
|
2004-11-09 17:20:19 +00:00
|
|
|
|
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();
|
2005-01-27 17:31:07 +00:00
|
|
|
void slotHistoryBack();
|
|
|
|
void slotHistoryNext();
|
2004-09-08 12:41:14 +00:00
|
|
|
void slotFind();
|
|
|
|
void slotFindNext();
|
2005-01-27 17:31:07 +00:00
|
|
|
void slotSaveFileAs();
|
|
|
|
void slotPreferences();
|
|
|
|
void slotNewConfig();
|
|
|
|
void slotPrintPreview();
|
2004-12-04 23:23:18 +00:00
|
|
|
void slotShowMenu(const KPDFPage *page, const QPoint &point);
|
2004-12-05 22:47:32 +00:00
|
|
|
void slotShowProperties();
|
2005-01-27 17:31:07 +00:00
|
|
|
void slotShowPresentation();
|
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-12-01 22:18:27 +00:00
|
|
|
void restoreDocument(const KURL &url, int page);
|
|
|
|
void saveDocumentRestoreInfo(KConfig* config);
|
|
|
|
void slotWatchFile();
|
|
|
|
void slotFileDirty( const QString& );
|
|
|
|
void slotDoFileDirty();
|
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
|
2004-11-09 17:20:19 +00:00
|
|
|
KPDFDocument * m_document;
|
2004-09-08 12:41:14 +00:00
|
|
|
|
|
|
|
// main widgets
|
2004-09-11 15:59:32 +00:00
|
|
|
QSplitter *m_splitter;
|
2004-09-27 21:36:25 +00:00
|
|
|
QToolBox *m_toolBox;
|
2005-01-03 15:51:05 +00:00
|
|
|
SearchWidget *m_searchWidget;
|
2004-09-08 12:41:14 +00:00
|
|
|
ThumbnailList *m_thumbnailList;
|
2004-09-23 17:16:04 +00:00
|
|
|
PageView *m_pageView;
|
2005-01-28 11:04:03 +00:00
|
|
|
QGuardedPtr<PresentationWidget> m_presentationWidget;
|
2004-09-08 12:41:14 +00:00
|
|
|
|
|
|
|
// static instances counter
|
|
|
|
static unsigned int m_count;
|
2005-01-03 15:51:05 +00:00
|
|
|
|
2004-12-01 22:18:27 +00:00
|
|
|
KDirWatch *m_watcher;
|
|
|
|
QTimer *m_dirtyHandler;
|
2004-09-08 12:41:14 +00:00
|
|
|
|
|
|
|
// actions
|
|
|
|
KAction *m_gotoPage;
|
|
|
|
KAction *m_prevPage;
|
|
|
|
KAction *m_nextPage;
|
|
|
|
KAction *m_firstPage;
|
|
|
|
KAction *m_lastPage;
|
2005-01-27 17:31:07 +00:00
|
|
|
KAction *m_historyBack;
|
|
|
|
KAction *m_historyNext;
|
2004-09-08 12:41:14 +00:00
|
|
|
KAction *m_find;
|
|
|
|
KAction *m_findNext;
|
2005-01-27 17:31:07 +00:00
|
|
|
KAction *m_saveAs;
|
|
|
|
KAction *m_printPreview;
|
2004-12-05 22:47:32 +00:00
|
|
|
KAction *m_showProperties;
|
2005-01-03 15:51:05 +00:00
|
|
|
KAction *m_showPresentation;
|
2004-12-01 22:18:27 +00:00
|
|
|
KToggleAction* m_watchFile;
|
2004-12-04 23:23:18 +00:00
|
|
|
KToggleAction* m_showMenuBarAction;
|
2004-12-13 00:27:09 +00:00
|
|
|
KToggleAction* m_showFullScreenAction;
|
|
|
|
bool m_actionsSearched;
|
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
|