Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportZoomMode_p.h
Show All 15 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | * Boston, MA 02110-1301, USA. | 18 | * Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef _KREPORTZOOMMODE_H_ | 21 | #ifndef _KREPORTZOOMMODE_H_ | ||
22 | #define _KREPORTZOOMMODE_H_ | 22 | #define _KREPORTZOOMMODE_H_ | ||
23 | 23 | | |||
24 | #include <QString> | 24 | #include <QCoreApplication> | ||
25 | 25 | | |||
26 | #include "kreport_export.h" | 26 | #include "kreport_export.h" | ||
27 | 27 | | |||
28 | /** | 28 | /** | ||
29 | * The ZoomMode container | 29 | * The ZoomMode container | ||
30 | */ | 30 | */ | ||
31 | class KReportZoomMode | 31 | class KReportZoomMode | ||
32 | { | 32 | { | ||
33 | Q_DECLARE_TR_FUNCTIONS(KReportZoomMode) | ||||
33 | public: | 34 | public: | ||
34 | enum Mode | 35 | enum class Type | ||
35 | { | 36 | { | ||
36 | ZOOM_CONSTANT = 0, ///< zoom x % | 37 | Constant, ///< zoom x % | ||
37 | ZOOM_WIDTH = 1, ///< zoom pagewidth | 38 | Width, ///< zoom pagewidth | ||
38 | ZOOM_PAGE = 2, ///< zoom to pagesize | 39 | Page, ///< zoom to pagesize | ||
39 | ZOOM_PIXELS = 4, ///< zoom to actual pixels | 40 | Pixels, ///< zoom to actual pixels | ||
40 | ZOOM_TEXT = 8 ///< zoom to actual pixels | 41 | Text ///< zoom to text | ||
41 | }; | 42 | }; | ||
42 | 43 | | |||
43 | Q_DECLARE_FLAGS(Modes, Mode) | 44 | /// \param type name | ||
45 | /// \return type converted | ||||
46 | static Type toType(const QString &string); | ||||
44 | 47 | | |||
45 | /// \param mode the mode name | 48 | /// \return QString converted and translated for type | ||
46 | /// \return the to Mode converted QString \c mode | 49 | static QString toString(Type type); | ||
47 | static Mode toMode(const QString& mode); | | |||
48 | 50 | | |||
49 | /// \return the to QString converted and translated Mode \c mode | 51 | /// \param type name | ||
50 | static QString toString(Mode mode); | | |||
51 | | ||||
52 | /// \param mode the mode name | | |||
53 | /// \return true if \c mode isn't dependent on windowsize | 52 | /// \return true if \c mode isn't dependent on windowsize | ||
54 | static bool isConstant(const QString& mode) | 53 | static bool isConstant(const QString& mode) | ||
55 | { return toMode(mode) == ZOOM_CONSTANT; } | 54 | { return toType(mode) == Type::Constant; } | ||
56 | 55 | | |||
57 | /** | 56 | /** | ||
58 | * Return the minimum zoom possible for documents. | 57 | * Return the minimum zoom possible for documents. | ||
59 | * | 58 | * | ||
60 | * \return The minimum zoom possible. | 59 | * \return The minimum zoom possible. | ||
61 | */ | 60 | */ | ||
62 | static qreal minimumZoom(); | 61 | static qreal minimumZoom(); | ||
63 | /** | 62 | /** | ||
Show All 25 Lines | |||||
89 | * Set the maximum zoom possible for documents. | 88 | * Set the maximum zoom possible for documents. | ||
90 | * | 89 | * | ||
91 | * Note that after calling this, any existing KoZoomAction instances | 90 | * Note that after calling this, any existing KoZoomAction instances | ||
92 | * should be recreated. | 91 | * should be recreated. | ||
93 | * | 92 | * | ||
94 | * \param zoom The maximum zoom to use. | 93 | * \param zoom The maximum zoom to use. | ||
95 | */ | 94 | */ | ||
96 | static void setMaximumZoom(qreal zoom); | 95 | static void setMaximumZoom(qreal zoom); | ||
97 | | ||||
98 | private: | | |||
99 | static const char * const modes[]; | | |||
100 | static qreal minimumZoomValue; | | |||
101 | static qreal maximumZoomValue; | | |||
102 | }; | 96 | }; | ||
103 | 97 | | |||
104 | Q_DECLARE_OPERATORS_FOR_FLAGS(KReportZoomMode::Modes) | | |||
105 | | ||||
106 | #endif | 98 | #endif |