1 /**
2  * Copyright (C) 2012  Stefan Löffler
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the Free
6  * Software Foundation; either version 2, or (at your option) any later
7  * version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14 #ifndef PDFDOCUMENTWIDGET_H
15 #define PDFDOCUMENTWIDGET_H
16 
17 #include "PDFDocumentView.h"
18 
19 namespace QtPDF {
20 
21 class PDFDocumentWidget : public PDFDocumentView
22 {
23 	Q_OBJECT
24 public:
25   PDFDocumentWidget(QWidget * parent = NULL, const double dpi = -1);
26   virtual ~PDFDocumentWidget();
27 
28   bool load(const QString & filename);
29 
30   QWeakPointer<Backend::Document> document() const;
31 
watchForDocumentChangesOnDisk()32   bool watchForDocumentChangesOnDisk() const { if (_scene) return _scene->watchForDocumentChangesOnDisk(); }
33   void setWatchForDocumentChangesOnDisk(const bool doWatch = true) { if (_scene) _scene->setWatchForDocumentChangesOnDisk(doWatch); }
34 
35   QStringList backends() const;
36   QString defaultBackend() const;
37   void setDefaultBackend(const QString & backend);
38 
39   // *TODO*: Possibly add some way to describe/choose/change the PDF backend used
40 
41   void setResolution(const double dpi);
42 
43 protected:
44   QSharedPointer<QtPDF::PDFDocumentScene> _scene;
45   QList<BackendInterface*> _backends;
46   double _dpi;
47 };
48 
49 } // namespace QtPDF
50 
51 #endif // PDFDOCUMENTWIDGET_H
52