Okular

saveinterface.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_SAVEINTERFACE_H_
8#define _OKULAR_SAVEINTERFACE_H_
9
10#include "../core/okularcore_export.h"
11
12#include <QObject>
13
14namespace Okular
15{
16class AnnotationProxy;
17
18/**
19 * @short Abstract interface for saving
20 *
21 * This interface defines a way to save (or help saving) the document opened
22 * by the Generator.
23 *
24 * How to use it in a custom Generator:
25 * @code
26 class MyGenerator : public Okular::Generator, public Okular::SaveInterface
27 {
28 Q_OBJECT
29 Q_INTERFACES( Okular::SaveInterface )
30
31 ...
32 };
33 * @endcode
34 * and - of course - implementing its methods.
35 */
36class OKULARCORE_EXPORT SaveInterface
37{
38public:
39 /**
40 * The possible options for the saving.
41 */
43 NoOption = 0,
44 SaveChanges = 1 ///< The possibility to save with the current changes to the document.
45 };
46 Q_DECLARE_FLAGS(SaveOptions, SaveOption)
47
49 {
50 }
51
52 /**
53 * Destroys the save interface.
54 */
56 {
57 }
58
59 SaveInterface(const SaveInterface &) = delete;
60 SaveInterface &operator=(const SaveInterface &) = delete;
61
62 /**
63 * Query for the supported saving options.
64 *
65 * @note NoOption is never queried
66 */
67 virtual bool supportsOption(SaveOption option) const = 0;
68
69 /**
70 * Save to the specified @p fileName with the specified @p options.
71 */
72 virtual bool save(const QString &fileName, SaveOptions options, QString *errorText) = 0;
73
74 /**
75 * Returns the annotation proxy. Generators can return NULL if native
76 * annotations are not supported.
77 *
78 * @note Returning NULL is equivalent to returning an AnnotationProxy
79 * that doesn't support any capability.
80 * @since 0.15 (KDE 4.9)
81 */
82 virtual AnnotationProxy *annotationProxy() const = 0;
83};
84
85}
86
87Q_DECLARE_INTERFACE(Okular::SaveInterface, "org.kde.okular.SaveInterface/0.3")
88Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::SaveInterface::SaveOptions)
89
90#endif
Native annotation interface.
Abstract interface for saving.
virtual AnnotationProxy * annotationProxy() const =0
Returns the annotation proxy.
virtual bool save(const QString &fileName, SaveOptions options, QString *errorText)=0
Save to the specified fileName with the specified options.
virtual bool supportsOption(SaveOption option) const =0
Query for the supported saving options.
virtual ~SaveInterface()
Destroys the save interface.
SaveOption
The possible options for the saving.
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.