okular
generator.cpp
Go to the documentation of this file.
106 request->page()->setPixmap( request->observer(), new QPixmap( QPixmap::fromImage( img ) ), request->normalizedRect() );
189 Document::OpenResult Generator::loadDocumentWithPassword( const QString & fileName, QVector< Page * > & pagesVector, const QString & )
194 Document::OpenResult Generator::loadDocumentFromDataWithPassword( const QByteArray & fileData, QVector< Page * > & pagesVector, const QString & )
196 return loadDocumentFromData( fileData, pagesVector ) ? Document::OpenSuccess : Document::OpenError;
250 if ( hasFeature( TextExtraction ) && !request->page()->hasTextPage() && canGenerateTextPage() && !d->m_closing ) {
259 request->page()->setPixmap( request->observer(), new QPixmap( QPixmap::fromImage( img ) ), request->normalizedRect() );
362 void Generator::walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const
445 const SourceReference * Generator::dynamicSourceReference( int /*pageNr*/, double /*absX*/, double /*absY*/)
462 PixmapRequest::PixmapRequest( DocumentObserver *observer, int pageNumber, int width, int height, int priority, PixmapRequestFeatures features )
557 ExportFormatPrivate( const QString &description, const KMimeType::Ptr &mimeType, const KIcon &icon = KIcon() )
580 ExportFormat::ExportFormat( const KIcon &icon, const QString &description, const KMimeType::Ptr &mimeType )
629 return ExportFormat( KIcon( "text-x-generic" ), i18n( "Plain &Text..." ), KMimeType::mimeType( "text/plain" ) );
632 return ExportFormat( KIcon( "application-pdf" ), i18n( "PDF" ), KMimeType::mimeType( "application/pdf" ) );
641 return ExportFormat( KIcon( "text-html" ), i18nc( "This is the document format", "HTML" ), KMimeType::mimeType( "text/html" ) );
void unlock()
TextPageGenerationThread * mTextPageGenerationThread
Definition: generator_p.h:61
virtual bool loadDocument(const QString &fileName, QVector< Page * > &pagesVector)
Loads the document with the given fileName and fills the pagesVector with the parsed pages...
Definition: generator.cpp:179
void endGeneration()
void signalPixmapRequestDone(PixmapRequest *request)
This method must be called when the pixmap request triggered by generatePixmap() has been finished...
Definition: generator.cpp:375
ExportFormat & operator=(const ExportFormat &other)
Definition: generator.cpp:594
virtual bool exportTo(const QString &fileName, const ExportFormat &format)
This method is called to export the document in the given format and save it under the given fileName...
Definition: generator.cpp:357
virtual PageSize::List pageSizes() const
Returns the list of supported page sizes.
Definition: generator.cpp:327
virtual void generateTextPage(Page *page)
This method can be called to trigger the generation of a text page for the given page.
Definition: generator.cpp:275
void quit()
NormalizedRect mNormalizedRect
Definition: generator_p.h:87
QMutex * userMutex() const
Return the pointer to a mutex the generator can use freely.
Definition: generator.cpp:423
QVariant documentMetaData(const QString &key, const QVariant &option=QVariant()) const
Request a meta data of the Document, if available, like an internal setting.
Definition: generator.cpp:414
Page * page() const
Returns a pointer to the page where the pixmap shall be generated for.
Definition: generator.cpp:516
The TextPage class represents the text of a page by providing.
Definition: textpage.h:90
PixmapGenerationThread * mPixmapGenerationThread
Definition: generator_p.h:60
virtual void rotationChanged(Rotation orientation, Rotation oldOrientation)
This method is called when the orientation has been changed by the user.
Definition: generator.cpp:323
virtual TextPage * textPage(Page *page)
Returns the text page for the given page.
Definition: generator.cpp:288
virtual const QList< EmbeddedFile * > * embeddedFiles() const
Returns the 'list of embedded files' object of the document or 0 if no list of embedded files is avai...
Definition: generator.cpp:308
virtual bool isAllowed(Permission action) const
This method returns whether given action (Permission) is allowed in this document.
Definition: generator.cpp:318
const NormalizedRect & normalizedRect() const
Returns the normalized region of the page to request.
Definition: generator.cpp:539
virtual bool canGeneratePixmap() const
This method returns whether the generator is ready to handle a new pixmap request.
Definition: generator.cpp:229
virtual PageSizeMetric pagesSizeMetric() const
This method returns the metric of the page size.
Definition: generator.cpp:313
void updatePageBoundingBox(int page, const NormalizedRect &boundingBox)
Set the bounding box of a page after the page has already been handed to the Document.
Definition: generator.cpp:433
bool isBoundingBoxKnown() const
Returns whether the bounding box of the page has been computed.
Definition: page.cpp:184
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
Definition: area.h:105
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
virtual QVariant metaData(const QString &key, const QVariant &option) const
This method returns the meta data of the given key with the given option of the document.
Definition: generator.cpp:346
void textpageGenerationFinished()
Definition: generator.cpp:114
virtual FontInfo::List fontsForPage(int page)
Definition: generator.cpp:303
Definition: generator_p.h:91
bool hasTextPage() const
Returns whether the page provides a text page (TextPage).
Definition: page.cpp:228
const SourceReference * dynamicSourceReference(int pageNr, double absX, double absY)
Asks the generator to dynamically generate a SourceReference for a given page number and absolute X a...
Definition: generator.cpp:445
Definition: generator.h:585
virtual QVariant metaData(const QString &key, const QVariant &option) const
Definition: generator.cpp:149
void setNormalizedRect(const NormalizedRect &rect)
Sets the region of the page to request.
Definition: generator.cpp:531
void requestFontData(const Okular::FontInfo &font, QByteArray *data)
Gets the font data for the given font.
Definition: generator.cpp:440
bool operator!=(const ExportFormat &other) const
Definition: generator.cpp:652
Definition: generator.h:202
void endGeneration()
static ExportFormat standardFormat(StandardExportFormat type)
Builds a standard format for the specified type .
Definition: generator.cpp:624
Generator(QObject *parent, const QVariantList &args)
Creates a new generator.
Definition: generator.cpp:160
virtual ExportFormat::List exportFormats() const
Returns the list of additional supported export formats.
Definition: generator.cpp:352
TextPage * textPage() const
int exec(QFlags< QEventLoop::ProcessEventsFlag > flags)
void setFeature(GeneratorFeature feature, bool on=true)
Toggle the feature .
Definition: generator.cpp:405
DocumentObserver * observer() const
Returns the observer of the request.
Definition: generator.cpp:481
static NormalizedRect imageBoundingBox(const QImage *image)
Compute the smallest rectangle that contains all non-white pixels in image), in normalized [0...
Definition: utils.cpp:311
virtual Document::OpenResult loadDocumentWithPassword(const QString &fileName, QVector< Page * > &pagesVector, const QString &password)
Loads the document with the given fileName and password and fills the pagesVector with the parsed pag...
Definition: generator.cpp:189
Definition: document.h:106
PixmapGenerationThread * pixmapGenerationThread()
Definition: generator.cpp:57
Okular::Generator::PrintError printError() const
Returns the last print error in case print() failed.
Definition: generator.cpp:341
Definition: generator_p.h:72
KIcon icon() const
Returns the icon for GUI representations of the format.
Definition: generator.cpp:614
void setPixmap(DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect=NormalizedRect())
Sets the region described by rect with pixmap for the given observer.
Definition: page.cpp:507
virtual const DocumentInfo * generateDocumentInfo()
Returns the general information object of the document or 0 if no information are available...
Definition: generator.cpp:293
QImage image() const
void pixmapGenerationFinished()
Definition: generator.cpp:85
TilesManager * tilesManager() const
Definition: generator.cpp:544
QDebug operator<<(QDebug str, const Okular::PixmapRequest &req)
Definition: generator.cpp:657
bool asynchronous() const
Returns whether the generation should be done synchronous or asynchronous.
Definition: generator.cpp:506
bool hasFeature(GeneratorFeature feature) const
Query for the specified feature.
Definition: generator.cpp:369
bool preload() const
Returns whether the generation request is for a page that is not important i.e.
Definition: generator.cpp:511
A DOM tree containing information about the document.
Definition: document.h:1086
int priority() const
Returns the priority (less it better, 0 is maximum) of the request.
Definition: generator.cpp:501
bool calcBoundingBox() const
virtual bool print(QPrinter &printer)
This method is called to print the document to the given printer.
Definition: generator.cpp:336
void signalTextGenerationDone(Page *page, TextPage *textPage)
This method must be called when a text generation has been finished.
Definition: generator.cpp:386
PixmapRequest * request() const
virtual bool loadDocumentFromData(const QByteArray &fileData, QVector< Page * > &pagesVector)
Loads the document from the raw data fileData and fills the pagesVector with the parsed pages...
Definition: generator.cpp:184
The page size is not defined in a physical metric.
Definition: generator.h:342
bool wait(unsigned long time)
virtual QImage image(PixmapRequest *page)
Returns the image of the page as specified in the passed pixmap request.
Definition: generator.cpp:282
virtual void pageSizeChanged(const PageSize &pageSize, const PageSize &oldPageSize)
This method is called when the page size has been changed by the user.
Definition: generator.cpp:332
Base class for objects being notified when something changes.
Definition: observer.h:28
virtual void generatePixmap(PixmapRequest *request)
This method can be called to trigger the generation of a new pixmap as described by request...
Definition: generator.cpp:235
bool isTile() const
Returns whether the generator should render just the region given by normalizedRect() or the entire p...
Definition: generator.cpp:526
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
virtual void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const
This method is called to know which wallet data should be used for the given file name...
Definition: generator.cpp:362
PixmapRequest(DocumentObserver *observer, int pageNumber, int width, int height, int priority, PixmapRequestFeatures features)
Creates a new pixmap request.
Definition: generator.cpp:462
TextPageGenerationThread * textPageGenerationThread()
Definition: generator.cpp:71
Whether the Generator can extract text from the document in the form of TextPage's.
Definition: generator.h:203
virtual bool canGenerateTextPage() const
This method returns whether the generator is ready to handle a new text page request.
Definition: generator.cpp:269
bool operator==(const ExportFormat &other) const
Definition: generator.cpp:647
NormalizedRect boundingBox() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Definition: document.h:105
virtual const DocumentSynopsis * generateDocumentSynopsis()
Returns the 'table of content' object of the document or 0 if no table of content is available...
Definition: generator.cpp:298
bool closeDocument()
This method is called when the document is closed and not used any longer.
Definition: generator.cpp:199
virtual bool doCloseDocument()=0
This method is called when the document is closed and not used any longer.
TilesManager * tilesManager(const DocumentObserver *observer) const
Get the tiles manager for the tiled .
Definition: page.cpp:1007
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
Page * page() const
Definition: generator_p.h:35
A DOM tree that describes the Table of Contents.
Definition: document.h:1167
virtual Document::OpenResult loadDocumentFromDataWithPassword(const QByteArray &fileData, QVector< Page * > &pagesVector, const QString &password)
Loads the document from the raw data fileData and password and fills the pagesVector with the parsed ...
Definition: generator.cpp:194
void setTile(bool tile)
Sets whether the generator should render only the given normalized rect or the entire page...
Definition: generator.cpp:521
GeneratorFeature
Describe the possible optional features that a Generator can provide.
Definition: generator.h:200
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.