mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-30 01:38:07 +00:00
04c3b836ff
Conflicts: generators/spectre/okularApplication_ghostview.desktop
121 lines
4.2 KiB
C++
121 lines
4.2 KiB
C++
/***************************************************************************
|
|
* Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> *
|
|
* Copyright (C) 2005 by Albert Astals Cid <aacid@kde.org> *
|
|
* *
|
|
* 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 _OKULAR_DOCUMENTOBSERVER_H_
|
|
#define _OKULAR_DOCUMENTOBSERVER_H_
|
|
|
|
#include <QtCore/QVector>
|
|
|
|
#include "okular_export.h"
|
|
|
|
namespace Okular {
|
|
|
|
class Page;
|
|
|
|
/**
|
|
* @short Base class for objects being notified when something changes.
|
|
*
|
|
* Inherit this class and call Document->addObserver( yourClass ) to get
|
|
* notified of asynchronous events (new pixmap generated, or changed, etc..).
|
|
*/
|
|
class OKULAR_EXPORT DocumentObserver
|
|
{
|
|
public:
|
|
DocumentObserver();
|
|
/**
|
|
* Destroys the document observer.
|
|
*/
|
|
virtual ~DocumentObserver();
|
|
|
|
/**
|
|
* 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
|
|
Annotations = 16, ///< Annotations have been changed
|
|
BoundingBox = 32, ///< Bounding boxes have been changed
|
|
NeedSaveAs = 64 ///< Set along with Annotations when Save As is needed or annotation changes will be lost @since 0.15 (KDE 4.9)
|
|
};
|
|
|
|
/**
|
|
* ...
|
|
*/
|
|
enum SetupFlags {
|
|
DocumentChanged = 1, ///< The document is a new document.
|
|
NewLayoutForPages = 2 ///< All the pages have
|
|
};
|
|
|
|
/**
|
|
* This method is called whenever the document is initialized or reconstructed.
|
|
*
|
|
* @param pages The vector of pages of the document.
|
|
* @param setupFlags the flags with the information about the setup
|
|
*/
|
|
virtual void notifySetup( const QVector< Okular::Page * > &pages, int setupFlags );
|
|
|
|
/**
|
|
* 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();
|
|
|
|
/**
|
|
* This method is called whenever the zoom of the document has been changed.
|
|
*/
|
|
virtual void notifyZoom( int factor );
|
|
|
|
/**
|
|
* 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;
|
|
|
|
/**
|
|
* This method is called after the current page of the document has been entered.
|
|
*
|
|
* @param previous The number of the previous page (is @c -1 for the initial page change).
|
|
* @param current The number of the current page.
|
|
*
|
|
* @since 0.16 (KDE 4.10)
|
|
*/
|
|
virtual void notifyCurrentPageChanged( int previous, int current );
|
|
|
|
private:
|
|
class Private;
|
|
const Private* d;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|