KReport

KReportRendererBase.cpp
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 #include "KReportRendererBase.h"
21 #include "KReportScreenRenderer_p.h"
22 #include "KReportPrintRenderer_p.h"
23 #include "KReportKSpreadRenderer.h"
24 #include "KReportHTMLTableRenderer_p.h"
25 #include "KReportHTMLCSSRenderer_p.h"
26 //! @todo port #include "KReportODTRenderer.h"
27 //! @todo port #include "KOdtFrameReportRenderer.h"
28 
29 class Q_DECL_HIDDEN KReportRendererContext::Private
30 {
31 public:
32  Private();
33  ~Private();
34  QUrl destinationUrl;
35  QPainter *painter = nullptr;
36  QPrinter *printer = nullptr;
37 };
38 
39 KReportRendererContext::Private::Private()
40 {
41 }
42 
43 KReportRendererContext::Private::~Private()
44 {
45 }
46 
47 
48 KReportRendererContext::KReportRendererContext()
49  : d(new Private())
50 {
51 }
52 
53 KReportRendererContext::~KReportRendererContext()
54 {
55  delete d;
56 }
57 
58 QPainter * KReportRendererContext::painter() const
59 {
60  return d->painter;
61 }
62 
63 QPrinter * KReportRendererContext::printer() const
64 {
65  return d->printer;
66 }
67 
68 
69 QPainter * KReportRendererContext::painter()
70 {
71  return d->painter;
72 }
73 
74 QPrinter * KReportRendererContext::printer()
75 {
76  return d->printer;
77 }
78 
79 void KReportRendererContext::setUrl(const QUrl& url)
80 {
81  d->destinationUrl = url;
82 }
83 
84 void KReportRendererContext::setPainter(QPainter* painter)
85 {
86  d->painter = painter;
87 }
88 
89 void KReportRendererContext::setPrinter(QPrinter* printer)
90 {
91  d->printer = printer;
92 }
93 
94 QUrl KReportRendererContext::url() const
95 {
96  return d->destinationUrl;
97 }
98 
99 
100 KReportRendererBase::KReportRendererBase()
101 {
102 }
103 
104 KReportRendererBase::~KReportRendererBase()
105 {
106 }
107 
108 class KReportRendererFactory::Private
109 {
110 public:
111  bool dummy = true;
112 };
113 
114 KReportRendererFactory::KReportRendererFactory() : d(new Private())
115 {
116 }
117 
118 KReportRendererFactory::~KReportRendererFactory()
119 {
120  delete d;
121 }
122 
124 {
125  const QString lowerKey = key.toLower();
126  if (lowerKey == QLatin1String("screen")) {
127  return new KReportPrivate::ScreenRenderer();
128  }
129  if (lowerKey == QLatin1String("print")) {
130  return new KReportPrivate::PrintRenderer();
131  }
132 //! @todo port
133 #if 0
134  if (lowerKey == QLatin1String("ods")) {
135  return new KReportKSpreadRenderer();
136  }
137 #endif
138  if (lowerKey == QLatin1String("htmltable")) {
139  return new KReportPrivate::HTMLTableRenderer();
140  }
141  if (lowerKey == QLatin1String("htmlcss")) {
142  return new KReportPrivate::HTMLCSSRenderer();
143  }
144 //! @todo port
145 #if 0
146  if (lowerKey == QLatin1String("odttable") || lowerKey == QLatin1String("odt")) {
147  return new KReportODTRenderer();
148  }
149  if (lowerKey == QLatin1String("odtframes")) {
150  return new KReportOdtFrameReportRenderer();
151  }
152 #endif
153  return nullptr;
154 }
KReportRendererBase * createInstance(const QString &key)
QString toLower() const const
Base class for report renderers.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:17:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.