KReport

KReportPluginInterface.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
3 Copyright (C) 2015 Jarosław Staniek <staniek@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library 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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "KReportPluginInterface.h"
22#include "KReportPluginMetaData.h"
23#include "KReportUtils.h"
24#include "kreport_debug.h"
25
26#include <QDomElement>
27
28class Q_DECL_HIDDEN KReportPluginInterface::Private
29{
30public:
31 Private() : metaData(nullptr) {}
32 ~Private() {}
33
34 const KReportPluginMetaData *metaData;
35};
36
37// ---
38
39KReportPluginInterface::KReportPluginInterface(QObject* parent, const QVariantList& args)
40 : QObject(parent), d(new Private)
41{
42 Q_UNUSED(args);
43}
44
45KReportPluginInterface::~KReportPluginInterface()
46{
47 delete d;
48}
49
50KReportElement KReportPluginInterface::createElement()
51{
52 return KReportElement();
53}
54
56{
57 return d->metaData;
58}
59
60void KReportPluginInterface::setMetaData(KReportPluginMetaData* metaData)
61{
62 d->metaData = metaData;
63}
64
65bool KReportPluginInterface::loadElement(KReportElement *el, const QDomElement &dom, KReportDesignReadingStatus *status)
66{
67 Q_ASSERT(el);
68 Q_UNUSED(status);
69 el->setName(KReportUtils::readNameAttribute(dom));
70 el->setRect(KReportUtils::readRectAttributes(dom, el->rect()));
71 el->setZ(KReportUtils::readZAttribute(dom, el->z()));
72
73 const QDomElement textStyleDom
74 = dom.firstChildElement(QLatin1String("report:text-style"));
75 el->setForegroundColor(KReportUtils::attr(
76 textStyleDom, QLatin1String("fo:foreground-color"), el->foregroundColor()));
77 el->setBackgroundColor(KReportUtils::attr(
78 textStyleDom, QLatin1String("fo:background-color"), el->backgroundColor()));
79 el->setBackgroundOpacity(KReportUtils::attrPercent(
80 textStyleDom, QLatin1String("fo:background-opacity"), el->backgroundOpacity()));
81 return true;
82}
The KReportDesignReadStatus represents status of reading a report design in .kreport format.
The KReportElement class represents a functional visual element of a report design.
An interface for plugins delivering KReport elements.
const KReportPluginMetaData * metaData() const
Information about a KReport plugin.
Q_SCRIPTABLE CaptureState status()
QDomElement firstChildElement(const QString &tagName) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:48:09 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.