Okular

document.h
1/*
2 SPDX-FileCopyrightText: 2004-2005 Enrico Ros <eros.kde@email.it>
3 SPDX-FileCopyrightText: 2004-2008 Albert Astals Cid <aacid@kde.org>
4
5 Work sponsored by the LiMux project of the city of Munich:
6 SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <info@kdab.com>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#ifndef _OKULAR_DOCUMENT_H_
12#define _OKULAR_DOCUMENT_H_
13
14#include "area.h"
15#include "global.h"
16#include "okularcore_export.h"
17#include "pagesize.h"
18
19#include <QDomDocument>
20#include <QObject>
21#include <QPrinter>
22#include <QStringList>
23#include <QVector>
24
25#include <QMimeType>
26#include <QUrl>
27#include <QVariant>
28
29class KConfigDialog;
30class KPluginMetaData;
31class KXMLGUIClient;
32class DocumentItem;
34
35namespace Okular
36{
37class Annotation;
38class BookmarkManager;
39class CertificateStore;
40class DocumentInfoPrivate;
41class DocumentObserver;
42class DocumentPrivate;
43class DocumentSynopsis;
44class DocumentViewport;
45class EmbeddedFile;
46class ExportFormat;
47class FontInfo;
48class FormField;
49class FormFieldText;
50class FormFieldButton;
51class FormFieldChoice;
52class Generator;
53class Action;
54class MovieAction;
55class Page;
56class PixmapRequest;
57class RenditionAction;
58class NewSignatureData;
59struct NewSignatureDataPrivate;
60class SourceReference;
61class View;
62class VisiblePageRect;
63class SignatureInfo;
64
65/** IDs for seaches. Globally defined here. **/
66#define PART_SEARCH_ID 1
67#define PAGEVIEW_SEARCH_ID 2
68#define SW_SEARCH_ID 3
69#define PRESENTATION_SEARCH_ID 4
70
71/**
72 * The DocumentInfo structure can be filled in by generators to display
73 * metadata about the currently opened file.
74 */
75class OKULARCORE_EXPORT DocumentInfo
76{
77 friend class Document;
78
79public:
80 /**
81 * The list of predefined keys.
82 */
83 enum Key {
84 Title, ///< The title of the document
85 Subject, ///< The subject of the document
86 Description, ///< The description of the document
87 Author, ///< The author of the document
88 Creator, ///< The creator of the document (this can be different from the author)
89 Producer, ///< The producer of the document (e.g. some software)
90 Copyright, ///< The copyright of the document
91 Pages, ///< The number of pages of the document
92 CreationDate, ///< The date of creation of the document
93 ModificationDate, ///< The date of last modification of the document
94 MimeType, ///< The mime type of the document
95 Category, ///< The category of the document
96 Keywords, ///< The keywords which describe the content of the document
97 FilePath, ///< The path of the file @since 0.10 (KDE 4.4)
98 DocumentSize, ///< The size of the document @since 0.10 (KDE 4.4)
99 PagesSize, ///< The size of the pages (if all pages have the same size) @since 0.10 (KDE 4.4)
100 CustomKeys, ///< All the custom keys the generator supports @since 0.21
101 Invalid ///< An invalid key @since 0.21. It will always be the last element in the enum
102 };
103
104 /**
105 * Creates a new document info.
106 */
107 DocumentInfo();
108 DocumentInfo(const DocumentInfo &info);
109 DocumentInfo &operator=(const DocumentInfo &);
110
112
113 /**
114 * Returns all the keys present in this DocumentInfo
115 *
116 * @since 0.21
117 */
118 QStringList keys() const;
119
120 /**
121 * Returns the value for a given key or an null string when the
122 * key doesn't exist.
123 */
124 QString get(Key key) const;
125
126 /**
127 * Returns the value for a given key or an null string when the
128 * key doesn't exist.
129 */
130 QString get(const QString &key) const;
131
132 /**
133 * Sets a value for a custom key. The title should be an i18n'ed
134 * string, since it's used in the document information dialog.
135 */
136 void set(const QString &key, const QString &value, const QString &title = QString());
137
138 /**
139 * Sets a value for a special key. The title should be an i18n'ed
140 * string, since it's used in the document information dialog.
141 */
142 void set(Key key, const QString &value);
143
144 /**
145 * Returns the user visible string for the given key
146 * Takes into account keys added by the set() that takes a QString
147 *
148 * @since 0.21
149 */
150 QString getKeyTitle(const QString &key) const;
151
152 /**
153 * Returns the internal string for the given key
154 * @since 0.10 (KDE 4.4)
155 */
156 static QString getKeyString(Key key);
157
158 /**
159 * Returns the user visible string for the given key
160 * @since 0.10 (KDE 4.4)
161 */
162 static QString getKeyTitle(Key key);
163
164 /**
165 * Returns the Key from a string key
166 * @since 0.21
167 */
168 static Key getKeyFromString(const QString &key);
169
170private:
171 DocumentInfoPrivate *d;
172};
173
174/**
175 * @short The Document. Heart of everything. Actions take place here.
176 *
177 * The Document is the main object in Okular. All views query the Document to
178 * get data/properties or even for accessing pages (in a 'const' way).
179 *
180 * It is designed to keep it detached from the document type (pdf, ps, you
181 * name it..) so whenever you want to get some data, it asks its internal
182 * generators to do the job and return results in a format-independent way.
183 *
184 * Apart from the generator (the currently running one) the document stores
185 * all the Pages ('Page' class) of the current document in a vector and
186 * notifies all the registered DocumentObservers when some content changes.
187 *
188 * For a better understanding of hierarchies @see README.internals.png
189 * @see DocumentObserver, Page
190 */
191class OKULARCORE_EXPORT Document : public QObject
192{
193 Q_OBJECT
194
195public:
196 /**
197 * Creates a new document with the given @p widget as widget to relay GUI things (messageboxes, ...).
198 */
199 explicit Document(QWidget *widget);
200
201 /**
202 * Destroys the document.
203 */
204 ~Document() override;
205
206 /**
207 * Describes the result of an open document operation.
208 * @since 0.20 (KDE 4.14)
209 */
211 OpenSuccess, //< The document was opened successfully
212 OpenError, //< The document failed to open
213 OpenNeedsPassword //< The document needs a password to be opened or the one provided is not the correct
214 };
215
216 /**
217 * Opens the document.
218 * @since 0.20 (KDE 4.14)
219 */
220 OpenResult openDocument(const QString &docFile, const QUrl &url, const QMimeType &mime, const QString &password = QString());
221
222 /**
223 * Closes the document.
224 */
225 void closeDocument();
226
227 /**
228 * Registers a new @p observer for the document.
229 */
230 void addObserver(DocumentObserver *observer);
231
232 /**
233 * Unregisters the given @p observer for the document.
234 */
235 void removeObserver(DocumentObserver *observer);
236
237 /**
238 * Reparses and applies the configuration.
239 */
240 void reparseConfig();
241
242 /**
243 * Returns whether the document is currently opened.
244 */
245 bool isOpened() const;
246
247 /**
248 * Returns the meta data of the document.
249 */
251
252 /**
253 * Returns the asked set of meta data of the document. The result may contain more
254 * metadata than the one asked for.
255 */
256 DocumentInfo documentInfo(const QSet<DocumentInfo::Key> &keys) const;
257
258 /**
259 * Returns the table of content of the document or 0 if no
260 * table of content is available.
261 */
262 const DocumentSynopsis *documentSynopsis() const;
263
264 /**
265 * Starts the reading of the information about the fonts in the
266 * document, if available.
267 *
268 * The results as well the end of the reading is notified using the
269 * signals gotFont(), fontReadingProgress() and fontReadingEnded()
270 */
271 void startFontReading();
272
273 /**
274 * Force the termination of the reading of the information about the
275 * fonts in the document, if running.
276 */
277 void stopFontReading();
278
279 /**
280 * Whether the current document can provide information about the
281 * fonts used in it.
282 */
283 bool canProvideFontInformation() const;
284
285 /**
286 * Whether the current document can perform digital signing.
287 */
288 bool canSign() const;
289
290 /**
291 * Returns the list of embedded files or 0 if no embedded files
292 * are available.
293 */
294 const QList<EmbeddedFile *> *embeddedFiles() const;
295
296 /**
297 * Returns the page object for the given page @p number or 0
298 * if the number is out of range.
299 */
300 const Page *page(int number) const;
301
302 /**
303 * Returns the current viewport of the document.
304 */
305 const DocumentViewport &viewport() const;
306
307 /**
308 * Sets the list of visible page rectangles.
309 * @see VisiblePageRect
310 */
311 void setVisiblePageRects(const QVector<VisiblePageRect *> &visiblePageRects, DocumentObserver *excludeObserver = nullptr);
312
313 /**
314 * Returns the list of visible page rectangles.
315 */
316 const QVector<VisiblePageRect *> &visiblePageRects() const;
317
318 /**
319 * Returns the number of the current page.
320 */
321 uint currentPage() const;
322
323 /**
324 * Returns the number of pages of the document.
325 */
326 uint pages() const;
327
328 /**
329 * Returns the url of the currently opened document.
330 */
331 QUrl currentDocument() const;
332
333 /**
334 * Returns whether the given @p action is allowed in the document.
335 * @see @ref Permission
336 */
337 bool isAllowed(Permission action) const;
338
339 /**
340 * Returns whether the document supports searching.
341 */
342 bool supportsSearching() const;
343
344 /**
345 * Returns whether the document supports the listing of page sizes.
346 */
347 bool supportsPageSizes() const;
348
349 /**
350 * Returns whether the current document supports tiles
351 *
352 * @since 0.16 (KDE 4.10)
353 */
354 bool supportsTiles() const;
355
356 /**
357 * Returns the list of supported page sizes or an empty list if this
358 * feature is not available.
359 * @see supportsPageSizes()
360 */
361 PageSize::List pageSizes() const;
362
363 /**
364 * Returns whether the document supports the export to ASCII text.
365 */
366 bool canExportToText() const;
367
368 /**
369 * Exports the document as ASCII text and saves it under @p fileName.
370 */
371 bool exportToText(const QString &fileName) const;
372
373 /**
374 * Returns the list of supported export formats.
375 * @see ExportFormat
376 */
377 QList<ExportFormat> exportFormats() const;
378
379 /**
380 * Exports the document in the given @p format and saves it under @p fileName.
381 */
382 bool exportTo(const QString &fileName, const ExportFormat &format) const;
383
384 /**
385 * Returns whether the document history is at the begin.
386 */
387 bool historyAtBegin() const;
388
389 /**
390 * Returns whether the document history is at the end.
391 */
392 bool historyAtEnd() const;
393
394 /**
395 * Returns the meta data for the given @p key and @p option or an empty variant
396 * if the key doesn't exists.
397 */
398 QVariant metaData(const QString &key, const QVariant &option = QVariant()) const;
399
400 /**
401 * Returns the current rotation of the document.
402 */
403 Rotation rotation() const;
404
405 /**
406 * If all pages have the same size this method returns it, if the page sizes
407 * differ an empty size object is returned.
408 */
409 QSizeF allPagesSize() const;
410
411 /**
412 * Returns the size string for the given @p page or an empty string
413 * if the page is out of range.
414 */
415 QString pageSizeString(int page) const;
416
417 /**
418 * Returns the gui client of the generator, if it provides one.
419 */
420 KXMLGUIClient *guiClient();
421
422 /**
423 * Sets the current document viewport to the given @p page.
424 *
425 * @param page The number of the page.
426 * @param excludeObserver The observer ids which shouldn't be effected by this change.
427 * @param smoothMove Whether the move shall be animated smoothly.
428 */
429 void setViewportPage(int page, DocumentObserver *excludeObserver = nullptr, bool smoothMove = false);
430
431 /**
432 * Sets the current document viewport to the given @p viewport.
433 *
434 * @param viewport The document viewport.
435 * @param excludeObserver The observer which shouldn't be effected by this change.
436 * @param smoothMove Whether the move shall be animated smoothly.
437 * @param updateHistory Whether to consider the change of viewport for the history navigation
438 */
439 void setViewport(const DocumentViewport &viewport, DocumentObserver *excludeObserver = nullptr, bool smoothMove = false, bool updateHistory = true);
440
441 /**
442 * Sets the current document viewport to the next viewport in the
443 * viewport history.
444 */
445 void setPrevViewport();
446
447 /**
448 * Sets the current document viewport to the previous viewport in the
449 * viewport history.
450 */
451 void setNextViewport();
452
453 /**
454 * Sets the next @p viewport in the viewport history.
455 */
456 void setNextDocumentViewport(const DocumentViewport &viewport);
457
458 /**
459 * Sets the next @p namedDestination in the viewport history.
460 *
461 * @since 0.9 (KDE 4.3)
462 */
463 void setNextDocumentDestination(const QString &namedDestination);
464
465 /**
466 * Sets the zoom for the current document.
467 */
468 void setZoom(int factor, DocumentObserver *excludeObserver = nullptr);
469
470 /**
471 * Describes the possible options for the pixmap requests.
472 */
474 NoOption = 0, ///< No options
475 RemoveAllPrevious = 1 ///< Remove all the previous requests, even for non requested page pixmaps
476 };
477 Q_DECLARE_FLAGS(PixmapRequestFlags, PixmapRequestFlag)
478
479 /**
480 * Sends @p requests for pixmap generation.
481 *
482 * The same as requestPixmaps( requests, RemoveAllPrevious );
483 *
484 * @since 22.08
485 */
486 void requestPixmaps(const QList<PixmapRequest *> &requests);
487
488 /**
489 * Sends @p requests for pixmap generation.
490 *
491 * @param requests the linked list of requests
492 * @param reqOptions the options for the request
493 *
494 * @since 22.08
495 */
496 void requestPixmaps(const QList<PixmapRequest *> &requests, PixmapRequestFlags reqOptions);
497
498 /**
499 * Sends a request for text page generation for the given page @p pageNumber.
500 */
501 void requestTextPage(uint pageNumber);
502
503 /**
504 * Adds a new @p annotation to the given @p page.
505 */
506 void addPageAnnotation(int page, Annotation *annotation);
507
508 /**
509 * Tests if the @p annotation can be modified
510 *
511 * @since 0.15 (KDE 4.9)
512 */
513 bool canModifyPageAnnotation(const Annotation *annotation) const;
514
515 /**
516 * Prepares to modify the properties of the given @p annotation.
517 * Must be called before the annotation's properties are modified
518 *
519 * @since 0.17 (KDE 4.11)
520 */
521 void prepareToModifyAnnotationProperties(Annotation *annotation);
522
523 /**
524 * Modifies the given @p annotation on the given @p page.
525 * Must be preceded by a call to prepareToModifyAnnotationProperties before
526 * the annotation's properties are modified
527 *
528 * @since 0.17 (KDE 4.11)
529 */
530 void modifyPageAnnotationProperties(int page, Annotation *annotation);
531
532 /**
533 * Translates the position of the given @p annotation on the given @p page by a distance @p delta in normalized coordinates.
534 *
535 * Consecutive translations applied to the same @p annotation are merged together on the undo stack if the
536 * BeingMoved flag is set on the @p annotation.
537 *
538 * @since 0.17 (KDE 4.11)
539 */
540 void translatePageAnnotation(int page, Annotation *annotation, const Okular::NormalizedPoint &delta);
541
542 /**
543 * Adjusts the position of the top-left and bottom-right corners of given @p annotation on the given @p page.
544 *
545 * Can be used to implement resize functionality.
546 * @p delta1 in normalized coordinates is added to top-left.
547 * @p delta2 in normalized coordinates is added to bottom-right.
548 *
549 * Consecutive adjustments applied to the same @p annotation are merged together on the undo stack if the
550 * BeingResized flag is set on the @p annotation.
551 *
552 * @since 1.1.0
553 */
554 void adjustPageAnnotation(int page, Annotation *annotation, const Okular::NormalizedPoint &delta1, const Okular::NormalizedPoint &delta2);
555
556 /**
557 * Edits the plain text contents of the given @p annotation on the given @p page.
558 *
559 * The contents are set to @p newContents with cursor position @p newCursorPos.
560 * The previous cursor position @p prevCursorPos and previous anchor position @p prevAnchorPos
561 * must also be supplied so that they can be restored if the edit action is undone.
562 *
563 * The Annotation's internal contents should not be modified prior to calling this method.
564 *
565 * @since 0.17 (KDE 4.11)
566 */
567 void editPageAnnotationContents(int page, Annotation *annotation, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos);
568
569 /**
570 * Tests if the @p annotation can be removed
571 *
572 * @since 0.15 (KDE 4.9)
573 */
574 bool canRemovePageAnnotation(const Annotation *annotation) const;
575
576 /**
577 * Removes the given @p annotation from the given @p page.
578 */
579 void removePageAnnotation(int page, Annotation *annotation);
580
581 /**
582 * Removes the given @p annotations from the given @p page.
583 */
584 void removePageAnnotations(int page, const QList<Annotation *> &annotations);
585
586 /**
587 * Clears the text selection highlights for the given @p page,
588 * creates new ones if @p rect is not nullptr,
589 * and deletes @p rect.
590 *
591 * @param page The number of the page.
592 * @param rect The rectangle of the selection.
593 * @param color The color of the selection.
594 */
595 void setPageTextSelection(int page, std::unique_ptr<RegularAreaRect> &&rect, const QColor &color);
596
597 /**
598 * Returns true if there is an undo command available; otherwise returns false.
599 * @since 0.17 (KDE 4.11)
600 */
601 bool canUndo() const;
602
603 /**
604 * Returns true if there is a redo command available; otherwise returns false.
605 * @since 0.17 (KDE 4.11)
606 */
607 bool canRedo() const;
608
609 /**
610 * Describes the possible search types.
611 */
613 NextMatch, ///< Search next match
614 PreviousMatch, ///< Search previous match
615 AllDocument, ///< Search complete document
616 GoogleAll, ///< Search complete document (all words in google style)
617 GoogleAny ///< Search complete document (any words in google style)
618 };
619
620 /**
621 * Describes how search ended
622 */
624 MatchFound, ///< Any match was found
625 NoMatchFound, ///< No match was found
626 SearchCancelled ///< The search was cancelled
627 };
628
629 /**
630 * Searches the given @p text in the document.
631 *
632 * @param searchID The unique id for this search request.
633 * @param text The text to be searched.
634 * @param fromStart Whether the search should be started at begin of the document.
635 * @param caseSensitivity Whether the search is case sensitive.
636 * @param type The type of the search. @ref SearchType
637 * @param moveViewport Whether the viewport shall be moved to the position of the matches.
638 * @param color The highlighting color of the matches.
639 */
640 void searchText(int searchID, const QString &text, bool fromStart, Qt::CaseSensitivity caseSensitivity, SearchType type, bool moveViewport, const QColor &color);
641
642 /**
643 * Continues the search for the given @p searchID.
644 */
645 void continueSearch(int searchID);
646
647 /**
648 * Continues the search for the given @p searchID, optionally specifying
649 * a new type for the search.
650 *
651 * @since 0.7 (KDE 4.1)
652 */
653 void continueSearch(int searchID, SearchType type);
654
655 /**
656 * Resets the search for the given @p searchID.
657 */
658 void resetSearch(int searchID);
659
660 /**
661 * Returns the bookmark manager of the document.
662 */
663 BookmarkManager *bookmarkManager() const;
664
665 /**
666 * Processes the given @p action.
667 */
668 void processAction(const Action *action);
669
670 /**
671 * Processes the given format @p action on @p fft.
672 *
673 * @since 1.9
674 * @deprecated use processFormatAction(const Action *, Okular::FormField *).
675 */
676 OKULARCORE_DEPRECATED void processFormatAction(const Action *action, Okular::FormFieldText *fft);
677
678 /**
679 * Processes the given format @p action on a Form Field @p ff.
680 *
681 * @since 24.08
682 */
683 void processFormatAction(const Action *action, Okular::FormField *ff);
684
685 /**
686 * Processes the given keystroke @p action on @p fft.
687 *
688 * @since 1.9
689 * @deprecated use processKeystrokeAction(const Action *, Okular::FormField *, const QVariant &, int, int)
690 */
691 OKULARCORE_DEPRECATED void processKeystrokeAction(const Action *action, Okular::FormFieldText *fft, const QVariant &newValue);
692
693 /**
694 * Processes the given keystroke @p action on @p ff between the two positions @p prevCursorPos and @p prevAnchorPos
695 * @p prevCursorPos and @p prevAnchorPos are used to set the selStart and selEnd event properties.
696 *
697 * @since 24.08
698 */
699 void processKeystrokeAction(const Action *action, Okular::FormField *ff, const QVariant &newValue, int prevCursorPos, int prevAnchorPos);
700
701 /**
702 * Processes the given keystroke @p action on @p fft.
703 * This will set event.willCommit=true
704 *
705 * @since 22.04
706 * @deprecated use processKeystrokeCommitAction(const Action *, Okular::FormField *, bool &).
707 */
708 OKULARCORE_DEPRECATED void processKeystrokeCommitAction(const Action *action, Okular::FormFieldText *fft);
709
710 /**
711 * Processes the given keystroke @p action on FormField @p ff.
712 * This will set event.willCommit=true.
713 * The return code parameter is set if the value is to be committed.
714 *
715 * @since 24.08
716 */
717 void processKeystrokeCommitAction(const Action *action, Okular::FormField *ff, bool &returnCode);
718
719 /**
720 * Processes the given focus action on the field.
721 *
722 * @since 1.9
723 */
724 void processFocusAction(const Action *action, Okular::FormField *field);
725
726 /**
727 * Processes the given keystroke @p action on @p fft.
728 *
729 * @since 1.9
730 * @deprecated use processValidateAction(const Action *, Okular::FormField *, bool &).
731 */
732 OKULARCORE_DEPRECATED void processValidateAction(const Action *action, Okular::FormFieldText *fft, bool &returnCode);
733
734 /**
735 * Validates the input value in the FormField @p ff and sets the @p returnCode for a given validate @p action.
736 *
737 * @since 24.08
738 */
739 void processValidateAction(const Action *action, Okular::FormField *ff, bool &returnCode);
740
741 /**
742 * A method that executes the relevant keystroke, validate, calculate and format actions on a FormField @p ff.
743 *
744 * @since 24.08
745 */
746 void processKVCFActions(Okular::FormField *ff);
747
748 /**
749 * Processes the mouse up @p action on @p ff.
750 *
751 * @deprecated use @ref processFormMouseScriptAction
752 * @since 23.12
753 */
754 OKULARCORE_DEPRECATED void processFormMouseUpScripAction(const Action *action, Okular::FormField *ff);
755
757 FieldMouseDown, /// < This event is the result of a mouse down on a field.
758 FieldMouseEnter, /// < This event is the result of mouse exiting from a field.
759 FieldMouseExit, /// < This event is the result of mouse exiting from a field.
760 FieldMouseUp, /// < This event is the result of a mouse up on a field.
761 };
762
763 /**
764 * Processes the mouse @p action of type @p fieldMouseEventType on @p ff.
765 *
766 * @since 24.12
767 */
768 void processFormMouseScriptAction(const Action *action, Okular::FormField *ff, MouseEventType fieldMouseEventType);
769
770 /**
771 * Describes the additional actions available in the Document.
772 *
773 * @since 24.08
774 */
776 CloseDocument,
777 SaveDocumentStart,
778 SaveDocumentFinish,
779 PrintDocumentStart,
780 PrintDocumentFinish,
781 };
782
783 /**
784 * Processes the given document additional @p action of specified @p type.
785 *
786 * @since 24.08
787 */
788 void processDocumentAction(const Action *action, DocumentAdditionalActionType type);
789
790 /**
791 * Recalculates all the form fields in the document
792 *
793 * @since 24.12
794 */
795 void recalculateForms();
796
797 /**
798 * Returns a list of the bookmarked.pages
799 */
800 QList<int> bookmarkedPageList() const;
801
802 /**
803 * Returns the range of the bookmarked.pages
804 */
805 QString bookmarkedPageRange() const;
806
807 /**
808 * Processes/Executes the given source @p reference.
809 */
810 void processSourceReference(const SourceReference *reference);
811
812 /**
813 * Returns whether the document can configure the printer itself.
814 */
815 bool canConfigurePrinter() const;
816
817 /**
818 * What type of printing a document supports
819 */
821 NoPrinting, ///< Printing Not Supported
822 NativePrinting, ///< Native Cross-Platform Printing
823 PostscriptPrinting ///< Postscript file printing
824 };
825
826 /**
827 * Returns what sort of printing the document supports:
828 * Native, Postscript, None
829 */
830 PrintingType printingSupport() const;
831
832 /**
833 * Returns whether the document supports printing to both PDF and PS files.
834 */
835 bool supportsPrintToFile() const;
836
837 /// @since 22.04
839 NoPrintError, ///< Printing succeeded
840 UnknownPrintError,
841 TemporaryFileOpenPrintError,
842 FileConversionPrintError,
843 PrintingProcessCrashPrintError,
844 PrintingProcessStartPrintError,
845 PrintToFilePrintError,
846 InvalidPrinterStatePrintError,
847 UnableToFindFilePrintError,
848 NoFileToPrintError,
849 NoBinaryToPrintError,
850 InvalidPageSizePrintError
851 };
852
853 /**
854 * Prints the document to the given @p printer.
855 */
856 Document::PrintError print(QPrinter &printer);
857
858 /// @since 22.04
859 static QString printErrorString(PrintError error);
860
861 /**
862 * Returns a custom printer configuration page or 0 if no
863 * custom printer configuration page is available.
864 *
865 * The returned object should be of a PrintOptionsWidget subclass
866 * (which is not officially enforced by the signature for binary
867 * compatibility reasons).
868 */
869 QWidget *printConfigurationWidget() const;
870
871 /**
872 * Fill the KConfigDialog @p dialog with the setting pages of the
873 * generators.
874 */
875 void fillConfigDialog(KConfigDialog *dialog);
876
877 /**
878 * Returns the number of generators that have a configuration widget.
879 */
880 int configurableGenerators() const;
881
882 /**
883 * Returns the list with the supported MIME types.
884 */
885 QStringList supportedMimeTypes() const;
886
887 /**
888 * Returns the metadata associated with the generator. May be invalid.
889 */
890 KPluginMetaData generatorInfo() const;
891
892 /**
893 * Returns whether the generator supports hot-swapping the current file
894 * with another identical file
895 *
896 * @since 1.3
897 */
898 bool canSwapBackingFile() const;
899
900 /**
901 * Reload the document from a new location, without any visible effect
902 * to the user.
903 *
904 * The new file must be identical to the current one or, if the document
905 * has been modified (eg the user edited forms and annotations), the new
906 * document must have these changes too. For example, you can call
907 * saveChanges first to write changes to a file and then swapBackingFile
908 * to switch to the new location.
909 *
910 * @since 1.3
911 */
912 bool swapBackingFile(const QString &newFileName, const QUrl &url);
913
914 /**
915 * Same as swapBackingFile, but newFileName must be a .okular file.
916 *
917 * The new file must be identical to the current one or, if the document
918 * has been modified (eg the user edited forms and annotations), the new
919 * document must have these changes too. For example, you can call
920 * saveDocumentArchive first to write changes to a file and then
921 * swapBackingFileArchive to switch to the new location.
922 *
923 * @since 1.3
924 */
925 bool swapBackingFileArchive(const QString &newFileName, const QUrl &url);
926
927 /**
928 * Sets the history to be clean
929 *
930 * @since 1.3
931 */
932 void setHistoryClean(bool clean);
933
934 bool isHistoryClean() const;
935
936 /**
937 * \since 24.12
938 */
939 void clearHistory();
940
941 /**
942 * Saving capabilities. Their availability varies according to the
943 * underlying generator and/or the document type.
944 *
945 * @see canSaveChanges (SaveCapability)
946 * @since 0.15 (KDE 4.9)
947 */
949 SaveFormsCapability = 1, ///< Can save form changes
950 SaveAnnotationsCapability = 2 ///< Can save annotation changes
951 };
952
953 /**
954 * Returns whether it's possible to save a given category of changes to
955 * another document.
956 *
957 * @since 0.15 (KDE 4.9)
958 */
959 bool canSaveChanges(SaveCapability cap) const;
960
961 /**
962 * Returns whether the changes to the document (modified annotations,
963 * values in form fields, etc) can be saved to another document.
964 *
965 * Equivalent to the logical OR of canSaveChanges(SaveCapability) for
966 * each capability.
967 *
968 * @since 0.7 (KDE 4.1)
969 */
970 bool canSaveChanges() const;
971
972 /**
973 * Save the document and the optional changes to it to the specified
974 * @p fileName.
975 *
976 * @since 0.7 (KDE 4.1)
977 */
978 bool saveChanges(const QString &fileName);
979
980 /**
981 * Save the document and the optional changes to it to the specified
982 * @p fileName and returns a @p errorText if fails.
983 *
984 * @since 0.10 (KDE 4.4)
985 */
986 bool saveChanges(const QString &fileName, QString *errorText);
987
988 /**
989 * Register the specified @p view for the current document.
990 *
991 * It is unregistered from the previous document, if any.
992 *
993 * @since 0.7 (KDE 4.1)
994 */
995 void registerView(View *view);
996
997 /**
998 * Unregister the specified @p view from the current document.
999 *
1000 * @since 0.7 (KDE 4.1)
1001 */
1002 void unregisterView(View *view);
1003
1004 /**
1005 * Gets the font data for the given font
1006 *
1007 * @since 0.8 (KDE 4.2)
1008 */
1009 QByteArray fontData(const FontInfo &font) const;
1010
1011 /**
1012 * Opens a document archive.
1013 *
1014 * @since 0.20 (KDE 4.14)
1015 */
1016 OpenResult openDocumentArchive(const QString &docFile, const QUrl &url, const QString &password = QString());
1017
1018 /**
1019 * Saves a document archive.
1020 *
1021 * @since 0.8 (KDE 4.2)
1022 */
1023 bool saveDocumentArchive(const QString &fileName);
1024
1025 /**
1026 * Extract the document file from the current archive.
1027 *
1028 * @warning This function only works if the current file is a document archive
1029 *
1030 * @since 1.3
1031 */
1032 bool extractArchivedFile(const QString &destFileName);
1033
1034 /**
1035 * Asks the generator to dynamically generate a SourceReference for a given
1036 * page number and absolute X and Y position on this page.
1037 *
1038 * @attention Ownership of the returned SourceReference is transferred to the caller.
1039 * @note This method does not call processSourceReference( const SourceReference * )
1040 *
1041 * @since 0.10 (KDE 4.4)
1042 */
1043 const SourceReference *dynamicSourceReference(int pageNr, double absX, double absY);
1044
1045 /**
1046 * Returns the orientation of the document (for printing purposes). This
1047 * is used in the KPart to initialize the print dialog and in the
1048 * generators to check whether the document needs to be rotated or not.
1049 *
1050 * @since 0.14 (KDE 4.8)
1051 */
1052 QPageLayout::Orientation orientation() const;
1053
1054 /**
1055 * Control annotation editing (creation, modification and removal),
1056 * which is enabled by default.
1057 *
1058 * @since 0.15 (KDE 4.9)
1059 */
1060 void setAnnotationEditingEnabled(bool enable);
1061
1062 /**
1063 * Returns which wallet data to use to read/write the password for the given fileName
1064 *
1065 * @since 0.20 (KDE 4.14)
1066 */
1067 void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const;
1068
1069 /**
1070 * Since version 0.21, okular does not allow editing annotations and
1071 * form data if they are stored in the docdata directory (like older
1072 * okular versions did by default).
1073 * If this flag is set, then annotations and forms cannot be edited.
1074 *
1075 * @since 1.3
1076 */
1077 bool isDocdataMigrationNeeded() const;
1078
1079 /**
1080 * Delete annotations and form data from the docdata folder. Call it if
1081 * isDocdataMigrationNeeded() was true and you've just saved them to an
1082 * external file.
1083 *
1084 * @since 1.3
1085 */
1086 void docdataMigrationDone();
1087
1088 /**
1089 * Returns the model for rendering layers (NULL if the document has no layers)
1090 *
1091 * @since 0.24
1092 */
1093 QAbstractItemModel *layersModel() const;
1094
1095 /**
1096 * Returns the reason why the file opening failed, if any.
1097 *
1098 * @since 1.10
1099 */
1100 QString openError() const;
1101
1102 /**
1103 * Digitally sign document
1104 *
1105 * @since 21.04
1106 */
1107 bool sign(const NewSignatureData &data, const QString &newPath);
1108
1109 /**
1110 * Returns the generator's certificate store (if any)
1111 *
1112 * @since 21.04
1113 */
1114 CertificateStore *certificateStore() const;
1115
1116 /** sets the editor command to the command \p editCmd, as
1117 * given at the commandline.
1118 *
1119 * @since 22.04
1120 */
1121 void setEditorCommandOverride(const QString &editCmd);
1122
1123 /** returns the overriding editor command.
1124 *
1125 * If the editor command was not overriden, the string is empty.
1126 *
1127 * @since 22.04
1128 */
1129 QString editorCommandOverride() const;
1130
1131public Q_SLOTS:
1132 /**
1133 * This slot is called whenever the user changes the @p rotation of
1134 * the document.
1135 */
1136 void setRotation(int rotation);
1137
1138 /**
1139 * This slot is called whenever the user changes the page @p size
1140 * of the document.
1141 */
1142 void setPageSize(const Okular::PageSize &size);
1143
1144 /**
1145 * Cancels the current search
1146 */
1147 void cancelSearch();
1148
1149 /**
1150 * Undo last edit command
1151 * @since 0.17 (KDE 4.11)
1152 */
1153 void undo();
1154
1155 /**
1156 * Redo last undone edit command
1157 * @since 0.17 (KDE 4.11)
1158 */
1159 void redo();
1160
1161 /**
1162 * Edit the text contents of the specified @p form on page @p page to be @p newContents.
1163 * The new text cursor position (@p newCursorPos), previous text cursor position (@p prevCursorPos),
1164 * and previous cursor anchor position will be restored by the undo / redo commands.
1165 * @since 0.17 (KDE 4.11)
1166 *
1167 * @deprecated use editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents,
1168 * int newCursorPos, int prevCursorPos, int prevAnchorPos, const QString &oldContents)
1169 */
1170 OKULARCORE_DEPRECATED void editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos);
1171
1172 /**
1173 * Edit the text contents of the specified @p form on page @p page to be @p newContents where
1174 * previous contents are @p oldContents for undo/redo commands. The new text cursor position (@p newCursorPos),
1175 * previous text cursor position (@p prevCursorPos), and previous cursor anchor position will be restored by the undo / redo commands.
1176 * @since 24.08
1177 */
1178 void editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos, const QString &oldContents);
1179
1180 /**
1181 * Edit the selected list entries in @p form on page @p page to be @p newChoices.
1182 * @since 0.17 (KDE 4.11)
1183 */
1184 void editFormList(int pageNumber, Okular::FormFieldChoice *form, const QList<int> &newChoices);
1185
1186 /**
1187 * Set the active choice in the combo box @p form on page @p page to @p newText
1188 * The new cursor position (@p newCursorPos), previous cursor position
1189 * (@p prevCursorPos), and previous anchor position (@p prevAnchorPos)
1190 * will be restored by the undo / redo commands.
1191 *
1192 * @since 0.17 (KDE 4.11)
1193 */
1194 void editFormCombo(int pageNumber, Okular::FormFieldChoice *form, const QString &newText, int newCursorPos, int prevCursorPos, int prevAnchorPos);
1195
1196 /**
1197 * Set the states of the group of form buttons @p formButtons on page @p page to @p newButtonStates.
1198 * The lists @p formButtons and @p newButtonStates should be the same length and true values
1199 * in @p newButtonStates indicate that the corresponding entry in @p formButtons should be enabled.
1200 */
1201 void editFormButtons(int pageNumber, const QList<Okular::FormFieldButton *> &formButtons, const QList<bool> &newButtonStates);
1202
1203 /**
1204 * Reloads the pixmaps for whole document
1205 *
1206 * @since 0.24
1207 */
1208 void reloadDocument() const;
1209
1210 /**
1211 * Returns the part of document covered by the given signature @p info.
1212 *
1213 * @since 1.7
1214 */
1215 QByteArray requestSignedRevisionData(const Okular::SignatureInfo &info);
1216
1217 /**
1218 * Refresh the pixmaps for the given @p pageNumber.
1219 *
1220 * @since 1.10
1221 */
1222 void refreshPixmaps(int pageNumber);
1223
1224Q_SIGNALS:
1225 /**
1226 * This signal is emitted whenever the document is about to close.
1227 * @since 1.5.3
1228 */
1230
1231 /**
1232 * This signal is emitted whenever an action requests a
1233 * document close operation.
1234 */
1235 void close();
1236
1237 /**
1238 * This signal is emitted whenever an action requests a
1239 * document print operation.
1240 * @since 22.04
1241 */
1243
1244 /**
1245 * This signal is emitted whenever an action requests a
1246 * document save as operation.
1247 * @since 22.04
1248 */
1250
1251 /**
1252 * This signal is emitted whenever an action requests an
1253 * application quit operation.
1254 */
1255 void quit();
1256
1257 /**
1258 * This signal is emitted whenever an action requests a
1259 * find operation.
1260 */
1261 void linkFind();
1262
1263 /**
1264 * This signal is emitted whenever an action requests a
1265 * goto operation.
1266 */
1268
1269 /**
1270 * This signal is emitted whenever an action requests a
1271 * start presentation operation.
1272 */
1274
1275 /**
1276 * This signal is emitted whenever an action requests an
1277 * end presentation operation.
1278 */
1280
1281 /**
1282 * This signal is emitted whenever an action requests an
1283 * open url operation for the given document @p url.
1284 */
1285 void openUrl(const QUrl &url);
1286
1287 /**
1288 * This signal is emitted whenever an error occurred.
1289 *
1290 * @param text The description of the error.
1291 * @param duration The time in milliseconds the message should be shown to the user.
1292 */
1293 void error(const QString &text, int duration);
1294
1295 /**
1296 * This signal is emitted to signal a warning.
1297 *
1298 * @param text The description of the warning.
1299 * @param duration The time in milliseconds the message should be shown to the user.
1300 */
1301 void warning(const QString &text, int duration);
1302
1303 /**
1304 * This signal is emitted to signal a notice.
1305 *
1306 * @param text The description of the notice.
1307 * @param duration The time in milliseconds the message should be shown to the user.
1308 */
1309 void notice(const QString &text, int duration);
1310
1311 /**
1312 * Emitted when a new font is found during the reading of the fonts of
1313 * the document.
1314 */
1315 void gotFont(const Okular::FontInfo &font);
1316
1317 /**
1318 * Reports the progress when reading the fonts in the document.
1319 *
1320 * \param page is the page that was just finished to scan for fonts
1321 */
1322 void fontReadingProgress(int page);
1323
1324 /**
1325 * Reports that the reading of the fonts in the document is finished.
1326 */
1328
1329 /**
1330 * Reports that the current search finished
1331 */
1332 void searchFinished(int searchID, Okular::Document::SearchStatus endStatus);
1333
1334 /**
1335 * This signal is emitted whenever a source reference with the given parameters has been
1336 * activated.
1337 *
1338 * \param absFileName absolute name of the file.
1339 * \param line line number.
1340 * \param col column number.
1341 * \param handled should be set to 'true' if a slot handles this source reference; the
1342 * default action to launch the configured editor will then not be performed
1343 * by the document
1344 *
1345 * @since 0.14 (KDE 4.8)
1346 */
1347 void sourceReferenceActivated(const QString &absFileName, int line, int col, bool *handled);
1348
1349 /**
1350 * This signal is emitted whenever an movie action is triggered and the UI should process it.
1351 */
1353
1354 /**
1355 * This signal is emitted whenever the availability of the undo function changes
1356 * @since 0.17 (KDE 4.11)
1357 */
1358 void canUndoChanged(bool undoAvailable);
1359
1360 /**
1361 * This signal is emitted whenever the availability of the redo function changes
1362 * @since 0.17 (KDE 4.11)
1363 */
1364 void canRedoChanged(bool redoAvailable);
1365
1366 /**
1367 * This signal is emitted whenever the undo history is clean (i.e. the same status the last time it was saved)
1368 * @since 1.3
1369 */
1370 void undoHistoryCleanChanged(bool clean);
1371
1372 /**
1373 * This signal is emitted whenever an rendition action is triggered and the UI should process it.
1374 *
1375 * @since 0.16 (KDE 4.10)
1376 */
1378
1379 /**
1380 * This signal is emitted whenever the contents of the given @p annotation are changed by an undo
1381 * or redo action.
1382 *
1383 * The new contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are
1384 * included
1385 * @since 0.17 (KDE 4.11)
1386 */
1387 void annotationContentsChangedByUndoRedo(Okular::Annotation *annotation, const QString &contents, int cursorPos, int anchorPos);
1388
1389 /**
1390 * This signal is emitted whenever the text contents of the given text @p form on the given @p page
1391 * are changed by an undo or redo action.
1392 *
1393 * The new text contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are
1394 * included
1395 * @since 0.17 (KDE 4.11)
1396 */
1397 void formTextChangedByUndoRedo(int page, Okular::FormFieldText *form, const QString &contents, int cursorPos, int anchorPos);
1398
1399 /**
1400 * This signal is emitted whenever the selected @p choices for the given list @p form on the
1401 * given @p page are changed by an undo or redo action.
1402 * @since 0.17 (KDE 4.11)
1403 */
1404 void formListChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QList<int> &choices);
1405
1406 /**
1407 * This signal is emitted whenever the active @p text for the given combo @p form on the
1408 * given @p page is changed by an undo or redo action.
1409 * @since 0.17 (KDE 4.11)
1410 */
1411 void formComboChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QString &text, int cursorPos, int anchorPos);
1412
1413 /**
1414 * This signal is emitted whenever the state of the specified group of form buttons (@p formButtons) on the
1415 * given @p page is changed by an undo or redo action.
1416 * @since 0.17 (KDE 4.11)
1417 */
1419
1420 /**
1421 * This signal is emitted whenever a FormField was changed programmatically and the
1422 * according widget should be updated.
1423 * @since 1.4
1424 */
1426
1427private:
1428 /// @cond PRIVATE
1429 friend class DocumentPrivate;
1430 friend class ::DocumentItem;
1431 friend class EditAnnotationContentsCommand;
1432 friend class EditFormTextCommand;
1433 friend class EditFormListCommand;
1434 friend class EditFormComboCommand;
1435 friend class EditFormButtonsCommand;
1436 /// @endcond
1437 DocumentPrivate *const d;
1438
1439 Q_DISABLE_COPY(Document)
1440};
1441
1442/**
1443 * @short A view on the document.
1444 *
1445 * The Viewport structure is the 'current view' over the document. Contained
1446 * data is broadcasted between observers to synchronize their viewports to get
1447 * the 'I scroll one view and others scroll too' views.
1448 */
1449class OKULARCORE_EXPORT DocumentViewport
1450{
1451public:
1452 /**
1453 * Creates a new viewport for the given page @p number.
1454 */
1455 explicit DocumentViewport(int number = -1);
1456
1457 /**
1458 * Creates a new viewport from the given @p xmlDesc.
1459 */
1460 explicit DocumentViewport(const QString &xmlDesc);
1461
1462 /**
1463 * Returns the viewport as xml description.
1464 */
1465 QString toString() const;
1466
1467 /**
1468 * Returns whether the viewport is valid.
1469 */
1470 bool isValid() const;
1471
1472 /**
1473 * @internal
1474 */
1475 bool operator==(const DocumentViewport &other) const;
1476 bool operator<(const DocumentViewport &other) const;
1477
1478 /**
1479 * The number of the page nearest the center of the viewport.
1480 */
1482
1483 /**
1484 * Describes the relative position of the viewport.
1485 */
1487 Center = 1, ///< Relative to the center of the page.
1488 TopLeft = 2 ///< Relative to the top left corner of the page.
1490
1491 /**
1492 * If 'rePos.enabled == true' then this structure contains the
1493 * viewport center or top left depending on the value of pos.
1494 */
1495 struct {
1496 bool enabled;
1497 double normalizedX;
1498 double normalizedY;
1499 Position pos;
1500 } rePos;
1501
1502 /**
1503 * If 'autoFit.enabled == true' then the page must be autofit in the viewport.
1504 */
1505 struct {
1506 bool enabled;
1507 bool width;
1508 bool height;
1509 } autoFit;
1510};
1511
1512/**
1513 * @short A DOM tree that describes the Table of Contents.
1514 *
1515 * The Synopsis (TOC or Table Of Contents for friends) is represented via
1516 * a dom tree where each node has an internal name (displayed in the TOC)
1517 * and one or more attributes.
1518 *
1519 * In the tree the tag name is the 'screen' name of the entry. A tag can have
1520 * attributes. Here follows the list of tag attributes with meaning:
1521 * - Destination: A string description of the referred viewport
1522 * - DestinationName: A 'named reference' to the viewport that must be converted
1523 * using metaData( "NamedViewport", viewport_name )
1524 * - ExternalFileName: A document to be opened, whose destination is specified
1525 * with Destination or DestinationName
1526 * - Open: a boolean saying whether its TOC branch is open or not (default: false)
1527 * - URL: a URL to be open as destination; if set, no other Destination* or
1528 * ExternalFileName entry is used
1529 */
1530class OKULARCORE_EXPORT DocumentSynopsis : public QDomDocument
1531{
1532public:
1533 /**
1534 * Creates a new document synopsis object.
1535 */
1537
1538 /**
1539 * Creates a new document synopsis object with the given
1540 * @p document as parent node.
1541 */
1542 explicit DocumentSynopsis(const QDomDocument &document);
1543};
1544
1545/**
1546 * @short An embedded file into the document.
1547 *
1548 * This class represents a sort of interface of an embedded file in a document.
1549 *
1550 * Generators \b must re-implement its members to give the all the information
1551 * about an embedded file, like its name, its description, the date of creation
1552 * and modification, and the real data of the file.
1553 */
1554class OKULARCORE_EXPORT EmbeddedFile
1555{
1556public:
1557 /**
1558 * Creates a new embedded file.
1559 */
1560 EmbeddedFile();
1561
1562 /**
1563 * Destroys the embedded file.
1564 */
1565 virtual ~EmbeddedFile();
1566
1567 EmbeddedFile(const EmbeddedFile &) = delete;
1568 EmbeddedFile &operator=(const EmbeddedFile &) = delete;
1569
1570 /**
1571 * Returns the name of the file
1572 */
1573 virtual QString name() const = 0;
1574
1575 /**
1576 * Returns the description of the file, or an empty string if not
1577 * available
1578 */
1579 virtual QString description() const = 0;
1580
1581 /**
1582 * Returns the real data representing the file contents
1583 */
1584 virtual QByteArray data() const = 0;
1585
1586 /**
1587 * Returns the size (in bytes) of the file, if available, or -1 otherwise.
1588 *
1589 * @note this method should be a fast way to know the size of the file
1590 * with no need to extract all the data from it
1591 */
1592 virtual int size() const = 0;
1593
1594 /**
1595 * Returns the modification date of the file, or an invalid date
1596 * if not available
1597 */
1598 virtual QDateTime modificationDate() const = 0;
1599
1600 /**
1601 * Returns the creation date of the file, or an invalid date
1602 * if not available
1603 */
1604 virtual QDateTime creationDate() const = 0;
1605};
1606
1607/**
1608 * @short An area of a specified page
1609 */
1610class OKULARCORE_EXPORT VisiblePageRect
1611{
1612public:
1613 /**
1614 * Creates a new visible page rectangle.
1615 *
1616 * @param pageNumber The page number where the rectangle is located.
1617 * @param rectangle The rectangle in normalized coordinates.
1618 */
1619 explicit VisiblePageRect(int pageNumber = -1, const NormalizedRect &rectangle = NormalizedRect());
1620
1621 /**
1622 * The page number where the rectangle is located.
1623 */
1625
1626 /**
1627 * The rectangle in normalized coordinates.
1628 */
1630};
1631
1632/**
1633 * @short Data needed to create a new signature
1634 *
1635 * @since 21.04
1636 */
1637class OKULARCORE_EXPORT NewSignatureData
1638{
1639public:
1642 NewSignatureData(const NewSignatureData &) = delete;
1643 NewSignatureData &operator=(const NewSignatureData &) = delete;
1644
1645 QString certNickname() const;
1646 void setCertNickname(const QString &certNickname);
1647
1648 QString certSubjectCommonName() const;
1649 void setCertSubjectCommonName(const QString &certSubjectCommonName);
1650
1651 QString password() const;
1652 void setPassword(const QString &password);
1653
1654 int page() const;
1655 void setPage(int page);
1656
1657 NormalizedRect boundingRectangle() const;
1658 void setBoundingRectangle(const NormalizedRect &rect);
1659
1660 /// @since 22.04
1661 QString documentPassword() const;
1662
1663 /// @since 22.04
1664 void setDocumentPassword(const QString &password);
1665
1666 /// @since 23.08
1667 QString reason() const;
1668
1669 /// @since 23.08
1670 void setReason(const QString &reason);
1671
1672 /// @since 23.08
1673 QString location() const;
1674
1675 /// @since 23.08
1676 void setLocation(const QString &location);
1677
1678 /// @since 23.08
1679 QString backgroundImagePath() const;
1680
1681 /// @since 23.08
1682 void setBackgroundImagePath(const QString &path);
1683
1684private:
1685 NewSignatureDataPrivate *const d;
1686};
1687
1688}
1689
1690Q_DECLARE_METATYPE(Okular::DocumentInfo::Key)
1691Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::Document::PixmapRequestFlags)
1692
1693#endif
1694
1695/* kate: replace-tabs on; indent-width 4; */
Encapsulates data that describes an action.
Definition action.h:41
Annotation struct holds properties shared by all annotations.
Definition annotations.h:99
Bookmarks manager utility.
A helper class to store information about x509 certificate.
The DocumentInfo structure can be filled in by generators to display metadata about the currently ope...
Definition document.h:76
Key
The list of predefined keys.
Definition document.h:83
@ ModificationDate
The date of last modification of the document.
Definition document.h:93
@ Author
The author of the document.
Definition document.h:87
@ Subject
The subject of the document.
Definition document.h:85
@ Category
The category of the document.
Definition document.h:95
@ Producer
The producer of the document (e.g. some software)
Definition document.h:89
@ Copyright
The copyright of the document.
Definition document.h:90
@ CreationDate
The date of creation of the document.
Definition document.h:92
@ CustomKeys
All the custom keys the generator supports.
Definition document.h:100
@ MimeType
The mime type of the document.
Definition document.h:94
@ FilePath
The path of the file.
Definition document.h:97
@ PagesSize
The size of the pages (if all pages have the same size)
Definition document.h:99
@ Keywords
The keywords which describe the content of the document.
Definition document.h:96
@ Creator
The creator of the document (this can be different from the author)
Definition document.h:88
@ Pages
The number of pages of the document.
Definition document.h:91
@ DocumentSize
The size of the document.
Definition document.h:98
@ Description
The description of the document.
Definition document.h:86
@ Title
The title of the document.
Definition document.h:84
Base class for objects being notified when something changes.
Definition observer.h:29
A DOM tree that describes the Table of Contents.
Definition document.h:1531
A view on the document.
Definition document.h:1450
int pageNumber
The number of the page nearest the center of the viewport.
Definition document.h:1481
Position
Describes the relative position of the viewport.
Definition document.h:1486
The Document.
Definition document.h:192
void fontReadingEnded()
Reports that the reading of the fonts in the document is finished.
void error(const QString &text, int duration)
This signal is emitted whenever an error occurred.
void linkEndPresentation()
This signal is emitted whenever an action requests an end presentation operation.
void canUndoChanged(bool undoAvailable)
This signal is emitted whenever the availability of the undo function changes.
PixmapRequestFlag
Describes the possible options for the pixmap requests.
Definition document.h:473
void linkGoToPage()
This signal is emitted whenever an action requests a goto operation.
void canRedoChanged(bool redoAvailable)
This signal is emitted whenever the availability of the redo function changes.
void linkPresentation()
This signal is emitted whenever an action requests a start presentation operation.
DocumentInfo documentInfo() const
Returns the meta data of the document.
DocumentAdditionalActionType
Describes the additional actions available in the Document.
Definition document.h:775
void linkFind()
This signal is emitted whenever an action requests a find operation.
void aboutToClose()
This signal is emitted whenever the document is about to close.
void gotFont(const Okular::FontInfo &font)
Emitted when a new font is found during the reading of the fonts of the document.
void requestPrint()
This signal is emitted whenever an action requests a document print operation.
void close()
This signal is emitted whenever an action requests a document close operation.
void annotationContentsChangedByUndoRedo(Okular::Annotation *annotation, const QString &contents, int cursorPos, int anchorPos)
This signal is emitted whenever the contents of the given annotation are changed by an undo or redo a...
void openUrl(const QUrl &url)
This signal is emitted whenever an action requests an open url operation for the given document url.
void sourceReferenceActivated(const QString &absFileName, int line, int col, bool *handled)
This signal is emitted whenever a source reference with the given parameters has been activated.
SaveCapability
Saving capabilities.
Definition document.h:948
void notice(const QString &text, int duration)
This signal is emitted to signal a notice.
void requestSaveAs()
This signal is emitted whenever an action requests a document save as operation.
void quit()
This signal is emitted whenever an action requests an application quit operation.
void fontReadingProgress(int page)
Reports the progress when reading the fonts in the document.
SearchStatus
Describes how search ended.
Definition document.h:623
@ NoMatchFound
No match was found.
Definition document.h:625
@ MatchFound
Any match was found.
Definition document.h:624
void warning(const QString &text, int duration)
This signal is emitted to signal a warning.
void searchFinished(int searchID, Okular::Document::SearchStatus endStatus)
Reports that the current search finished.
@ NoPrintError
Printing succeeded.
Definition document.h:839
void refreshFormWidget(Okular::FormField *field)
This signal is emitted whenever a FormField was changed programmatically and the according widget sho...
void undoHistoryCleanChanged(bool clean)
This signal is emitted whenever the undo history is clean (i.e.
PrintingType
What type of printing a document supports.
Definition document.h:820
@ NativePrinting
Native Cross-Platform Printing.
Definition document.h:822
@ NoPrinting
Printing Not Supported.
Definition document.h:821
void processMovieAction(const Okular::MovieAction *action)
This signal is emitted whenever an movie action is triggered and the UI should process it.
void formComboChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QString &text, int cursorPos, int anchorPos)
This signal is emitted whenever the active text for the given combo form on the given page is changed...
void formButtonsChangedByUndoRedo(int page, const QList< Okular::FormFieldButton * > &formButtons)
This signal is emitted whenever the state of the specified group of form buttons (formButtons) on the...
void processRenditionAction(const Okular::RenditionAction *action)
This signal is emitted whenever an rendition action is triggered and the UI should process it.
OpenResult
Describes the result of an open document operation.
Definition document.h:210
SearchType
Describes the possible search types.
Definition document.h:612
@ PreviousMatch
Search previous match.
Definition document.h:614
@ AllDocument
Search complete document.
Definition document.h:615
@ GoogleAll
Search complete document (all words in google style)
Definition document.h:616
@ NextMatch
Search next match.
Definition document.h:613
void formTextChangedByUndoRedo(int page, Okular::FormFieldText *form, const QString &contents, int cursorPos, int anchorPos)
This signal is emitted whenever the text contents of the given text form on the given page are change...
@ FieldMouseUp
< This event is the result of mouse exiting from a field.
Definition document.h:760
@ FieldMouseEnter
< This event is the result of a mouse down on a field.
Definition document.h:758
@ FieldMouseExit
< This event is the result of mouse exiting from a field.
Definition document.h:759
void formListChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QList< int > &choices)
This signal is emitted whenever the selected choices for the given list form on the given page are ch...
An embedded file into the document.
Definition document.h:1555
virtual int size() const =0
Returns the size (in bytes) of the file, if available, or -1 otherwise.
virtual QDateTime creationDate() const =0
Returns the creation date of the file, or an invalid date if not available.
virtual QDateTime modificationDate() const =0
Returns the modification date of the file, or an invalid date if not available.
virtual QString name() const =0
Returns the name of the file.
virtual QString description() const =0
Returns the description of the file, or an empty string if not available.
virtual QByteArray data() const =0
Returns the real data representing the file contents.
Defines an entry for the export menu.
Definition generator.h:80
A small class that represents the information of a font.
Definition fontinfo.h:25
Interface of a choice form field.
Definition form.h:421
Interface of a text form field.
Definition form.h:310
The base interface of a form field.
Definition form.h:40
The Movie action executes an operation on a video on activation.
Definition action.h:469
Data needed to create a new signature.
Definition document.h:1638
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition area.h:117
A NormalizedRect is a rectangle which can be defined by two NormalizedPoints.
Definition area.h:189
A small class that represents the size of a page.
Definition pagesize.h:24
Collector for all the data belonging to a page.
Definition page.h:48
The Rendition action executes an operation on a video or executes some JavaScript code on activation.
Definition action.h:523
Defines a source reference.
View on the document.
Definition view.h:30
An area of a specified page.
Definition document.h:1611
NormalizedRect rect
The rectangle in normalized coordinates.
Definition document.h:1629
int pageNumber
The page number where the rectangle is located.
Definition document.h:1624
global.h
Definition action.h:17
Permission
Describes the DRM capabilities.
Definition global.h:24
Rotation
A rotation.
Definition global.h:46
CaseSensitivity
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:49:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.