File indexing completed on 2024-05-05 04:43:22

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2007-2008 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 Lesser 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  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 #ifndef KREPORTPAGE_H
0019 #define KREPORTPAGE_H
0020 
0021 #include "kreport_export.h"
0022 
0023 #include <QGraphicsRectItem>
0024 #include <QObject>
0025 
0026 class ORODocument;
0027 
0028 /*!
0029  * @brief Provides a widget that renders a specific page of
0030  * an ORODocument
0031  * The widget is sized to the document size in pixels
0032  */
0033 class KREPORT_EXPORT KReportPage : public QObject, public QGraphicsRectItem
0034 {
0035     Q_OBJECT
0036 public:
0037     KReportPage(QWidget *parent, ORODocument *document);
0038 
0039     ~KReportPage() override;
0040 
0041     //! Renders page @a page (counted from 1).
0042     void renderPage(int page);
0043 
0044 public Q_SLOTS:
0045     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
0046 
0047     void pageUpdated(int pageNo);
0048 
0049 private Q_SLOTS:
0050     void renderCurrentPage();
0051 
0052 private:
0053     Q_DISABLE_COPY(KReportPage)
0054     class Private;
0055     Private * const d;
0056 };
0057 
0058 #endif