KReport

KReportRendererBase.h
1 /* This file is part of the KDE project
2  Copyright (C) 2010 by Adam Pigg ([email protected])
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KREPORTRENDERERBASE_H
21 #define KREPORTRENDERERBASE_H
22 
23 #include <QUrl>
24 
25 #include "kreport_export.h"
26 
27 class QPainter;
28 class QPrinter;
29 class ORODocument;
30 
31 /*!
32  * @bref Context for executing rendering.
33  */
34 class KREPORT_EXPORT KReportRendererContext
35 {
36  public:
39 
40  void setUrl(const QUrl& url);
41  void setPainter(QPainter* painter);
42  void setPrinter(QPrinter* printer);
43 
44  QPrinter *printer();
45  QPainter *painter();
46  QPrinter *printer() const;
47  QPainter *painter() const;
48 
49  QUrl url() const;
50 
51  private:
52  Q_DISABLE_COPY(KReportRendererContext)
53  class Private;
54  Private * const d;
55 };
56 
57 /*!
58  * @brief Base class for report renderers.
59  *
60  * A renderer combines the report design with
61  * data to produce a visual output
62  */
63 class KREPORT_EXPORT KReportRendererBase
64 {
65  public:
67 
68  virtual ~KReportRendererBase();
69 
70  //! Render the page of the given document within the given context.
71  //! If page == -1, renders the entire document.
72  virtual bool render(const KReportRendererContext& context, ORODocument *document, int page = -1) = 0;
73 };
74 
75 /*!
76  * @brief Factory for creating renderers
77  * @todo make it use plugins
78  */
79 class KREPORT_EXPORT KReportRendererFactory
80 {
81  public:
84 
85  KReportRendererBase* createInstance(const QString& key);
86 
87  private:
88  Q_DISABLE_COPY(KReportRendererFactory)
89  class Private;
90  Private * const d;
91 };
92 
93 #endif // KREPORTRENDERERBASE_H
Factory for creating renderers.
Represents a single document containing one or more OROPage elements.
Base class for report renderers.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Feb 8 2023 04:21:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.