1 | /* This file is part of the KDE project |
2 | Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 | Copyright (C) 2000 - 2003 The KSpread Team <calligra-devel@kde.org> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef CALLIGRA_SHEETS_ROW_COLUMN_FORMAT |
22 | #define CALLIGRA_SHEETS_ROW_COLUMN_FORMAT |
23 | |
24 | #include <QBrush> |
25 | |
26 | #include "calligra_sheets_export.h" |
27 | #include <KoXmlReader.h> |
28 | |
29 | #include "Global.h" |
30 | #include "Style.h" |
31 | |
32 | class QDomElement; |
33 | class QDomDocument; |
34 | class KoGenStyle; |
35 | |
36 | namespace Calligra |
37 | { |
38 | namespace Sheets |
39 | { |
40 | class Sheet; |
41 | class RowFormatStorage; |
42 | |
43 | /** |
44 | * A row style. |
45 | */ |
46 | class CALLIGRA_SHEETS_ODF_EXPORT RowFormat |
47 | { |
48 | public: |
49 | RowFormat(); |
50 | RowFormat(const RowFormat& other); |
51 | RowFormat(const RowFormatStorage* rows, int row); |
52 | ~RowFormat(); |
53 | |
54 | void setSheet(Sheet* sheet); |
55 | |
56 | QDomElement save(QDomDocument&, int yshift = 0) const; |
57 | bool load(const KoXmlElement& row, int yshift = 0, Paste::Mode mode = Paste::Normal); |
58 | bool loadOdf(const KoXmlElement& row, KoXmlElement * rowStyle); |
59 | |
60 | /** |
61 | * \return the row's height |
62 | */ |
63 | double height() const; |
64 | |
65 | /** |
66 | * The visible row height, respecting hiding and filtering attributes. |
67 | * \return the visible row height |
68 | */ |
69 | double visibleHeight() const; |
70 | |
71 | /** |
72 | * Sets the height to _h zoomed pixels. |
73 | * |
74 | * @param _h is calculated in display pixels as double value. The function cares for zooming. |
75 | * Use this function when setting the height, to not get rounding problems. |
76 | */ |
77 | void setHeight(double _h); |
78 | |
79 | /** |
80 | * @reimp |
81 | */ |
82 | bool isDefault() const; |
83 | |
84 | /** |
85 | * @return the row for this RowFormat. May be 0 if this is the default format. |
86 | */ |
87 | int row() const; |
88 | void setRow(int row); |
89 | |
90 | RowFormat* next() const; |
91 | RowFormat* previous() const; |
92 | void setNext(RowFormat* c); |
93 | void setPrevious(RowFormat* c); |
94 | |
95 | /** |
96 | * Sets the hide flag |
97 | */ |
98 | void setHidden(bool _hide, bool repaint = true); |
99 | bool isHidden() const; |
100 | |
101 | void setFiltered(bool filtered); |
102 | bool isFiltered() const; |
103 | |
104 | bool isHiddenOrFiltered() const; |
105 | |
106 | /** |
107 | * Sets a page break before this row, if \p enable is \c true. |
108 | */ |
109 | void setPageBreak(bool enable); |
110 | |
111 | /** |
112 | * \return \c true, if there's a page break set before this row. |
113 | */ |
114 | bool hasPageBreak() const; |
115 | |
116 | bool operator==(const RowFormat& other) const; |
117 | inline bool operator!=(const RowFormat& other) const { |
118 | return !operator==(other); |
119 | } |
120 | |
121 | private: |
122 | // do not allow assignment |
123 | RowFormat& operator=(const RowFormat&); |
124 | |
125 | class Private; |
126 | Private * const d; |
127 | }; |
128 | |
129 | /** |
130 | * A column style. |
131 | */ |
132 | class CALLIGRA_SHEETS_ODF_EXPORT ColumnFormat |
133 | { |
134 | public: |
135 | ColumnFormat(); |
136 | ColumnFormat(const ColumnFormat& other); |
137 | ~ColumnFormat(); |
138 | |
139 | void setSheet(Sheet* sheet); |
140 | |
141 | QDomElement save(QDomDocument&, int xshift = 0) const; |
142 | bool load(const KoXmlElement& row, int xshift = 0, Paste::Mode mode = Paste::Normal); |
143 | |
144 | /** |
145 | * \return the column's width |
146 | */ |
147 | double width() const; |
148 | |
149 | /** |
150 | * The visible column width, respecting hiding and filtering attributes. |
151 | * \return the visible column width |
152 | */ |
153 | double visibleWidth() const; |
154 | |
155 | /** |
156 | * Sets the width to _w zoomed pixels as double value. |
157 | * Use this function to set the width without getting rounding problems. |
158 | * |
159 | * @param _w is calculated in display pixels. The function cares for |
160 | * zooming. |
161 | */ |
162 | void setWidth(double _w); |
163 | |
164 | /** |
165 | * @reimp |
166 | */ |
167 | bool isDefault() const; |
168 | |
169 | /** |
170 | * @return the column of this ColumnFormat. May be 0 if this is the default format. |
171 | */ |
172 | int column() const; |
173 | void setColumn(int column); |
174 | |
175 | ColumnFormat* next() const; |
176 | ColumnFormat* previous() const; |
177 | void setNext(ColumnFormat* c); |
178 | void setPrevious(ColumnFormat* c); |
179 | |
180 | void setHidden(bool _hide); |
181 | bool isHidden() const; |
182 | |
183 | void setFiltered(bool filtered); |
184 | bool isFiltered() const; |
185 | |
186 | bool isHiddenOrFiltered() const; |
187 | |
188 | /** |
189 | * Sets a page break before this row, if \p enable is \c true. |
190 | */ |
191 | void setPageBreak(bool enable); |
192 | |
193 | /** |
194 | * \return \c true, if there's a page break set before this row. |
195 | */ |
196 | bool hasPageBreak() const; |
197 | |
198 | bool operator==(const ColumnFormat& other) const; |
199 | inline bool operator!=(const ColumnFormat& other) const { |
200 | return !operator==(other); |
201 | } |
202 | |
203 | private: |
204 | // do not allow assignment |
205 | ColumnFormat& operator=(const ColumnFormat&); |
206 | |
207 | class Private; |
208 | Private * const d; |
209 | }; |
210 | |
211 | } // namespace Sheets |
212 | } // namespace Calligra |
213 | |
214 | #endif // CALLIGRA_SHEETS_ROW_COLUMN_FORMAT |
215 | |