File indexing completed on 2024-04-28 16:21:28

0001 /* This file is part of the KDE project
0002    Copyright 2010 Marijn Kruisselbrink <mkruisselbrink@kde.org>
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_ROWFORMATSTORAGE_H
0021 #define CALLIGRA_SHEETS_ROWFORMATSTORAGE_H
0022 
0023 #include <Qt>
0024 
0025 #include "sheets_odf_export.h"
0026 
0027 namespace Calligra {
0028 namespace Sheets {
0029 
0030 class Sheet;
0031 
0032 /** first and last row are both inclusive in all functions */
0033 class CALLIGRA_SHEETS_ODF_EXPORT RowFormatStorage
0034 {
0035 public:
0036     explicit RowFormatStorage(Sheet *sheet);
0037     ~RowFormatStorage();
0038 
0039     Sheet* sheet() const;
0040 
0041     qreal rowHeight(int row, int* lastRow = 0, int* firstRow = 0) const;
0042     void setRowHeight(int firstRow, int lastRow, qreal height);
0043 
0044     bool isHidden(int row, int* lastRow = 0, int* firstRow = 0) const;
0045     void setHidden(int firstRow, int lastRow, bool hidden);
0046 
0047     bool isFiltered(int row, int* lastRow = 0, int* firstRow = 0) const;
0048     void setFiltered(int firstRow, int lastRow, bool filtered);
0049 
0050     bool isHiddenOrFiltered(int row, int* lastRow = 0, int* firstRow = 0) const;
0051 
0052     qreal visibleHeight(int row, int* lastRow = 0, int* firstRow = 0) const;
0053 
0054     qreal totalRowHeight(int firstRow, int lastRow) const;
0055     qreal totalVisibleRowHeight(int firstRow, int lastRow) const;
0056 
0057     int rowForPosition(qreal ypos, qreal * topOfRow = 0) const;
0058 
0059     bool hasPageBreak(int row, int* lastRow = 0, int* firstRow = 0) const;
0060     void setPageBreak(int firstRow, int lastRow, bool pageBreak);
0061 
0062     bool isDefaultRow(int row, int* lastRow = 0, int* firstRow = 0) const;
0063     void setDefault(int firstRow, int lastRow);
0064     int lastNonDefaultRow() const;
0065 
0066     bool rowsAreEqual(int row1, int row2) const;
0067 
0068 
0069     /**
0070      * Insert \p number of rows at position \p row.
0071      * Also updates the sheets documentHeight property
0072      */
0073     void insertRows(int row, int number);
0074 
0075     /**
0076      * Removes \p number of rows starting at position \p row.
0077      * Also updates the sheets documentHeight property
0078      */
0079     void removeRows(int row, int number);
0080 
0081     RowFormatStorage& operator=(const RowFormatStorage& r);
0082 private:
0083     RowFormatStorage(const RowFormatStorage&);
0084     class Private;
0085     Private * const d;
0086 };
0087 
0088 
0089 } // namespace Sheets
0090 } // namespace Calligra
0091 
0092 #endif // CALLIGRA_SHEETS_ROWFORMATSTORAGE_H
0093