File indexing completed on 2024-04-28 04:32:43

0001 /*
0002     SPDX-FileCopyrightText: 2004-5 Enrico Ros <eros.kde@email.it>
0003     SPDX-FileCopyrightText: 2005 Piotr Szymanski <niedakh@gmail.com>
0004     SPDX-FileCopyrightText: 2008 Albert Astals Cid <aacid@kde.org>
0005 
0006     Work sponsored by the LiMux project of the city of Munich:
0007     SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <info@kdab.com>
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 
0012 #ifndef _OKULAR_GENERATOR_H_
0013 #define _OKULAR_GENERATOR_H_
0014 
0015 #include "document.h"
0016 #include "fontinfo.h"
0017 #include "global.h"
0018 #include "okularcore_export.h"
0019 #include "pagesize.h"
0020 #include "signatureutils.h"
0021 
0022 #include <QList>
0023 #include <QObject>
0024 #include <QSharedDataPointer>
0025 #include <QSizeF>
0026 #include <QString>
0027 #include <QVariant>
0028 #include <QVector>
0029 
0030 #include <KPluginFactory>
0031 #include <QMimeType>
0032 
0033 #define OKULAR_EXPORT_PLUGIN(classname, json)                                                                                                                                                                                                  \
0034     static_assert(json[0] != '\0', "arg2 must be a string literal");                                                                                                                                                                           \
0035     K_PLUGIN_CLASS_WITH_JSON(classname, json)
0036 
0037 class QByteArray;
0038 class QMutex;
0039 class QPrinter;
0040 class QIcon;
0041 
0042 namespace Okular
0043 {
0044 class BackendOpaqueAction;
0045 class DocumentFonts;
0046 class DocumentInfo;
0047 class DocumentObserver;
0048 class DocumentSynopsis;
0049 class EmbeddedFile;
0050 class ExportFormatPrivate;
0051 class FontInfo;
0052 class GeneratorPrivate;
0053 class Page;
0054 class PixmapRequest;
0055 class PixmapRequestPrivate;
0056 class TextPage;
0057 class TextRequest;
0058 class TextRequestPrivate;
0059 class NormalizedRect;
0060 
0061 /* Note: on contents generation and asynchronous queries.
0062  * Many observers may want to request data synchronously or asynchronously.
0063  * - Sync requests. These should be done in-place.
0064  * - Async request must be done in real background. That usually means a
0065  *   thread, such as QThread derived classes.
0066  * Once contents are available, they must be immediately stored in the
0067  * Page they refer to, and a signal is emitted as soon as storing
0068  * (even for sync or async queries) has been done.
0069  */
0070 
0071 /**
0072  * @short Defines an entry for the export menu
0073  *
0074  * This class encapsulates information about an export format.
0075  * Every Generator can support 0 or more export formats which can be
0076  * queried with @ref Generator::exportFormats().
0077  */
0078 class OKULARCORE_EXPORT ExportFormat
0079 {
0080 public:
0081     typedef QList<ExportFormat> List;
0082 
0083     /**
0084      * Creates an empty export format.
0085      *
0086      * @see isNull()
0087      */
0088     ExportFormat();
0089 
0090     /**
0091      * Creates a new export format.
0092      *
0093      * @param description The i18n'ed description of the format.
0094      * @param mimeType The supported mime type of the format.
0095      */
0096     ExportFormat(const QString &description, const QMimeType &mimeType);
0097 
0098     /**
0099      * Creates a new export format.
0100      *
0101      * @param icon The icon used in the GUI for this format.
0102      * @param description The i18n'ed description of the format.
0103      * @param mimeType The supported mime type of the format.
0104      */
0105     ExportFormat(const QIcon &icon, const QString &description, const QMimeType &mimeType);
0106 
0107     /**
0108      * Destroys the export format.
0109      */
0110     ~ExportFormat();
0111 
0112     /**
0113      * @internal
0114      */
0115     ExportFormat(const ExportFormat &other);
0116 
0117     /**
0118      * @internal
0119      */
0120     ExportFormat &operator=(const ExportFormat &other);
0121 
0122     /**
0123      * Returns the description of the format.
0124      */
0125     QString description() const;
0126 
0127     /**
0128      * Returns the mime type of the format.
0129      */
0130     QMimeType mimeType() const;
0131 
0132     /**
0133      * Returns the icon for GUI representations of the format.
0134      */
0135     QIcon icon() const;
0136 
0137     /**
0138      * Returns whether the export format is null/valid.
0139      *
0140      * An ExportFormat is null if the mimetype is not valid or the
0141      * description is empty, or both.
0142      */
0143     bool isNull() const;
0144 
0145     /**
0146      * Type of standard export format.
0147      */
0148     enum StandardExportFormat {
0149         PlainText,        ///< Plain text
0150         PDF,              ///< PDF, aka Portable Document Format
0151         OpenDocumentText, ///< OpenDocument Text format @since 0.8 (KDE 4.2)
0152         HTML              ///< OpenDocument Text format @since 0.8 (KDE 4.2)
0153     };
0154 
0155     /**
0156      * Builds a standard format for the specified @p type .
0157      */
0158     static ExportFormat standardFormat(StandardExportFormat type);
0159 
0160     bool operator==(const ExportFormat &other) const;
0161 
0162     bool operator!=(const ExportFormat &other) const;
0163 
0164 private:
0165     /// @cond PRIVATE
0166     friend class ExportFormatPrivate;
0167     /// @endcond
0168     QSharedDataPointer<ExportFormatPrivate> d;
0169 };
0170 
0171 /**
0172  * @short [Abstract Class] The information generator.
0173  *
0174  * Most of class members are virtuals and some of them pure virtual. The pure
0175  * virtuals provide the minimal functionalities for a Generator, that is being
0176  * able to generate QPixmap for the Page 's of the Document.
0177  *
0178  * Implementing the other functions will make the Generator able to provide
0179  * more contents and/or functionalities (like text extraction).
0180  *
0181  * Generation/query is requested by the Document class only, and that
0182  * class stores the resulting data into Page s. The data will then be
0183  * displayed by the GUI components (PageView, ThumbnailList, etc..).
0184  *
0185  * @see PrintInterface, ConfigInterface, GuiInterface
0186  */
0187 class OKULARCORE_EXPORT Generator : public QObject
0188 {
0189     /// @cond PRIVATE
0190     friend class PixmapGenerationThread;
0191     friend class TextPageGenerationThread;
0192     /// @endcond
0193 
0194     Q_OBJECT
0195 
0196 public:
0197     /**
0198      * Describe the possible optional features that a Generator can
0199      * provide.
0200      */
0201     enum GeneratorFeature {
0202         Threaded,          ///< Whether the Generator supports asynchronous generation of pictures or text pages
0203         TextExtraction,    ///< Whether the Generator can extract text from the document in the form of TextPage's
0204         ReadRawData,       ///< Whether the Generator can read a document directly from its raw data.
0205         FontInfo,          ///< Whether the Generator can provide information about the fonts used in the document
0206         PageSizes,         ///< Whether the Generator can change the size of the document pages.
0207         PrintNative,       ///< Whether the Generator supports native cross-platform printing (QPainter-based).
0208         PrintPostscript,   ///< Whether the Generator supports postscript-based file printing.
0209         PrintToFile,       ///< Whether the Generator supports export to PDF & PS through the Print Dialog
0210         TiledRendering,    ///< Whether the Generator can render tiles @since 0.16 (KDE 4.10)
0211         SwapBackingFile,   ///< Whether the Generator can hot-swap the file it's reading from @since 1.3
0212         SupportsCancelling ///< Whether the Generator can cancel requests @since 1.4
0213     };
0214 
0215     /**
0216      * Creates a new generator.
0217      */
0218     explicit Generator(QObject *parent = nullptr, const QVariantList &args = QVariantList());
0219 
0220     /**
0221      * Destroys the generator.
0222      */
0223     ~Generator() override;
0224 
0225     /**
0226      * Loads the document with the given @p fileName and fills the
0227      * @p pagesVector with the parsed pages.
0228      *
0229      * @note If you implement the WithPassword variants you don't need to implement this one
0230      *
0231      * @returns true on success, false otherwise.
0232      */
0233     virtual bool loadDocument(const QString &fileName, QVector<Page *> &pagesVector);
0234 
0235     /**
0236      * Loads the document from the raw data @p fileData and fills the
0237      * @p pagesVector with the parsed pages.
0238      *
0239      * @note If you implement the WithPassword variants you don't need to implement this one
0240      *
0241      * @note the Generator has to have the feature @ref ReadRawData enabled
0242      *
0243      * @returns true on success, false otherwise.
0244      */
0245     virtual bool loadDocumentFromData(const QByteArray &fileData, QVector<Page *> &pagesVector);
0246 
0247     /**
0248      * Loads the document with the given @p fileName and @p password and fills the
0249      * @p pagesVector with the parsed pages.
0250      *
0251      * @note Do not implement this if your format doesn't support passwords, it'll cleanly call loadDocument()
0252      *
0253      * @since 0.20 (KDE 4.14)
0254      *
0255      * @returns a LoadResult defining the result of the operation
0256      */
0257     virtual Document::OpenResult loadDocumentWithPassword(const QString &fileName, QVector<Page *> &pagesVector, const QString &password);
0258 
0259     /**
0260      * Loads the document from the raw data @p fileData and @p password and fills the
0261      * @p pagesVector with the parsed pages.
0262      *
0263      * @note Do not implement this if your format doesn't support passwords, it'll cleanly call loadDocumentFromData()
0264      *
0265      * @note the Generator has to have the feature @ref ReadRawData enabled
0266      *
0267      * @since 0.20 (KDE 4.14)
0268      *
0269      * @returns a LoadResult defining the result of the operation
0270      */
0271     virtual Document::OpenResult loadDocumentFromDataWithPassword(const QByteArray &fileData, QVector<Page *> &pagesVector, const QString &password);
0272 
0273     /**
0274      * Describes the result of an swap file operation.
0275      *
0276      * @since 1.3
0277      */
0278     enum SwapBackingFileResult {
0279         SwapBackingFileError,             //< The document could not be swapped
0280         SwapBackingFileNoOp,              //< The document was swapped and nothing needs to be done
0281         SwapBackingFileReloadInternalData //< The document was swapped and internal data (forms, annotations, etc) needs to be reloaded
0282     };
0283 
0284     /**
0285      * Changes the path of the file we are reading from. The new path must
0286      * point to a copy of the same document.
0287      *
0288      * @note the Generator has to have the feature @ref SwapBackingFile enabled
0289      *
0290      * @since 1.3
0291      */
0292     virtual SwapBackingFileResult swapBackingFile(const QString &newFileName, QVector<Okular::Page *> &newPagesVector);
0293 
0294     /**
0295      * This method is called when the document is closed and not used
0296      * any longer.
0297      *
0298      * @returns true on success, false otherwise.
0299      */
0300     bool closeDocument();
0301 
0302     /**
0303      * This method returns whether the generator is ready to
0304      * handle a new pixmap request.
0305      */
0306     virtual bool canGeneratePixmap() const;
0307 
0308     virtual bool canSign() const;
0309 
0310     virtual bool sign(const NewSignatureData &data, const QString &rFilename);
0311 
0312     virtual CertificateStore *certificateStore() const;
0313 
0314     /**
0315      * This method can be called to trigger the generation of
0316      * a new pixmap as described by @p request.
0317      */
0318     virtual void generatePixmap(PixmapRequest *request);
0319 
0320     /**
0321      * This method returns whether the generator is ready to
0322      * handle a new text page request.
0323      */
0324     virtual bool canGenerateTextPage() const;
0325 
0326     /**
0327      * This method can be called to trigger the generation of
0328      * a text page for the given @p page.
0329      *
0330      * The generation is done in the calling thread.
0331      *
0332      * @see TextPage
0333      */
0334     void generateTextPage(Page *page);
0335 
0336     /**
0337      * Returns the general information object of the document.
0338      *
0339      * Changed signature in okular version 0.21
0340      */
0341     virtual DocumentInfo generateDocumentInfo(const QSet<DocumentInfo::Key> &keys) const;
0342 
0343     /**
0344      * Returns the 'table of content' object of the document or 0 if
0345      * no table of content is available.
0346      */
0347     virtual const DocumentSynopsis *generateDocumentSynopsis();
0348 
0349     /**
0350      * Returns the 'list of embedded fonts' object of the specified \p page
0351      * of the document.
0352      *
0353      * \param page a page of the document, starting from 0 - -1 indicates all
0354      * the other fonts
0355      */
0356     virtual FontInfo::List fontsForPage(int page);
0357 
0358     /**
0359      * Returns the 'list of embedded files' object of the document or 0 if
0360      * no list of embedded files is available.
0361      */
0362     virtual const QList<EmbeddedFile *> *embeddedFiles() const;
0363 
0364     /**
0365      * This enum identifies the metric of the page size.
0366      */
0367     enum PageSizeMetric {
0368         None,   ///< The page size is not defined in a physical metric.
0369         Points, ///< The page size is given in 1/72 inches.
0370         Pixels  ///< The page size is given in screen pixels @since 0.19 (KDE 4.13)
0371     };
0372 
0373     /**
0374      * This method returns the metric of the page size. Default is @ref None.
0375      */
0376     virtual PageSizeMetric pagesSizeMetric() const;
0377 
0378     /**
0379      * Returns whether the given @p action is allowed in the document.
0380      * @see @ref Okular::Permission
0381      */
0382     virtual bool isAllowed(Permission action) const;
0383 
0384     /**
0385      * This method is called when the orientation has been changed by the user.
0386      */
0387     virtual void rotationChanged(Rotation orientation, Rotation oldOrientation);
0388 
0389     /**
0390      * Returns the list of supported page sizes.
0391      */
0392     virtual PageSize::List pageSizes() const;
0393 
0394     /**
0395      * This method is called when the page size has been changed by the user.
0396      */
0397     virtual void pageSizeChanged(const PageSize &pageSize, const PageSize &oldPageSize);
0398 
0399     /**
0400      * This method is called to print the document to the given @p printer.
0401      */
0402     virtual Document::PrintError print(QPrinter &printer);
0403 
0404     /**
0405      * This method returns the meta data of the given @p key with the given @p option
0406      * of the document.
0407      */
0408     virtual QVariant metaData(const QString &key, const QVariant &option) const;
0409 
0410     /**
0411      * Returns the list of additional supported export formats.
0412      */
0413     virtual ExportFormat::List exportFormats() const;
0414 
0415     /**
0416      * This method is called to export the document in the given @p format and save it
0417      * under the given @p fileName. The format must be one of the supported export formats.
0418      */
0419     virtual bool exportTo(const QString &fileName, const ExportFormat &format);
0420 
0421     /**
0422      * This method is called to know which wallet data should be used for the given file name.
0423      * Unless you have very special requirements to where wallet data should be stored you
0424      * don't need to reimplement this method.
0425      */
0426     virtual void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const;
0427 
0428     /**
0429      * Query for the specified @p feature.
0430      */
0431     bool hasFeature(GeneratorFeature feature) const;
0432 
0433     /**
0434      * Update DPI of the generator
0435      *
0436      * @since 0.19 (old signature)
0437      * @since 22.04 (new signature)
0438      */
0439     void setDPI(const QSizeF dpi);
0440 
0441     /**
0442      * Returns the 'layers model' object of the document or NULL if
0443      * layers model is not available.
0444      *
0445      * @since 0.24
0446      */
0447     virtual QAbstractItemModel *layersModel() const;
0448 
0449     /**
0450      * Calls the backend to execute an BackendOpaqueAction
0451      */
0452     virtual void opaqueAction(const BackendOpaqueAction *action);
0453 
0454     /**
0455      * Frees the contents of the opaque action (if any);
0456      *
0457      * @since 22.04
0458      */
0459     virtual void freeOpaqueActionContents(const BackendOpaqueAction &action);
0460 
0461 Q_SIGNALS:
0462     /**
0463      * This signal should be emitted whenever an error occurred in the generator.
0464      *
0465      * @param message The message which should be shown to the user.
0466      * @param duration The time that the message should be shown to the user.
0467      */
0468     void error(const QString &message, int duration);
0469 
0470     /**
0471      * This signal should be emitted whenever the user should be warned.
0472      *
0473      * @param message The message which should be shown to the user.
0474      * @param duration The time that the message should be shown to the user.
0475      */
0476     void warning(const QString &message, int duration);
0477 
0478     /**
0479      * This signal should be emitted whenever the user should be noticed.
0480      *
0481      * @param message The message which should be shown to the user.
0482      * @param duration The time that the message should be shown to the user.
0483      */
0484     void notice(const QString &message, int duration);
0485 
0486 protected:
0487     /**
0488      * This method must be called when the pixmap request triggered by generatePixmap()
0489      * has been finished.
0490      */
0491     void signalPixmapRequestDone(PixmapRequest *request);
0492 
0493     /**
0494      * This method must be called when a text generation has been finished.
0495      */
0496     void signalTextGenerationDone(Page *page, TextPage *textPage);
0497 
0498     /**
0499      * This method is called when the document is closed and not used
0500      * any longer.
0501      *
0502      * @returns true on success, false otherwise.
0503      */
0504     virtual bool doCloseDocument() = 0;
0505 
0506     /**
0507      * Returns the image of the page as specified in
0508      * the passed pixmap @p request.
0509      *
0510      * Must return a null image if the request was cancelled and the generator supports cancelling
0511      *
0512      * @warning this method may be executed in its own separated thread if the
0513      * @ref Threaded is enabled!
0514      */
0515     virtual QImage image(PixmapRequest *request);
0516 
0517     /**
0518      * Returns the text page for the given @p request.
0519      *
0520      * Must return a null pointer if the request was cancelled and the generator supports cancelling
0521      *
0522      * @warning this method may be executed in its own separated thread if the
0523      * @ref Threaded is enabled!
0524      *
0525      * @since 1.4
0526      */
0527     virtual TextPage *textPage(TextRequest *request);
0528 
0529     /**
0530      * Returns a pointer to the document.
0531      */
0532     const Document *document() const;
0533 
0534     /**
0535      * Toggle the @p feature .
0536      */
0537     void setFeature(GeneratorFeature feature, bool on = true);
0538 
0539     /**
0540      * Internal document setting
0541      */
0542     enum DocumentMetaDataKey {
0543         PaperColorMetaData,        ///< Returns (QColor) the paper color if set in Settings or the default color (white) if option is true (otherwise returns a non initialized QColor)
0544         TextAntialiasMetaData,     ///< Returns (bool) text antialias from Settings (option is not used)
0545         GraphicsAntialiasMetaData, ///< Returns (bool)graphic antialias from Settings (option is not used)
0546         TextHintingMetaData        ///< Returns (bool)text hinting from Settings (option is not used)
0547     };
0548 
0549     /**
0550      * Request a meta data of the Document, if available, like an internal
0551      * setting.
0552      *
0553      * @since 1.1
0554      */
0555     QVariant documentMetaData(const DocumentMetaDataKey key, const QVariant &option = QVariant()) const;
0556 
0557     /**
0558      * Return the pointer to a mutex the generator can use freely.
0559      */
0560     QMutex *userMutex() const;
0561 
0562     /**
0563      * Set the bounding box of a page after the page has already been handed
0564      * to the Document. Call this instead of Page::setBoundingBox() to ensure
0565      * that all observers are notified.
0566      *
0567      * @since 0.7 (KDE 4.1)
0568      */
0569     void updatePageBoundingBox(int page, const NormalizedRect &boundingBox);
0570 
0571     /**
0572      * Returns DPI, previously set via setDPI()
0573      * @since 0.19 (KDE 4.13)
0574      */
0575     QSizeF dpi() const;
0576 
0577     /**
0578      * Gets the font data for the given font
0579      *
0580      * @since 0.8 (old signature)
0581      * @since 22.04 (new signature)
0582      */
0583     virtual QByteArray requestFontData(const Okular::FontInfo &font);
0584 
0585 protected Q_SLOTS:
0586     /**
0587      * This method can be called to trigger a partial pixmap update for the given request
0588      * Make sure you call it in a way it's executed in the main thread.
0589      * @since 1.3
0590      */
0591     void signalPartialPixmapRequest(Okular::PixmapRequest *request, const QImage &image);
0592 
0593 protected:
0594     /// @cond PRIVATE
0595     Generator(GeneratorPrivate &dd, QObject *parent, const QVariantList &args);
0596     Q_DECLARE_PRIVATE(Generator)
0597     GeneratorPrivate *d_ptr;
0598 
0599     friend class Document;
0600     friend class DocumentPrivate;
0601     /// @endcond PRIVATE
0602 
0603 private:
0604     Q_DISABLE_COPY(Generator)
0605 };
0606 
0607 /**
0608  * @short Describes a pixmap type request.
0609  */
0610 class OKULARCORE_EXPORT PixmapRequest
0611 {
0612     friend class Document;
0613     friend class DocumentPrivate;
0614 
0615 public:
0616     enum PixmapRequestFeature { NoFeature = 0, Asynchronous = 1, Preload = 2 };
0617     Q_DECLARE_FLAGS(PixmapRequestFeatures, PixmapRequestFeature)
0618 
0619     /**
0620      * Creates a new pixmap request.
0621      *
0622      * @param observer The observer.
0623      * @param pageNumber The page number.
0624      * @param width The width of the page in logical pixels.
0625      * @param height The height of the page in logical pixels.
0626      * @param dpr Device pixel ratio of the screen that the pixmap is intended for.
0627      * @param priority The priority of the request.
0628      * @param features The features of generation.
0629      */
0630     PixmapRequest(DocumentObserver *observer, int pageNumber, int width, int height, qreal dpr, int priority, PixmapRequestFeatures features);
0631 
0632     /**
0633      * Destroys the pixmap request.
0634      */
0635     ~PixmapRequest();
0636 
0637     /**
0638      * Returns the observer of the request.
0639      */
0640     DocumentObserver *observer() const;
0641 
0642     /**
0643      * Returns the page number of the request.
0644      */
0645     int pageNumber() const;
0646 
0647     /**
0648      * Returns the page width of the requested pixmap.
0649      */
0650     int width() const;
0651 
0652     /**
0653      * Returns the page height of the requested pixmap.
0654      */
0655     int height() const;
0656 
0657     /**
0658      * Returns the priority (less it better, 0 is maximum) of the
0659      * request.
0660      */
0661     int priority() const;
0662 
0663     /**
0664      * Returns whether the generation should be done synchronous or
0665      * asynchronous.
0666      *
0667      * If asynchronous, the pixmap is created in a thread and the observer
0668      * is notified when the job is done.
0669      */
0670     bool asynchronous() const;
0671 
0672     /**
0673      * Returns whether the generation request is for a page that is not important
0674      * i.e. it's just for speeding up future rendering
0675      */
0676     bool preload() const;
0677 
0678     /**
0679      * Returns a pointer to the page where the pixmap shall be generated for.
0680      */
0681     Page *page() const;
0682 
0683     /**
0684      * Sets whether the generator should render only the given normalized
0685      * rect or the entire page
0686      *
0687      * @since 0.16 (KDE 4.10)
0688      */
0689     void setTile(bool tile);
0690 
0691     /**
0692      * Returns whether the generator should render just the region given by
0693      * normalizedRect() or the entire page.
0694      *
0695      * @since 0.16 (KDE 4.10)
0696      */
0697     bool isTile() const;
0698 
0699     /**
0700      * Sets the region of the page to request.
0701      *
0702      * @since 0.16 (KDE 4.10)
0703      */
0704     void setNormalizedRect(const NormalizedRect &rect);
0705 
0706     /**
0707      * Returns the normalized region of the page to request.
0708      *
0709      * @since 0.16 (KDE 4.10)
0710      */
0711     const NormalizedRect &normalizedRect() const;
0712 
0713     /**
0714      * Sets whether the request should report back updates if possible
0715      *
0716      * @since 1.3
0717      */
0718     void setPartialUpdatesWanted(bool partialUpdatesWanted);
0719 
0720     /**
0721      * Should the request report back updates if possible?
0722      *
0723      * @since 1.3
0724      */
0725     bool partialUpdatesWanted() const;
0726 
0727     /**
0728      * Should the request be aborted if possible?
0729      *
0730      * @since 1.4
0731      */
0732     bool shouldAbortRender() const;
0733 
0734 private:
0735     Q_DISABLE_COPY(PixmapRequest)
0736 
0737     friend class PixmapRequestPrivate;
0738     PixmapRequestPrivate *const d;
0739 };
0740 
0741 /**
0742  * @short Describes a text request.
0743  *
0744  * @since 1.4
0745  */
0746 class OKULARCORE_EXPORT TextRequest
0747 {
0748 public:
0749     /**
0750      * Creates a new text request.
0751      */
0752     explicit TextRequest(Page *page);
0753 
0754     TextRequest();
0755 
0756     /**
0757      * Destroys the pixmap request.
0758      */
0759     ~TextRequest();
0760 
0761     /**
0762      * Returns a pointer to the page where the pixmap shall be generated for.
0763      */
0764     Page *page() const;
0765 
0766     /**
0767      * Should the request be aborted if possible?
0768      */
0769     bool shouldAbortExtraction() const;
0770 
0771 private:
0772     Q_DISABLE_COPY(TextRequest)
0773 
0774     friend TextRequestPrivate;
0775     TextRequestPrivate *const d;
0776 };
0777 
0778 }
0779 
0780 Q_DECLARE_METATYPE(Okular::PixmapRequest *)
0781 
0782 #define OkularGeneratorInterface_iid "org.kde.okular.Generator"
0783 Q_DECLARE_INTERFACE(Okular::Generator, OkularGeneratorInterface_iid)
0784 
0785 #ifndef QT_NO_DEBUG_STREAM
0786 OKULARCORE_EXPORT QDebug operator<<(QDebug str, const Okular::PixmapRequest &req);
0787 #endif
0788 
0789 #endif
0790 
0791 /* kate: replace-tabs on; indent-width 4; */