File indexing completed on 2024-04-28 16:21:25
0001 /* This file is part of the KDE project 0002 Copyright 2008 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 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 0020 #ifndef CALLIGRA_SHEETS_PAGE_MANAGER 0021 #define CALLIGRA_SHEETS_PAGE_MANAGER 0022 0023 #include <Qt> 0024 0025 #include "sheets_common_export.h" 0026 0027 class QRect; 0028 class QSizeF; 0029 0030 namespace Calligra 0031 { 0032 namespace Sheets 0033 { 0034 class PrintSettings; 0035 class Sheet; 0036 0037 /** 0038 * Manages the layouting of pages. 0039 * Contains shared functionality between PrintManager, which layouts pages for 0040 * printing, and TablePageManager, which does the same for the table shape in 0041 * page based hosting apps. 0042 */ 0043 class CALLIGRA_SHEETS_COMMON_EXPORT PageManager 0044 { 0045 public: 0046 /** 0047 * Constructor. 0048 */ 0049 explicit PageManager(Sheet *sheet); 0050 0051 /** 0052 * Destructor. 0053 */ 0054 virtual ~PageManager(); 0055 0056 /** 0057 * Layouts the pages. 0058 * Splits the used cell range, so that it fits on several pages. 0059 */ 0060 void layoutPages(); 0061 0062 /** 0063 * Sets the print settings. 0064 * If the settings differ from the existing ones, the pages are recreated. 0065 * \param settings the print settings 0066 * \param force forces a recreation of the pages, if \c true 0067 */ 0068 void setPrintSettings(const PrintSettings& settings, bool force = false); 0069 0070 /** 0071 * Number of pages. 0072 */ 0073 int pageCount() const; 0074 0075 /** 0076 * Return the cell range of the requested page. 0077 * \param page the page number 0078 * \return the page's cell range 0079 */ 0080 QRect cellRange(int page) const; 0081 0082 /** 0083 * Return the visible size, the page size decreased by the borders, of the requested page. 0084 * \param page the page number 0085 * \return the page's visible size 0086 */ 0087 virtual QSizeF size(int page) const; 0088 0089 protected: 0090 Sheet* sheet() const; 0091 const PrintSettings& printSettings() const; 0092 virtual void clearPages(); 0093 virtual bool pageNeedsPrinting(const QRect& cellRange) const; 0094 virtual void insertPage(int page); 0095 virtual void preparePage(int page); 0096 0097 private: 0098 Q_DISABLE_COPY(PageManager) 0099 0100 class Private; 0101 Private * const d; 0102 }; 0103 0104 } // namespace Sheets 0105 } // namespace Calligra 0106 0107 #endif // CALLIGRA_SHEETS_PAGE_MANAGER