File indexing completed on 2024-05-05 16:39:34
0001 /* 0002 SPDX-FileCopyrightText: 2004-2005 Enrico Ros <eros.kde@email.it> 0003 SPDX-FileCopyrightText: 2004-2008 Albert Astals Cid <aacid@kde.org> 0004 0005 Work sponsored by the LiMux project of the city of Munich: 0006 SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <info@kdab.com> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 0011 #ifndef _OKULAR_DOCUMENT_H_ 0012 #define _OKULAR_DOCUMENT_H_ 0013 0014 #include "area.h" 0015 #include "global.h" 0016 #include "okularcore_export.h" 0017 #include "pagesize.h" 0018 0019 #include <QDomDocument> 0020 #include <QObject> 0021 #include <QPrinter> 0022 #include <QStringList> 0023 #include <QVector> 0024 0025 #include <QMimeType> 0026 #include <QUrl> 0027 #include <QVariant> 0028 0029 class KConfigDialog; 0030 class KPluginMetaData; 0031 class KXMLGUIClient; 0032 class DocumentItem; 0033 class QAbstractItemModel; 0034 0035 namespace Okular 0036 { 0037 class Annotation; 0038 class BookmarkManager; 0039 class CertificateStore; 0040 class DocumentInfoPrivate; 0041 class DocumentObserver; 0042 class DocumentPrivate; 0043 class DocumentSynopsis; 0044 class DocumentViewport; 0045 class EmbeddedFile; 0046 class ExportFormat; 0047 class FontInfo; 0048 class FormField; 0049 class FormFieldText; 0050 class FormFieldButton; 0051 class FormFieldChoice; 0052 class Generator; 0053 class Action; 0054 class MovieAction; 0055 class Page; 0056 class PixmapRequest; 0057 class RenditionAction; 0058 class NewSignatureData; 0059 struct NewSignatureDataPrivate; 0060 class SourceReference; 0061 class View; 0062 class VisiblePageRect; 0063 class SignatureInfo; 0064 0065 /** IDs for seaches. Globally defined here. **/ 0066 #define PART_SEARCH_ID 1 0067 #define PAGEVIEW_SEARCH_ID 2 0068 #define SW_SEARCH_ID 3 0069 #define PRESENTATION_SEARCH_ID 4 0070 0071 /** 0072 * The DocumentInfo structure can be filled in by generators to display 0073 * metadata about the currently opened file. 0074 */ 0075 class OKULARCORE_EXPORT DocumentInfo 0076 { 0077 friend class Document; 0078 0079 public: 0080 /** 0081 * The list of predefined keys. 0082 */ 0083 enum Key { 0084 Title, ///< The title of the document 0085 Subject, ///< The subject of the document 0086 Description, ///< The description of the document 0087 Author, ///< The author of the document 0088 Creator, ///< The creator of the document (this can be different from the author) 0089 Producer, ///< The producer of the document (e.g. some software) 0090 Copyright, ///< The copyright of the document 0091 Pages, ///< The number of pages of the document 0092 CreationDate, ///< The date of creation of the document 0093 ModificationDate, ///< The date of last modification of the document 0094 MimeType, ///< The mime type of the document 0095 Category, ///< The category of the document 0096 Keywords, ///< The keywords which describe the content of the document 0097 FilePath, ///< The path of the file @since 0.10 (KDE 4.4) 0098 DocumentSize, ///< The size of the document @since 0.10 (KDE 4.4) 0099 PagesSize, ///< The size of the pages (if all pages have the same size) @since 0.10 (KDE 4.4) 0100 CustomKeys, ///< All the custom keys the generator supports @since 0.21 0101 Invalid ///< An invalid key @since 0.21. It will always be the last element in the enum 0102 }; 0103 0104 /** 0105 * Creates a new document info. 0106 */ 0107 DocumentInfo(); 0108 DocumentInfo(const DocumentInfo &info); 0109 DocumentInfo &operator=(const DocumentInfo &); 0110 0111 ~DocumentInfo(); 0112 0113 /** 0114 * Returns all the keys present in this DocumentInfo 0115 * 0116 * @since 0.21 0117 */ 0118 QStringList keys() const; 0119 0120 /** 0121 * Returns the value for a given key or an null string when the 0122 * key doesn't exist. 0123 */ 0124 QString get(Key key) const; 0125 0126 /** 0127 * Returns the value for a given key or an null string when the 0128 * key doesn't exist. 0129 */ 0130 QString get(const QString &key) const; 0131 0132 /** 0133 * Sets a value for a custom key. The title should be an i18n'ed 0134 * string, since it's used in the document information dialog. 0135 */ 0136 void set(const QString &key, const QString &value, const QString &title = QString()); 0137 0138 /** 0139 * Sets a value for a special key. The title should be an i18n'ed 0140 * string, since it's used in the document information dialog. 0141 */ 0142 void set(Key key, const QString &value); 0143 0144 /** 0145 * Returns the user visible string for the given key 0146 * Takes into account keys added by the set() that takes a QString 0147 * 0148 * @since 0.21 0149 */ 0150 QString getKeyTitle(const QString &key) const; 0151 0152 /** 0153 * Returns the internal string for the given key 0154 * @since 0.10 (KDE 4.4) 0155 */ 0156 static QString getKeyString(Key key); 0157 0158 /** 0159 * Returns the user visible string for the given key 0160 * @since 0.10 (KDE 4.4) 0161 */ 0162 static QString getKeyTitle(Key key); 0163 0164 /** 0165 * Returns the Key from a string key 0166 * @since 0.21 0167 */ 0168 static Key getKeyFromString(const QString &key); 0169 0170 private: 0171 DocumentInfoPrivate *d; 0172 }; 0173 0174 /** 0175 * @short The Document. Heart of everything. Actions take place here. 0176 * 0177 * The Document is the main object in Okular. All views query the Document to 0178 * get data/properties or even for accessing pages (in a 'const' way). 0179 * 0180 * It is designed to keep it detached from the document type (pdf, ps, you 0181 * name it..) so whenever you want to get some data, it asks its internal 0182 * generators to do the job and return results in a format-independent way. 0183 * 0184 * Apart from the generator (the currently running one) the document stores 0185 * all the Pages ('Page' class) of the current document in a vector and 0186 * notifies all the registered DocumentObservers when some content changes. 0187 * 0188 * For a better understanding of hierarchies @see README.internals.png 0189 * @see DocumentObserver, Page 0190 */ 0191 class OKULARCORE_EXPORT Document : public QObject 0192 { 0193 Q_OBJECT 0194 0195 public: 0196 /** 0197 * Creates a new document with the given @p widget as widget to relay GUI things (messageboxes, ...). 0198 */ 0199 explicit Document(QWidget *widget); 0200 0201 /** 0202 * Destroys the document. 0203 */ 0204 ~Document() override; 0205 0206 /** 0207 * Describes the result of an open document operation. 0208 * @since 0.20 (KDE 4.14) 0209 */ 0210 enum OpenResult { 0211 OpenSuccess, //< The document was opened successfully 0212 OpenError, //< The document failed to open 0213 OpenNeedsPassword //< The document needs a password to be opened or the one provided is not the correct 0214 }; 0215 0216 /** 0217 * Opens the document. 0218 * @since 0.20 (KDE 4.14) 0219 */ 0220 OpenResult openDocument(const QString &docFile, const QUrl &url, const QMimeType &mime, const QString &password = QString()); 0221 0222 /** 0223 * Closes the document. 0224 */ 0225 void closeDocument(); 0226 0227 /** 0228 * Registers a new @p observer for the document. 0229 */ 0230 void addObserver(DocumentObserver *observer); 0231 0232 /** 0233 * Unregisters the given @p observer for the document. 0234 */ 0235 void removeObserver(DocumentObserver *observer); 0236 0237 /** 0238 * Reparses and applies the configuration. 0239 */ 0240 void reparseConfig(); 0241 0242 /** 0243 * Returns whether the document is currently opened. 0244 */ 0245 bool isOpened() const; 0246 0247 /** 0248 * Returns the meta data of the document. 0249 */ 0250 DocumentInfo documentInfo() const; 0251 0252 /** 0253 * Returns the asked set of meta data of the document. The result may contain more 0254 * metadata than the one asked for. 0255 */ 0256 DocumentInfo documentInfo(const QSet<DocumentInfo::Key> &keys) const; 0257 0258 /** 0259 * Returns the table of content of the document or 0 if no 0260 * table of content is available. 0261 */ 0262 const DocumentSynopsis *documentSynopsis() const; 0263 0264 /** 0265 * Starts the reading of the information about the fonts in the 0266 * document, if available. 0267 * 0268 * The results as well the end of the reading is notified using the 0269 * signals gotFont(), fontReadingProgress() and fontReadingEnded() 0270 */ 0271 void startFontReading(); 0272 0273 /** 0274 * Force the termination of the reading of the information about the 0275 * fonts in the document, if running. 0276 */ 0277 void stopFontReading(); 0278 0279 /** 0280 * Whether the current document can provide information about the 0281 * fonts used in it. 0282 */ 0283 bool canProvideFontInformation() const; 0284 0285 /** 0286 * Whether the current document can perform digital signing. 0287 */ 0288 bool canSign() const; 0289 0290 /** 0291 * Returns the list of embedded files or 0 if no embedded files 0292 * are available. 0293 */ 0294 const QList<EmbeddedFile *> *embeddedFiles() const; 0295 0296 /** 0297 * Returns the page object for the given page @p number or 0 0298 * if the number is out of range. 0299 */ 0300 const Page *page(int number) const; 0301 0302 /** 0303 * Returns the current viewport of the document. 0304 */ 0305 const DocumentViewport &viewport() const; 0306 0307 /** 0308 * Sets the list of visible page rectangles. 0309 * @see VisiblePageRect 0310 */ 0311 void setVisiblePageRects(const QVector<VisiblePageRect *> &visiblePageRects, DocumentObserver *excludeObserver = nullptr); 0312 0313 /** 0314 * Returns the list of visible page rectangles. 0315 */ 0316 const QVector<VisiblePageRect *> &visiblePageRects() const; 0317 0318 /** 0319 * Returns the number of the current page. 0320 */ 0321 uint currentPage() const; 0322 0323 /** 0324 * Returns the number of pages of the document. 0325 */ 0326 uint pages() const; 0327 0328 /** 0329 * Returns the url of the currently opened document. 0330 */ 0331 QUrl currentDocument() const; 0332 0333 /** 0334 * Returns whether the given @p action is allowed in the document. 0335 * @see @ref Permission 0336 */ 0337 bool isAllowed(Permission action) const; 0338 0339 /** 0340 * Returns whether the document supports searching. 0341 */ 0342 bool supportsSearching() const; 0343 0344 /** 0345 * Returns whether the document supports the listing of page sizes. 0346 */ 0347 bool supportsPageSizes() const; 0348 0349 /** 0350 * Returns whether the current document supports tiles 0351 * 0352 * @since 0.16 (KDE 4.10) 0353 */ 0354 bool supportsTiles() const; 0355 0356 /** 0357 * Returns the list of supported page sizes or an empty list if this 0358 * feature is not available. 0359 * @see supportsPageSizes() 0360 */ 0361 PageSize::List pageSizes() const; 0362 0363 /** 0364 * Returns whether the document supports the export to ASCII text. 0365 */ 0366 bool canExportToText() const; 0367 0368 /** 0369 * Exports the document as ASCII text and saves it under @p fileName. 0370 */ 0371 bool exportToText(const QString &fileName) const; 0372 0373 /** 0374 * Returns the list of supported export formats. 0375 * @see ExportFormat 0376 */ 0377 QList<ExportFormat> exportFormats() const; 0378 0379 /** 0380 * Exports the document in the given @p format and saves it under @p fileName. 0381 */ 0382 bool exportTo(const QString &fileName, const ExportFormat &format) const; 0383 0384 /** 0385 * Returns whether the document history is at the begin. 0386 */ 0387 bool historyAtBegin() const; 0388 0389 /** 0390 * Returns whether the document history is at the end. 0391 */ 0392 bool historyAtEnd() const; 0393 0394 /** 0395 * Returns the meta data for the given @p key and @p option or an empty variant 0396 * if the key doesn't exists. 0397 */ 0398 QVariant metaData(const QString &key, const QVariant &option = QVariant()) const; 0399 0400 /** 0401 * Returns the current rotation of the document. 0402 */ 0403 Rotation rotation() const; 0404 0405 /** 0406 * If all pages have the same size this method returns it, if the page sizes 0407 * differ an empty size object is returned. 0408 */ 0409 QSizeF allPagesSize() const; 0410 0411 /** 0412 * Returns the size string for the given @p page or an empty string 0413 * if the page is out of range. 0414 */ 0415 QString pageSizeString(int page) const; 0416 0417 /** 0418 * Returns the gui client of the generator, if it provides one. 0419 */ 0420 KXMLGUIClient *guiClient(); 0421 0422 /** 0423 * Sets the current document viewport to the given @p page. 0424 * 0425 * @param page The number of the page. 0426 * @param excludeObserver The observer ids which shouldn't be effected by this change. 0427 * @param smoothMove Whether the move shall be animated smoothly. 0428 */ 0429 void setViewportPage(int page, DocumentObserver *excludeObserver = nullptr, bool smoothMove = false); 0430 0431 /** 0432 * Sets the current document viewport to the given @p viewport. 0433 * 0434 * @param viewport The document viewport. 0435 * @param excludeObserver The observer which shouldn't be effected by this change. 0436 * @param smoothMove Whether the move shall be animated smoothly. 0437 * @param updateHistory Whether to consider the change of viewport for the history navigation 0438 */ 0439 void setViewport(const DocumentViewport &viewport, DocumentObserver *excludeObserver = nullptr, bool smoothMove = false, bool updateHistory = true); 0440 0441 /** 0442 * Sets the current document viewport to the next viewport in the 0443 * viewport history. 0444 */ 0445 void setPrevViewport(); 0446 0447 /** 0448 * Sets the current document viewport to the previous viewport in the 0449 * viewport history. 0450 */ 0451 void setNextViewport(); 0452 0453 /** 0454 * Sets the next @p viewport in the viewport history. 0455 */ 0456 void setNextDocumentViewport(const DocumentViewport &viewport); 0457 0458 /** 0459 * Sets the next @p namedDestination in the viewport history. 0460 * 0461 * @since 0.9 (KDE 4.3) 0462 */ 0463 void setNextDocumentDestination(const QString &namedDestination); 0464 0465 /** 0466 * Sets the zoom for the current document. 0467 */ 0468 void setZoom(int factor, DocumentObserver *excludeObserver = nullptr); 0469 0470 /** 0471 * Describes the possible options for the pixmap requests. 0472 */ 0473 enum PixmapRequestFlag { 0474 NoOption = 0, ///< No options 0475 RemoveAllPrevious = 1 ///< Remove all the previous requests, even for non requested page pixmaps 0476 }; 0477 Q_DECLARE_FLAGS(PixmapRequestFlags, PixmapRequestFlag) 0478 0479 /** 0480 * Sends @p requests for pixmap generation. 0481 * 0482 * The same as requestPixmaps( requests, RemoveAllPrevious ); 0483 * 0484 * @since 22.08 0485 */ 0486 void requestPixmaps(const QList<PixmapRequest *> &requests); 0487 0488 /** 0489 * Sends @p requests for pixmap generation. 0490 * 0491 * @param requests the linked list of requests 0492 * @param reqOptions the options for the request 0493 * 0494 * @since 22.08 0495 */ 0496 void requestPixmaps(const QList<PixmapRequest *> &requests, PixmapRequestFlags reqOptions); 0497 0498 /** 0499 * Sends a request for text page generation for the given page @p pageNumber. 0500 */ 0501 void requestTextPage(uint pageNumber); 0502 0503 /** 0504 * Adds a new @p annotation to the given @p page. 0505 */ 0506 void addPageAnnotation(int page, Annotation *annotation); 0507 0508 /** 0509 * Tests if the @p annotation can be modified 0510 * 0511 * @since 0.15 (KDE 4.9) 0512 */ 0513 bool canModifyPageAnnotation(const Annotation *annotation) const; 0514 0515 /** 0516 * Prepares to modify the properties of the given @p annotation. 0517 * Must be called before the annotation's properties are modified 0518 * 0519 * @since 0.17 (KDE 4.11) 0520 */ 0521 void prepareToModifyAnnotationProperties(Annotation *annotation); 0522 0523 /** 0524 * Modifies the given @p annotation on the given @p page. 0525 * Must be preceded by a call to prepareToModifyAnnotationProperties before 0526 * the annotation's properties are modified 0527 * 0528 * @since 0.17 (KDE 4.11) 0529 */ 0530 void modifyPageAnnotationProperties(int page, Annotation *annotation); 0531 0532 /** 0533 * Translates the position of the given @p annotation on the given @p page by a distance @p delta in normalized coordinates. 0534 * 0535 * Consecutive translations applied to the same @p annotation are merged together on the undo stack if the 0536 * BeingMoved flag is set on the @p annotation. 0537 * 0538 * @since 0.17 (KDE 4.11) 0539 */ 0540 void translatePageAnnotation(int page, Annotation *annotation, const Okular::NormalizedPoint &delta); 0541 0542 /** 0543 * Adjusts the position of the top-left and bottom-right corners of given @p annotation on the given @p page. 0544 * 0545 * Can be used to implement resize functionality. 0546 * @p delta1 in normalized coordinates is added to top-left. 0547 * @p delta2 in normalized coordinates is added to bottom-right. 0548 * 0549 * Consecutive adjustments applied to the same @p annotation are merged together on the undo stack if the 0550 * BeingResized flag is set on the @p annotation. 0551 * 0552 * @since 1.1.0 0553 */ 0554 void adjustPageAnnotation(int page, Annotation *annotation, const Okular::NormalizedPoint &delta1, const Okular::NormalizedPoint &delta2); 0555 0556 /** 0557 * Edits the plain text contents of the given @p annotation on the given @p page. 0558 * 0559 * The contents are set to @p newContents with cursor position @p newCursorPos. 0560 * The previous cursor position @p prevCursorPos and previous anchor position @p prevAnchorPos 0561 * must also be supplied so that they can be restored if the edit action is undone. 0562 * 0563 * The Annotation's internal contents should not be modified prior to calling this method. 0564 * 0565 * @since 0.17 (KDE 4.11) 0566 */ 0567 void editPageAnnotationContents(int page, Annotation *annotation, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos); 0568 0569 /** 0570 * Tests if the @p annotation can be removed 0571 * 0572 * @since 0.15 (KDE 4.9) 0573 */ 0574 bool canRemovePageAnnotation(const Annotation *annotation) const; 0575 0576 /** 0577 * Removes the given @p annotation from the given @p page. 0578 */ 0579 void removePageAnnotation(int page, Annotation *annotation); 0580 0581 /** 0582 * Removes the given @p annotations from the given @p page. 0583 */ 0584 void removePageAnnotations(int page, const QList<Annotation *> &annotations); 0585 0586 /** 0587 * Clears the text selection highlights for the given @p page, 0588 * creates new ones if @p rect is not nullptr, 0589 * and deletes @p rect. 0590 * 0591 * @param page The number of the page. 0592 * @param rect The rectangle of the selection. 0593 * @param color The color of the selection. 0594 */ 0595 void setPageTextSelection(int page, RegularAreaRect *rect, const QColor &color); 0596 0597 /** 0598 * Returns true if there is an undo command available; otherwise returns false. 0599 * @since 0.17 (KDE 4.11) 0600 */ 0601 bool canUndo() const; 0602 0603 /** 0604 * Returns true if there is a redo command available; otherwise returns false. 0605 * @since 0.17 (KDE 4.11) 0606 */ 0607 bool canRedo() const; 0608 0609 /** 0610 * Describes the possible search types. 0611 */ 0612 enum SearchType { 0613 NextMatch, ///< Search next match 0614 PreviousMatch, ///< Search previous match 0615 AllDocument, ///< Search complete document 0616 GoogleAll, ///< Search complete document (all words in google style) 0617 GoogleAny ///< Search complete document (any words in google style) 0618 }; 0619 0620 /** 0621 * Describes how search ended 0622 */ 0623 enum SearchStatus { 0624 MatchFound, ///< Any match was found 0625 NoMatchFound, ///< No match was found 0626 SearchCancelled ///< The search was cancelled 0627 }; 0628 0629 /** 0630 * Searches the given @p text in the document. 0631 * 0632 * @param searchID The unique id for this search request. 0633 * @param text The text to be searched. 0634 * @param fromStart Whether the search should be started at begin of the document. 0635 * @param caseSensitivity Whether the search is case sensitive. 0636 * @param type The type of the search. @ref SearchType 0637 * @param moveViewport Whether the viewport shall be moved to the position of the matches. 0638 * @param color The highlighting color of the matches. 0639 */ 0640 void searchText(int searchID, const QString &text, bool fromStart, Qt::CaseSensitivity caseSensitivity, SearchType type, bool moveViewport, const QColor &color); 0641 0642 /** 0643 * Continues the search for the given @p searchID. 0644 */ 0645 void continueSearch(int searchID); 0646 0647 /** 0648 * Continues the search for the given @p searchID, optionally specifying 0649 * a new type for the search. 0650 * 0651 * @since 0.7 (KDE 4.1) 0652 */ 0653 void continueSearch(int searchID, SearchType type); 0654 0655 /** 0656 * Resets the search for the given @p searchID. 0657 */ 0658 void resetSearch(int searchID); 0659 0660 /** 0661 * Returns the bookmark manager of the document. 0662 */ 0663 BookmarkManager *bookmarkManager() const; 0664 0665 /** 0666 * Processes the given @p action. 0667 */ 0668 void processAction(const Action *action); 0669 0670 /** 0671 * Processes the given format @p action on @p fft. 0672 * 0673 * @since 1.9 0674 */ 0675 void processFormatAction(const Action *action, Okular::FormFieldText *fft); 0676 0677 /** 0678 * Processes the given keystroke @p action on @p fft. 0679 * 0680 * @since 1.9 0681 */ 0682 void processKeystrokeAction(const Action *action, Okular::FormFieldText *fft, const QVariant &newValue); 0683 0684 /** 0685 * Processes the given keystroke @p action on @p fft. 0686 * This will set event.willCommit=true 0687 * 0688 * @since 22.04 0689 */ 0690 void processKeystrokeCommitAction(const Action *action, Okular::FormFieldText *fft); 0691 0692 /** 0693 * Processes the given focus action on the field. 0694 * 0695 * @since 1.9 0696 */ 0697 void processFocusAction(const Action *action, Okular::FormField *field); 0698 0699 /** 0700 * Processes the given keystroke @p action on @p fft. 0701 * 0702 * @since 1.9 0703 */ 0704 void processValidateAction(const Action *action, Okular::FormFieldText *fft, bool &returnCode); 0705 0706 /** 0707 * Processes the mouse up @p action on @p ff. 0708 * 0709 * @since 23.12 0710 */ 0711 void processFormMouseUpScripAction(const Action *action, Okular::FormField *ff); 0712 0713 /** 0714 * Returns a list of the bookmarked.pages 0715 */ 0716 QList<int> bookmarkedPageList() const; 0717 0718 /** 0719 * Returns the range of the bookmarked.pages 0720 */ 0721 QString bookmarkedPageRange() const; 0722 0723 /** 0724 * Processes/Executes the given source @p reference. 0725 */ 0726 void processSourceReference(const SourceReference *reference); 0727 0728 /** 0729 * Returns whether the document can configure the printer itself. 0730 */ 0731 bool canConfigurePrinter() const; 0732 0733 /** 0734 * What type of printing a document supports 0735 */ 0736 enum PrintingType { 0737 NoPrinting, ///< Printing Not Supported 0738 NativePrinting, ///< Native Cross-Platform Printing 0739 PostscriptPrinting ///< Postscript file printing 0740 }; 0741 0742 /** 0743 * Returns what sort of printing the document supports: 0744 * Native, Postscript, None 0745 */ 0746 PrintingType printingSupport() const; 0747 0748 /** 0749 * Returns whether the document supports printing to both PDF and PS files. 0750 */ 0751 bool supportsPrintToFile() const; 0752 0753 /// @since 22.04 0754 enum PrintError { 0755 NoPrintError, ///< Printing succeeded 0756 UnknownPrintError, 0757 TemporaryFileOpenPrintError, 0758 FileConversionPrintError, 0759 PrintingProcessCrashPrintError, 0760 PrintingProcessStartPrintError, 0761 PrintToFilePrintError, 0762 InvalidPrinterStatePrintError, 0763 UnableToFindFilePrintError, 0764 NoFileToPrintError, 0765 NoBinaryToPrintError, 0766 InvalidPageSizePrintError 0767 }; 0768 0769 /** 0770 * Prints the document to the given @p printer. 0771 */ 0772 Document::PrintError print(QPrinter &printer); 0773 0774 /// @since 22.04 0775 static QString printErrorString(PrintError error); 0776 0777 /** 0778 * Returns a custom printer configuration page or 0 if no 0779 * custom printer configuration page is available. 0780 * 0781 * The returned object should be of a PrintOptionsWidget subclass 0782 * (which is not officially enforced by the signature for binary 0783 * compatibility reasons). 0784 */ 0785 QWidget *printConfigurationWidget() const; 0786 0787 /** 0788 * Fill the KConfigDialog @p dialog with the setting pages of the 0789 * generators. 0790 */ 0791 void fillConfigDialog(KConfigDialog *dialog); 0792 0793 /** 0794 * Returns the number of generators that have a configuration widget. 0795 */ 0796 int configurableGenerators() const; 0797 0798 /** 0799 * Returns the list with the supported MIME types. 0800 */ 0801 QStringList supportedMimeTypes() const; 0802 0803 /** 0804 * Returns the metadata associated with the generator. May be invalid. 0805 */ 0806 KPluginMetaData generatorInfo() const; 0807 0808 /** 0809 * Returns whether the generator supports hot-swapping the current file 0810 * with another identical file 0811 * 0812 * @since 1.3 0813 */ 0814 bool canSwapBackingFile() const; 0815 0816 /** 0817 * Reload the document from a new location, without any visible effect 0818 * to the user. 0819 * 0820 * The new file must be identical to the current one or, if the document 0821 * has been modified (eg the user edited forms and annotations), the new 0822 * document must have these changes too. For example, you can call 0823 * saveChanges first to write changes to a file and then swapBackingFile 0824 * to switch to the new location. 0825 * 0826 * @since 1.3 0827 */ 0828 bool swapBackingFile(const QString &newFileName, const QUrl &url); 0829 0830 /** 0831 * Same as swapBackingFile, but newFileName must be a .okular file. 0832 * 0833 * The new file must be identical to the current one or, if the document 0834 * has been modified (eg the user edited forms and annotations), the new 0835 * document must have these changes too. For example, you can call 0836 * saveDocumentArchive first to write changes to a file and then 0837 * swapBackingFileArchive to switch to the new location. 0838 * 0839 * @since 1.3 0840 */ 0841 bool swapBackingFileArchive(const QString &newFileName, const QUrl &url); 0842 0843 /** 0844 * Sets the history to be clean 0845 * 0846 * @since 1.3 0847 */ 0848 void setHistoryClean(bool clean); 0849 0850 bool isHistoryClean() const; 0851 0852 /** 0853 * Saving capabilities. Their availability varies according to the 0854 * underlying generator and/or the document type. 0855 * 0856 * @see canSaveChanges (SaveCapability) 0857 * @since 0.15 (KDE 4.9) 0858 */ 0859 enum SaveCapability { 0860 SaveFormsCapability = 1, ///< Can save form changes 0861 SaveAnnotationsCapability = 2 ///< Can save annotation changes 0862 }; 0863 0864 /** 0865 * Returns whether it's possible to save a given category of changes to 0866 * another document. 0867 * 0868 * @since 0.15 (KDE 4.9) 0869 */ 0870 bool canSaveChanges(SaveCapability cap) const; 0871 0872 /** 0873 * Returns whether the changes to the document (modified annotations, 0874 * values in form fields, etc) can be saved to another document. 0875 * 0876 * Equivalent to the logical OR of canSaveChanges(SaveCapability) for 0877 * each capability. 0878 * 0879 * @since 0.7 (KDE 4.1) 0880 */ 0881 bool canSaveChanges() const; 0882 0883 /** 0884 * Save the document and the optional changes to it to the specified 0885 * @p fileName. 0886 * 0887 * @since 0.7 (KDE 4.1) 0888 */ 0889 bool saveChanges(const QString &fileName); 0890 0891 /** 0892 * Save the document and the optional changes to it to the specified 0893 * @p fileName and returns a @p errorText if fails. 0894 * 0895 * @since 0.10 (KDE 4.4) 0896 */ 0897 bool saveChanges(const QString &fileName, QString *errorText); 0898 0899 /** 0900 * Register the specified @p view for the current document. 0901 * 0902 * It is unregistered from the previous document, if any. 0903 * 0904 * @since 0.7 (KDE 4.1) 0905 */ 0906 void registerView(View *view); 0907 0908 /** 0909 * Unregister the specified @p view from the current document. 0910 * 0911 * @since 0.7 (KDE 4.1) 0912 */ 0913 void unregisterView(View *view); 0914 0915 /** 0916 * Gets the font data for the given font 0917 * 0918 * @since 0.8 (KDE 4.2) 0919 */ 0920 QByteArray fontData(const FontInfo &font) const; 0921 0922 /** 0923 * Opens a document archive. 0924 * 0925 * @since 0.20 (KDE 4.14) 0926 */ 0927 OpenResult openDocumentArchive(const QString &docFile, const QUrl &url, const QString &password = QString()); 0928 0929 /** 0930 * Saves a document archive. 0931 * 0932 * @since 0.8 (KDE 4.2) 0933 */ 0934 bool saveDocumentArchive(const QString &fileName); 0935 0936 /** 0937 * Extract the document file from the current archive. 0938 * 0939 * @warning This function only works if the current file is a document archive 0940 * 0941 * @since 1.3 0942 */ 0943 bool extractArchivedFile(const QString &destFileName); 0944 0945 /** 0946 * Asks the generator to dynamically generate a SourceReference for a given 0947 * page number and absolute X and Y position on this page. 0948 * 0949 * @attention Ownership of the returned SourceReference is transferred to the caller. 0950 * @note This method does not call processSourceReference( const SourceReference * ) 0951 * 0952 * @since 0.10 (KDE 4.4) 0953 */ 0954 const SourceReference *dynamicSourceReference(int pageNr, double absX, double absY); 0955 0956 /** 0957 * Returns the orientation of the document (for printing purposes). This 0958 * is used in the KPart to initialize the print dialog and in the 0959 * generators to check whether the document needs to be rotated or not. 0960 * 0961 * @since 0.14 (KDE 4.8) 0962 */ 0963 QPageLayout::Orientation orientation() const; 0964 0965 /** 0966 * Control annotation editing (creation, modification and removal), 0967 * which is enabled by default. 0968 * 0969 * @since 0.15 (KDE 4.9) 0970 */ 0971 void setAnnotationEditingEnabled(bool enable); 0972 0973 /** 0974 * Returns which wallet data to use to read/write the password for the given fileName 0975 * 0976 * @since 0.20 (KDE 4.14) 0977 */ 0978 void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const; 0979 0980 /** 0981 * Since version 0.21, okular does not allow editing annotations and 0982 * form data if they are stored in the docdata directory (like older 0983 * okular versions did by default). 0984 * If this flag is set, then annotations and forms cannot be edited. 0985 * 0986 * @since 1.3 0987 */ 0988 bool isDocdataMigrationNeeded() const; 0989 0990 /** 0991 * Delete annotations and form data from the docdata folder. Call it if 0992 * isDocdataMigrationNeeded() was true and you've just saved them to an 0993 * external file. 0994 * 0995 * @since 1.3 0996 */ 0997 void docdataMigrationDone(); 0998 0999 /** 1000 * Returns the model for rendering layers (NULL if the document has no layers) 1001 * 1002 * @since 0.24 1003 */ 1004 QAbstractItemModel *layersModel() const; 1005 1006 /** 1007 * Returns the reason why the file opening failed, if any. 1008 * 1009 * @since 1.10 1010 */ 1011 QString openError() const; 1012 1013 /** 1014 * Digitally sign document 1015 * 1016 * @since 21.04 1017 */ 1018 bool sign(const NewSignatureData &data, const QString &newPath); 1019 1020 /** 1021 * Returns the generator's certificate store (if any) 1022 * 1023 * @since 21.04 1024 */ 1025 CertificateStore *certificateStore() const; 1026 1027 /** sets the editor command to the command \p editCmd, as 1028 * given at the commandline. 1029 * 1030 * @since 22.04 1031 */ 1032 void setEditorCommandOverride(const QString &editCmd); 1033 1034 /** returns the overriding editor command. 1035 * 1036 * If the editor command was not overriden, the string is empty. 1037 * 1038 * @since 22.04 1039 */ 1040 QString editorCommandOverride() const; 1041 1042 public Q_SLOTS: 1043 /** 1044 * This slot is called whenever the user changes the @p rotation of 1045 * the document. 1046 */ 1047 void setRotation(int rotation); 1048 1049 /** 1050 * This slot is called whenever the user changes the page @p size 1051 * of the document. 1052 */ 1053 void setPageSize(const Okular::PageSize &size); 1054 1055 /** 1056 * Cancels the current search 1057 */ 1058 void cancelSearch(); 1059 1060 /** 1061 * Undo last edit command 1062 * @since 0.17 (KDE 4.11) 1063 */ 1064 void undo(); 1065 1066 /** 1067 * Redo last undone edit command 1068 * @since 0.17 (KDE 4.11) 1069 */ 1070 void redo(); 1071 1072 /** 1073 * Edit the text contents of the specified @p form on page @p page to be @p newContents. 1074 * The new text cursor position (@p newCursorPos), previous text cursor position (@p prevCursorPos), 1075 * and previous cursor anchor position will be restored by the undo / redo commands. 1076 * @since 0.17 (KDE 4.11) 1077 */ 1078 void editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos); 1079 1080 /** 1081 * Edit the selected list entries in @p form on page @p page to be @p newChoices. 1082 * @since 0.17 (KDE 4.11) 1083 */ 1084 void editFormList(int pageNumber, Okular::FormFieldChoice *form, const QList<int> &newChoices); 1085 1086 /** 1087 * Set the active choice in the combo box @p form on page @p page to @p newText 1088 * The new cursor position (@p newCursorPos), previous cursor position 1089 * (@p prevCursorPos), and previous anchor position (@p prevAnchorPos) 1090 * will be restored by the undo / redo commands. 1091 * 1092 * @since 0.17 (KDE 4.11) 1093 */ 1094 void editFormCombo(int pageNumber, Okular::FormFieldChoice *form, const QString &newText, int newCursorPos, int prevCursorPos, int prevAnchorPos); 1095 1096 /** 1097 * Set the states of the group of form buttons @p formButtons on page @p page to @p newButtonStates. 1098 * The lists @p formButtons and @p newButtonStates should be the same length and true values 1099 * in @p newButtonStates indicate that the corresponding entry in @p formButtons should be enabled. 1100 */ 1101 void editFormButtons(int pageNumber, const QList<Okular::FormFieldButton *> &formButtons, const QList<bool> &newButtonStates); 1102 1103 /** 1104 * Reloads the pixmaps for whole document 1105 * 1106 * @since 0.24 1107 */ 1108 void reloadDocument() const; 1109 1110 /** 1111 * Returns the part of document covered by the given signature @p info. 1112 * 1113 * @since 1.7 1114 */ 1115 QByteArray requestSignedRevisionData(const Okular::SignatureInfo &info); 1116 1117 /** 1118 * Refresh the pixmaps for the given @p pageNumber. 1119 * 1120 * @since 1.10 1121 */ 1122 void refreshPixmaps(int pageNumber); 1123 1124 Q_SIGNALS: 1125 /** 1126 * This signal is emitted whenever the document is about to close. 1127 * @since 1.5.3 1128 */ 1129 void aboutToClose(); 1130 1131 /** 1132 * This signal is emitted whenever an action requests a 1133 * document close operation. 1134 */ 1135 void close(); 1136 1137 /** 1138 * This signal is emitted whenever an action requests a 1139 * document print operation. 1140 * @since 22.04 1141 */ 1142 void requestPrint(); 1143 1144 /** 1145 * This signal is emitted whenever an action requests a 1146 * document save as operation. 1147 * @since 22.04 1148 */ 1149 void requestSaveAs(); 1150 1151 /** 1152 * This signal is emitted whenever an action requests an 1153 * application quit operation. 1154 */ 1155 void quit(); 1156 1157 /** 1158 * This signal is emitted whenever an action requests a 1159 * find operation. 1160 */ 1161 void linkFind(); 1162 1163 /** 1164 * This signal is emitted whenever an action requests a 1165 * goto operation. 1166 */ 1167 void linkGoToPage(); 1168 1169 /** 1170 * This signal is emitted whenever an action requests a 1171 * start presentation operation. 1172 */ 1173 void linkPresentation(); 1174 1175 /** 1176 * This signal is emitted whenever an action requests an 1177 * end presentation operation. 1178 */ 1179 void linkEndPresentation(); 1180 1181 /** 1182 * This signal is emitted whenever an action requests an 1183 * open url operation for the given document @p url. 1184 */ 1185 void openUrl(const QUrl &url); 1186 1187 /** 1188 * This signal is emitted whenever an error occurred. 1189 * 1190 * @param text The description of the error. 1191 * @param duration The time in milliseconds the message should be shown to the user. 1192 */ 1193 void error(const QString &text, int duration); 1194 1195 /** 1196 * This signal is emitted to signal a warning. 1197 * 1198 * @param text The description of the warning. 1199 * @param duration The time in milliseconds the message should be shown to the user. 1200 */ 1201 void warning(const QString &text, int duration); 1202 1203 /** 1204 * This signal is emitted to signal a notice. 1205 * 1206 * @param text The description of the notice. 1207 * @param duration The time in milliseconds the message should be shown to the user. 1208 */ 1209 void notice(const QString &text, int duration); 1210 1211 /** 1212 * Emitted when a new font is found during the reading of the fonts of 1213 * the document. 1214 */ 1215 void gotFont(const Okular::FontInfo &font); 1216 1217 /** 1218 * Reports the progress when reading the fonts in the document. 1219 * 1220 * \param page is the page that was just finished to scan for fonts 1221 */ 1222 void fontReadingProgress(int page); 1223 1224 /** 1225 * Reports that the reading of the fonts in the document is finished. 1226 */ 1227 void fontReadingEnded(); 1228 1229 /** 1230 * Reports that the current search finished 1231 */ 1232 void searchFinished(int searchID, Okular::Document::SearchStatus endStatus); 1233 1234 /** 1235 * This signal is emitted whenever a source reference with the given parameters has been 1236 * activated. 1237 * 1238 * \param absFileName absolute name of the file. 1239 * \param line line number. 1240 * \param col column number. 1241 * \param handled should be set to 'true' if a slot handles this source reference; the 1242 * default action to launch the configured editor will then not be performed 1243 * by the document 1244 * 1245 * @since 0.14 (KDE 4.8) 1246 */ 1247 void sourceReferenceActivated(const QString &absFileName, int line, int col, bool *handled); 1248 1249 /** 1250 * This signal is emitted whenever an movie action is triggered and the UI should process it. 1251 */ 1252 void processMovieAction(const Okular::MovieAction *action); 1253 1254 /** 1255 * This signal is emitted whenever the availability of the undo function changes 1256 * @since 0.17 (KDE 4.11) 1257 */ 1258 void canUndoChanged(bool undoAvailable); 1259 1260 /** 1261 * This signal is emitted whenever the availability of the redo function changes 1262 * @since 0.17 (KDE 4.11) 1263 */ 1264 void canRedoChanged(bool redoAvailable); 1265 1266 /** 1267 * This signal is emitted whenever the undo history is clean (i.e. the same status the last time it was saved) 1268 * @since 1.3 1269 */ 1270 void undoHistoryCleanChanged(bool clean); 1271 1272 /** 1273 * This signal is emitted whenever an rendition action is triggered and the UI should process it. 1274 * 1275 * @since 0.16 (KDE 4.10) 1276 */ 1277 void processRenditionAction(const Okular::RenditionAction *action); 1278 1279 /** 1280 * This signal is emitted whenever the contents of the given @p annotation are changed by an undo 1281 * or redo action. 1282 * 1283 * The new contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are 1284 * included 1285 * @since 0.17 (KDE 4.11) 1286 */ 1287 void annotationContentsChangedByUndoRedo(Okular::Annotation *annotation, const QString &contents, int cursorPos, int anchorPos); 1288 1289 /** 1290 * This signal is emitted whenever the text contents of the given text @p form on the given @p page 1291 * are changed by an undo or redo action. 1292 * 1293 * The new text contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are 1294 * included 1295 * @since 0.17 (KDE 4.11) 1296 */ 1297 void formTextChangedByUndoRedo(int page, Okular::FormFieldText *form, const QString &contents, int cursorPos, int anchorPos); 1298 1299 /** 1300 * This signal is emitted whenever the selected @p choices for the given list @p form on the 1301 * given @p page are changed by an undo or redo action. 1302 * @since 0.17 (KDE 4.11) 1303 */ 1304 void formListChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QList<int> &choices); 1305 1306 /** 1307 * This signal is emitted whenever the active @p text for the given combo @p form on the 1308 * given @p page is changed by an undo or redo action. 1309 * @since 0.17 (KDE 4.11) 1310 */ 1311 void formComboChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QString &text, int cursorPos, int anchorPos); 1312 1313 /** 1314 * This signal is emitted whenever the state of the specified group of form buttons (@p formButtons) on the 1315 * given @p page is changed by an undo or redo action. 1316 * @since 0.17 (KDE 4.11) 1317 */ 1318 void formButtonsChangedByUndoRedo(int page, const QList<Okular::FormFieldButton *> &formButtons); 1319 1320 /** 1321 * This signal is emitted whenever a FormField was changed programmatically and the 1322 * according widget should be updated. 1323 * @since 1.4 1324 */ 1325 void refreshFormWidget(Okular::FormField *field); 1326 1327 private: 1328 /// @cond PRIVATE 1329 friend class DocumentPrivate; 1330 friend class ::DocumentItem; 1331 friend class EditAnnotationContentsCommand; 1332 friend class EditFormTextCommand; 1333 friend class EditFormListCommand; 1334 friend class EditFormComboCommand; 1335 friend class EditFormButtonsCommand; 1336 /// @endcond 1337 DocumentPrivate *const d; 1338 1339 Q_DISABLE_COPY(Document) 1340 }; 1341 1342 /** 1343 * @short A view on the document. 1344 * 1345 * The Viewport structure is the 'current view' over the document. Contained 1346 * data is broadcasted between observers to synchronize their viewports to get 1347 * the 'I scroll one view and others scroll too' views. 1348 */ 1349 class OKULARCORE_EXPORT DocumentViewport 1350 { 1351 public: 1352 /** 1353 * Creates a new viewport for the given page @p number. 1354 */ 1355 explicit DocumentViewport(int number = -1); 1356 1357 /** 1358 * Creates a new viewport from the given @p xmlDesc. 1359 */ 1360 explicit DocumentViewport(const QString &xmlDesc); 1361 1362 /** 1363 * Returns the viewport as xml description. 1364 */ 1365 QString toString() const; 1366 1367 /** 1368 * Returns whether the viewport is valid. 1369 */ 1370 bool isValid() const; 1371 1372 /** 1373 * @internal 1374 */ 1375 bool operator==(const DocumentViewport &other) const; 1376 bool operator<(const DocumentViewport &other) const; 1377 1378 /** 1379 * The number of the page nearest the center of the viewport. 1380 */ 1381 int pageNumber; 1382 1383 /** 1384 * Describes the relative position of the viewport. 1385 */ 1386 enum Position { 1387 Center = 1, ///< Relative to the center of the page. 1388 TopLeft = 2 ///< Relative to the top left corner of the page. 1389 }; 1390 1391 /** 1392 * If 'rePos.enabled == true' then this structure contains the 1393 * viewport center or top left depending on the value of pos. 1394 */ 1395 struct { 1396 bool enabled; 1397 double normalizedX; 1398 double normalizedY; 1399 Position pos; 1400 } rePos; 1401 1402 /** 1403 * If 'autoFit.enabled == true' then the page must be autofit in the viewport. 1404 */ 1405 struct { 1406 bool enabled; 1407 bool width; 1408 bool height; 1409 } autoFit; 1410 }; 1411 1412 /** 1413 * @short A DOM tree that describes the Table of Contents. 1414 * 1415 * The Synopsis (TOC or Table Of Contents for friends) is represented via 1416 * a dom tree where each node has an internal name (displayed in the TOC) 1417 * and one or more attributes. 1418 * 1419 * In the tree the tag name is the 'screen' name of the entry. A tag can have 1420 * attributes. Here follows the list of tag attributes with meaning: 1421 * - Destination: A string description of the referred viewport 1422 * - DestinationName: A 'named reference' to the viewport that must be converted 1423 * using metaData( "NamedViewport", viewport_name ) 1424 * - ExternalFileName: A document to be opened, whose destination is specified 1425 * with Destination or DestinationName 1426 * - Open: a boolean saying whether its TOC branch is open or not (default: false) 1427 * - URL: a URL to be open as destination; if set, no other Destination* or 1428 * ExternalFileName entry is used 1429 */ 1430 class OKULARCORE_EXPORT DocumentSynopsis : public QDomDocument 1431 { 1432 public: 1433 /** 1434 * Creates a new document synopsis object. 1435 */ 1436 DocumentSynopsis(); 1437 1438 /** 1439 * Creates a new document synopsis object with the given 1440 * @p document as parent node. 1441 */ 1442 explicit DocumentSynopsis(const QDomDocument &document); 1443 }; 1444 1445 /** 1446 * @short An embedded file into the document. 1447 * 1448 * This class represents a sort of interface of an embedded file in a document. 1449 * 1450 * Generators \b must re-implement its members to give the all the information 1451 * about an embedded file, like its name, its description, the date of creation 1452 * and modification, and the real data of the file. 1453 */ 1454 class OKULARCORE_EXPORT EmbeddedFile 1455 { 1456 public: 1457 /** 1458 * Creates a new embedded file. 1459 */ 1460 EmbeddedFile(); 1461 1462 /** 1463 * Destroys the embedded file. 1464 */ 1465 virtual ~EmbeddedFile(); 1466 1467 EmbeddedFile(const EmbeddedFile &) = delete; 1468 EmbeddedFile &operator=(const EmbeddedFile &) = delete; 1469 1470 /** 1471 * Returns the name of the file 1472 */ 1473 virtual QString name() const = 0; 1474 1475 /** 1476 * Returns the description of the file, or an empty string if not 1477 * available 1478 */ 1479 virtual QString description() const = 0; 1480 1481 /** 1482 * Returns the real data representing the file contents 1483 */ 1484 virtual QByteArray data() const = 0; 1485 1486 /** 1487 * Returns the size (in bytes) of the file, if available, or -1 otherwise. 1488 * 1489 * @note this method should be a fast way to know the size of the file 1490 * with no need to extract all the data from it 1491 */ 1492 virtual int size() const = 0; 1493 1494 /** 1495 * Returns the modification date of the file, or an invalid date 1496 * if not available 1497 */ 1498 virtual QDateTime modificationDate() const = 0; 1499 1500 /** 1501 * Returns the creation date of the file, or an invalid date 1502 * if not available 1503 */ 1504 virtual QDateTime creationDate() const = 0; 1505 }; 1506 1507 /** 1508 * @short An area of a specified page 1509 */ 1510 class OKULARCORE_EXPORT VisiblePageRect 1511 { 1512 public: 1513 /** 1514 * Creates a new visible page rectangle. 1515 * 1516 * @param pageNumber The page number where the rectangle is located. 1517 * @param rectangle The rectangle in normalized coordinates. 1518 */ 1519 explicit VisiblePageRect(int pageNumber = -1, const NormalizedRect &rectangle = NormalizedRect()); 1520 1521 /** 1522 * The page number where the rectangle is located. 1523 */ 1524 int pageNumber; 1525 1526 /** 1527 * The rectangle in normalized coordinates. 1528 */ 1529 NormalizedRect rect; 1530 }; 1531 1532 /** 1533 * @short Data needed to create a new signature 1534 * 1535 * @since 21.04 1536 */ 1537 class OKULARCORE_EXPORT NewSignatureData 1538 { 1539 public: 1540 NewSignatureData(); 1541 ~NewSignatureData(); 1542 NewSignatureData(const NewSignatureData &) = delete; 1543 NewSignatureData &operator=(const NewSignatureData &) = delete; 1544 1545 QString certNickname() const; 1546 void setCertNickname(const QString &certNickname); 1547 1548 QString certSubjectCommonName() const; 1549 void setCertSubjectCommonName(const QString &certSubjectCommonName); 1550 1551 QString password() const; 1552 void setPassword(const QString &password); 1553 1554 int page() const; 1555 void setPage(int page); 1556 1557 NormalizedRect boundingRectangle() const; 1558 void setBoundingRectangle(const NormalizedRect &rect); 1559 1560 /// @since 22.04 1561 QString documentPassword() const; 1562 1563 /// @since 22.04 1564 void setDocumentPassword(const QString &password); 1565 1566 /// @since 23.08 1567 QString reason() const; 1568 1569 /// @since 23.08 1570 void setReason(const QString &reason); 1571 1572 /// @since 23.08 1573 QString location() const; 1574 1575 /// @since 23.08 1576 void setLocation(const QString &location); 1577 1578 /// @since 23.08 1579 QString backgroundImagePath() const; 1580 1581 /// @since 23.08 1582 void setBackgroundImagePath(const QString &path); 1583 1584 private: 1585 NewSignatureDataPrivate *const d; 1586 }; 1587 1588 } 1589 1590 Q_DECLARE_METATYPE(Okular::DocumentInfo::Key) 1591 Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::Document::PixmapRequestFlags) 1592 1593 #endif 1594 1595 /* kate: replace-tabs on; indent-width 4; */