source: terepaima/terepaima-0.4.16/sources/fitzmodel.h

desarrollostretch
Last change on this file was 1f4adec, checked in by aosorio <aosorio@…>, 8 years ago

Agregado proyecto base, esto luego del dh_make -f

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2
3Copyright 2014 Adam Reichold
4
5This file is part of qpdfview.
6
7qpdfview is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12qpdfview is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
19
20*/
21
22#ifndef FITZMODEL_H
23#define FITZMODEL_H
24
25#include <QMutex>
26
27extern "C"
28{
29
30#include <mupdf/fitz/context.h>
31
32typedef struct fz_page_s fz_page;
33typedef struct fz_document_s fz_document;
34
35}
36
37#include "model.h"
38
39namespace qpdfview
40{
41
42class FitzPlugin;
43
44namespace Model
45{
46    class FitzPage : public Page
47    {
48        friend class FitzDocument;
49
50    public:
51        ~FitzPage();
52
53        QSizeF size() const;
54
55        QImage render(qreal horizontalResolution, qreal verticalResolution, Rotation rotation, const QRect& boundingRect) const;
56
57        QList< Link* > links() const;
58
59    private:
60        Q_DISABLE_COPY(FitzPage)
61
62        FitzPage(const class FitzDocument* parent, fz_page* page);
63
64        const class FitzDocument* m_parent;
65
66        fz_page* m_page;
67
68    };
69
70    class FitzDocument : public Document
71    {
72        friend class FitzPage;
73        friend class qpdfview::FitzPlugin;
74
75    public:
76        ~FitzDocument();
77
78        int numberOfPages() const;
79
80        Page* page(int index) const;
81
82        bool canBePrintedUsingCUPS() const;
83
84        void setPaperColor(const QColor& paperColor);
85
86        void loadOutline(QStandardItemModel* outlineModel) const;
87
88    private:
89        Q_DISABLE_COPY(FitzDocument)
90
91        FitzDocument(fz_context* context, fz_document* document);
92
93        mutable QMutex m_mutex;
94        fz_context* m_context;
95        fz_document* m_document;
96
97        QColor m_paperColor;
98
99    };
100}
101
102class FitzPlugin : public QObject, Plugin
103{
104    Q_OBJECT
105    Q_INTERFACES(qpdfview::Plugin)
106
107#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
108
109    Q_PLUGIN_METADATA(IID "local.qpdfview.Plugin")
110
111#endif // QT_VERSION
112
113public:
114    FitzPlugin(QObject* parent = 0);
115    ~FitzPlugin();
116
117    Model::Document* loadDocument(const QString& filePath) const;
118
119private:
120    QMutex m_mutex[FZ_LOCK_MAX];
121    fz_locks_context m_locks_context;
122    fz_context* m_context;
123
124    static void lock(void* user, int lock);
125    static void unlock(void* user, int lock);
126
127};
128
129} // qpdfview
130
131#endif // FITZMODEL_H
Note: See TracBrowser for help on using the repository browser.