KReport

KReportDesignerItemBase.cpp
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 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "KReportDesignerItemBase.h"
20#include "KReportDesigner.h"
21#include "KReportItemBase.h"
22#include "KReportUtils.h"
23
24#include <QString>
25#include <QDomDocument>
26#include <QCheckBox>
27
28class Q_DECL_HIDDEN KReportDesignerItemBase::Private
29{
30public:
31 Private();
32 ~Private();
33
34 KReportDesigner *reportDesigner;
35 KReportItemBase *item;
36 QString renderText;
37};
38
39KReportDesignerItemBase::Private::Private()
40{
41}
42
43KReportDesignerItemBase::Private::~Private()
44{
45}
46
47KReportDesignerItemBase::~KReportDesignerItemBase()
48{
49 delete d;
50}
51
52KReportDesignerItemBase::KReportDesignerItemBase(KReportDesigner *r, KReportItemBase *b) : d(new Private())
53{
54 d->reportDesigner = r;
55 d->item = b;
56 b->setUnit(r->pageUnit());
57}
58
59void KReportDesignerItemBase::buildXML(QGraphicsItem * item, QDomDocument *doc, QDomElement *parent)
60{
61 KReportDesignerItemBase *re = dynamic_cast<KReportDesignerItemBase*>(item);
62 if (re) {
63 re->buildXML(doc, parent);
64 }
65
66}
67
68void KReportDesignerItemBase::buildXMLRect(QDomDocument *doc, QDomElement *entity, KReportItemBase *i)
69{
70 Q_UNUSED(doc);
71 KReportUtils::buildXMLRect(entity, i->position(), i->size());
72}
73
74void KReportDesignerItemBase::buildXMLTextStyle(QDomDocument *doc, QDomElement *entity, const KReportTextStyleData &ts)
75{
76 KReportUtils::buildXMLTextStyle(doc, entity, ts);
77}
78
79void KReportDesignerItemBase::buildXMLLineStyle(QDomDocument *doc, QDomElement *entity, const KReportLineStyle &ls)
80{
81 KReportUtils::buildXMLLineStyle(doc, entity, ls);
82}
83
84QString KReportDesignerItemBase::dataSourceAndObjectTypeName(const QString& dataSource, const QString& objectTypeName) const
85{
86 return QString::fromLatin1("%1: %2").arg(dataSource).arg(objectTypeName);
87}
88
89// static
90void KReportDesignerItemBase::addPropertyAsAttribute(QDomElement* e, KProperty* p)
91{
92 KReportUtils::addPropertyAsAttribute(e, p);
93}
94
95KReportDesigner * KReportDesignerItemBase::designer() const
96{
97 return d->reportDesigner;
98}
99
100void KReportDesignerItemBase::setDesigner(KReportDesigner* rd)
101{
102 d->reportDesigner = rd;
103}
104
105KReportItemBase *KReportDesignerItemBase::item() const
106{
107 return d->item;
108}
109
110QString KReportDesignerItemBase::renderText() const
111{
112 return d->renderText;
113}
114
115void KReportDesignerItemBase::setRenderText(const QString& text)
116{
117 d->renderText = text;
118}
Base class for report items used within the designer GUI.
The ReportDesigner is the main widget for designing a report.
KReportUnit pageUnit() const
Return the current unit assigned to the report.
Base class for items that are drawn syncronously.
QPointF position() const
Return the position in points.
QSizeF size() const
Return the size in points.
virtual void setUnit(const KReportUnit &u)
Sets unit to a and converts values of position and size property from the old unit to new if needed.
The KReportLineStyle class represents line style.
QString arg(Args &&... args) const const
QString fromLatin1(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.