compile
[kdegraphics.git] / okular / core / view.h
blobd1fa3769249b4d939cbff3bd49f24c940fc3c1e6
1 /***************************************************************************
2 * Copyright (C) 2008 by Pino Toscano <pino@kde.org> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #ifndef OKULAR_VIEW_H
11 #define OKULAR_VIEW_H
13 #include "okular_export.h"
15 class QString;
16 class QVariant;
18 namespace Okular {
20 class Document;
21 class DocumentPrivate;
22 class ViewPrivate;
24 /**
25 * @short View on the document
27 * The View class represents a "view" on a document.
28 * A view can be registered with only a document at a time.
30 * @since 0.7 (KDE 4.1)
32 class OKULAR_EXPORT View
34 /// @cond PRIVATE
35 friend class Document;
36 friend class DocumentPrivate;
37 /// @endcond
39 public:
40 /**
41 * The capabilities of a view
43 enum ViewCapability
45 Zoom, ///< Possibility to get/set the zoom of the view
46 ZoomModality ///< Possibility to get/set the zoom mode of the view
49 /**
50 * The access type of a capability
52 enum CapabilityFlag
54 NoFlag = 0,
55 CapabilityRead = 0x01, ///< Possibility to read a capability
56 CapabilityWrite = 0x02, ///< Possibility to write a capability
57 CapabilitySerializable = 0x04 ///< The capability is suitable for being serialized/deserialized
59 Q_DECLARE_FLAGS( CapabilityFlags, CapabilityFlag )
61 virtual ~View();
63 /**
64 * Return the document which this view is associated to,
65 * or null if it is not associated with any document.
67 Document* viewDocument() const;
69 /**
70 * Return the name of this view.
72 QString name() const;
74 /**
75 * Must return an unique ID for each view.
77 virtual uint viewId() const = 0;
79 /**
80 * Query whether the view support the specified @p capability.
82 virtual bool supportsCapability( ViewCapability capability ) const;
84 /**
85 * Query the flags for the specified @p capability.
87 virtual CapabilityFlags capabilityFlags( ViewCapability capability ) const;
89 /**
90 * Query the value of the specified @p capability.
92 virtual QVariant capability( ViewCapability capability ) const;
94 /**
95 * Sets a new value for the specified @p capability.
97 virtual void setCapability( ViewCapability capability, const QVariant &option );
99 protected:
101 * Construct a new view with the specified @p name.
103 View( const QString &name );
105 /// @cond PRIVATE
106 Q_DECLARE_PRIVATE( View )
107 ViewPrivate *d_ptr;
108 /// @endcond
110 private:
111 Q_DISABLE_COPY( View )
116 Q_DECLARE_OPERATORS_FOR_FLAGS( Okular::View::CapabilityFlags )
118 #endif