Okular

view.h
1/*
2 SPDX-FileCopyrightText: 2008 Pino Toscano <pino@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#ifndef OKULAR_VIEW_H
8#define OKULAR_VIEW_H
9
10#include "okularcore_export.h"
11#include <QObject>
12class QString;
13class QVariant;
14
15namespace Okular
16{
17class Document;
18class DocumentPrivate;
19class ViewPrivate;
20
21/**
22 * @short View on the document
23 *
24 * The View class represents a "view" on a document.
25 * A view can be registered with only a document at a time.
26 *
27 * @since 0.7 (KDE 4.1)
28 */
29class OKULARCORE_EXPORT View
30{
31 /// @cond PRIVATE
32 friend class Document;
33 friend class DocumentPrivate;
34 /// @endcond
35
36public:
37 /**
38 * The capabilities of a view
39 */
41 Zoom, ///< Possibility to get/set the zoom of the view
42 ZoomModality, ///< Possibility to get/set the zoom mode of the view
43 Continuous, ///< Possibility to toggle continuous mode @since 1.9
44 ViewModeModality, ///< Possibility to get/set the view mode @since 1.9
45 TrimMargins ///< Possibility to toggle trim-margins mode @since 1.9
46 };
47
48 /**
49 * The access type of a capability
50 */
52 NoFlag = 0,
53 CapabilityRead = 0x01, ///< Possibility to read a capability
54 CapabilityWrite = 0x02, ///< Possibility to write a capability
55 CapabilitySerializable = 0x04 ///< The capability is suitable for being serialized/deserialized
56 };
57 Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag)
58
59 virtual ~View();
60
61 /**
62 * Return the document which this view is associated to,
63 * or null if it is not associated with any document.
64 */
65 Document *viewDocument() const;
66
67 /**
68 * Return the name of this view.
69 */
70 QString name() const;
71
72 /**
73 * Query whether the view support the specified @p capability.
74 */
75 virtual bool supportsCapability(ViewCapability capability) const;
76
77 /**
78 * Query the flags for the specified @p capability.
79 */
80 virtual CapabilityFlags capabilityFlags(ViewCapability capability) const;
81
82 /**
83 * Query the value of the specified @p capability.
84 */
85 virtual QVariant capability(ViewCapability capability) const;
86
87 /**
88 * Sets a new value for the specified @p capability.
89 */
90 virtual void setCapability(ViewCapability capability, const QVariant &option);
91
92protected:
93 /**
94 * Construct a new view with the specified @p name.
95 */
96 explicit View(const QString &name);
97
98 /// @cond PRIVATE
99 Q_DECLARE_PRIVATE(View)
100 ViewPrivate *d_ptr;
101 /// @endcond
102
103private:
104 Q_DISABLE_COPY(View)
105};
106
107}
108
109Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::View::CapabilityFlags)
110
111#endif
The Document.
Definition document.h:192
View on the document.
Definition view.h:30
CapabilityFlag
The access type of a capability.
Definition view.h:51
ViewCapability
The capabilities of a view.
Definition view.h:40
@ ZoomModality
Possibility to get/set the zoom mode of the view.
Definition view.h:42
@ Zoom
Possibility to get/set the zoom of the view.
Definition view.h:41
@ ViewModeModality
Possibility to get/set the view mode.
Definition view.h:44
@ Continuous
Possibility to toggle continuous mode.
Definition view.h:43
global.h
Definition action.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:35 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.