Changeset View
Changeset View
Standalone View
Standalone View
src/common/KReportSectionData.h
Show All 15 Lines | |||||
16 | * You should have received a copy of the GNU Lesser General Public | 16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | 20 | | |||
21 | #ifndef KREPORTSECTIONDATA_H | 21 | #ifndef KREPORTSECTIONDATA_H | ||
22 | #define KREPORTSECTIONDATA_H | 22 | #define KREPORTSECTIONDATA_H | ||
23 | 23 | | |||
24 | #include <QColor> | 24 | #include "KReportUnit.h" | ||
25 | 25 | | |||
26 | #include <KPropertySet> | 26 | #include <KPropertySet> | ||
27 | 27 | | |||
28 | #include <QColor> | ||||
29 | | ||||
28 | class KReportItemBase; | 30 | class KReportItemBase; | ||
29 | class KReportDocument; | 31 | class KReportDocument; | ||
30 | class QDomElement; | 32 | class QDomElement; | ||
31 | 33 | | |||
32 | namespace Scripting | 34 | namespace Scripting | ||
33 | { | 35 | { | ||
34 | class Section; | 36 | class Section; | ||
35 | } | 37 | } | ||
Show All 26 Lines | 50 | enum class Type { | |||
62 | GroupHeader, | 64 | GroupHeader, | ||
63 | GroupFooter, | 65 | GroupFooter, | ||
64 | Detail | 66 | Detail | ||
65 | }; | 67 | }; | ||
66 | 68 | | |||
67 | explicit KReportSectionData(QObject* parent = nullptr); | 69 | explicit KReportSectionData(QObject* parent = nullptr); | ||
68 | KReportSectionData(const QDomElement &, KReportDocument* report); | 70 | KReportSectionData(const QDomElement &, KReportDocument* report); | ||
69 | ~KReportSectionData() override; | 71 | ~KReportSectionData() override; | ||
72 | | ||||
73 | KReportUnit unit() const; | ||||
74 | | ||||
75 | void setUnit(const KReportUnit &u); | ||||
76 | | ||||
70 | KPropertySet* propertySet() const { | 77 | KPropertySet* propertySet() const { | ||
71 | return m_set; | 78 | return m_set; | ||
72 | } | 79 | } | ||
73 | 80 | | |||
74 | bool isValid() const { | 81 | bool isValid() const { | ||
75 | return m_valid; | 82 | return m_valid; | ||
76 | } | 83 | } | ||
77 | 84 | | |||
78 | qreal height() const { | 85 | qreal height() const; | ||
79 | return m_height->value().toDouble(); | 86 | | ||
80 | } | 87 | void setHeight(qreal ptHeight); | ||
81 | 88 | | |||
82 | QList<KReportItemBase*> objects() const { | 89 | QList<KReportItemBase*> objects() const { | ||
83 | return m_objects; | 90 | return m_objects; | ||
84 | } | 91 | } | ||
85 | 92 | | |||
86 | QString name() const; | 93 | QString name() const; | ||
87 | 94 | | |||
88 | QColor backgroundColor() const { | 95 | QColor backgroundColor() const { | ||
89 | return m_backgroundColor->value().value<QColor>(); | 96 | return m_backgroundColor->value().value<QColor>(); | ||
90 | } | 97 | } | ||
91 | 98 | | |||
92 | Type type() const { | 99 | Type type() const { | ||
93 | return m_type; | 100 | return m_type; | ||
94 | } | 101 | } | ||
95 | 102 | | |||
96 | static KReportSectionData::Type sectionTypeFromString(const QString& s); | 103 | static KReportSectionData::Type sectionTypeFromString(const QString& s); | ||
97 | static QString sectionTypeString(KReportSectionData::Type type); | 104 | static QString sectionTypeString(KReportSectionData::Type type); | ||
98 | protected: | 105 | protected: | ||
99 | KPropertySet *m_set; | 106 | KPropertySet *m_set; | ||
100 | KProperty *m_height; | | |||
101 | KProperty *m_backgroundColor; | 107 | KProperty *m_backgroundColor; | ||
102 | 108 | | |||
103 | private: | 109 | private: | ||
104 | void createProperties(const QDomElement & elemSource); | 110 | void createProperties(const QDomElement & elemSource); | ||
105 | 111 | | |||
112 | KProperty *m_height; | ||||
106 | QList<KReportItemBase*> m_objects; | 113 | QList<KReportItemBase*> m_objects; | ||
114 | KReportUnit m_unit; | ||||
107 | 115 | | |||
108 | Type m_type; | 116 | Type m_type; | ||
109 | 117 | | |||
110 | static bool zLessThan(KReportItemBase* s1, KReportItemBase* s2); | 118 | static bool zLessThan(KReportItemBase* s1, KReportItemBase* s2); | ||
111 | static bool xLessThan(KReportItemBase* s1, KReportItemBase* s2); | 119 | static bool xLessThan(KReportItemBase* s1, KReportItemBase* s2); | ||
112 | 120 | | |||
113 | bool m_valid; | 121 | bool m_valid; | ||
114 | 122 | | |||
115 | friend class Scripting::Section; | 123 | friend class Scripting::Section; | ||
116 | friend class KReportDesignerSection; | 124 | friend class KReportDesignerSection; | ||
117 | }; | 125 | }; | ||
118 | 126 | | |||
119 | #endif | 127 | #endif |