20#include "KReportSectionData.h"
21#include "KReportDesigner.h"
22#include "KReportDocument.h"
23#include "KReportItemLine.h"
24#include "KReportPluginInterface.h"
25#include "KReportPluginManager.h"
26#include "KReportItemLine.h"
27#include "KReportDesigner.h"
28#include "KReportUtils.h"
29#include "KReportUtils_p.h"
30#include "kreport_debug.h"
32#include <KPropertySet>
41 if (!elemSource.
isNull()) {
42 q->setObjectName(elemSource.tagName());
43 type = sectionTypeFromString(KReportUtils::readSectionTypeNameAttribute(elemSource));
45 createProperties(elemSource);
46 if (!elemSource.
isNull()) {
49 set.clearModifiedFlags();
57 void setHeight(qreal ptHeight, KProperty::ValueOptions options);
68 Type
type = Type::None;
72 void createProperties(
const QDomElement &elemSource);
76KReportSectionData::KReportSectionData(
QObject *parent)
82 :
QObject(parent), d(new Private(this, elemSource))
86void KReportSectionData::Private::loadXml(
const QDomElement &elemSource)
96 for (
int nodeCounter = 0; nodeCounter < section.
count(); nodeCounter++) {
101 QString reportItemName = n.
mid(qstrlen(
"report:"));
103 KReportItemLine * line =
new KReportItemLine(elemThis);
118 kreportWarning() <<
"Could not create element of type" << reportItemName;
121 kreportWarning() <<
"While parsing section encountered an unknown element:" << n;
124 std::sort(objects.
begin(), objects.
end(), zLessThan);
128KReportSectionData::~KReportSectionData()
138void KReportSectionData::setUnit(
const KReportUnit &u)
148 KProperty::ValueOption::IgnoreOld);
154 return s1->
z() < s2->
z();
162void KReportSectionData::Private::createProperties(
const QDomElement & elemSource)
166 height =
new KProperty(
"height", 0.0,
tr(
"Height"));
170 tr(
"Background Color"));
172 if (!elemSource.
isNull()) {
174 KReportUtils::readSizeAttributes(
175 elemSource,
QSizeF(DEFAULT_SECTION_SIZE_PT, DEFAULT_SECTION_SIZE_PT))
179 set.addProperty(height);
180 set.addProperty(backgroundColor);
181 set.clearModifiedFlags();
184QString KReportSectionData::name()
const
194 case KReportSectionData::Type::PageHeaderAny:
197 case KReportSectionData::Type::PageHeaderEven:
200 case KReportSectionData::Type::PageHeaderOdd:
203 case KReportSectionData::Type::PageHeaderFirst:
206 case KReportSectionData::Type::PageHeaderLast:
209 case KReportSectionData::Type::PageFooterAny:
212 case KReportSectionData::Type::PageFooterEven:
215 case KReportSectionData::Type::PageFooterOdd:
218 case KReportSectionData::Type::PageFooterFirst:
221 case KReportSectionData::Type::PageFooterLast:
224 case KReportSectionData::Type::ReportHeader:
227 case KReportSectionData::Type::ReportFooter:
230 case KReportSectionData::Type::GroupHeader:
233 case KReportSectionData::Type::GroupFooter:
236 case KReportSectionData::Type::Detail:
249 KReportSectionData::Type type;
252 type = KReportSectionData::Type::PageHeaderAny;
254 type = KReportSectionData::Type::PageHeaderEven;
256 type = KReportSectionData::Type::PageHeaderOdd;
258 type = KReportSectionData::Type::PageHeaderFirst;
260 type = KReportSectionData::Type::PageHeaderLast;
262 type = KReportSectionData::Type::ReportHeader;
264 type = KReportSectionData::Type::PageFooterAny;
266 type = KReportSectionData::Type::PageFooterEven;
268 type = KReportSectionData::Type::PageFooterOdd;
270 type = KReportSectionData::Type::PageFooterFirst;
272 type = KReportSectionData::Type::PageFooterLast;
274 type = KReportSectionData::Type::ReportFooter;
276 type = KReportSectionData::Type::GroupHeader;
278 type = KReportSectionData::Type::GroupFooter;
280 type = KReportSectionData::Type::Detail;
282 type = KReportSectionData::Type::None;
287qreal KReportSectionData::height()
const
292void KReportSectionData::setHeight(qreal ptHeight, KProperty::ValueOptions options)
297void KReportSectionData::setHeight(qreal ptHeight)
299 setHeight(ptHeight, KProperty::ValueOptions());
312bool KReportSectionData::isValid()
const
322QColor KReportSectionData::backgroundColor()
const
327void KReportSectionData::setBackgroundColor(
const QColor &color)
329 d->backgroundColor->
setValue(color);
332KReportSectionData::Type KReportSectionData::type()
const
339 return d->objects.
value(index);
void clearModifiedFlags()
bool setValue(const QVariant &value, ValueOptions options=ValueOptions())
void setOption(const char *name, const QVariant &val)
static void addMetaProperties(KPropertySet *set, const QString &classString, const QString &iconName)
Adds meta-properties to the property set set for consumption by property editor.
Base class for items that are drawn syncronously.
QPointF position() const
Return the position in points.
qreal z() const
Return the z-value in points.
An interface for plugins delivering KReport elements.
virtual QObject * createRendererInstance(const QDomNode &element)=0
Manager class for finding and loading available plugins.
KReportSectionData is used to store the information about a specific report section.
KPropertySet * propertySet()
Returns property set for this section.
static KReportSectionData::Type sectionTypeFromString(const QString &s)
static QString sectionTypeString(KReportSectionData::Type type)
Converts between different units.
qreal convertFromPoint(qreal ptValue) const
static qreal convertFromUnitToUnit(qreal value, const KReportUnit &fromUnit, const KReportUnit &toUnit, qreal factor=1.0)
convert the given value directly from one unit to another with high accuracy
static QString symbol(KReportUnit::Type type)
Returns the symbol string of given unit type Symbol for Invalid type is empty string.
qreal convertToPoint(qreal value) const
Type type(const QSqlDatabase &db)
QString tagName() const const
QDomNodeList childNodes() const const
bool isNull() const const
QDomElement toElement() const const
QDomNode item(int index) const const
void append(QList< T > &&value)
T value(qsizetype i) const const
QString tr(const char *sourceText, const char *disambiguation, int n)
QPoint toPoint() const const
QString mid(qsizetype position, qsizetype n) const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
qreal toReal(bool *ok) const const