File indexing completed on 2024-04-28 04:42:09
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com) 0003 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Lesser General Public 0016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 0019 /* 0020 * This file contains all the Report Entity classes. Each one is a 0021 * derivative of ReportEntity, which in turn is derived from QCanvasItem. 0022 */ 0023 0024 #ifndef KREPORTDESIGNERITEMBASE_H 0025 #define KREPORTDESIGNERITEMBASE_H 0026 0027 #include <QGraphicsItem> 0028 0029 #include "KReportItemBase.h" 0030 0031 class QDomDocument; 0032 class QDomElement; 0033 0034 class KReportDesigner; 0035 0036 /*! 0037 * @brief Base class for report items used within the designer GUI. 0038 */ 0039 class KREPORT_EXPORT KReportDesignerItemBase 0040 { 0041 public: 0042 virtual ~KReportDesignerItemBase(); 0043 0044 static void buildXML(QGraphicsItem * item, QDomDocument *doc, QDomElement *parent); 0045 virtual void buildXML(QDomDocument *doc, QDomElement *parent) = 0; 0046 0047 static void buildXMLRect(QDomDocument *doc, QDomElement *entity, KReportItemBase *i); 0048 static void buildXMLTextStyle(QDomDocument *doc, QDomElement *entity, const KReportTextStyleData &ts); 0049 static void buildXMLLineStyle(QDomDocument *doc, QDomElement *entity, const KReportLineStyle &ls); 0050 0051 virtual KReportDesignerItemBase* clone() = 0; 0052 virtual void move(const QPointF&) = 0; 0053 0054 KReportDesigner* designer() const; 0055 void setDesigner(KReportDesigner* rd); 0056 0057 static void addPropertyAsAttribute(QDomElement* e, KProperty* p); 0058 0059 protected: 0060 explicit KReportDesignerItemBase(KReportDesigner *r, KReportItemBase *); 0061 QString dataSourceAndObjectTypeName(const QString &dataSource, 0062 const QString &objectTypeName) const; 0063 0064 /** 0065 * @brief Updates the text that is shown for the item in the report designer 0066 * If itemDataSource is set then it is preferred over itemStaticValue 0067 * itemType is appended to the end of the text 0068 * 0069 * @param itemDataSource source field property 0070 * @param itemStaticValue value property 0071 * @param itemType type of item 0072 * @return void 0073 */ 0074 void updateRenderText(const QString &itemDataSource, const QString &itemStaticValue, const QString &itemType); 0075 KReportItemBase *item() const; 0076 0077 void setRenderText(const QString &text); 0078 QString renderText() const; 0079 0080 private: 0081 Q_DISABLE_COPY(KReportDesignerItemBase) 0082 class Private; 0083 Private * const d; 0084 }; 0085 0086 #endif 0087