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

KDE's Doxygen guidelines are available online.