KReport

KReportDesignerItemBase.cpp
1 /* This file is part of the KDE project
2  * Copyright (C) 2001-2007 by OpenMFG, LLC ([email protected])
3  * Copyright (C) 2007-2008 by Adam Pigg ([email protected])
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 
28 class Q_DECL_HIDDEN KReportDesignerItemBase::Private
29 {
30 public:
31  Private();
32  ~Private();
33 
34  KReportDesigner *reportDesigner;
35  KReportItemBase *item;
36  QString renderText;
37 };
38 
39 KReportDesignerItemBase::Private::Private()
40 {
41 }
42 
43 KReportDesignerItemBase::Private::~Private()
44 {
45 }
46 
47 KReportDesignerItemBase::~KReportDesignerItemBase()
48 {
49  delete d;
50 }
51 
52 KReportDesignerItemBase::KReportDesignerItemBase(KReportDesigner *r, KReportItemBase *b) : d(new Private())
53 {
54  d->reportDesigner = r;
55  d->item = b;
56  b->setUnit(r->pageUnit());
57 }
58 
59 void 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 
68 void KReportDesignerItemBase::buildXMLRect(QDomDocument *doc, QDomElement *entity, KReportItemBase *i)
69 {
70  Q_UNUSED(doc);
71  KReportUtils::buildXMLRect(entity, i->position(), i->size());
72 }
73 
74 void KReportDesignerItemBase::buildXMLTextStyle(QDomDocument *doc, QDomElement *entity, const KReportTextStyleData &ts)
75 {
76  KReportUtils::buildXMLTextStyle(doc, entity, ts);
77 }
78 
79 void KReportDesignerItemBase::buildXMLLineStyle(QDomDocument *doc, QDomElement *entity, const KReportLineStyle &ls)
80 {
81  KReportUtils::buildXMLLineStyle(doc, entity, ls);
82 }
83 
84 QString KReportDesignerItemBase::dataSourceAndObjectTypeName(const QString& dataSource, const QString& objectTypeName) const
85 {
86  return QString::fromLatin1("%1: %2").arg(dataSource).arg(objectTypeName);
87 }
88 
89 // static
90 void KReportDesignerItemBase::addPropertyAsAttribute(QDomElement* e, KProperty* p)
91 {
92  KReportUtils::addPropertyAsAttribute(e, p);
93 }
94 
95 KReportDesigner * KReportDesignerItemBase::designer() const
96 {
97  return d->reportDesigner;
98 }
99 
100 void KReportDesignerItemBase::setDesigner(KReportDesigner* rd)
101 {
102  d->reportDesigner = rd;
103 }
104 
105 KReportItemBase *KReportDesignerItemBase::item() const
106 {
107  return d->item;
108 }
109 
110 QString KReportDesignerItemBase::renderText() const
111 {
112  return d->renderText;
113 }
114 
115 void KReportDesignerItemBase::setRenderText(const QString& text)
116 {
117  d->renderText = text;
118 }
Base class for items that are drawn syncronously.
The KReportLineStyle class represents line style.
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.
KReportUnit pageUnit() const
Return the current unit assigned to the report.
QPointF position() const
Return the position in points.
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromLatin1(const char *str, int size)
QSizeF size() const
Return the size in points.
The ReportDesigner is the main widget for designing a report.
Base class for report items used within the designer GUI.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:17:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.