File indexing completed on 2024-05-05 16:48:35
0001 /* This file is part of the KDE project 0002 Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) 0003 Copyright (C) 2015 Jarosław Staniek <staniek@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2.1 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #include "KReportPluginInterface.h" 0022 #include "KReportPluginMetaData.h" 0023 #include "KReportUtils.h" 0024 #include "kreport_debug.h" 0025 0026 #include <QDomElement> 0027 0028 class Q_DECL_HIDDEN KReportPluginInterface::Private 0029 { 0030 public: 0031 Private() : metaData(nullptr) {} 0032 ~Private() {} 0033 0034 const KReportPluginMetaData *metaData; 0035 }; 0036 0037 // --- 0038 0039 KReportPluginInterface::KReportPluginInterface(QObject* parent, const QVariantList& args) 0040 : QObject(parent), d(new Private) 0041 { 0042 Q_UNUSED(args); 0043 } 0044 0045 KReportPluginInterface::~KReportPluginInterface() 0046 { 0047 delete d; 0048 } 0049 0050 KReportElement KReportPluginInterface::createElement() 0051 { 0052 return KReportElement(); 0053 } 0054 0055 const KReportPluginMetaData* KReportPluginInterface::metaData() const 0056 { 0057 return d->metaData; 0058 } 0059 0060 void KReportPluginInterface::setMetaData(KReportPluginMetaData* metaData) 0061 { 0062 d->metaData = metaData; 0063 } 0064 0065 bool KReportPluginInterface::loadElement(KReportElement *el, const QDomElement &dom, KReportDesignReadingStatus *status) 0066 { 0067 Q_ASSERT(el); 0068 Q_UNUSED(status); 0069 el->setName(KReportUtils::readNameAttribute(dom)); 0070 el->setRect(KReportUtils::readRectAttributes(dom, el->rect())); 0071 el->setZ(KReportUtils::readZAttribute(dom, el->z())); 0072 0073 const QDomElement textStyleDom 0074 = dom.firstChildElement(QLatin1String("report:text-style")); 0075 el->setForegroundColor(KReportUtils::attr( 0076 textStyleDom, QLatin1String("fo:foreground-color"), el->foregroundColor())); 0077 el->setBackgroundColor(KReportUtils::attr( 0078 textStyleDom, QLatin1String("fo:background-color"), el->backgroundColor())); 0079 el->setBackgroundOpacity(KReportUtils::attrPercent( 0080 textStyleDom, QLatin1String("fo:background-opacity"), el->backgroundOpacity())); 0081 return true; 0082 }