File indexing completed on 2024-05-05 04:43:22
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 KREPORTPRERENDERER_P_H 0020 #define KREPORTPRERENDERER_P_H 0021 0022 #include "config-kreport.h" 0023 0024 #include "KReportRenderObjects.h" 0025 #include "KReportAsyncItemManager_p.h" 0026 #include "KReportDetailSectionData.h" 0027 0028 #include <QMap> 0029 0030 #ifdef KREPORT_SCRIPTING 0031 #include <KReportScriptSource> 0032 #endif 0033 0034 namespace KReportPrivate{ 0035 class OneRecordDataSource; 0036 } 0037 class KReportPreRenderer; 0038 0039 /*! This class is the private class that houses all the internal 0040 variables so we can provide a cleaner interface to the user 0041 without presenting to them things that they don't need to see 0042 and may change over time. */ 0043 class KReportPreRendererPrivate : public QObject 0044 { 0045 Q_OBJECT 0046 public: 0047 KReportPreRendererPrivate(KReportPreRenderer *preRenderer); 0048 ~KReportPreRendererPrivate() override; 0049 0050 KReportPreRenderer * const m_preRenderer; 0051 bool m_valid; 0052 0053 ORODocument* m_document; 0054 OROPage* m_page; 0055 KReportDocument* m_reportDocument; 0056 0057 qreal m_yOffset; // how far down the current page are we 0058 qreal m_topMargin; // value stored in the correct units 0059 qreal m_bottomMargin; // -- same as above -- 0060 qreal m_leftMargin; // -- same as above -- 0061 qreal m_rightMargin; // -- same as above -- 0062 qreal m_maxHeight; // -- same as above -- 0063 qreal m_maxWidth; // -- same as above -- 0064 int m_pageCounter; // what page are we currently on? 0065 0066 KReportDataSource* m_dataSource; 0067 KReportPrivate::OneRecordDataSource *m_oneRecord; 0068 0069 QList<OROTextBox*> m_postProcText; 0070 0071 #ifdef KREPORT_SCRIPTING 0072 QMap<QString, QObject*> m_scriptObjects; 0073 KReportScriptSource *scriptSource = nullptr; 0074 #endif 0075 0076 void createNewPage(); 0077 qreal finishCurPage(bool lastPage); 0078 qreal finishCurPageSize(bool lastPage); 0079 0080 void renderDetailSection(KReportDetailSectionData *detailData); 0081 qreal renderSection(const KReportSectionData &); 0082 qreal renderSectionSize(const KReportSectionData &); 0083 0084 ///Scripting Stuff 0085 KReportScriptHandler *m_scriptHandler; 0086 #ifdef KREPORT_SCRIPTING 0087 void initEngine(); 0088 #endif 0089 0090 //! Generates m_document. Returns true on success. 0091 //! @note m_document is not removed on failure, caller should remove it. 0092 bool generateDocument(); 0093 0094 KReportPrivate::AsyncItemManager* asyncManager; 0095 0096 private Q_SLOTS: 0097 void asyncItemsFinished(); 0098 0099 Q_SIGNALS: 0100 void enteredGroup(const QString&, const QVariant&); 0101 void exitedGroup(const QString&, const QVariant&); 0102 void renderingSection(KReportSectionData*, OROPage*, QPointF); 0103 void finishedAllASyncItems(); 0104 }; 0105 0106 #endif // __KOREPORTPRERENDERER_P_H__