• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdegraphics
  • Sitemap
  • Contact Us
 

okular

Okular::Generator

Okular::Generator Class Reference

#include <generator.h>

Inheritance diagram for Okular::Generator:

Inheritance graph
[legend]

List of all members.


Detailed Description

[Abstract Class] The information generator.

Most of class members are virtuals and some of them pure virtual. The pure virtuals provide the minimal functionalities for a Generator, that is being able to generate QPixmap for the Page 's of the Document.

Implementing the other functions will make the Generator able to provide more contents and/or functionalities (like text extraction).

Generation/query is requested by the Document class only, and that class stores the resulting data into Page s. The data will then be displayed by the GUI components (PageView, ThumbnailList, etc..).

See also:
PrintInterface, ConfigInterface, GuiInterface

Definition at line 177 of file generator.h.


Public Types

enum  GeneratorFeature {
  Threaded, TextExtraction, ReadRawData, FontInfo,
  PageSizes, PrintNative, PrintPostscript, PrintToFile
}
enum  PageSizeMetric { None, Points }

Signals

void error (const QString &message, int duration)
void warning (const QString &message, int duration)
void notice (const QString &message, int duration)

Public Member Functions

 Generator (QObject *parent, const QVariantList &args)
virtual ~Generator ()
virtual bool loadDocument (const QString &fileName, QVector< Page * > &pagesVector)=0
virtual bool loadDocumentFromData (const QByteArray &fileData, QVector< Page * > &pagesVector)
bool closeDocument ()
virtual bool canGeneratePixmap () const
virtual void generatePixmap (PixmapRequest *request)
virtual bool canGenerateTextPage () const
virtual void generateTextPage (Page *page)
virtual const DocumentInfo * generateDocumentInfo ()
virtual const DocumentSynopsis * generateDocumentSynopsis ()
virtual FontInfo::List fontsForPage (int page)
virtual const QList
< EmbeddedFile * > * 
embeddedFiles () const
virtual PageSizeMetric pagesSizeMetric () const
virtual bool isAllowed (Permission action) const
virtual void rotationChanged (Rotation orientation, Rotation oldOrientation)
virtual PageSize::List pageSizes () const
virtual void pageSizeChanged (const PageSize &pageSize, const PageSize &oldPageSize)
virtual bool print (QPrinter &printer)
virtual QVariant metaData (const QString &key, const QVariant &option) const
virtual ExportFormat::List exportFormats () const
virtual bool exportTo (const QString &fileName, const ExportFormat &format)
bool hasFeature (GeneratorFeature feature) const

Protected Member Functions

void signalPixmapRequestDone (PixmapRequest *request)
virtual bool doCloseDocument ()=0
virtual QImage image (PixmapRequest *page)
virtual TextPage * textPage (Page *page)
const Document * document () const
void setFeature (GeneratorFeature feature, bool on=true)
QVariant documentMetaData (const QString &key, const QVariant &option=QVariant()) const
QMutex * userMutex () const

Member Enumeration Documentation

enum Okular::Generator::GeneratorFeature

Describe the possible optional features that a Generator can provide.

Enumerator:
Threaded 
TextExtraction  Whether the Generator can extract text from the document in the form of TextPage's.
ReadRawData  Whether the Generator can read a document directly from its raw data.
FontInfo  Whether the Generator can provide information about the fonts used in the document.
PageSizes  Whether the Generator can change the size of the document pages.
PrintNative  Whether the Generator supports native cross-platform printing (QPainter-based).
PrintPostscript  Whether the Generator supports postscript-based file printing.
PrintToFile  Whether the Generator supports export to PDF & PS through the Print Dialog.

Definition at line 191 of file generator.h.

enum Okular::Generator::PageSizeMetric

This enum identifies the metric of the page size.

Enumerator:
None  The page size is not defined in a physical metric.
Points  The page size is given in 1/72 inches.

Definition at line 299 of file generator.h.


Constructor & Destructor Documentation

Generator::Generator ( QObject *  parent,
const QVariantList &  args 
)

Creates a new generator.

Definition at line 135 of file generator.cpp.

Generator::~Generator (  )  [virtual]

Destroys the generator.

Definition at line 149 of file generator.cpp.


Member Function Documentation

virtual bool Okular::Generator::loadDocument ( const QString &  fileName,
QVector< Page * > &  pagesVector 
) [pure virtual]

Loads the document with the given fileName and fills the pagesVector with the parsed pages.

Returns:
true on success, false otherwise.

Implemented in Okular::TextDocumentGenerator.

bool Generator::loadDocumentFromData ( const QByteArray &  fileData,
QVector< Page * > &  pagesVector 
) [virtual]

Loads the document from the raw data fileData and fills the pagesVector with the parsed pages.

Note:
the Generator has to have the feature ReadRawData enabled
Returns:
true on success, false otherwise.

Definition at line 154 of file generator.cpp.

bool Generator::closeDocument (  ) 

This method is called when the document is closed and not used any longer.

Returns:
true on success, false otherwise.

Definition at line 159 of file generator.cpp.

bool Generator::canGeneratePixmap (  )  const [virtual]

This method returns whether the generator is ready to handle a new pixmap request.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 189 of file generator.cpp.

void Generator::generatePixmap ( PixmapRequest *  request  )  [virtual]

This method can be called to trigger the generation of a new pixmap as described by request.

We create the text page for every page that is visible to the user, so he can use the text extraction tools without a delay.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 195 of file generator.cpp.

bool Generator::canGenerateTextPage (  )  const [virtual]

This method returns whether the generator is ready to handle a new text page request.

Definition at line 223 of file generator.cpp.

void Generator::generateTextPage ( Page *  page  )  [virtual]

This method can be called to trigger the generation of a text page for the given page.

The generation is done synchronous or asynchronous, depending on the type parameter and the capabilities of the generator (e.g. multithreading).

See also:
TextPage

Definition at line 229 of file generator.cpp.

const DocumentInfo * Generator::generateDocumentInfo (  )  [virtual]

Returns the general information object of the document or 0 if no information are available.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 246 of file generator.cpp.

const DocumentSynopsis * Generator::generateDocumentSynopsis (  )  [virtual]

Returns the 'table of content' object of the document or 0 if no table of content is available.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 251 of file generator.cpp.

FontInfo::List Generator::fontsForPage ( int  page  )  [virtual]

Definition at line 256 of file generator.cpp.

const QList< EmbeddedFile * > * Generator::embeddedFiles (  )  const [virtual]

Returns the 'list of embedded files' object of the document or 0 if no list of embedded files is available.

Definition at line 261 of file generator.cpp.

Generator::PageSizeMetric Generator::pagesSizeMetric (  )  const [virtual]

This method returns the metric of the page size.

Default is None.

Definition at line 266 of file generator.cpp.

bool Generator::isAllowed ( Permission  action  )  const [virtual]

This method returns whether given action (Permission) is allowed in this document.

Definition at line 271 of file generator.cpp.

void Generator::rotationChanged ( Rotation  orientation,
Rotation  oldOrientation 
) [virtual]

This method is called when the orientation has been changed by the user.

Definition at line 276 of file generator.cpp.

PageSize::List Generator::pageSizes (  )  const [virtual]

Returns the list of supported page sizes.

Definition at line 280 of file generator.cpp.

void Generator::pageSizeChanged ( const PageSize &  pageSize,
const PageSize &  oldPageSize 
) [virtual]

This method is called when the page size has been changed by the user.

Definition at line 285 of file generator.cpp.

bool Generator::print ( QPrinter &  printer  )  [virtual]

This method is called to print the document to the given printer.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 289 of file generator.cpp.

QVariant Generator::metaData ( const QString &  key,
const QVariant &  option 
) const [virtual]

This method returns the meta data of the given key with the given option of the document.

Definition at line 294 of file generator.cpp.

ExportFormat::List Generator::exportFormats (  )  const [virtual]

Returns the list of additional supported export formats.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 299 of file generator.cpp.

bool Generator::exportTo ( const QString &  fileName,
const ExportFormat &  format 
) [virtual]

This method is called to export the document in the given format and save it under the given fileName.

The format must be one of the supported export formats.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 304 of file generator.cpp.

bool Generator::hasFeature ( GeneratorFeature  feature  )  const

Query for the specified feature.

Definition at line 309 of file generator.cpp.

void Okular::Generator::error ( const QString &  message,
int  duration 
) [signal]

This signal should be emitted whenever an error occurred in the generator.

Parameters:
message The message which should be shown to the user.
duration The time that the message should be shown to the user.

void Okular::Generator::warning ( const QString &  message,
int  duration 
) [signal]

This signal should be emitted whenever the user should be warned.

Parameters:
message The message which should be shown to the user.
duration The time that the message should be shown to the user.

void Okular::Generator::notice ( const QString &  message,
int  duration 
) [signal]

This signal should be emitted whenever the user should be noticed.

Parameters:
message The message which should be shown to the user.
duration The time that the message should be shown to the user.

void Generator::signalPixmapRequestDone ( PixmapRequest *  request  )  [protected]

This method must be called when the pixmap request triggered by generatePixmap() has been finished.

Definition at line 315 of file generator.cpp.

virtual bool Okular::Generator::doCloseDocument (  )  [protected, pure virtual]

This method is called when the document is closed and not used any longer.

Returns:
true on success, false otherwise.

Implemented in Okular::TextDocumentGenerator.

QImage Generator::image ( PixmapRequest *  page  )  [protected, virtual]

Returns the image of the page as specified in the passed pixmap request.

Warning:
this method may be executed in its own separated thread if the Threaded is enabled!

Definition at line 236 of file generator.cpp.

TextPage * Generator::textPage ( Page *  page  )  [protected, virtual]

Returns the text page for the given page.

Warning:
this method may be executed in its own separated thread if the Threaded is enabled!

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 241 of file generator.cpp.

const Document * Generator::document (  )  const [protected]

Returns a pointer to the document.

Definition at line 326 of file generator.cpp.

void Generator::setFeature ( GeneratorFeature  feature,
bool  on = true 
) [protected]

Toggle the feature .

Definition at line 332 of file generator.cpp.

QVariant Generator::documentMetaData ( const QString &  key,
const QVariant &  option = QVariant() 
) const [protected]

Request a meta data of the Document, if available, like an internal setting.

Definition at line 341 of file generator.cpp.

QMutex * Generator::userMutex (  )  const [protected]

Return the pointer to a mutex the generator can use freely.

Definition at line 350 of file generator.cpp.


The documentation for this class was generated from the following files:
  • generator.h
  • generator.cpp

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdegraphics

Skip menu "kdegraphics"
  • okular
Generated for kdegraphics by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal