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 "sheets_odf_export.h" 28 29 30 namespace Calligra 31 { 32 namespace Sheets 33 { 34 class HeaderFooter; 35 class PrintSettings; 36 class Sheet; 37 38 /** 39 * \class SheetPrint 40 * Manages the layout of pages for printing. 41 * Supports next to the obligatory page dimensions 42 * zooming, page limits and column/row repetitions. 43 * \ingroup Printing 44 */ 45 class CALLIGRA_SHEETS_ODF_EXPORT SheetPrint 46 { 47 public: 48 explicit SheetPrint(Sheet * sheet = 0); 49 SheetPrint(const SheetPrint &other); 50 ~SheetPrint(); 51 52 /** 53 * \return the print settings 54 */ 55 PrintSettings *settings() const; 56 57 /** 58 * Sets the print \p settings. 59 * \param settings the print 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 *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