1 /*
2  *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
3  *
4  *  This library is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU Lesser General Public License as published
6  *  by the Free Software Foundation; either version 2.1 of the License, or
7  *  (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
12  *  GNU Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef KOCOLUMNSTYLE_H
20 #define KOCOLUMNSTYLE_H
21 
22 #include "KoStyle.h"
23 #include "koodf2_export.h"
24 
25 /**
26  * \class KoColumnStyle
27  * \brief represents a style to be applied to one or more columns.
28  *
29  * As all the styles it can be shared
30  */
31 
32 class KOODF2_EXPORT KoColumnStyle : public KoStyle
33 {
34     KoColumnStyle();
35 public:
36     KOSTYLE_DECLARE_SHARED_POINTER(KoColumnStyle)
37 
38     ~KoColumnStyle() override;
39 
40     enum BreakType {
41         NoBreak,
42         AutoBreak,
43         ColumnBreak,
44         PageBreak
45     };
46     void setBreakBefore(BreakType breakBefore);
47     BreakType breakBefore() const;
48 
49     void setBreakAfter(BreakType breakAfter);
50     BreakType breakAfter() const;
51 
52     enum WidthType {
53         MinimumWidth,
54         ExactWidth,
55         OptimalWidth
56     };
57     void setWidth(qreal width);
58     qreal width() const;
59     void setWidthType(WidthType type);
60     WidthType widthType() const;
61 
62 protected:
63     void prepareStyle(KoGenStyle& style) const override;
64     QString defaultPrefix() const override;
65     KoGenStyle::Type styleType() const override;
66     KoGenStyle::Type automaticstyleType() const override;
67     const char* styleFamilyName() const override;
68 
69 private:
70     BreakType m_breakAfter;
71     BreakType m_breakBefore;
72     qreal m_width;
73     WidthType m_widthType;
74 };
75 
76 #endif
77