File indexing completed on 2024-04-28 04:41:56
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 #ifndef KREPORTDOCUMENT_H 0020 #define KREPORTDOCUMENT_H 0021 0022 #include "config-kreport.h" 0023 #include "KReportSectionData.h" 0024 0025 #include <QPageLayout> 0026 0027 class KReportDetailSectionData; 0028 0029 #ifdef KREPORT_SCRIPTING 0030 namespace Scripting 0031 { 0032 class Report; 0033 } 0034 #endif 0035 0036 /*! 0037 * @brief Top level report document definition. 0038 * A KReportDocment defines the design of a document, and is composed of multiple 0039 * sections. 0040 */ 0041 class KREPORT_EXPORT KReportDocument : public QObject 0042 { 0043 Q_OBJECT 0044 0045 public: 0046 explicit KReportDocument(const QDomElement &elemSource, QObject *parent = nullptr); 0047 explicit KReportDocument(QObject *parent = nullptr); 0048 ~KReportDocument() override; 0049 0050 bool isValid() const; 0051 0052 /** 0053 \return a list of all objects in the report 0054 */ 0055 QList<KReportItemBase*> objects() const; 0056 0057 /** 0058 \return a report object given its name 0059 */ 0060 KReportItemBase* object(const QString&) const; 0061 0062 /** 0063 \return all the sections, including groups and detail 0064 */ 0065 QList<KReportSectionData*> sections() const; 0066 0067 /** 0068 \return a sectiondata given a section type 0069 */ 0070 KReportSectionData* section(KReportSectionData::Type type) const; 0071 0072 /** 0073 \return a sectiondata given its name 0074 */ 0075 KReportSectionData* section(const QString &name) const; 0076 0077 QString query() const; 0078 #ifdef KREPORT_SCRIPTING 0079 QString script() const; 0080 0081 QString interpreter() const; 0082 #endif 0083 0084 bool externalData() const; 0085 0086 KReportDetailSectionData* detail() const; 0087 0088 void setName(const QString&n); 0089 QString name() const; 0090 0091 QString title() const; 0092 0093 QPageLayout pageLayout() const; 0094 0095 QString pageSize(); 0096 void setPageSize(const QString &size); 0097 0098 private: 0099 friend class KReportPreRendererPrivate; 0100 friend class KReportPreRenderer; 0101 #ifdef KREPORT_SCRIPTING 0102 friend class KReportScriptHandler; 0103 friend class Scripting::Report; 0104 #endif 0105 0106 //! TODO add support for labels 0107 QString labelType() const; 0108 void setLabelType(const QString &label); 0109 0110 class Private; 0111 Private * const d; 0112 }; 0113 0114 #endif