File indexing completed on 2024-05-19 08:34:08
0001 /* This file is part of the KDE project 0002 Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2.1 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KREPORTRENDERERBASE_H 0021 #define KREPORTRENDERERBASE_H 0022 0023 #include <QUrl> 0024 0025 #include "kreport_export.h" 0026 0027 class QPainter; 0028 class QPrinter; 0029 class ORODocument; 0030 0031 /*! 0032 * @bref Context for executing rendering. 0033 */ 0034 class KREPORT_EXPORT KReportRendererContext 0035 { 0036 public: 0037 KReportRendererContext(); 0038 ~KReportRendererContext(); 0039 0040 void setUrl(const QUrl& url); 0041 void setPainter(QPainter* painter); 0042 void setPrinter(QPrinter* printer); 0043 0044 QPrinter *printer(); 0045 QPainter *painter(); 0046 QPrinter *printer() const; 0047 QPainter *painter() const; 0048 0049 QUrl url() const; 0050 0051 private: 0052 Q_DISABLE_COPY(KReportRendererContext) 0053 class Private; 0054 Private * const d; 0055 }; 0056 0057 /*! 0058 * @brief Base class for report renderers. 0059 * 0060 * A renderer combines the report design with 0061 * data to produce a visual output 0062 */ 0063 class KREPORT_EXPORT KReportRendererBase 0064 { 0065 public: 0066 KReportRendererBase(); 0067 0068 virtual ~KReportRendererBase(); 0069 0070 //! Render the page of the given document within the given context. 0071 //! If page == -1, renders the entire document. 0072 virtual bool render(const KReportRendererContext& context, ORODocument *document, int page = -1) = 0; 0073 }; 0074 0075 /*! 0076 * @brief Factory for creating renderers 0077 * @todo make it use plugins 0078 */ 0079 class KREPORT_EXPORT KReportRendererFactory 0080 { 0081 public: 0082 KReportRendererFactory(); 0083 ~KReportRendererFactory(); 0084 0085 KReportRendererBase* createInstance(const QString& key); 0086 0087 private: 0088 Q_DISABLE_COPY(KReportRendererFactory) 0089 class Private; 0090 Private * const d; 0091 }; 0092 0093 #endif // KREPORTRENDERERBASE_H