Okular

saveinterface.h
1 /*
2  SPDX-FileCopyrightText: 2008 Pino Toscano <[email protected]>
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 
14 namespace Okular
15 {
16 class 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  */
36 class OKULARCORE_EXPORT SaveInterface
37 {
38 public:
39  /**
40  * The possible options for the saving.
41  */
42  enum SaveOption {
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  */
55  virtual ~SaveInterface()
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 
87 Q_DECLARE_INTERFACE(Okular::SaveInterface, "org.kde.okular.SaveInterface/0.3")
88 Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::SaveInterface::SaveOptions)
89 
90 #endif
The documentation to the global Okular namespace.
Definition: action.h:16
SaveOption
The possible options for the saving.
Definition: saveinterface.h:42
Abstract interface for saving.
Definition: saveinterface.h:36
virtual ~SaveInterface()
Destroys the save interface.
Definition: saveinterface.h:55
Native annotation interface.
Definition: annotations.h:706
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Mar 27 2023 04:09:00 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.