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

okular

  • Okular
  • Generator
Public Types | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
Okular::Generator Class Referenceabstract

#include <generator.h>

Inheritance diagram for Okular::Generator:
Inheritance graph
[legend]

Public Types

enum  GeneratorFeature {
  Threaded, TextExtraction, ReadRawData, FontInfo,
  PageSizes, PrintNative, PrintPostscript, PrintToFile,
  TiledRendering
}
 
enum  PageSizeMetric { None, Points }
 
enum  PrintError {
  NoPrintError, UnknownPrintError, TemporaryFileOpenPrintError, FileConversionPrintError,
  PrintingProcessCrashPrintError, PrintingProcessStartPrintError, PrintToFilePrintError, InvalidPrinterStatePrintError,
  UnableToFindFilePrintError, NoFileToPrintError, NoBinaryToPrintError, InvalidPageSizePrintError
}
 

Signals

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

Public Member Functions

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

Protected Slots

const SourceReference * dynamicSourceReference (int pageNr, double absX, double absY)
 
Okular::Generator::PrintError printError () const
 
void requestFontData (const Okular::FontInfo &font, QByteArray *data)
 

Protected Member Functions

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

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 185 of file generator.h.

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.

TiledRendering 

Whether the Generator can render tiles.

Since
0.16 (KDE 4.10)

Definition at line 199 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 308 of file generator.h.

enum Okular::Generator::PrintError

Possible print errors.

Since
0.11 (KDE 4.5)
Enumerator
NoPrintError 

There was no print error.

UnknownPrintError 
TemporaryFileOpenPrintError 
FileConversionPrintError 
PrintingProcessCrashPrintError 
PrintingProcessStartPrintError 
PrintToFilePrintError 
InvalidPrinterStatePrintError 
UnableToFindFilePrintError 
NoFileToPrintError 
NoBinaryToPrintError 
InvalidPageSizePrintError 
Since
0.18.2 (KDE 4.12.2)

Definition at line 349 of file generator.h.

Constructor & Destructor Documentation

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

Creates a new generator.

Definition at line 157 of file generator.cpp.

Generator::~Generator ( )
virtual

Destroys the generator.

Definition at line 171 of file generator.cpp.

Member Function Documentation

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 211 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 251 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 181 of file generator.cpp.

virtual bool Okular::Generator::doCloseDocument ( )
protectedpure 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.

const Document * Generator::document ( ) const
protected

Returns a pointer to the document.

Definition at line 370 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 389 of file generator.cpp.

const SourceReference * Generator::dynamicSourceReference ( int  pageNr,
double  absX,
double  absY 
)
protectedslot

Asks the generator to dynamically generate a SourceReference for a given page number and absolute X and Y position on this page.

Attention
Ownership of the returned SourceReference is transferred to the caller.
Since
0.10 (KDE 4.4)

Definition at line 420 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 290 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
messageThe message which should be shown to the user.
durationThe time that the message should be shown to the user.
ExportFormat::List Generator::exportFormats ( ) const
virtual

Returns the list of additional supported export formats.

Reimplemented in Okular::TextDocumentGenerator.

Definition at line 334 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 339 of file generator.cpp.

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

Definition at line 285 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 275 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 280 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 217 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 257 of file generator.cpp.

bool Generator::hasFeature ( GeneratorFeature  feature) const

Query for the specified feature.

Definition at line 344 of file generator.cpp.

QImage Generator::image ( PixmapRequest *  page)
protectedvirtual

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 264 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 300 of file generator.cpp.

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.
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 176 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 328 of file generator.cpp.

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

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

Parameters
messageThe message which should be shown to the user.
durationThe time that the message should be shown to the user.
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 314 of file generator.cpp.

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

Returns the list of supported page sizes.

Definition at line 309 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 295 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 318 of file generator.cpp.

Generator::PrintError Generator::printError ( ) const
protectedslot

Returns the last print error in case print() failed.

Since
0.11 (KDE 4.5)

Definition at line 323 of file generator.cpp.

void Generator::requestFontData ( const Okular::FontInfo &  font,
QByteArray *  data 
)
protectedslot

Gets the font data for the given font.

Since
0.8 (KDE 4.1)

Definition at line 415 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 305 of file generator.cpp.

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

Toggle the feature .

Definition at line 380 of file generator.cpp.

void Generator::signalPixmapRequestDone ( PixmapRequest *  request)
protected

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

Definition at line 350 of file generator.cpp.

void Generator::signalTextGenerationDone ( Page *  page,
TextPage *  textPage 
)
protected

This method must be called when a text generation has been finished.

Definition at line 361 of file generator.cpp.

TextPage * Generator::textPage ( Page *  page)
protectedvirtual

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 270 of file generator.cpp.

void Generator::updatePageBoundingBox ( int  page,
const NormalizedRect &  boundingBox 
)
protected

Set the bounding box of a page after the page has already been handed to the Document.

Call this instead of Page::setBoundingBox() to ensure that all observers are notified.

Since
0.7 (KDE 4.1)

Definition at line 408 of file generator.cpp.

QMutex * Generator::userMutex ( ) const
protected

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

Definition at line 398 of file generator.cpp.

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

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

Parameters
messageThe message which should be shown to the user.
durationThe time that the message should be shown to the user.

The documentation for this class was generated from the following files:
  • generator.h
  • generator.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

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

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal