File indexing completed on 2024-05-12 16:02:14
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2005 Johannes Schaub <litb_devel@web.de> 0003 SPDX-FileCopyrightText: 2011 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef _KOZOOMMODE_H_ 0009 #define _KOZOOMMODE_H_ 0010 0011 #include <QString> 0012 #include <QFlags> 0013 #include "kritawidgets_export.h" 0014 0015 /** 0016 * The ZoomMode container 0017 */ 0018 class KRITAWIDGETS_EXPORT KoZoomMode 0019 { 0020 public: 0021 enum Mode 0022 { 0023 ZOOM_CONSTANT = 0, ///< zoom x % 0024 ZOOM_WIDTH = 1, ///< zoom pagewidth 0025 ZOOM_PAGE = 2, ///< zoom to pagesize 0026 ZOOM_HEIGHT = 16, ///< zoom pageheight 0027 ZOOM_PIXELS = 4 ///< zoom to actual pixels 0028 }; 0029 0030 Q_DECLARE_FLAGS(Modes, Mode) 0031 0032 /// \param mode the mode name 0033 /// \return the to Mode converted QString \c mode 0034 static Mode toMode(const QString& mode); 0035 0036 /// \return the to QString converted and translated Mode \c mode 0037 static QString toString(Mode mode); 0038 0039 /** 0040 * Return the minimum zoom possible for documents. 0041 * 0042 * \return The minimum zoom possible. 0043 */ 0044 static qreal minimumZoom(); 0045 /** 0046 * Return the maximum zoom possible for documents. 0047 * 0048 * \return The maximum zoom possible. 0049 */ 0050 static qreal maximumZoom(); 0051 0052 /** 0053 * Set the minimum zoom possible for documents. 0054 * 0055 * Note that after calling this, any existing KoZoomAction instances 0056 * should be recreated. 0057 * 0058 * \param zoom The minimum zoom to use. 0059 */ 0060 0061 static void setMinimumZoom(qreal zoom); 0062 /** 0063 * Set the maximum zoom possible for documents. 0064 * 0065 * Note that after calling this, any existing KoZoomAction instances 0066 * should be recreated. 0067 * 0068 * \param zoom The maximum zoom to use. 0069 */ 0070 static void setMaximumZoom(qreal zoom); 0071 0072 private: 0073 static const char * const modes[]; 0074 static qreal minimumZoomValue; 0075 static qreal maximumZoomValue; 0076 }; 0077 0078 Q_DECLARE_OPERATORS_FOR_FLAGS(KoZoomMode::Modes) 0079 0080 #endif