File indexing completed on 2024-12-01 13:11:44

0001 /*
0002  *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
0003  *
0004  *  This library is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU Lesser General Public License as published
0006  *  by the Free Software Foundation; either version 2.1 of the License, or
0007  *  (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
0012  *  GNU Lesser General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU Lesser General Public License
0015  *  along with this program; if not, write to the Free Software
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 #ifndef KOROWSTYLE_H
0020 #define KOROWSTYLE_H
0021 
0022 #include "KoStyle.h"
0023 #include "koodf2_export.h"
0024 
0025 #include <QColor>
0026 
0027 /**
0028  * \class KoRowStyle
0029  * \brief This class represents a style of a row to be applied to one or more rows.
0030  * 
0031  * As all the styles it can be shared
0032  */
0033 
0034 class KOODF2_EXPORT KoRowStyle : public KoStyle
0035 {
0036     KoRowStyle();
0037 
0038 public:
0039     KOSTYLE_DECLARE_SHARED_POINTER(KoRowStyle)
0040     ~KoRowStyle() override;
0041 
0042     void setBackgroundColor(const QColor& color);
0043     QColor backgroundColor() const;
0044 
0045     enum HeightType{
0046         MinimumHeight,
0047         ExactHeight,
0048         OptimalHeight
0049     };
0050     void setHeight(qreal height);
0051     void setHeightType(HeightType type);
0052     qreal height() const;
0053 
0054     enum BreakType {
0055         NoBreak,
0056         AutoBreak,
0057         ColumnBreak,
0058         PageBreak
0059     };
0060     void setBreakBefore(BreakType breakBefore);
0061     BreakType breakBefore() const;
0062 
0063     void setBreakAfter(BreakType breakAfter);
0064     BreakType breakAfter() const;
0065 
0066     enum KeepTogetherType {
0067         DontKeepTogether,
0068         AutoKeepTogether,
0069         AlwaysKeeptogether
0070     };
0071     void setKeepTogether(KeepTogetherType keepTogether);
0072     KeepTogetherType keepTogether() const;
0073 
0074 //     void setBackgroundImage(Image image);
0075 //     Image backgroundImage() const;
0076 
0077 protected:
0078     KoGenStyle::Type automaticstyleType() const override;
0079     QString defaultPrefix() const override;
0080     void prepareStyle(KoGenStyle& style) const override;
0081     const char* styleFamilyName() const override;
0082     KoGenStyle::Type styleType() const override;
0083 
0084 private:
0085     QColor m_backgroundColor;
0086 //     Image* m_image;
0087 
0088     qreal m_height;
0089     HeightType m_heightType;
0090     BreakType m_breakAfter;
0091     BreakType m_breakBefore;
0092     KeepTogetherType m_keepTogether;
0093 };
0094 
0095 #endif