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 * Returns a list of the bookmarked.pages
792 */
793 QList<int> bookmarkedPageList() const;
794
795 /**
796 * Returns the range of the bookmarked.pages
797 */
798 QString bookmarkedPageRange() const;
799
800 /**
801 * Processes/Executes the given source @p reference.
802 */
803 void processSourceReference(const SourceReference *reference);
804
805 /**
806 * Returns whether the document can configure the printer itself.
807 */
808 bool canConfigurePrinter() const;
809
810 /**
811 * What type of printing a document supports
812 */
814 NoPrinting, ///< Printing Not Supported
815 NativePrinting, ///< Native Cross-Platform Printing
816 PostscriptPrinting ///< Postscript file printing
817 };
818
819 /**
820 * Returns what sort of printing the document supports:
821 * Native, Postscript, None
822 */
823 PrintingType printingSupport() const;
824
825 /**
826 * Returns whether the document supports printing to both PDF and PS files.
827 */
828 bool supportsPrintToFile() const;
829
830 /// @since 22.04
832 NoPrintError, ///< Printing succeeded
833 UnknownPrintError,
834 TemporaryFileOpenPrintError,
835 FileConversionPrintError,
836 PrintingProcessCrashPrintError,
837 PrintingProcessStartPrintError,
838 PrintToFilePrintError,
839 InvalidPrinterStatePrintError,
840 UnableToFindFilePrintError,
841 NoFileToPrintError,
842 NoBinaryToPrintError,
843 InvalidPageSizePrintError
844 };
845
846 /**
847 * Prints the document to the given @p printer.
848 */
849 Document::PrintError print(QPrinter &printer);
850
851 /// @since 22.04
852 static QString printErrorString(PrintError error);
853
854 /**
855 * Returns a custom printer configuration page or 0 if no
856 * custom printer configuration page is available.
857 *
858 * The returned object should be of a PrintOptionsWidget subclass
859 * (which is not officially enforced by the signature for binary
860 * compatibility reasons).
861 */
862 QWidget *printConfigurationWidget() const;
863
864 /**
865 * Fill the KConfigDialog @p dialog with the setting pages of the
866 * generators.
867 */
868 void fillConfigDialog(KConfigDialog *dialog);
869
870 /**
871 * Returns the number of generators that have a configuration widget.
872 */
873 int configurableGenerators() const;
874
875 /**
876 * Returns the list with the supported MIME types.
877 */
878 QStringList supportedMimeTypes() const;
879
880 /**
881 * Returns the metadata associated with the generator. May be invalid.
882 */
883 KPluginMetaData generatorInfo() const;
884
885 /**
886 * Returns whether the generator supports hot-swapping the current file
887 * with another identical file
888 *
889 * @since 1.3
890 */
891 bool canSwapBackingFile() const;
892
893 /**
894 * Reload the document from a new location, without any visible effect
895 * to the user.
896 *
897 * The new file must be identical to the current one or, if the document
898 * has been modified (eg the user edited forms and annotations), the new
899 * document must have these changes too. For example, you can call
900 * saveChanges first to write changes to a file and then swapBackingFile
901 * to switch to the new location.
902 *
903 * @since 1.3
904 */
905 bool swapBackingFile(const QString &newFileName, const QUrl &url);
906
907 /**
908 * Same as swapBackingFile, but newFileName must be a .okular file.
909 *
910 * The new file must be identical to the current one or, if the document
911 * has been modified (eg the user edited forms and annotations), the new
912 * document must have these changes too. For example, you can call
913 * saveDocumentArchive first to write changes to a file and then
914 * swapBackingFileArchive to switch to the new location.
915 *
916 * @since 1.3
917 */
918 bool swapBackingFileArchive(const QString &newFileName, const QUrl &url);
919
920 /**
921 * Sets the history to be clean
922 *
923 * @since 1.3
924 */
925 void setHistoryClean(bool clean);
926
927 bool isHistoryClean() const;
928
929 /**
930 * \since 24.12
931 */
932 void clearHistory();
933
934 /**
935 * Saving capabilities. Their availability varies according to the
936 * underlying generator and/or the document type.
937 *
938 * @see canSaveChanges (SaveCapability)
939 * @since 0.15 (KDE 4.9)
940 */
942 SaveFormsCapability = 1, ///< Can save form changes
943 SaveAnnotationsCapability = 2 ///< Can save annotation changes
944 };
945
946 /**
947 * Returns whether it's possible to save a given category of changes to
948 * another document.
949 *
950 * @since 0.15 (KDE 4.9)
951 */
952 bool canSaveChanges(SaveCapability cap) const;
953
954 /**
955 * Returns whether the changes to the document (modified annotations,
956 * values in form fields, etc) can be saved to another document.
957 *
958 * Equivalent to the logical OR of canSaveChanges(SaveCapability) for
959 * each capability.
960 *
961 * @since 0.7 (KDE 4.1)
962 */
963 bool canSaveChanges() const;
964
965 /**
966 * Save the document and the optional changes to it to the specified
967 * @p fileName.
968 *
969 * @since 0.7 (KDE 4.1)
970 */
971 bool saveChanges(const QString &fileName);
972
973 /**
974 * Save the document and the optional changes to it to the specified
975 * @p fileName and returns a @p errorText if fails.
976 *
977 * @since 0.10 (KDE 4.4)
978 */
979 bool saveChanges(const QString &fileName, QString *errorText);
980
981 /**
982 * Register the specified @p view for the current document.
983 *
984 * It is unregistered from the previous document, if any.
985 *
986 * @since 0.7 (KDE 4.1)
987 */
988 void registerView(View *view);
989
990 /**
991 * Unregister the specified @p view from the current document.
992 *
993 * @since 0.7 (KDE 4.1)
994 */
995 void unregisterView(View *view);
996
997 /**
998 * Gets the font data for the given font
999 *
1000 * @since 0.8 (KDE 4.2)
1001 */
1002 QByteArray fontData(const FontInfo &font) const;
1003
1004 /**
1005 * Opens a document archive.
1006 *
1007 * @since 0.20 (KDE 4.14)
1008 */
1009 OpenResult openDocumentArchive(const QString &docFile, const QUrl &url, const QString &password = QString());
1010
1011 /**
1012 * Saves a document archive.
1013 *
1014 * @since 0.8 (KDE 4.2)
1015 */
1016 bool saveDocumentArchive(const QString &fileName);
1017
1018 /**
1019 * Extract the document file from the current archive.
1020 *
1021 * @warning This function only works if the current file is a document archive
1022 *
1023 * @since 1.3
1024 */
1025 bool extractArchivedFile(const QString &destFileName);
1026
1027 /**
1028 * Asks the generator to dynamically generate a SourceReference for a given
1029 * page number and absolute X and Y position on this page.
1030 *
1031 * @attention Ownership of the returned SourceReference is transferred to the caller.
1032 * @note This method does not call processSourceReference( const SourceReference * )
1033 *
1034 * @since 0.10 (KDE 4.4)
1035 */
1036 const SourceReference *dynamicSourceReference(int pageNr, double absX, double absY);
1037
1038 /**
1039 * Returns the orientation of the document (for printing purposes). This
1040 * is used in the KPart to initialize the print dialog and in the
1041 * generators to check whether the document needs to be rotated or not.
1042 *
1043 * @since 0.14 (KDE 4.8)
1044 */
1045 QPageLayout::Orientation orientation() const;
1046
1047 /**
1048 * Control annotation editing (creation, modification and removal),
1049 * which is enabled by default.
1050 *
1051 * @since 0.15 (KDE 4.9)
1052 */
1053 void setAnnotationEditingEnabled(bool enable);
1054
1055 /**
1056 * Returns which wallet data to use to read/write the password for the given fileName
1057 *
1058 * @since 0.20 (KDE 4.14)
1059 */
1060 void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const;
1061
1062 /**
1063 * Since version 0.21, okular does not allow editing annotations and
1064 * form data if they are stored in the docdata directory (like older
1065 * okular versions did by default).
1066 * If this flag is set, then annotations and forms cannot be edited.
1067 *
1068 * @since 1.3
1069 */
1070 bool isDocdataMigrationNeeded() const;
1071
1072 /**
1073 * Delete annotations and form data from the docdata folder. Call it if
1074 * isDocdataMigrationNeeded() was true and you've just saved them to an
1075 * external file.
1076 *
1077 * @since 1.3
1078 */
1079 void docdataMigrationDone();
1080
1081 /**
1082 * Returns the model for rendering layers (NULL if the document has no layers)
1083 *
1084 * @since 0.24
1085 */
1086 QAbstractItemModel *layersModel() const;
1087
1088 /**
1089 * Returns the reason why the file opening failed, if any.
1090 *
1091 * @since 1.10
1092 */
1093 QString openError() const;
1094
1095 /**
1096 * Digitally sign document
1097 *
1098 * @since 21.04
1099 */
1100 bool sign(const NewSignatureData &data, const QString &newPath);
1101
1102 /**
1103 * Returns the generator's certificate store (if any)
1104 *
1105 * @since 21.04
1106 */
1107 CertificateStore *certificateStore() const;
1108
1109 /** sets the editor command to the command \p editCmd, as
1110 * given at the commandline.
1111 *
1112 * @since 22.04
1113 */
1114 void setEditorCommandOverride(const QString &editCmd);
1115
1116 /** returns the overriding editor command.
1117 *
1118 * If the editor command was not overriden, the string is empty.
1119 *
1120 * @since 22.04
1121 */
1122 QString editorCommandOverride() const;
1123
1124public Q_SLOTS:
1125 /**
1126 * This slot is called whenever the user changes the @p rotation of
1127 * the document.
1128 */
1129 void setRotation(int rotation);
1130
1131 /**
1132 * This slot is called whenever the user changes the page @p size
1133 * of the document.
1134 */
1135 void setPageSize(const Okular::PageSize &size);
1136
1137 /**
1138 * Cancels the current search
1139 */
1140 void cancelSearch();
1141
1142 /**
1143 * Undo last edit command
1144 * @since 0.17 (KDE 4.11)
1145 */
1146 void undo();
1147
1148 /**
1149 * Redo last undone edit command
1150 * @since 0.17 (KDE 4.11)
1151 */
1152 void redo();
1153
1154 /**
1155 * Edit the text contents of the specified @p form on page @p page to be @p newContents.
1156 * The new text cursor position (@p newCursorPos), previous text cursor position (@p prevCursorPos),
1157 * and previous cursor anchor position will be restored by the undo / redo commands.
1158 * @since 0.17 (KDE 4.11)
1159 *
1160 * @deprecated use editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents,
1161 * int newCursorPos, int prevCursorPos, int prevAnchorPos, const QString &oldContents)
1162 */
1163 OKULARCORE_DEPRECATED void editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos);
1164
1165 /**
1166 * Edit the text contents of the specified @p form on page @p page to be @p newContents where
1167 * previous contents are @p oldContents for undo/redo commands. The new text cursor position (@p newCursorPos),
1168 * previous text cursor position (@p prevCursorPos), and previous cursor anchor position will be restored by the undo / redo commands.
1169 * @since 24.08
1170 */
1171 void editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos, const QString &oldContents);
1172
1173 /**
1174 * Edit the selected list entries in @p form on page @p page to be @p newChoices.
1175 * @since 0.17 (KDE 4.11)
1176 */
1177 void editFormList(int pageNumber, Okular::FormFieldChoice *form, const QList<int> &newChoices);
1178
1179 /**
1180 * Set the active choice in the combo box @p form on page @p page to @p newText
1181 * The new cursor position (@p newCursorPos), previous cursor position
1182 * (@p prevCursorPos), and previous anchor position (@p prevAnchorPos)
1183 * will be restored by the undo / redo commands.
1184 *
1185 * @since 0.17 (KDE 4.11)
1186 */
1187 void editFormCombo(int pageNumber, Okular::FormFieldChoice *form, const QString &newText, int newCursorPos, int prevCursorPos, int prevAnchorPos);
1188
1189 /**
1190 * Set the states of the group of form buttons @p formButtons on page @p page to @p newButtonStates.
1191 * The lists @p formButtons and @p newButtonStates should be the same length and true values
1192 * in @p newButtonStates indicate that the corresponding entry in @p formButtons should be enabled.
1193 */
1194 void editFormButtons(int pageNumber, const QList<Okular::FormFieldButton *> &formButtons, const QList<bool> &newButtonStates);
1195
1196 /**
1197 * Reloads the pixmaps for whole document
1198 *
1199 * @since 0.24
1200 */
1201 void reloadDocument() const;
1202
1203 /**
1204 * Returns the part of document covered by the given signature @p info.
1205 *
1206 * @since 1.7
1207 */
1208 QByteArray requestSignedRevisionData(const Okular::SignatureInfo &info);
1209
1210 /**
1211 * Refresh the pixmaps for the given @p pageNumber.
1212 *
1213 * @since 1.10
1214 */
1215 void refreshPixmaps(int pageNumber);
1216
1217Q_SIGNALS:
1218 /**
1219 * This signal is emitted whenever the document is about to close.
1220 * @since 1.5.3
1221 */
1223
1224 /**
1225 * This signal is emitted whenever an action requests a
1226 * document close operation.
1227 */
1228 void close();
1229
1230 /**
1231 * This signal is emitted whenever an action requests a
1232 * document print operation.
1233 * @since 22.04
1234 */
1236
1237 /**
1238 * This signal is emitted whenever an action requests a
1239 * document save as operation.
1240 * @since 22.04
1241 */
1243
1244 /**
1245 * This signal is emitted whenever an action requests an
1246 * application quit operation.
1247 */
1248 void quit();
1249
1250 /**
1251 * This signal is emitted whenever an action requests a
1252 * find operation.
1253 */
1254 void linkFind();
1255
1256 /**
1257 * This signal is emitted whenever an action requests a
1258 * goto operation.
1259 */
1261
1262 /**
1263 * This signal is emitted whenever an action requests a
1264 * start presentation operation.
1265 */
1267
1268 /**
1269 * This signal is emitted whenever an action requests an
1270 * end presentation operation.
1271 */
1273
1274 /**
1275 * This signal is emitted whenever an action requests an
1276 * open url operation for the given document @p url.
1277 */
1278 void openUrl(const QUrl &url);
1279
1280 /**
1281 * This signal is emitted whenever an error occurred.
1282 *
1283 * @param text The description of the error.
1284 * @param duration The time in milliseconds the message should be shown to the user.
1285 */
1286 void error(const QString &text, int duration);
1287
1288 /**
1289 * This signal is emitted to signal a warning.
1290 *
1291 * @param text The description of the warning.
1292 * @param duration The time in milliseconds the message should be shown to the user.
1293 */
1294 void warning(const QString &text, int duration);
1295
1296 /**
1297 * This signal is emitted to signal a notice.
1298 *
1299 * @param text The description of the notice.
1300 * @param duration The time in milliseconds the message should be shown to the user.
1301 */
1302 void notice(const QString &text, int duration);
1303
1304 /**
1305 * Emitted when a new font is found during the reading of the fonts of
1306 * the document.
1307 */
1308 void gotFont(const Okular::FontInfo &font);
1309
1310 /**
1311 * Reports the progress when reading the fonts in the document.
1312 *
1313 * \param page is the page that was just finished to scan for fonts
1314 */
1315 void fontReadingProgress(int page);
1316
1317 /**
1318 * Reports that the reading of the fonts in the document is finished.
1319 */
1321
1322 /**
1323 * Reports that the current search finished
1324 */
1325 void searchFinished(int searchID, Okular::Document::SearchStatus endStatus);
1326
1327 /**
1328 * This signal is emitted whenever a source reference with the given parameters has been
1329 * activated.
1330 *
1331 * \param absFileName absolute name of the file.
1332 * \param line line number.
1333 * \param col column number.
1334 * \param handled should be set to 'true' if a slot handles this source reference; the
1335 * default action to launch the configured editor will then not be performed
1336 * by the document
1337 *
1338 * @since 0.14 (KDE 4.8)
1339 */
1340 void sourceReferenceActivated(const QString &absFileName, int line, int col, bool *handled);
1341
1342 /**
1343 * This signal is emitted whenever an movie action is triggered and the UI should process it.
1344 */
1346
1347 /**
1348 * This signal is emitted whenever the availability of the undo function changes
1349 * @since 0.17 (KDE 4.11)
1350 */
1351 void canUndoChanged(bool undoAvailable);
1352
1353 /**
1354 * This signal is emitted whenever the availability of the redo function changes
1355 * @since 0.17 (KDE 4.11)
1356 */
1357 void canRedoChanged(bool redoAvailable);
1358
1359 /**
1360 * This signal is emitted whenever the undo history is clean (i.e. the same status the last time it was saved)
1361 * @since 1.3
1362 */
1363 void undoHistoryCleanChanged(bool clean);
1364
1365 /**
1366 * This signal is emitted whenever an rendition action is triggered and the UI should process it.
1367 *
1368 * @since 0.16 (KDE 4.10)
1369 */
1371
1372 /**
1373 * This signal is emitted whenever the contents of the given @p annotation are changed by an undo
1374 * or redo action.
1375 *
1376 * The new contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are
1377 * included
1378 * @since 0.17 (KDE 4.11)
1379 */
1380 void annotationContentsChangedByUndoRedo(Okular::Annotation *annotation, const QString &contents, int cursorPos, int anchorPos);
1381
1382 /**
1383 * This signal is emitted whenever the text contents of the given text @p form on the given @p page
1384 * are changed by an undo or redo action.
1385 *
1386 * The new text contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are
1387 * included
1388 * @since 0.17 (KDE 4.11)
1389 */
1390 void formTextChangedByUndoRedo(int page, Okular::FormFieldText *form, const QString &contents, int cursorPos, int anchorPos);
1391
1392 /**
1393 * This signal is emitted whenever the selected @p choices for the given list @p form on the
1394 * given @p page are changed by an undo or redo action.
1395 * @since 0.17 (KDE 4.11)
1396 */
1397 void formListChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QList<int> &choices);
1398
1399 /**
1400 * This signal is emitted whenever the active @p text for the given combo @p form on the
1401 * given @p page is changed by an undo or redo action.
1402 * @since 0.17 (KDE 4.11)
1403 */
1404 void formComboChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QString &text, int cursorPos, int anchorPos);
1405
1406 /**
1407 * This signal is emitted whenever the state of the specified group of form buttons (@p formButtons) on the
1408 * given @p page is changed by an undo or redo action.
1409 * @since 0.17 (KDE 4.11)
1410 */
1412
1413 /**
1414 * This signal is emitted whenever a FormField was changed programmatically and the
1415 * according widget should be updated.
1416 * @since 1.4
1417 */
1419
1420private:
1421 /// @cond PRIVATE
1422 friend class DocumentPrivate;
1423 friend class ::DocumentItem;
1424 friend class EditAnnotationContentsCommand;
1425 friend class EditFormTextCommand;
1426 friend class EditFormListCommand;
1427 friend class EditFormComboCommand;
1428 friend class EditFormButtonsCommand;
1429 /// @endcond
1430 DocumentPrivate *const d;
1431
1432 Q_DISABLE_COPY(Document)
1433};
1434
1435/**
1436 * @short A view on the document.
1437 *
1438 * The Viewport structure is the 'current view' over the document. Contained
1439 * data is broadcasted between observers to synchronize their viewports to get
1440 * the 'I scroll one view and others scroll too' views.
1441 */
1442class OKULARCORE_EXPORT DocumentViewport
1443{
1444public:
1445 /**
1446 * Creates a new viewport for the given page @p number.
1447 */
1448 explicit DocumentViewport(int number = -1);
1449
1450 /**
1451 * Creates a new viewport from the given @p xmlDesc.
1452 */
1453 explicit DocumentViewport(const QString &xmlDesc);
1454
1455 /**
1456 * Returns the viewport as xml description.
1457 */
1458 QString toString() const;
1459
1460 /**
1461 * Returns whether the viewport is valid.
1462 */
1463 bool isValid() const;
1464
1465 /**
1466 * @internal
1467 */
1468 bool operator==(const DocumentViewport &other) const;
1469 bool operator<(const DocumentViewport &other) const;
1470
1471 /**
1472 * The number of the page nearest the center of the viewport.
1473 */
1475
1476 /**
1477 * Describes the relative position of the viewport.
1478 */
1480 Center = 1, ///< Relative to the center of the page.
1481 TopLeft = 2 ///< Relative to the top left corner of the page.
1483
1484 /**
1485 * If 'rePos.enabled == true' then this structure contains the
1486 * viewport center or top left depending on the value of pos.
1487 */
1488 struct {
1489 bool enabled;
1490 double normalizedX;
1491 double normalizedY;
1492 Position pos;
1493 } rePos;
1494
1495 /**
1496 * If 'autoFit.enabled == true' then the page must be autofit in the viewport.
1497 */
1498 struct {
1499 bool enabled;
1500 bool width;
1501 bool height;
1502 } autoFit;
1503};
1504
1505/**
1506 * @short A DOM tree that describes the Table of Contents.
1507 *
1508 * The Synopsis (TOC or Table Of Contents for friends) is represented via
1509 * a dom tree where each node has an internal name (displayed in the TOC)
1510 * and one or more attributes.
1511 *
1512 * In the tree the tag name is the 'screen' name of the entry. A tag can have
1513 * attributes. Here follows the list of tag attributes with meaning:
1514 * - Destination: A string description of the referred viewport
1515 * - DestinationName: A 'named reference' to the viewport that must be converted
1516 * using metaData( "NamedViewport", viewport_name )
1517 * - ExternalFileName: A document to be opened, whose destination is specified
1518 * with Destination or DestinationName
1519 * - Open: a boolean saying whether its TOC branch is open or not (default: false)
1520 * - URL: a URL to be open as destination; if set, no other Destination* or
1521 * ExternalFileName entry is used
1522 */
1523class OKULARCORE_EXPORT DocumentSynopsis : public QDomDocument
1524{
1525public:
1526 /**
1527 * Creates a new document synopsis object.
1528 */
1530
1531 /**
1532 * Creates a new document synopsis object with the given
1533 * @p document as parent node.
1534 */
1535 explicit DocumentSynopsis(const QDomDocument &document);
1536};
1537
1538/**
1539 * @short An embedded file into the document.
1540 *
1541 * This class represents a sort of interface of an embedded file in a document.
1542 *
1543 * Generators \b must re-implement its members to give the all the information
1544 * about an embedded file, like its name, its description, the date of creation
1545 * and modification, and the real data of the file.
1546 */
1547class OKULARCORE_EXPORT EmbeddedFile
1548{
1549public:
1550 /**
1551 * Creates a new embedded file.
1552 */
1553 EmbeddedFile();
1554
1555 /**
1556 * Destroys the embedded file.
1557 */
1558 virtual ~EmbeddedFile();
1559
1560 EmbeddedFile(const EmbeddedFile &) = delete;
1561 EmbeddedFile &operator=(const EmbeddedFile &) = delete;
1562
1563 /**
1564 * Returns the name of the file
1565 */
1566 virtual QString name() const = 0;
1567
1568 /**
1569 * Returns the description of the file, or an empty string if not
1570 * available
1571 */
1572 virtual QString description() const = 0;
1573
1574 /**
1575 * Returns the real data representing the file contents
1576 */
1577 virtual QByteArray data() const = 0;
1578
1579 /**
1580 * Returns the size (in bytes) of the file, if available, or -1 otherwise.
1581 *
1582 * @note this method should be a fast way to know the size of the file
1583 * with no need to extract all the data from it
1584 */
1585 virtual int size() const = 0;
1586
1587 /**
1588 * Returns the modification date of the file, or an invalid date
1589 * if not available
1590 */
1591 virtual QDateTime modificationDate() const = 0;
1592
1593 /**
1594 * Returns the creation date of the file, or an invalid date
1595 * if not available
1596 */
1597 virtual QDateTime creationDate() const = 0;
1598};
1599
1600/**
1601 * @short An area of a specified page
1602 */
1603class OKULARCORE_EXPORT VisiblePageRect
1604{
1605public:
1606 /**
1607 * Creates a new visible page rectangle.
1608 *
1609 * @param pageNumber The page number where the rectangle is located.
1610 * @param rectangle The rectangle in normalized coordinates.
1611 */
1612 explicit VisiblePageRect(int pageNumber = -1, const NormalizedRect &rectangle = NormalizedRect());
1613
1614 /**
1615 * The page number where the rectangle is located.
1616 */
1618
1619 /**
1620 * The rectangle in normalized coordinates.
1621 */
1623};
1624
1625/**
1626 * @short Data needed to create a new signature
1627 *
1628 * @since 21.04
1629 */
1630class OKULARCORE_EXPORT NewSignatureData
1631{
1632public:
1635 NewSignatureData(const NewSignatureData &) = delete;
1636 NewSignatureData &operator=(const NewSignatureData &) = delete;
1637
1638 QString certNickname() const;
1639 void setCertNickname(const QString &certNickname);
1640
1641 QString certSubjectCommonName() const;
1642 void setCertSubjectCommonName(const QString &certSubjectCommonName);
1643
1644 QString password() const;
1645 void setPassword(const QString &password);
1646
1647 int page() const;
1648 void setPage(int page);
1649
1650 NormalizedRect boundingRectangle() const;
1651 void setBoundingRectangle(const NormalizedRect &rect);
1652
1653 /// @since 22.04
1654 QString documentPassword() const;
1655
1656 /// @since 22.04
1657 void setDocumentPassword(const QString &password);
1658
1659 /// @since 23.08
1660 QString reason() const;
1661
1662 /// @since 23.08
1663 void setReason(const QString &reason);
1664
1665 /// @since 23.08
1666 QString location() const;
1667
1668 /// @since 23.08
1669 void setLocation(const QString &location);
1670
1671 /// @since 23.08
1672 QString backgroundImagePath() const;
1673
1674 /// @since 23.08
1675 void setBackgroundImagePath(const QString &path);
1676
1677private:
1678 NewSignatureDataPrivate *const d;
1679};
1680
1681}
1682
1683Q_DECLARE_METATYPE(Okular::DocumentInfo::Key)
1684Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::Document::PixmapRequestFlags)
1685
1686#endif
1687
1688/* 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:1524
A view on the document.
Definition document.h:1443
int pageNumber
The number of the page nearest the center of the viewport.
Definition document.h:1474
Position
Describes the relative position of the viewport.
Definition document.h:1479
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:941
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:832
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:813
@ NativePrinting
Native Cross-Platform Printing.
Definition document.h:815
@ NoPrinting
Printing Not Supported.
Definition document.h:814
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:1548
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:1631
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:1604
NormalizedRect rect
The rectangle in normalized coordinates.
Definition document.h:1622
int pageNumber
The page number where the rectangle is located.
Definition document.h:1617
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 Oct 11 2024 12:08:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.