1 | /* This file is part of the KDE project |
2 | Copyright 2007, 2009 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_SHEET_PRINT |
23 | #define CALLIGRA_SHEETS_SHEET_PRINT |
24 | |
25 | #include <QRectF> |
26 | |
27 | #include "calligra_sheets_export.h" |
28 | |
29 | class QPainter; |
30 | |
31 | namespace Calligra |
32 | { |
33 | namespace Sheets |
34 | { |
35 | class ; |
36 | class PrintSettings; |
37 | class Sheet; |
38 | |
39 | /** |
40 | * \class SheetPrint |
41 | * Manages the layout of pages for printing. |
42 | * Supports next to the obligatory page dimensions |
43 | * zooming, page limits and column/row repetitions. |
44 | * \ingroup Printing |
45 | */ |
46 | class CALLIGRA_SHEETS_ODF_EXPORT SheetPrint |
47 | { |
48 | public: |
49 | explicit SheetPrint(Sheet * sheet = 0); |
50 | SheetPrint(const SheetPrint &other); |
51 | ~SheetPrint(); |
52 | |
53 | /** |
54 | * \return the print settings |
55 | */ |
56 | PrintSettings *settings() const; |
57 | |
58 | /** |
59 | * Sets the print \p settings. |
60 | * \param force Forces a relayout of the pages, if \c true. |
61 | */ |
62 | void setSettings(const PrintSettings &settings, bool force = false); |
63 | |
64 | /** |
65 | * \return the header & footer object |
66 | */ |
67 | HeaderFooter *() const; |
68 | |
69 | /** |
70 | * Tests whether @p column is the first column of a new page. In this |
71 | * case the left border of this column may be drawn highlighted to show |
72 | * that this is a page break. |
73 | */ |
74 | bool isColumnOnNewPage(int column); |
75 | |
76 | /** |
77 | * Tests whether \p row is the first row of a new page. In this |
78 | * case the top border of this row may be drawn highlighted to show |
79 | * that this is a page break. |
80 | */ |
81 | bool isRowOnNewPage(int row); |
82 | |
83 | /** |
84 | * Updates the page parameters in horizontal direction (for columns) |
85 | * starting at \p column. |
86 | * Actually, only removes them and they get calculated on demand. |
87 | * Triggers an update of the repeated columns' pre-calculated width, |
88 | * if \p column is not beyond the repetition. |
89 | */ |
90 | void updateHorizontalPageParameters(int column); |
91 | |
92 | /** |
93 | * Updates the page parameters in vertical direction (for rows) |
94 | * starting at \p row. |
95 | * Actually, only removes them and they get calculated on demand. |
96 | * Triggers an update of the repeated rows' pre-calculated height, |
97 | * if \p row is not beyond the repetition. |
98 | */ |
99 | void updateVerticalPageParameters(int row); |
100 | |
101 | /** |
102 | * Updates the print range, according to the inserted columns |
103 | * \param col the column index |
104 | * \param nbCol number of inserted columns |
105 | */ |
106 | void insertColumn(int col, int nbCol); |
107 | |
108 | /** |
109 | * Updates the print range, according to the removed columns |
110 | * \param col the column index |
111 | * \param nbCol number of removed columns |
112 | */ |
113 | void removeColumn(int col, int nbCol); |
114 | |
115 | /** |
116 | * Updates the print range, according to the inserted rows |
117 | * \param row the row index |
118 | * \param nbRow number of inserted rows |
119 | */ |
120 | void insertRow(int row, int nbRow); |
121 | |
122 | /** |
123 | * Updates the print range, according to the removed rows |
124 | * \param row the row index |
125 | * \param nbRow number of removed rows |
126 | */ |
127 | void removeRow(int row, int nbRow); |
128 | |
129 | /** |
130 | * The number of pages. |
131 | */ |
132 | int pageCount() const; |
133 | |
134 | /** |
135 | * Return the cell range of the requested page. |
136 | * \param page the page number |
137 | * \return the page's cell range |
138 | */ |
139 | QRect cellRange(int page) const; |
140 | |
141 | /** |
142 | * Return the document area of the requested page. |
143 | * \param page the page number |
144 | * \return the page's document area |
145 | */ |
146 | QRectF documentArea(int page) const; |
147 | |
148 | /** |
149 | * Assignment operator. |
150 | */ |
151 | void operator=(const SheetPrint &); |
152 | |
153 | |
154 | private: |
155 | class Private; |
156 | Private *const d; |
157 | }; |
158 | |
159 | } // namespace Sheets |
160 | } // namespace Calligra |
161 | |
162 | #endif // CALLIGRA_SHEETS_SHEET_PRINT |
163 | |