File indexing completed on 2024-04-28 16:21:26
0001 /* This file is part of the KDE project 0002 Copyright 2008 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 0003 Copyright 2003 Philipp Müller <philipp.mueller@gmx.de> 0004 Copyright 1998, 1999 Torben Weis <weis@kde.org>, 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Library General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Library General Public License for more details. 0015 0016 You should have received a copy of the GNU Library General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef CALLIGRA_SHEETS_PRINT_SETTINGS 0023 #define CALLIGRA_SHEETS_PRINT_SETTINGS 0024 0025 #include <KoPageLayout.h> 0026 0027 #include <QPair> 0028 0029 #include "sheets_odf_export.h" 0030 0031 class QSize; 0032 0033 namespace Calligra 0034 { 0035 namespace Sheets 0036 { 0037 class Region; 0038 class Sheet; 0039 0040 /** 0041 * Settings used for printing. 0042 */ 0043 class CALLIGRA_SHEETS_ODF_EXPORT PrintSettings 0044 { 0045 public: 0046 enum PageOrder { TopToBottom, LeftToRight }; 0047 0048 /** 0049 * Constructor. 0050 */ 0051 PrintSettings(); 0052 0053 /** 0054 * Constructor. 0055 */ 0056 PrintSettings(const PrintSettings& other); 0057 0058 /** 0059 * Destructor. 0060 */ 0061 virtual ~PrintSettings(); 0062 0063 /** 0064 * \return the page layout associated with this document (margins, pageSize, etc). 0065 * \see KoPageLayout 0066 */ 0067 const KoPageLayout& pageLayout() const; 0068 0069 void setPageLayout(const KoPageLayout& pageLayout); 0070 0071 void setPageFormat(KoPageFormat::Format format); 0072 void setPageOrientation(KoPageFormat::Orientation orientation); 0073 0074 /** 0075 * \return the name of the paper orientation (like Portrait, Landscape) 0076 */ 0077 QString orientationString() const; 0078 0079 /** 0080 * \return the name of the paper format (like A4, Letter etc.) 0081 */ 0082 QString paperFormatString() const; 0083 0084 /** 0085 * \return the print width of the paper. 0086 */ 0087 double printWidth() const; 0088 0089 /** 0090 * \return the print height of the paper. 0091 */ 0092 double printHeight() const; 0093 0094 /** 0095 * The order in which the pages should be created. 0096 * Either they are created beginning at the left, continuing to the right and 0097 * then the next row of pages, or they are created vertically page column-wise. 0098 * 0099 * \return the page order 0100 */ 0101 PageOrder pageOrder() const; 0102 void setPageOrder(PageOrder order); 0103 0104 /** 0105 * Returns, if the grid shall be shown on printouts. 0106 */ 0107 bool printGrid() const; 0108 0109 /** 0110 * Sets, if the grid shall be shown on printouts. 0111 */ 0112 void setPrintGrid(bool printGrid); 0113 0114 /** 0115 * Returns, if the charts shall be shown on printouts. 0116 */ 0117 bool printCharts() const; 0118 0119 /** 0120 * Sets, if the charts shall be shown on printouts. 0121 */ 0122 void setPrintCharts(bool printCharts); 0123 0124 /** 0125 * Returns, if the objects shall be shown on printouts 0126 */ 0127 bool printObjects() const; 0128 0129 /** 0130 * Sets, if the objects shall be shown on printouts. 0131 */ 0132 void setPrintObjects(bool printObjects); 0133 0134 /** 0135 * Returns, if the graphics shall be shown on printouts. 0136 */ 0137 bool printGraphics() const; 0138 0139 /** 0140 * Sets, if the graphics shall be shown on printouts. 0141 */ 0142 void setPrintGraphics(bool printGraphics); 0143 0144 /** 0145 * Returns, if the comment rect shall be shown on printouts 0146 */ 0147 bool printCommentIndicator() const; 0148 0149 /** 0150 * Sets, if the comment rect shall be shown on printouts 0151 */ 0152 void setPrintCommentIndicator(bool printCommentIndicator); 0153 0154 /** 0155 * Returns, if the formula rect shall be shown on printouts. 0156 */ 0157 bool printFormulaIndicator() const; 0158 0159 /** 0160 * Sets, if the formula Rect shall be shown on printouts. 0161 */ 0162 void setPrintFormulaIndicator(bool printFormulaIndicator); 0163 0164 /** 0165 * Returns, if the headers shall be shown on printouts. 0166 */ 0167 bool printHeaders() const; 0168 0169 /** 0170 * Sets, if the headers shall be shown on printouts. 0171 */ 0172 void setPrintHeaders(bool printHeaders); 0173 0174 /** 0175 * Returns, if the zero values shall be shown on printouts. 0176 */ 0177 bool printZeroValues() const; 0178 0179 /** 0180 * Sets, if the zero values shall be shown on printouts. 0181 */ 0182 void setPrintZeroValues(bool printZeroValues); 0183 0184 bool centerHorizontally() const; 0185 void setCenterHorizontally(bool center); 0186 bool centerVertically() const; 0187 void setCenterVertically(bool center); 0188 0189 const Region& printRegion() const; 0190 void setPrintRegion(const Region& region); 0191 void addPrintRange(const QRect& range); 0192 void removePrintRange(const QRect& range); 0193 0194 double zoom() const; 0195 void setZoom(double zoom); 0196 const QSize& pageLimits() const; 0197 void setPageLimits(const QSize& pageLimits); 0198 0199 /** 0200 * Returns the columns, which are printed on each page. 0201 * Returns QPair (0, 0) if nothing is defined. 0202 */ 0203 const QPair<int, int>& repeatedColumns() const; 0204 0205 /** 0206 * Sets the columns to be printed on each page. 0207 * Only the x-values of the points are used 0208 * Set it to QPair (0, 0) to undefine it 0209 */ 0210 void setRepeatedColumns(const QPair<int, int>& repeatedColumns); 0211 0212 /** 0213 * Returns the rows, which are printed on each page. 0214 * Returns QPair (0, 0) if nothing is defined 0215 */ 0216 const QPair<int, int>& repeatedRows() const; 0217 0218 /** 0219 * Sets the rows to be printed on each page. 0220 * Only the y-values of the points are used 0221 * Set it to QPair (0, 0) to undefine it 0222 */ 0223 void setRepeatedRows(const QPair<int, int>& repeatedRows); 0224 0225 /** 0226 * Assignment operator. 0227 */ 0228 void operator=(const PrintSettings& settings); 0229 0230 /** 0231 * Equality operator. 0232 */ 0233 bool operator==(const PrintSettings& other) const; 0234 inline bool operator!=(const PrintSettings& other) const { 0235 return !operator==(other); 0236 } 0237 0238 private: 0239 class Private; 0240 Private * const d; 0241 }; 0242 0243 } // namespace Sheets 0244 } // namespace Calligra 0245 0246 #endif // CALLIGRA_SHEETS_PRINT_SETTINGS