generator_tiff.h 1.8 KB
Newer Older
Pino Toscano's avatar
Pino Toscano committed
1 2 3 4 5 6 7 8 9 10 11 12
/***************************************************************************
 *   Copyright (C) 2006 by Pino Toscano <toscano.pino@tiscali.it>          *
 *                                                                         *
 *   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  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef _OKULAR_GENERATOR_TIFF_H_
#define _OKULAR_GENERATOR_TIFF_H_

13
#include <core/generator.h>
Pino Toscano's avatar
Pino Toscano committed
14

15
#include <QtCore/qloggingcategory.h>
16 17
#include <qhash.h>

18
class TIFFGenerator : public Okular::Generator
Pino Toscano's avatar
Pino Toscano committed
19 20
{
    Q_OBJECT
21
    Q_INTERFACES( Okular::Generator )
Pino Toscano's avatar
Pino Toscano committed
22
    public:
23
        TIFFGenerator( QObject *parent, const QVariantList &args );
Pino Toscano's avatar
Pino Toscano committed
24 25
        virtual ~TIFFGenerator();

26 27
        bool loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector ) override;
        bool loadDocumentFromData( const QByteArray & fileData, QVector< Okular::Page * > & pagesVector ) override;
Pino Toscano's avatar
Pino Toscano committed
28

29
        Okular::DocumentInfo generateDocumentInfo( const QSet<Okular::DocumentInfo::Key> &keys ) const override;
30

31
        bool print( QPrinter& printer ) override;
32

33
    protected:
34 35
        bool doCloseDocument() override;
        QImage image( Okular::PixmapRequest * request ) override;
Pino Toscano's avatar
Pino Toscano committed
36 37 38 39 40

    private:
        class Private;
        Private * const d;

41
        bool loadTiff( QVector< Okular::Page * > & pagesVector, const char *name );
Pino Toscano's avatar
Pino Toscano committed
42
        void loadPages( QVector<Okular::Page*> & pagesVector );
43
        int mapPage( int page ) const;
Pino Toscano's avatar
Pino Toscano committed
44

45
        QHash< int, int > m_pageMapping;
Pino Toscano's avatar
Pino Toscano committed
46 47
};

48 49
Q_DECLARE_LOGGING_CATEGORY(OkularTiffDebug)

Pino Toscano's avatar
Pino Toscano committed
50
#endif