LeechCraft Monocle  0.6.70-16373-g319c272718
Modular document viewer for LeechCraft
idocument.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <memory>
12 #include <QImage>
13 #include <QMetaType>
14 #include <QStringList>
15 #include <QDateTime>
16 #include "ilink.h"
17 
18 class QUrl;
19 
20 template<typename>
21 class QFuture;
22 
23 namespace LC
24 {
25 namespace Monocle
26 {
31  struct DocumentInfo
32  {
35  QString Title_;
38  QString Subject_;
41  QString Description_;
44  QString Author_;
45 
48  QStringList Genres_;
51  QStringList Keywords_;
52 
55  QDateTime Date_;
56  };
57 
80  class IDocument
81  {
82  public:
85  virtual ~IDocument () {}
86 
96  virtual QObject* GetBackendPlugin () const = 0;
97 
105  virtual QObject* GetQObject () = 0;
106 
114  virtual bool IsValid () const = 0;
115 
120  virtual DocumentInfo GetDocumentInfo () const = 0;
121 
126  virtual int GetNumPages () const = 0;
127 
140  virtual QSize GetPageSize (int page) const = 0;
141 
159  virtual QFuture<QImage> RenderPage (int page, double xScale, double yScale) = 0;
160 
173  virtual QList<ILink_ptr> GetPageLinks (int page) = 0;
174 
183  virtual QUrl GetDocURL () const = 0;
184 
193  virtual void printRequested (const QList<int>& pages) = 0;
194  };
195 
198  typedef std::shared_ptr<IDocument> IDocument_ptr;
199 }
200 }
201 
202 Q_DECLARE_INTERFACE (LC::Monocle::IDocument,
203  "org.LeechCraft.Monocle.IDocument/1.0")
virtual ~IDocument()
Virtual destructor.
Definition: idocument.h:85
virtual QSize GetPageSize(int page) const =0
Returns the size in points of the given page.
Document metadata.
Definition: idocument.h:31
virtual QObject * GetQObject()=0
Returns this object as a QObject.
virtual DocumentInfo GetDocumentInfo() const =0
Returns the document metadata.
Basic interface for documents.
Definition: idocument.h:80
virtual int GetNumPages() const =0
Returns the number of pages in this document.
QString Subject_
The subject line of this document.
Definition: idocument.h:38
QString Author_
The author of the document.
Definition: idocument.h:44
QString Title_
Document title.
Definition: idocument.h:35
virtual QObject * GetBackendPlugin() const =0
Returns the parent backend plugin.
std::shared_ptr< IDocument > IDocument_ptr
Shared pointer to a document.
Definition: idocument.h:198
virtual bool IsValid() const =0
Returns whether this document is valid.
QString Description_
Description of the document.
Definition: idocument.h:41
QStringList Keywords_
Keywords corresponding to this document.
Definition: idocument.h:51
QStringList Genres_
Genres of this document.
Definition: idocument.h:48
Definition: iannotation.h:20
virtual QUrl GetDocURL() const =0
Returns the URL of the document.
virtual QList< ILink_ptr > GetPageLinks(int page)=0
Returns the links found at the given page.
virtual QFuture< QImage > RenderPage(int page, double xScale, double yScale)=0
Renders the given page at the given scale.
QDateTime Date_
Date this document was created.
Definition: idocument.h:55
virtual void printRequested(const QList< int > &pages)=0
Emitted when printing is requested.