3
* Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
19
#include "kexireportpage.h"
24
#include <KoPageFormat.h>
28
#include <renderobjects.h>
31
KexiReportPage::KexiReportPage(QWidget *parent, ORODocument *document)
34
setAttribute(Qt::WA_NoBackground);
35
kDebug() << "CREATED PAGE";
36
m_reportDocument = document;
41
if (m_reportDocument) {
42
QString pageSize = m_reportDocument->pageOptions().getPageSize();
45
if (pageSize == "Custom") {
46
// if this is custom sized sheet of paper we will just use those values
47
pageWidth = (int)(m_reportDocument->pageOptions().getCustomWidth());
48
pageHeight = (int)(m_reportDocument->pageOptions().getCustomHeight());
50
// lookup the correct size information for the specified size paper
51
pageWidth = m_reportDocument->pageOptions().widthPx();
52
pageHeight = m_reportDocument->pageOptions().heightPx();
56
setFixedSize(pageWidth, pageHeight);
58
kDebug() << "PAGE IS " << pageWidth << "x" << pageHeight;
60
m_pixmap = new QPixmap(pageWidth, pageHeight);
61
setAutoFillBackground(true);
63
m_renderer = m_factory.createInstance("screen");
68
KexiReportPage::~KexiReportPage()
74
void KexiReportPage::paintEvent(QPaintEvent*)
76
QPainter painter(this);
77
painter.drawPixmap(QPoint(0, 0), *m_pixmap);
80
void KexiReportPage::renderPage(int page)
83
//js: is m_page needed?
86
QPainter qp(m_pixmap);
87
if (m_reportDocument) {
88
KoReportRendererContext cxt;
90
m_renderer->render(cxt, m_reportDocument, m_page - 1);
96
#include "kexireportpage.moc"