File indexing completed on 2024-04-28 16:21:27
0001 /* This file is part of the KDE project 0002 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 0003 Copyright (C) 2000 - 2003 The KSpread Team <calligra-devel@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef CALLIGRA_SHEETS_ROW_COLUMN_FORMAT 0022 #define CALLIGRA_SHEETS_ROW_COLUMN_FORMAT 0023 0024 #include <QBrush> 0025 0026 #include <KoXmlReader.h> 0027 0028 #include "sheets_odf_export.h" 0029 #include "Global.h" 0030 #include "Style.h" 0031 0032 class QDomElement; 0033 class QDomDocument; 0034 0035 namespace Calligra 0036 { 0037 namespace Sheets 0038 { 0039 class Sheet; 0040 class RowFormatStorage; 0041 0042 /** 0043 * A row style. 0044 */ 0045 class CALLIGRA_SHEETS_ODF_EXPORT RowFormat 0046 { 0047 public: 0048 RowFormat(); 0049 RowFormat(const RowFormat& other); 0050 RowFormat(const RowFormatStorage* rows, int row); 0051 ~RowFormat(); 0052 0053 void setSheet(Sheet* sheet); 0054 0055 QDomElement save(QDomDocument&, int yshift = 0) const; 0056 bool load(const KoXmlElement& row, int yshift = 0, Paste::Mode mode = Paste::Normal); 0057 0058 /** 0059 * \return the row's height 0060 */ 0061 double height() const; 0062 0063 /** 0064 * The visible row height, respecting hiding and filtering attributes. 0065 * \return the visible row height 0066 */ 0067 double visibleHeight() const; 0068 0069 /** 0070 * Sets the height to _h zoomed pixels. 0071 * 0072 * @param _h is calculated in display pixels as double value. The function cares for zooming. 0073 * Use this function when setting the height, to not get rounding problems. 0074 */ 0075 void setHeight(double _h); 0076 0077 /** 0078 * @reimp 0079 */ 0080 bool isDefault() const; 0081 0082 /** 0083 * @return the row for this RowFormat. May be 0 if this is the default format. 0084 */ 0085 int row() const; 0086 void setRow(int row); 0087 0088 RowFormat* next() const; 0089 RowFormat* previous() const; 0090 void setNext(RowFormat* c); 0091 void setPrevious(RowFormat* c); 0092 0093 /** 0094 * Sets the hide flag 0095 */ 0096 void setHidden(bool _hide, bool repaint = true); 0097 bool isHidden() const; 0098 0099 void setFiltered(bool filtered); 0100 bool isFiltered() const; 0101 0102 bool isHiddenOrFiltered() const; 0103 0104 /** 0105 * Sets a page break before this row, if \p enable is \c true. 0106 */ 0107 void setPageBreak(bool enable); 0108 0109 /** 0110 * \return \c true, if there's a page break set before this row. 0111 */ 0112 bool hasPageBreak() const; 0113 0114 bool operator==(const RowFormat& other) const; 0115 inline bool operator!=(const RowFormat& other) const { 0116 return !operator==(other); 0117 } 0118 0119 private: 0120 // do not allow assignment 0121 RowFormat& operator=(const RowFormat&); 0122 0123 class Private; 0124 Private * const d; 0125 }; 0126 0127 /** 0128 * A column style. 0129 */ 0130 class CALLIGRA_SHEETS_ODF_EXPORT ColumnFormat 0131 { 0132 public: 0133 ColumnFormat(); 0134 ColumnFormat(const ColumnFormat& other); 0135 ~ColumnFormat(); 0136 0137 void setSheet(Sheet* sheet); 0138 0139 QDomElement save(QDomDocument&, int xshift = 0) const; 0140 bool load(const KoXmlElement& row, int xshift = 0, Paste::Mode mode = Paste::Normal); 0141 0142 /** 0143 * \return the column's width 0144 */ 0145 double width() const; 0146 0147 /** 0148 * The visible column width, respecting hiding and filtering attributes. 0149 * \return the visible column width 0150 */ 0151 double visibleWidth() const; 0152 0153 /** 0154 * Sets the width to _w zoomed pixels as double value. 0155 * Use this function to set the width without getting rounding problems. 0156 * 0157 * @param _w is calculated in display pixels. The function cares for 0158 * zooming. 0159 */ 0160 void setWidth(double _w); 0161 0162 /** 0163 * @reimp 0164 */ 0165 bool isDefault() const; 0166 0167 /** 0168 * @return the column of this ColumnFormat. May be 0 if this is the default format. 0169 */ 0170 int column() const; 0171 void setColumn(int column); 0172 0173 ColumnFormat* next() const; 0174 ColumnFormat* previous() const; 0175 void setNext(ColumnFormat* c); 0176 void setPrevious(ColumnFormat* c); 0177 0178 void setHidden(bool _hide); 0179 bool isHidden() const; 0180 0181 void setFiltered(bool filtered); 0182 bool isFiltered() const; 0183 0184 bool isHiddenOrFiltered() const; 0185 0186 /** 0187 * Sets a page break before this row, if \p enable is \c true. 0188 */ 0189 void setPageBreak(bool enable); 0190 0191 /** 0192 * \return \c true, if there's a page break set before this row. 0193 */ 0194 bool hasPageBreak() const; 0195 0196 bool operator==(const ColumnFormat& other) const; 0197 inline bool operator!=(const ColumnFormat& other) const { 0198 return !operator==(other); 0199 } 0200 0201 private: 0202 // do not allow assignment 0203 ColumnFormat& operator=(const ColumnFormat&); 0204 0205 class Private; 0206 Private * const d; 0207 }; 0208 0209 } // namespace Sheets 0210 } // namespace Calligra 0211 0212 #endif // CALLIGRA_SHEETS_ROW_COLUMN_FORMAT