File indexing completed on 2024-05-12 16:37:08
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2007-2010 Thomas Zander <zander@kde.org> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Library General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 #ifndef KWAPPLICATIONCONFIG_H 0020 #define KWAPPLICATIONCONFIG_H 0021 0022 #include <KoZoomMode.h> 0023 0024 class KWDocument; 0025 class KoUnit; 0026 0027 /** 0028 * A set of config settings for application-specific stuff (compared to document-specific stuff). 0029 */ 0030 class KWApplicationConfig 0031 { 0032 public: 0033 KWApplicationConfig(); 0034 0035 /// load the words settings. 0036 void load(KWDocument *document); 0037 /// save the config settings. 0038 void save(); 0039 0040 void setViewFrameBorders(bool on) { 0041 m_viewFrameBorders = on; 0042 } 0043 bool viewFrameBorders() const { 0044 return m_viewFrameBorders; 0045 } 0046 0047 void setShowFormattingChars(bool on) { 0048 m_showFormattingChars = on; 0049 } 0050 bool showFormattingChars() const { 0051 return m_showFormattingChars; 0052 } 0053 0054 void setShowInlineObjectVisualization(bool on) { 0055 m_showInlineObjectVisualization = on; 0056 } 0057 bool showInlineObjectVisualization() const { 0058 return m_showInlineObjectVisualization; 0059 } 0060 0061 void setShowTableBorders(bool on) { 0062 m_showTableBorders = on; 0063 } 0064 0065 void setShowSectionBounds(bool on) { 0066 m_showSectionBounds = on; 0067 } 0068 0069 bool showTableBorders() const { 0070 return m_showTableBorders; 0071 } 0072 0073 bool showSectionBounds() const { 0074 return m_showSectionBounds; 0075 } 0076 0077 void setViewRulers(bool on) { 0078 m_viewRulers = on; 0079 } 0080 bool viewRulers() const { 0081 return m_viewRulers; 0082 } 0083 0084 void setStatusBarShowPage(bool on) { 0085 m_statusBarShowPage = on; 0086 } 0087 0088 bool statusBarShowPage() { 0089 return m_statusBarShowPage; 0090 } 0091 0092 bool statusBarShowPageStyle() { 0093 return m_statusBarShowPageStyle; 0094 } 0095 0096 void setStatusBarShowPageStyle(bool on) { 0097 m_statusBarShowPageStyle = on; 0098 } 0099 0100 bool statusBarShowPageSize() { 0101 return m_statusBarShowPageSize; 0102 } 0103 0104 void setStatusBarShowPageSize(bool on) { 0105 m_statusBarShowPageSize = on; 0106 } 0107 0108 void setStatusBarShowLineNumber(bool on) { 0109 m_statusBarShowLineNumber = on; 0110 } 0111 0112 bool statusBarShowLineNumber() { 0113 return m_statusBarShowLineNumber; 0114 } 0115 0116 void setStatusBarShowModified(bool on) { 0117 m_statusBarShowModified = on; 0118 } 0119 0120 bool statusBarShowModified() { 0121 return m_statusBarShowModified; 0122 } 0123 0124 void setStatusBarShowMouse(bool on) { 0125 m_statusBarShowMouse = on; 0126 } 0127 0128 bool statusBarShowMouse() { 0129 return m_statusBarShowMouse; 0130 } 0131 0132 void setStatusBarShowZoom(bool on) { 0133 m_statusBarShowZoom = on; 0134 } 0135 0136 bool statusBarShowZoom() { 0137 return m_statusBarShowZoom; 0138 } 0139 0140 void setStatusBarShowWordCount(bool on) { 0141 m_statusBarShowWordCount = on; 0142 } 0143 0144 bool statusBarShowWordCount() { 0145 return m_statusBarShowWordCount; 0146 } 0147 /** 0148 * Set the zoom level for new views and for next startups of words. 0149 * Documents shown at 100% will show the page on screen at the same amount of 0150 * metric units as the user set them to be. In other words; the paper and the 0151 * screen versions should be exactly the same. 0152 * @param percent the new zoom level to be persisted between sessions. 0153 */ 0154 void setZoom(int percent) { 0155 m_zoom = percent; 0156 } 0157 0158 /** 0159 * Return the percentage of zoom. 0160 * @return the percentage of zoom. 0161 * @see setZoom(int) 0162 */ 0163 int zoom() const { 0164 return m_zoom; 0165 } 0166 0167 /** 0168 * Set the mode of zooming for new views and to be persisted between sessions. 0169 * @param mode the new mode 0170 */ 0171 void setZoomMode(KoZoomMode::Mode mode) { 0172 m_zoomMode = mode; 0173 } 0174 0175 /** 0176 * Return the zoomMode to be used for new views. 0177 */ 0178 KoZoomMode::Mode zoomMode() const { 0179 return m_zoomMode; 0180 } 0181 0182 qreal defaultColumnSpacing() const { 0183 return m_defaultColumnSpacing; 0184 } 0185 0186 void setUnit(const KoUnit &unit); 0187 0188 private: 0189 bool m_viewFrameBorders; 0190 bool m_viewRulers; 0191 bool m_showFormattingChars; 0192 bool m_showTableBorders; 0193 bool m_showSectionBounds; 0194 bool m_createBackupFile; 0195 bool m_statusBarShowPage, m_statusBarShowPageStyle, m_statusBarShowPageSize; 0196 bool m_statusBarShowLineNumber, m_statusBarShowModified; 0197 bool m_statusBarShowMouse, m_statusBarShowZoom; 0198 bool m_statusBarShowWordCount; 0199 bool m_showInlineObjectVisualization; 0200 0201 int m_zoom; /// < zoom level in percent 0202 KoZoomMode::Mode m_zoomMode; 0203 0204 int m_autoSaveSeconds; 0205 qreal m_defaultColumnSpacing; 0206 0207 Q_DISABLE_COPY(KWApplicationConfig) 0208 }; 0209 0210 #endif