2005-01-02 14:55:14 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> *
|
|
|
|
* Copyright (C) 2005 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. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#ifndef _OKULAR_DOCUMENTOBSERVER_H_
|
|
|
|
#define _OKULAR_DOCUMENTOBSERVER_H_
|
2005-01-02 14:55:14 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#include <QtCore/QVector>
|
|
|
|
|
2011-06-01 08:31:44 +00:00
|
|
|
#include "okular_export.h"
|
2006-12-25 15:10:39 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
namespace Okular {
|
2005-01-02 14:55:14 +00:00
|
|
|
|
|
|
|
/** 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
|
2005-01-26 10:42:07 +00:00
|
|
|
#define MINIBAR_ID 6
|
2005-03-24 19:50:28 +00:00
|
|
|
#define REVIEWS_ID 7
|
2006-10-15 15:59:22 +00:00
|
|
|
#define PROGRESSWIDGET_ID 8
|
2006-10-15 19:37:14 +00:00
|
|
|
#define PAGESIZELABEL_ID 9
|
2006-12-27 16:04:49 +00:00
|
|
|
#define BOOKMARKLIST_ID 10
|
2007-09-08 16:58:31 +00:00
|
|
|
#define ANNOTATIONMODEL_ID 11
|
2005-01-02 14:55:14 +00:00
|
|
|
|
2006-10-15 19:37:14 +00:00
|
|
|
// the biggest id, useful for ignoring wrong id request
|
2007-09-08 16:58:31 +00:00
|
|
|
#define MAX_OBSERVER_ID 12
|
2006-11-27 08:12:39 +00:00
|
|
|
|
2005-01-18 16:43:36 +00:00
|
|
|
/** PRIORITIES for requests. Globally defined here. **/
|
|
|
|
#define PAGEVIEW_PRIO 1
|
2006-11-29 22:00:13 +00:00
|
|
|
#define PAGEVIEW_PRELOAD_PRIO 4
|
2005-01-18 16:43:36 +00:00
|
|
|
#define THUMBNAILS_PRIO 2
|
2006-11-29 22:00:13 +00:00
|
|
|
#define THUMBNAILS_PRELOAD_PRIO 5
|
2005-01-18 16:43:36 +00:00
|
|
|
#define PRESENTATION_PRIO 0
|
2006-11-29 22:00:13 +00:00
|
|
|
#define PRESENTATION_PRELOAD_PRIO 3
|
2005-01-18 16:43:36 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
class Page;
|
2005-01-09 23:37:07 +00:00
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
/**
|
|
|
|
* @short Base class for objects being notified when something changes.
|
|
|
|
*
|
2006-09-21 08:45:36 +00:00
|
|
|
* Inherit this class and call Document->addObserver( yourClass ) to get
|
2006-05-13 11:17:24 +00:00
|
|
|
* notified of asynchronous events (new pixmap generated, or changed, etc..).
|
2005-01-02 14:55:14 +00:00
|
|
|
*/
|
2006-12-25 15:10:39 +00:00
|
|
|
class OKULAR_EXPORT DocumentObserver
|
2005-01-02 14:55:14 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-03-18 17:14:36 +00:00
|
|
|
DocumentObserver();
|
2006-11-27 08:12:39 +00:00
|
|
|
/**
|
|
|
|
* Destroys the document observer.
|
|
|
|
*/
|
2006-12-05 08:53:26 +00:00
|
|
|
virtual ~DocumentObserver();
|
2006-03-20 22:51:56 +00:00
|
|
|
|
2006-11-27 08:12:39 +00:00
|
|
|
/**
|
|
|
|
* Must return an unique ID for each observer (used for notifications).
|
|
|
|
*/
|
2005-01-02 14:55:14 +00:00
|
|
|
virtual uint observerId() const = 0;
|
|
|
|
|
2006-11-27 08:12:39 +00:00
|
|
|
/**
|
|
|
|
* Flags that can be sent from the document to all observers to
|
|
|
|
* inform them about the type of object that has been changed.
|
|
|
|
*/
|
|
|
|
enum ChangedFlags {
|
|
|
|
Pixmap = 1, ///< Pixmaps has been changed
|
|
|
|
Bookmark = 2, ///< Bookmarks has been changed
|
|
|
|
Highlights = 4, ///< Highlighting information has been changed
|
|
|
|
TextSelection = 8, ///< Text selection has been changed
|
2008-05-18 23:06:21 +00:00
|
|
|
Annotations = 16, ///< Annotations has been changed
|
|
|
|
BoundingBox = 32 ///< Bounding boxes have been changed
|
2006-11-27 08:12:39 +00:00
|
|
|
};
|
|
|
|
|
2007-09-09 10:50:36 +00:00
|
|
|
/**
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
enum SetupFlags {
|
|
|
|
DocumentChanged = 1, ///< The document is a new document.
|
|
|
|
NewLayoutForPages = 2 ///< All the pages have
|
|
|
|
};
|
|
|
|
|
2006-12-05 08:53:26 +00:00
|
|
|
/**
|
|
|
|
* This method is called whenever the document is initialized or reconstructed.
|
|
|
|
*
|
|
|
|
* @param pages The vector of pages of the document.
|
2007-09-09 10:50:36 +00:00
|
|
|
* @param setupFlags the flags with the information about the setup
|
2006-12-05 08:53:26 +00:00
|
|
|
*/
|
2007-09-09 10:50:36 +00:00
|
|
|
virtual void notifySetup( const QVector< Okular::Page * > &pages, int setupFlags );
|
2006-12-05 08:53:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is called whenever the viewport has been changed.
|
|
|
|
*
|
|
|
|
* @param smoothMove If true, the move shall be animated.
|
|
|
|
*/
|
|
|
|
virtual void notifyViewportChanged( bool smoothMove );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is called whenever the content on @p page described by the
|
|
|
|
* passed @p flags has been changed.
|
|
|
|
*/
|
|
|
|
virtual void notifyPageChanged( int page, int flags );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is called whenever the content described by the passed @p flags
|
|
|
|
* has been cleared.
|
|
|
|
*/
|
|
|
|
virtual void notifyContentsCleared( int flags );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is called whenever the visible rects have been changed.
|
|
|
|
*/
|
|
|
|
virtual void notifyVisibleRectsChanged();
|
|
|
|
|
2007-07-08 14:25:08 +00:00
|
|
|
/**
|
|
|
|
* This method is called whenever the zoom of the document has been changed.
|
|
|
|
*/
|
|
|
|
virtual void notifyZoom( int factor );
|
|
|
|
|
2006-12-05 08:53:26 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the observer agrees that all pixmaps for the given
|
|
|
|
* @p page can be unloaded to improve memory usage.
|
|
|
|
*
|
|
|
|
* Returns true per default.
|
|
|
|
*/
|
|
|
|
virtual bool canUnloadPixmap( int page ) const;
|
2005-01-02 14:55:14 +00:00
|
|
|
|
2006-12-05 08:53:26 +00:00
|
|
|
private:
|
|
|
|
class Private;
|
2007-04-15 19:11:10 +00:00
|
|
|
const Private* d;
|
2005-01-02 14:55:14 +00:00
|
|
|
};
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
}
|
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
#endif
|