XPDFRenderer.h 1.83 KB
Newer Older
Claudio Valerio's avatar
Claudio Valerio committed
1 2 3
/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
Claudio Valerio's avatar
Claudio Valerio committed
4
 * the Free Software Foundation, either version 2 of the License, or
Claudio Valerio's avatar
Claudio Valerio committed
5 6 7 8 9 10 11 12 13 14
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
Claudio Valerio's avatar
Claudio Valerio committed
15 16 17

#ifndef XPDFRENDERER_H
#define XPDFRENDERER_H
18
#include <QImage>
Claudio Valerio's avatar
Claudio Valerio committed
19
#include "PDFRenderer.h"
20
#include <splash/SplashBitmap.h>
21 22 23 24

#include "globals/UBGlobals.h"

THIRD_PARTY_WARNINGS_DISABLE
25 26 27 28
#include <xpdf/Object.h>
#include <xpdf/GlobalParams.h>
#include <xpdf/SplashOutputDev.h>
#include <xpdf/PDFDoc.h>
29
THIRD_PARTY_WARNINGS_ENABLE
Claudio Valerio's avatar
Claudio Valerio committed
30 31 32 33 34 35 36 37

class PDFDoc;

class XPDFRenderer : public PDFRenderer
{
    Q_OBJECT

    public:
Didier's avatar
Didier committed
38
        XPDFRenderer(const QString &filename, bool importingFile = false);
Claudio Valerio's avatar
Claudio Valerio committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
        virtual ~XPDFRenderer();

        bool isValid() const;

        virtual int pageCount() const;

        virtual QSizeF pageSizeF(int pageNumber) const;

        virtual int pageRotation(int pageNumber) const;

        virtual QString title() const;

    public slots:
        void render(QPainter *p, int pageNumber, const QRectF &bounds = QRectF());

    private:
        void init();
56
        QImage* createPDFImage(int pageNumber, qreal xscale = 0.5, qreal yscale = 0.5, const QRectF &bounds = QRectF());
Claudio Valerio's avatar
Claudio Valerio committed
57 58 59

        PDFDoc *mDocument;
        static QAtomicInt sInstancesCount;
60 61
        qreal mSliceX;
        qreal mSliceY;
62

63 64
        SplashBitmap* mpSplashBitmap;
        SplashOutputDev* mSplash;
Claudio Valerio's avatar
Claudio Valerio committed
65 66 67
};

#endif // XPDFRENDERER_H