1 | /* This file is part of the KDE project |
2 | Copyright 2008 Stefan Nikolaus <stefan.nikolaus@kdemail.net> |
3 | Copyright 2003 Philipp Müller <philipp.mueller@gmx.de> |
4 | Copyright 1998, 1999 Torben Weis <weis@kde.org>, |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. |
10 | |
11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #ifndef CALLIGRA_SHEETS_PRINT_SETTINGS |
23 | #define CALLIGRA_SHEETS_PRINT_SETTINGS |
24 | |
25 | #include <KoPageLayout.h> |
26 | |
27 | #include <QPair> |
28 | |
29 | #include "calligra_sheets_export.h" |
30 | |
31 | class QSize; |
32 | |
33 | namespace Calligra |
34 | { |
35 | namespace Sheets |
36 | { |
37 | class Region; |
38 | class Sheet; |
39 | |
40 | /** |
41 | * Settings used for printing. |
42 | */ |
43 | class CALLIGRA_SHEETS_ODF_EXPORT PrintSettings |
44 | { |
45 | public: |
46 | enum PageOrder { TopToBottom, LeftToRight }; |
47 | |
48 | /** |
49 | * Constructor. |
50 | */ |
51 | PrintSettings(); |
52 | |
53 | /** |
54 | * Constructor. |
55 | */ |
56 | PrintSettings(const PrintSettings& other); |
57 | |
58 | /** |
59 | * Destructor. |
60 | */ |
61 | virtual ~PrintSettings(); |
62 | |
63 | /** |
64 | * \return the page layout associated with this document (margins, pageSize, etc). |
65 | * \see KoPageLayout |
66 | */ |
67 | const KoPageLayout& pageLayout() const; |
68 | |
69 | void setPageLayout(const KoPageLayout& pageLayout); |
70 | |
71 | void setPageFormat(KoPageFormat::Format format); |
72 | void setPageOrientation(KoPageFormat::Orientation orientation); |
73 | |
74 | /** |
75 | * \return the name of the paper orientation (like Portrait, Landscape) |
76 | */ |
77 | QString orientationString() const; |
78 | |
79 | /** |
80 | * \return the name of the paper format (like A4, Letter etc.) |
81 | */ |
82 | QString paperFormatString() const; |
83 | |
84 | /** |
85 | * \return the print width of the paper. |
86 | */ |
87 | double printWidth() const; |
88 | |
89 | /** |
90 | * \return the print height of the paper. |
91 | */ |
92 | double printHeight() const; |
93 | |
94 | /** |
95 | * The order in which the pages should be created. |
96 | * Either they are created beginning at the left, continuing to the right and |
97 | * then the next row of pages, or they are created vertically page column-wise. |
98 | * |
99 | * \return the page order |
100 | */ |
101 | PageOrder pageOrder() const; |
102 | void setPageOrder(PageOrder order); |
103 | |
104 | /** |
105 | * Returns, if the grid shall be shown on printouts. |
106 | */ |
107 | bool printGrid() const; |
108 | |
109 | /** |
110 | * Sets, if the grid shall be shown on printouts. |
111 | */ |
112 | void setPrintGrid(bool printGrid); |
113 | |
114 | /** |
115 | * Returns, if the charts shall be shown on printouts. |
116 | */ |
117 | bool printCharts() const; |
118 | |
119 | /** |
120 | * Sets, if the charts shall be shown on printouts. |
121 | */ |
122 | void setPrintCharts(bool printCharts); |
123 | |
124 | /** |
125 | * Returns, if the objects shall be shown on printouts |
126 | */ |
127 | bool printObjects() const; |
128 | |
129 | /** |
130 | * Sets, if the objects shall be shown on printouts. |
131 | */ |
132 | void setPrintObjects(bool printObjects); |
133 | |
134 | /** |
135 | * Returns, if the graphics shall be shown on printouts. |
136 | */ |
137 | bool printGraphics() const; |
138 | |
139 | /** |
140 | * Sets, if the graphics shall be shown on printouts. |
141 | */ |
142 | void setPrintGraphics(bool printGraphics); |
143 | |
144 | /** |
145 | * Returns, if the comment rect shall be shown on printouts |
146 | */ |
147 | bool () const; |
148 | |
149 | /** |
150 | * Sets, if the comment rect shall be shown on printouts |
151 | */ |
152 | void (bool ); |
153 | |
154 | /** |
155 | * Returns, if the formula rect shall be shown on printouts. |
156 | */ |
157 | bool printFormulaIndicator() const; |
158 | |
159 | /** |
160 | * Sets, if the formula Rect shall be shown on printouts. |
161 | */ |
162 | void setPrintFormulaIndicator(bool printFormulaIndicator); |
163 | |
164 | /** |
165 | * Returns, if the headers shall be shown on printouts. |
166 | */ |
167 | bool () const; |
168 | |
169 | /** |
170 | * Sets, if the headers shall be shown on printouts. |
171 | */ |
172 | void (bool ); |
173 | |
174 | /** |
175 | * Returns, if the zero values shall be shown on printouts. |
176 | */ |
177 | bool printZeroValues() const; |
178 | |
179 | /** |
180 | * Sets, if the zero values shall be shown on printouts. |
181 | */ |
182 | void setPrintZeroValues(bool printZeroValues); |
183 | |
184 | bool centerHorizontally() const; |
185 | void setCenterHorizontally(bool center); |
186 | bool centerVertically() const; |
187 | void setCenterVertically(bool center); |
188 | |
189 | const Region& printRegion() const; |
190 | void setPrintRegion(const Region& region); |
191 | void addPrintRange(const QRect& range); |
192 | void removePrintRange(const QRect& range); |
193 | |
194 | double zoom() const; |
195 | void setZoom(double zoom); |
196 | const QSize& pageLimits() const; |
197 | void setPageLimits(const QSize& pageLimits); |
198 | |
199 | /** |
200 | * Returns the columns, which are printed on each page. |
201 | * Returns QPair (0, 0) if nothing is defined. |
202 | */ |
203 | const QPair<int, int>& repeatedColumns() const; |
204 | |
205 | /** |
206 | * Sets the columns to be printed on each page. |
207 | * Only the x-values of the points are used |
208 | * Set it to QPair (0, 0) to undefine it |
209 | */ |
210 | void setRepeatedColumns(const QPair<int, int>& repeatedColumns); |
211 | |
212 | /** |
213 | * Returns the rows, which are printed on each page. |
214 | * Returns QPair (0, 0) if nothing is defined |
215 | */ |
216 | const QPair<int, int>& repeatedRows() const; |
217 | |
218 | /** |
219 | * Sets the rows to be printed on each page. |
220 | * Only the y-values of the points are used |
221 | * Set it to QPair (0, 0) to undefine it |
222 | */ |
223 | void setRepeatedRows(const QPair<int, int>& repeatedRows); |
224 | |
225 | /** |
226 | * Saves a page layout style. |
227 | * Adds the style to \p mainStyles. |
228 | * Saved OpenDocument properties: |
229 | * \li 15.2.1 Page Size |
230 | * \li 15.2.4 Print Orientation |
231 | * \li 15.2.5 Margins |
232 | * \li 15.2.13 Print |
233 | * \li 15.2.14 Print Page Order |
234 | * \li 15.2.16 Scale |
235 | * \li 15.2.17 Table Centering |
236 | * \param mainStyles generic styles |
237 | * \param formulas print formulas |
238 | * \param zeros print zero values |
239 | * \return the style's name |
240 | * \ingroup OpenDocument |
241 | */ |
242 | QString saveOdfPageLayout(KoGenStyles &mainStyles, bool formulas, bool zeros); |
243 | |
244 | /** |
245 | * Assignment operator. |
246 | */ |
247 | void operator=(const PrintSettings& settings); |
248 | |
249 | /** |
250 | * Equality operator. |
251 | */ |
252 | bool operator==(const PrintSettings& other) const; |
253 | inline bool operator!=(const PrintSettings& other) const { |
254 | return !operator==(other); |
255 | } |
256 | |
257 | private: |
258 | class Private; |
259 | Private * const d; |
260 | }; |
261 | |
262 | } // namespace Sheets |
263 | } // namespace Calligra |
264 | |
265 | #endif // CALLIGRA_SHEETS_PRINT_SETTINGS |
266 | |