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 KOCELLSTYLE_H
20 #define KOCELLSTYLE_H
21 
22 #include <KoBorder.h>
23 
24 #include "koodf2_export.h"
25 #include "KoStyle.h"
26 
27 
28 /**
29  * \class KoCellStyle
30  * \brief represents a style of a cell to be applied to one or more cells.
31  *
32  * As all the styles it can be shared
33  */
34 class KOODF2_EXPORT KoCellStyle : public KoStyle
35 {
36     KoCellStyle();
37 
38 public:
39     KOSTYLE_DECLARE_SHARED_POINTER(KoCellStyle)
40 
41     ~KoCellStyle() override;
42 
43     KoBorder* borders();
44 
45     void setBackgroundColor(const QColor& color);
46     QColor backgroundColor() const;
47 
48     void setBackgroundOpacity(qreal opacity);
49     qreal backgroundOpacity() const;
50 
51     qreal leftPadding() const;
52     void setLeftPadding(qreal padding);
53 
54     qreal topPadding() const;
55     void setTopPadding(qreal padding);
56 
57     qreal rightPadding() const;
58     void setRightPadding(qreal padding);
59 
60     qreal bottomPadding() const;
61     void setBottomPadding(qreal padding);
62 
63     QString verticalAlign() const;
64     void setVerticalAlign(const QString& align);
65 
66     bool glyphOrientation() const;
67     void setGlyphOrientation(bool orientation);
68 
69     void setTextStyle(const KoGenStyle& style);
70     void setParagraphStyle(const KoGenStyle& style);
71     KoGenStyle styleProperties() const;
72 
73 protected:
74     void prepareStyle( KoGenStyle& style ) const override;
75     QString defaultPrefix() const override;
76     KoGenStyle::Type styleType() const override;
77     KoGenStyle::Type automaticstyleType() const override;
78     const char* styleFamilyName() const override;
79 
80 private:
81     KoBorder* m_borders;
82     QColor m_backgroundColor;
83     qreal m_backgroundOpacity;
84 
85     qreal m_leftPadding;
86     qreal m_topPadding;
87     qreal m_rightPadding;
88     qreal m_bottomPadding;
89 
90     QString m_verticalAlign;
91     bool m_glyphOrientation;
92 
93     KoGenStyle m_styleProperties;
94 };
95 
96 #endif
97