1 | /* This file is part of the KDE project |
2 | Copyright 2010 Marijn Kruisselbrink <mkruisselbrink@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | #ifndef ROWREPEATSTORAGE_H |
20 | #define ROWREPEATSTORAGE_H |
21 | |
22 | #include <QMap> |
23 | #include <QRect> |
24 | |
25 | #include "calligra_sheets_export.h" |
26 | |
27 | namespace Calligra |
28 | { |
29 | namespace Sheets |
30 | { |
31 | |
32 | /** |
33 | * Class to store row-repeat values, so on saving of a file we won't have to recalculate these entirely |
34 | * but can just use the values as we know them from loading. |
35 | * Current implementation doesn't have very optimal insertRows/removeRows functions, but the rest of |
36 | * the methods are quite okay. |
37 | */ |
38 | class CALLIGRA_SHEETS_ODF_TEST_EXPORT RowRepeatStorage |
39 | { |
40 | public: |
41 | RowRepeatStorage(); |
42 | void setRowRepeat(int firstRow, int rowRepeat); |
43 | int rowRepeat(int row) const; |
44 | int firstIdenticalRow(int row) const; |
45 | void insertRows(int row, int count); |
46 | void removeRows(int row, int count); |
47 | void insertShiftDown(const QRect& rect); |
48 | void insertShiftRight(const QRect& rect); |
49 | void removeShiftUp(const QRect& rect); |
50 | void removeShiftLeft(const QRect& rect); |
51 | void splitRowRepeat(int row); |
52 | void dump() const; |
53 | private: |
54 | // m_data[i] = j means that rows [i-j+1 , i] are the same |
55 | QMap<int, int> m_data; |
56 | }; |
57 | |
58 | } // namespace Sheets |
59 | } // namespace Calligra |
60 | |
61 | #endif // ROWREPEATSTORAGE_H |
62 | |