compile
[kdegraphics.git] / okular / interfaces / saveinterface.h
blobf1a7da97cfd66d9efa09f6609b0591e53500be0a
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_SAVEINTERFACE_H_
11 #define _OKULAR_SAVEINTERFACE_H_
13 #include <okular/core/okular_export.h>
15 #include <QtCore/QObject>
17 namespace Okular {
19 class AnnotationProxy;
21 /**
22 * @short Abstract interface for saving
24 * This interface defines a way to save (or help saving) the document opened
25 * by the Generator.
27 * How to use it in a custom Generator:
28 * @code
29 class MyGenerator : public Okular::Generator, public Okular::SaveInterface
31 Q_OBJECT
32 Q_INTERFACES( Okular::SaveInterface )
34 ...
36 * @endcode
37 * and - of course - implementing its methods.
39 class OKULAR_EXPORT SaveInterface
41 public:
42 /**
43 * The possible options for the saving.
45 enum SaveOption
47 NoOption = 0,
48 SaveChanges = 1 ///< The possibility to save with the current changes to the document.
50 Q_DECLARE_FLAGS( SaveOptions, SaveOption )
52 /**
53 * Destroys the save interface.
55 virtual ~SaveInterface() {}
57 /**
58 * Query for the supported saving options.
60 * @note NoOption is never queried
62 virtual bool supportsOption( SaveOption option ) const = 0;
64 /**
65 * Save to the specified @p fileName with the specified @p options.
67 virtual bool save( const QString &fileName, SaveOptions options ) = 0;
72 Q_DECLARE_INTERFACE( Okular::SaveInterface, "org.kde.okular.SaveInterface/0.1" )
73 Q_DECLARE_OPERATORS_FOR_FLAGS( Okular::SaveInterface::SaveOptions )
75 #endif