![]() |
LeechCraft Monocle
0.6.70-6645-gcd10d7e
Modular document viewer for LeechCraft
|
Basic interface for documents. More...
#include "idocument.h"
Public Member Functions | |
virtual | ~IDocument () |
Virtual destructor. More... | |
virtual QObject * | GetBackendPlugin () const =0 |
Returns the parent backend plugin. More... | |
virtual QObject * | GetQObject ()=0 |
Returns this object as a QObject. More... | |
virtual bool | IsValid () const =0 |
Returns whether this document is valid. More... | |
virtual DocumentInfo | GetDocumentInfo () const =0 |
Returns the document metadata. More... | |
virtual int | GetNumPages () const =0 |
Returns the number of pages in this document. More... | |
virtual QSize | GetPageSize (int page) const =0 |
Returns the size in pixels of the given page. More... | |
virtual QImage | RenderPage (int page, double xScale, double yScale)=0 |
Renders the given page at the given scale. More... | |
virtual QList< ILink_ptr > | GetPageLinks (int page)=0 |
Returns the links found at the given page. More... | |
virtual QUrl | GetDocURL () const =0 |
Returns the URL of the document. More... | |
Protected Member Functions | |
virtual void | navigateRequested (const QString &filename, int pageNum, double x, double y)=0 |
Emitted when navigation is requested. More... | |
virtual void | printRequested (const QList< int > &pages)=0 |
Emitted when printing is requested. More... | |
Basic interface for documents.
This interface is the basic interface for documents returned from format backends.
Pages actions (like rendering) are also performed via this interface. Pages indexes are zero-based.
This class has some signals, and one can use the GetQObject() method to get an object of this class as a QObject and connect to those signals.
There are also other interfaces for extended functionality like documents that can be changed and saved, the documents containing annotations and so on. See the See also section for the details.
Definition at line 98 of file idocument.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 103 of file idocument.h.
|
pure virtual |
Returns the parent backend plugin.
This function should return the instance object of the backend plugin that created this document.
The returned value should obviously implement IBackendPlugin.
|
pure virtual |
Returns the document metadata.
|
pure virtual |
Returns the URL of the document.
This method should return the URL of this document. URLs on the local filesystem should obviously have the file scheme.
|
pure virtual |
Returns the number of pages in this document.
|
pure virtual |
Returns the links found at the given page.
If the format doesn't support links, an empty list should be returned.
The ownership of the returned links objects is passed to the caller.
[in] | page | The page index to query. |
|
pure virtual |
Returns the size in pixels of the given page.
This function returns the physical dimensions of the given page in pixels.
Some formats support different pages having different sizes in the same document, thus the size should be queried for each page.
[in] | page | The index of the page to query. |
|
pure virtual |
Returns this object as a QObject.
This function can be used to connect to the signals of this class.
|
pure virtual |
Returns whether this document is valid.
An invalid document is basically equivalent to a null pointer, all operations on it lead to undefined behavior.
|
protectedpure virtual |
Emitted when navigation is requested.
For example, this signal is emitted when a navigation link in a table of contents has been triggered.
If filename is empty, pageNum, x and y are all related to he current document. Otherwise filename should be loaded first.
x and y coordinates are absolute, that is, between 0 and GetPageSize (pageNum).width ()
and GetPageSize (pageNum).height ()
correspondingly.
[out] | filename | The filename of the document to navigate to, or an empty string if current document should be used. |
[out] | pageNum | The index of the page to navigate to. |
[out] | x | The new x coordinate of the viewport. |
[out] | y | The new y coordinate of the viewport. |
|
protectedpure virtual |
Emitted when printing is requested.
This signal is emitted when printing is requested, for example, by a link action.
[out] | pages | The list of pages to print, or an empty list to print all pages. |
|
pure virtual |
Renders the given page at the given scale.
This function should return an image with the given page rendered at the given xScale and yScale for x and y axises correspondingly. That is, the image's size should be equal to the following:
[in] | page | The index of the page to render. |
[in] | xScale | The scale of the x axis. |
[in] | yScale | The scale of the y axis. |