LeechCraft Monocle  0.6.70-18450-gabe19ee3b0
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::Monocle
24 {
29  struct DocumentInfo
30  {
33  QString Title_;
36  QString Subject_;
39  QString Description_;
42  QString Author_;
43 
46  QStringList Genres_;
49  QStringList Keywords_;
50 
53  QDateTime Date_;
54  };
55 
56  class DocumentSignals;
57 
80  class IDocument
81  {
82  public:
85  virtual ~IDocument () = default;
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 
192  virtual const DocumentSignals* GetDocumentSignals () const = 0;
193  };
194 
197  typedef std::shared_ptr<IDocument> IDocument_ptr;
198 }
199 
200 
201 Q_DECLARE_INTERFACE (LC::Monocle::IDocument,
202  "org.LeechCraft.Monocle.IDocument/1.0")
virtual QSize GetPageSize(int page) const =0
Returns the size in points of the given page.
Document metadata.
Definition: idocument.h:29
virtual ~IDocument()=default
Virtual destructor.
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:36
QString Author_
The author of the document.
Definition: idocument.h:42
QString Title_
Document title.
Definition: idocument.h:33
virtual QObject * GetBackendPlugin() const =0
Returns the parent backend plugin.
std::shared_ptr< IDocument > IDocument_ptr
Shared pointer to a document.
Definition: idocument.h:197
virtual const DocumentSignals * GetDocumentSignals() const =0
Returns the type-safe connector for various document signals.
virtual bool IsValid() const =0
Returns whether this document is valid.
QString Description_
Description of the document.
Definition: idocument.h:39
QStringList Keywords_
Keywords corresponding to this document.
Definition: idocument.h:49
QStringList Genres_
Genres of this document.
Definition: idocument.h:46
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:53