KReport

KReportSectionData.h
1/* This file is part of the KDE project
2 * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
3 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
4 * Copyright (C) 2010-2018 Jarosław Staniek <staniek@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
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/>.
18 */
19
20
21#ifndef KREPORTSECTIONDATA_H
22#define KREPORTSECTIONDATA_H
23
24#include "KReportUnit.h"
25
26#include <KPropertySet>
27
28#include <QColor>
29
30class KReportItemBase;
31class KReportDocument;
32class QDomElement;
33
34namespace Scripting
35{
36class Section;
37}
38
39/**
40 * KReportSectionData is used to store the information about a specific report section
41 *
42 * A section has a name, type, unit and optionally extra data.
43 */
44class KREPORT_EXPORT KReportSectionData : public QObject
45{
46 Q_OBJECT
47public:
48 enum class Type {
49 None,
50 PageHeaderFirst,
51 PageHeaderOdd,
52 PageHeaderEven,
53 PageHeaderLast,
54 PageHeaderAny,
55 ReportHeader,
56 ReportFooter,
57 PageFooterFirst,
58 PageFooterOdd,
59 PageFooterEven,
60 PageFooterLast,
61 PageFooterAny,
62 GroupHeader,
63 GroupFooter,
64 Detail
65 };
66
67 explicit KReportSectionData(QObject* parent = nullptr);
68
69 explicit KReportSectionData(const QDomElement &elemSource, QObject *parent = nullptr);
70
71 ~KReportSectionData() override;
72
73 KReportUnit unit() const;
74
75 void setUnit(const KReportUnit &u);
76
77 /**
78 * Returns property set for this section
79 *
80 * @since 3.1
81 */
82 KPropertySet* propertySet();
83
84 /**
85 * @overload
86 */
87 const KPropertySet* propertySet() const;
88
89 bool isValid() const;
90
91 qreal height() const;
92
93 void setHeight(qreal ptHeight);
94
95 QList<KReportItemBase*> objects() const;
96
97 QString name() const;
98
99 QColor backgroundColor() const;
100
101 Type type() const;
102
103 static KReportSectionData::Type sectionTypeFromString(const QString& s);
104 static QString sectionTypeString(KReportSectionData::Type type);
105
106private:
107 void setBackgroundColor(const QColor &color);
108 void setHeight(qreal ptHeight, KProperty::ValueOptions options);
109 KReportItemBase* object(int index);
110
111 Q_DISABLE_COPY(KReportSectionData)
112 class Private;
113 Private * const d;
114
115 friend class Scripting::Section;
116 friend class KReportDesignerSection;
117};
118
119#endif
This class is the base to all Report Section's visual representation.
Top level report document definition. A KReportDocment defines the design of a document,...
Base class for items that are drawn syncronously.
KReportSectionData is used to store the information about a specific report section.
Converts between different units.
Definition KReportUnit.h:71
Field item script interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:50:46 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.