diff --git a/core/document.cpp b/core/document.cpp index 00a7ace5e..e817cca28 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -26,11 +26,11 @@ // local includes #include "document.h" +#include "observer.h" #include "page.h" #include "link.h" -#include "conf/settings.h" #include "generator_pdf/generator_pdf.h" // PDF generator -//#include "generator_ps/generator_ps.H" // PS generator +#include "conf/settings.h" // structures used internally by KPDFDocument for local variables storage class KPDFDocumentPrivate diff --git a/core/document.h b/core/document.h index 8f0ff6d0a..7b13ceba2 100644 --- a/core/document.h +++ b/core/document.h @@ -15,43 +15,14 @@ #include #include -class KPrinter; class KPDFPage; class KPDFLink; -class Generator; +class KPDFDocumentObserver; class DocumentInfo; class DocumentSynopsis; +class Generator; class PixmapRequest; - -/** - * @short Base class for objects being notified when something changes. - * - * Inherit this class and call KPDFDocument->addObserver( yourClass ) to get - * notified of asyncronous events (new pixmap generated, or changed, etc..). - */ -class KPDFDocumentObserver -{ - public: - // you must give each observer a unique ID (used for notifications) - virtual uint observerId() const = 0; - - // commands from the Document to all observers - virtual void pageSetup( const QValueVector & /*pages*/, bool /*documentChanged*/ ) {}; - virtual void pageSetCurrent( int /*pageNumber*/, const QRect & /*viewport*/ = QRect() ) {}; - - // queries to observers - virtual bool canUnloadPixmap( int /*pageNum*/ ) { return true; } - - // monitor changes in pixmaps (generation thread complete) - virtual void notifyPixmapChanged( int /*pageNumber*/ ) {}; - virtual void notifyPixmapsCleared() {}; -}; - -#define PRESENTATION_ID 1 -#define PART_ID 2 -#define PAGEVIEW_ID 3 -#define THUMBNAILS_ID 4 -#define TOC_ID 5 +class KPrinter; /** * @short The Document. Heart of everything. Actions take place here. diff --git a/core/observer.h b/core/observer.h new file mode 100644 index 000000000..9fb38300d --- /dev/null +++ b/core/observer.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (C) 2005 by Enrico Ros * + * Copyright (C) 2005 by Albert Astals Cid * + * * + * 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. * + ***************************************************************************/ + +#ifndef _KPDF_DOCUMENTOBSERVER_H_ +#define _KPDF_DOCUMENTOBSERVER_H_ + +#include +#include + +/** IDs for observers. Globally defined here. **/ +#define PRESENTATION_ID 1 +#define PART_ID 2 +#define PAGEVIEW_ID 3 +#define THUMBNAILS_ID 4 +#define TOC_ID 5 + +/** + * @short Base class for objects being notified when something changes. + * + * Inherit this class and call KPDFDocument->addObserver( yourClass ) to get + * notified of asyncronous events (new pixmap generated, or changed, etc..). + */ +class KPDFDocumentObserver +{ + public: + // you must give each observer a unique ID (used for notifications) + virtual uint observerId() const = 0; + + // commands from the Document to all observers + virtual void pageSetup( const QValueVector< class KPDFPage * > & /*pages*/, bool /*documentChanged*/ ) {}; + virtual void pageSetCurrent( int /*pageNumber*/, const QRect & /*viewport*/ = QRect() ) {}; + + // queries to observers + virtual bool canUnloadPixmap( int /*pageNum*/ ) { return true; } + + // monitor changes in pixmaps (generation thread complete) + virtual void notifyPixmapChanged( int /*pageNumber*/ ) {}; + virtual void notifyPixmapsCleared() {}; +}; + +#endif diff --git a/part.cpp b/part.cpp index 07b6508f9..d8af6cb59 100644 --- a/part.cpp +++ b/part.cpp @@ -21,6 +21,7 @@ * (at your option) any later version. * ***************************************************************************/ +// qt/kde includes #include #include #include @@ -28,7 +29,6 @@ #include #include #include - #include #include #include @@ -48,8 +48,8 @@ #include #include +// local includes #include "xpdf/GlobalParams.h" - #include "part.h" #include "ui/pageview.h" #include "ui/thumbnaillist.h" diff --git a/part.h b/part.h index 91bc61db4..bdc5a0e2c 100644 --- a/part.h +++ b/part.h @@ -18,9 +18,8 @@ #include #include - +#include "core/observer.h" #include "dcop.h" -#include "core/document.h" class QWidget; class QSplitter; @@ -35,6 +34,7 @@ class KSelectAction; class KAboutData; class KPrinter; +class KPDFDocument; class ThumbnailList; class PageView; class SearchWidget; diff --git a/shell.cpp b/shell.cpp index 6536114c4..dfb9f333a 100644 --- a/shell.cpp +++ b/shell.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include // local includes #include "shell.h" diff --git a/shell.h b/shell.h index 97434c67e..2dc7a60e5 100644 --- a/shell.h +++ b/shell.h @@ -73,8 +73,8 @@ namespace KPDF void optionsConfigureToolbars(); void applyNewToolbarConfig(); - void slotUpdateFullScreen(); - void slotShowMenubar(); + void slotUpdateFullScreen(); + void slotShowMenubar(); public slots: void openURL( const KURL & url ); diff --git a/ui/pageview.cpp b/ui/pageview.cpp index beaf07614..d3dc16bd0 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -16,13 +16,13 @@ * (at your option) any later version. * ***************************************************************************/ +// qt/kde includes #include #include #include #include #include #include - #include #include #include @@ -34,11 +34,14 @@ #include #include +// system includes #include #include +// local includes #include "pageview.h" #include "pageviewutils.h" +#include "core/document.h" #include "core/page.h" #include "core/link.h" #include "core/generator.h" diff --git a/ui/pageview.h b/ui/pageview.h index caac20079..4c9fb7ca7 100644 --- a/ui/pageview.h +++ b/ui/pageview.h @@ -21,12 +21,12 @@ #include #include - -#include "core/document.h" +#include "core/observer.h" class KURL; class KActionCollection; +class KPDFDocument; class PageViewItem; class PageViewPrivate; diff --git a/ui/presentationwidget.h b/ui/presentationwidget.h index 0c7a7c4ec..211df139b 100644 --- a/ui/presentationwidget.h +++ b/ui/presentationwidget.h @@ -14,12 +14,15 @@ #include #include #include -#include "core/document.h" +#include "core/observer.h" -class PresentationFrame; class KToolBar; class QTimer; +class KPDFDocument; +class KPDFPage; +class PresentationFrame; + /** * @short A widget that shows pages as fullscreen slides (with transitions fx). * diff --git a/ui/thumbnaillist.cpp b/ui/thumbnaillist.cpp index 9b98d977c..ef8c2e4c5 100644 --- a/ui/thumbnaillist.cpp +++ b/ui/thumbnaillist.cpp @@ -18,6 +18,7 @@ // local includes #include "thumbnaillist.h" +#include "core/document.h" #include "core/generator.h" #include "core/page.h" diff --git a/ui/thumbnaillist.h b/ui/thumbnaillist.h index 83d8bb8e3..5147d5251 100644 --- a/ui/thumbnaillist.h +++ b/ui/thumbnaillist.h @@ -7,13 +7,13 @@ * (at your option) any later version. * ***************************************************************************/ -#ifndef THUMBNAILLIST_H -#define THUMBNAILLIST_H +#ifndef _KPDF_THUMBNAILLIST_H_ +#define _KPDF_THUMBNAILLIST_H_ #include #include #include -#include "core/document.h" +#include "core/observer.h" class QTimer; class KActionCollection; diff --git a/ui/toc.cpp b/ui/toc.cpp index fcb1abcad..44d207fb4 100644 --- a/ui/toc.cpp +++ b/ui/toc.cpp @@ -13,8 +13,8 @@ // local includes #include "toc.h" -#include "core/page.h" #include "core/document.h" +#include "core/page.h" // uncomment following to enable a 2nd column showing the page referred by // each tree entry diff --git a/ui/toc.h b/ui/toc.h index 8cdad1695..62376a7a0 100644 --- a/ui/toc.h +++ b/ui/toc.h @@ -7,12 +7,11 @@ * (at your option) any later version. * ***************************************************************************/ -#ifndef TOC_H -#define TOC_H +#ifndef _KPDF_TOC_H_ +#define _KPDF_TOC_H_ #include - -#include "core/document.h" +#include "core/observer.h" class TOC : public KListView, public KPDFDocumentObserver {