Warning, file /office/calligra/libs/widgets/KoZoomMode.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 Copyright (C) 2005 Johannes Schaub <litb_devel@web.de> 0003 Copyright (C) 2011 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef _KOZOOMMODE_H_ 0022 #define _KOZOOMMODE_H_ 0023 0024 #include <QString> 0025 #include <QFlags> 0026 #include "kowidgets_export.h" 0027 0028 /** 0029 * The ZoomMode container 0030 */ 0031 class KOWIDGETS_EXPORT KoZoomMode 0032 { 0033 public: 0034 enum Mode 0035 { 0036 ZOOM_CONSTANT = 0, ///< zoom x % 0037 ZOOM_WIDTH = 1, ///< zoom pagewidth 0038 ZOOM_PAGE = 2, ///< zoom to pagesize 0039 ZOOM_PIXELS = 4, ///< zoom to actual pixels 0040 ZOOM_TEXT = 8 ///< zoom to actual pixels 0041 }; 0042 0043 Q_DECLARE_FLAGS(Modes, Mode) 0044 0045 /// \param mode the mode name 0046 /// \return the to Mode converted QString \c mode 0047 static Mode toMode(const QString& mode); 0048 0049 /// \return the to QString converted and translated Mode \c mode 0050 static QString toString(Mode mode); 0051 0052 /// \param mode the mode name 0053 /// \return true if \c mode isn't dependent on windowsize 0054 static bool isConstant(const QString& mode) 0055 { return toMode(mode) == ZOOM_CONSTANT; } 0056 0057 /** 0058 * Return the minimum zoom possible for documents. 0059 * 0060 * \return The minimum zoom possible. 0061 */ 0062 static qreal minimumZoom(); 0063 /** 0064 * Return the maximum zoom possible for documents. 0065 * 0066 * \return The maximum zoom possible. 0067 */ 0068 static qreal maximumZoom(); 0069 /** 0070 * Clamp the zoom value so that mimimumZoom <= zoom <= maximumZoom. 0071 * 0072 * \param zoom The value to clamp. 0073 * 0074 * \return minimumZoom if zoom < minimumZoom, maximumZoom if zoom > 0075 * maximumZoom, zoom if otherwise. 0076 */ 0077 static qreal clampZoom(qreal zoom); 0078 0079 /** 0080 * Set the minimum zoom possible for documents. 0081 * 0082 * Note that after calling this, any existing KoZoomAction instances 0083 * should be recreated. 0084 * 0085 * \param zoom The minimum zoom to use. 0086 */ 0087 static void setMinimumZoom(qreal zoom); 0088 /** 0089 * Set the maximum zoom possible for documents. 0090 * 0091 * Note that after calling this, any existing KoZoomAction instances 0092 * should be recreated. 0093 * 0094 * \param zoom The maximum zoom to use. 0095 */ 0096 static void setMaximumZoom(qreal zoom); 0097 0098 private: 0099 static const char * const modes[]; 0100 static qreal minimumZoomValue; 0101 static qreal maximumZoomValue; 0102 }; 0103 0104 Q_DECLARE_OPERATORS_FOR_FLAGS(KoZoomMode::Modes) 0105 0106 #endif