2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2004-2005 Enrico Ros <eros.kde@email.it>
|
|
|
|
SPDX-FileCopyrightText: 2004-2008 Albert Astals Cid <aacid@kde.org>
|
2021-06-03 18:33:18 +00:00
|
|
|
|
|
|
|
Work sponsored by the LiMux project of the city of Munich:
|
2021-05-24 11:41:08 +00:00
|
|
|
SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <info@kdab.com>
|
2021-05-24 07:25:56 +00:00
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#ifndef _OKULAR_DOCUMENT_H_
|
|
|
|
#define _OKULAR_DOCUMENT_H_
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2011-06-01 08:31:44 +00:00
|
|
|
#include "area.h"
|
|
|
|
#include "global.h"
|
2014-10-27 21:35:06 +00:00
|
|
|
#include "okularcore_export.h"
|
2011-06-01 08:31:44 +00:00
|
|
|
#include "pagesize.h"
|
2006-05-08 20:12:04 +00:00
|
|
|
|
2018-08-31 09:23:45 +00:00
|
|
|
#include <QDomDocument>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPrinter>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QVector>
|
2006-09-21 08:45:36 +00:00
|
|
|
|
2014-09-11 13:18:05 +00:00
|
|
|
#include <QMimeType>
|
2015-01-29 19:55:57 +00:00
|
|
|
#include <QUrl>
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2007-01-28 15:46:10 +00:00
|
|
|
class KConfigDialog;
|
2015-11-28 19:24:41 +00:00
|
|
|
class KPluginMetaData;
|
2007-08-28 23:17:00 +00:00
|
|
|
class KXMLGUIClient;
|
2013-02-24 21:58:53 +00:00
|
|
|
class DocumentItem;
|
2015-05-27 13:56:56 +00:00
|
|
|
class QAbstractItemModel;
|
2006-09-21 08:45:36 +00:00
|
|
|
|
|
|
|
namespace Okular
|
|
|
|
{
|
|
|
|
class Annotation;
|
2006-12-27 16:04:49 +00:00
|
|
|
class BookmarkManager;
|
2020-01-17 00:42:22 +00:00
|
|
|
class CertificateStore;
|
2014-05-11 09:17:49 +00:00
|
|
|
class DocumentInfoPrivate;
|
2006-09-21 08:45:36 +00:00
|
|
|
class DocumentObserver;
|
2007-04-14 19:44:07 +00:00
|
|
|
class DocumentPrivate;
|
2006-09-21 08:45:36 +00:00
|
|
|
class DocumentSynopsis;
|
|
|
|
class DocumentViewport;
|
|
|
|
class EmbeddedFile;
|
2006-10-25 15:35:53 +00:00
|
|
|
class ExportFormat;
|
2007-07-07 20:35:01 +00:00
|
|
|
class FontInfo;
|
2018-02-21 22:56:43 +00:00
|
|
|
class FormField;
|
2013-06-03 20:46:41 +00:00
|
|
|
class FormFieldText;
|
|
|
|
class FormFieldButton;
|
|
|
|
class FormFieldChoice;
|
2006-09-21 08:45:36 +00:00
|
|
|
class Generator;
|
2007-04-20 12:37:12 +00:00
|
|
|
class Action;
|
2012-04-03 12:18:10 +00:00
|
|
|
class MovieAction;
|
2006-09-21 08:45:36 +00:00
|
|
|
class Page;
|
|
|
|
class PixmapRequest;
|
2012-09-27 12:15:04 +00:00
|
|
|
class RenditionAction;
|
2020-10-29 16:14:05 +00:00
|
|
|
class NewSignatureData;
|
|
|
|
struct NewSignatureDataPrivate;
|
2006-11-17 22:15:15 +00:00
|
|
|
class SourceReference;
|
2008-04-27 11:05:59 +00:00
|
|
|
class View;
|
2006-06-23 21:11:52 +00:00
|
|
|
class VisiblePageRect;
|
2019-01-05 22:30:25 +00:00
|
|
|
class SignatureInfo;
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2006-05-28 15:54:48 +00:00
|
|
|
/** IDs for seaches. Globally defined here. **/
|
|
|
|
#define PART_SEARCH_ID 1
|
|
|
|
#define PAGEVIEW_SEARCH_ID 2
|
|
|
|
#define SW_SEARCH_ID 3
|
2007-03-17 22:58:41 +00:00
|
|
|
#define PRESENTATION_SEARCH_ID 4
|
2006-05-28 15:54:48 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* The DocumentInfo structure can be filled in by generators to display
|
|
|
|
* metadata about the currently opened file.
|
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT DocumentInfo
|
2014-05-11 09:17:49 +00:00
|
|
|
{
|
|
|
|
friend class Document;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* The list of predefined keys.
|
|
|
|
*/
|
|
|
|
enum Key {
|
|
|
|
Title, ///< The title of the document
|
|
|
|
Subject, ///< The subject of the document
|
|
|
|
Description, ///< The description of the document
|
|
|
|
Author, ///< The author of the document
|
|
|
|
Creator, ///< The creator of the document (this can be different from the author)
|
|
|
|
Producer, ///< The producer of the document (e.g. some software)
|
|
|
|
Copyright, ///< The copyright of the document
|
|
|
|
Pages, ///< The number of pages of the document
|
|
|
|
CreationDate, ///< The date of creation of the document
|
|
|
|
ModificationDate, ///< The date of last modification of the document
|
|
|
|
MimeType, ///< The mime type of the document
|
|
|
|
Category, ///< The category of the document
|
|
|
|
Keywords, ///< The keywords which describe the content of the document
|
|
|
|
FilePath, ///< The path of the file @since 0.10 (KDE 4.4)
|
|
|
|
DocumentSize, ///< The size of the document @since 0.10 (KDE 4.4)
|
|
|
|
PagesSize, ///< The size of the pages (if all pages have the same size) @since 0.10 (KDE 4.4)
|
|
|
|
CustomKeys, ///< All the custom keys the generator supports @since 0.21
|
|
|
|
Invalid ///< An invalid key @since 0.21. It will always be the last element in the enum
|
|
|
|
};
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Creates a new document info.
|
|
|
|
*/
|
|
|
|
DocumentInfo();
|
|
|
|
DocumentInfo(const DocumentInfo &info);
|
|
|
|
DocumentInfo &operator=(const DocumentInfo &);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
~DocumentInfo();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns all the keys present in this DocumentInfo
|
|
|
|
*
|
|
|
|
* @since 0.21
|
|
|
|
*/
|
|
|
|
QStringList keys() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the value for a given key or an null string when the
|
|
|
|
* key doesn't exist.
|
|
|
|
*/
|
|
|
|
QString get(Key key) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the value for a given key or an null string when the
|
|
|
|
* key doesn't exist.
|
|
|
|
*/
|
|
|
|
QString get(const QString &key) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Sets a value for a custom key. The title should be an i18n'ed
|
|
|
|
* string, since it's used in the document information dialog.
|
|
|
|
*/
|
|
|
|
void set(const QString &key, const QString &value, const QString &title = QString());
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Sets a value for a special key. The title should be an i18n'ed
|
|
|
|
* string, since it's used in the document information dialog.
|
|
|
|
*/
|
|
|
|
void set(Key key, const QString &value);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the user visible string for the given key
|
|
|
|
* Takes into account keys added by the set() that takes a QString
|
|
|
|
*
|
|
|
|
* @since 0.21
|
|
|
|
*/
|
|
|
|
QString getKeyTitle(const QString &key) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the internal string for the given key
|
|
|
|
* @since 0.10 (KDE 4.4)
|
|
|
|
*/
|
|
|
|
static QString getKeyString(Key key);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the user visible string for the given key
|
|
|
|
* @since 0.10 (KDE 4.4)
|
|
|
|
*/
|
|
|
|
static QString getKeyTitle(Key key);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the Key from a string key
|
|
|
|
* @since 0.21
|
|
|
|
*/
|
|
|
|
static Key getKeyFromString(const QString &key);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
private:
|
|
|
|
DocumentInfoPrivate *d;
|
|
|
|
};
|
|
|
|
|
2004-09-08 12:41:14 +00:00
|
|
|
/**
|
2004-12-11 17:25:03 +00:00
|
|
|
* @short The Document. Heart of everything. Actions take place here.
|
2004-09-08 12:41:14 +00:00
|
|
|
*
|
2006-09-21 08:45:36 +00:00
|
|
|
* The Document is the main object in Okular. All views query the Document to
|
2004-12-11 17:25:03 +00:00
|
|
|
* get data/properties or even for accessing pages (in a 'const' way).
|
|
|
|
*
|
|
|
|
* It is designed to keep it detached from the document type (pdf, ps, you
|
2014-08-10 17:08:13 +00:00
|
|
|
* name it..) so whenever you want to get some data, it asks its internal
|
2018-11-14 19:12:15 +00:00
|
|
|
* generators to do the job and return results in a format-independent way.
|
2004-12-11 17:25:03 +00:00
|
|
|
*
|
|
|
|
* Apart from the generator (the currently running one) the document stores
|
2006-09-21 08:45:36 +00:00
|
|
|
* all the Pages ('Page' class) of the current document in a vector and
|
2004-12-11 17:25:03 +00:00
|
|
|
* notifies all the registered DocumentObservers when some content changes.
|
|
|
|
*
|
2014-08-10 17:08:13 +00:00
|
|
|
* For a better understanding of hierarchies @see README.internals.png
|
2006-09-21 08:45:36 +00:00
|
|
|
* @see DocumentObserver, Page
|
2004-09-08 12:41:14 +00:00
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT Document : public QObject
|
2004-09-08 12:41:14 +00:00
|
|
|
{
|
2004-12-22 18:21:36 +00:00
|
|
|
Q_OBJECT
|
2007-01-02 22:37:55 +00:00
|
|
|
|
2004-11-09 17:20:19 +00:00
|
|
|
public:
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-03-30 17:46:50 +00:00
|
|
|
* Creates a new document with the given @p widget as widget to relay GUI things (messageboxes, ...).
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-04-15 19:11:10 +00:00
|
|
|
explicit Document(QWidget *widget);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Destroys the document.
|
|
|
|
*/
|
2019-12-18 11:51:13 +00:00
|
|
|
~Document() override;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-09 17:56:16 +00:00
|
|
|
/**
|
|
|
|
* Describes the result of an open document operation.
|
|
|
|
* @since 0.20 (KDE 4.14)
|
|
|
|
*/
|
|
|
|
enum OpenResult {
|
|
|
|
OpenSuccess, //< The document was opened successfully
|
|
|
|
OpenError, //< The document failed to open
|
|
|
|
OpenNeedsPassword //< The document needs a password to be opened or the one provided is not the correct
|
|
|
|
};
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Opens the document.
|
2014-05-09 17:56:16 +00:00
|
|
|
* @since 0.20 (KDE 4.14)
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2015-01-29 19:55:57 +00:00
|
|
|
OpenResult openDocument(const QString &docFile, const QUrl &url, const QMimeType &mime, const QString &password = QString());
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Closes the document.
|
|
|
|
*/
|
2004-11-09 17:20:19 +00:00
|
|
|
void closeDocument();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Registers a new @p observer for the document.
|
|
|
|
*/
|
|
|
|
void addObserver(DocumentObserver *observer);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Unregisters the given @p observer for the document.
|
|
|
|
*/
|
|
|
|
void removeObserver(DocumentObserver *observer);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Reparses and applies the configuration.
|
|
|
|
*/
|
|
|
|
void reparseConfig();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the document is currently opened.
|
|
|
|
*/
|
2005-01-15 01:08:35 +00:00
|
|
|
bool isOpened() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2014-05-11 09:17:49 +00:00
|
|
|
* Returns the meta data of the document.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2014-05-11 09:17:49 +00:00
|
|
|
DocumentInfo documentInfo() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-11 09:17:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the asked set of meta data of the document. The result may contain more
|
|
|
|
* metadata than the one asked for.
|
|
|
|
*/
|
|
|
|
DocumentInfo documentInfo(const QSet<DocumentInfo::Key> &keys) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the table of content of the document or 0 if no
|
|
|
|
* table of content is available.
|
|
|
|
*/
|
2004-12-11 17:25:03 +00:00
|
|
|
const DocumentSynopsis *documentSynopsis() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-07-15 13:54:36 +00:00
|
|
|
* Starts the reading of the information about the fonts in the
|
2007-07-07 20:35:01 +00:00
|
|
|
* document, if available.
|
|
|
|
*
|
|
|
|
* The results as well the end of the reading is notified using the
|
|
|
|
* signals gotFont(), fontReadingProgress() and fontReadingEnded()
|
|
|
|
*/
|
|
|
|
void startFontReading();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-08 21:22:37 +00:00
|
|
|
/**
|
2007-07-15 13:54:36 +00:00
|
|
|
* Force the termination of the reading of the information about the
|
2007-07-08 21:22:37 +00:00
|
|
|
* fonts in the document, if running.
|
|
|
|
*/
|
|
|
|
void stopFontReading();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
/**
|
|
|
|
* Whether the current document can provide information about the
|
|
|
|
* fonts used in it.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-07-07 20:35:01 +00:00
|
|
|
bool canProvideFontInformation() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2019-08-25 00:04:19 +00:00
|
|
|
/**
|
|
|
|
* Whether the current document can perform digital signing.
|
|
|
|
*/
|
|
|
|
bool canSign() const;
|
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the list of embedded files or 0 if no embedded files
|
|
|
|
* are available.
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
const QList<EmbeddedFile *> *embeddedFiles() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the page object for the given page @p number or 0
|
|
|
|
* if the number is out of range.
|
|
|
|
*/
|
|
|
|
const Page *page(int number) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the current viewport of the document.
|
|
|
|
*/
|
2005-01-09 23:37:07 +00:00
|
|
|
const DocumentViewport &viewport() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Sets the list of visible page rectangles.
|
|
|
|
* @see VisiblePageRect
|
|
|
|
*/
|
2017-09-05 21:27:18 +00:00
|
|
|
void setVisiblePageRects(const QVector<VisiblePageRect *> &visiblePageRects, DocumentObserver *excludeObserver = nullptr);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the list of visible page rectangles.
|
|
|
|
*/
|
|
|
|
const QVector<VisiblePageRect *> &visiblePageRects() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of the current page.
|
|
|
|
*/
|
2004-11-09 17:20:19 +00:00
|
|
|
uint currentPage() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of pages of the document.
|
|
|
|
*/
|
2004-11-09 17:20:19 +00:00
|
|
|
uint pages() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the url of the currently opened document.
|
|
|
|
*/
|
2015-01-29 19:55:57 +00:00
|
|
|
QUrl currentDocument() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-03-10 23:59:11 +00:00
|
|
|
* Returns whether the given @p action is allowed in the document.
|
|
|
|
* @see @ref Permission
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-03-10 23:59:11 +00:00
|
|
|
bool isAllowed(Permission action) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the document supports searching.
|
|
|
|
*/
|
2005-06-24 16:45:25 +00:00
|
|
|
bool supportsSearching() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-01-05 23:12:06 +00:00
|
|
|
* Returns whether the document supports the listing of page sizes.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-01-05 23:12:06 +00:00
|
|
|
bool supportsPageSizes() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-11-15 22:18:59 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the current document supports tiles
|
|
|
|
*
|
|
|
|
* @since 0.16 (KDE 4.10)
|
|
|
|
*/
|
|
|
|
bool supportsTiles() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-01-05 23:12:06 +00:00
|
|
|
* Returns the list of supported page sizes or an empty list if this
|
2007-01-02 22:37:55 +00:00
|
|
|
* feature is not available.
|
2007-01-05 23:12:06 +00:00
|
|
|
* @see supportsPageSizes()
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-01-05 23:12:06 +00:00
|
|
|
PageSize::List pageSizes() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the document supports the export to ASCII text.
|
|
|
|
*/
|
2006-07-01 22:17:53 +00:00
|
|
|
bool canExportToText() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Exports the document as ASCII text and saves it under @p fileName.
|
|
|
|
*/
|
2006-07-01 22:17:53 +00:00
|
|
|
bool exportToText(const QString &fileName) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the list of supported export formats.
|
|
|
|
* @see ExportFormat
|
|
|
|
*/
|
2006-10-25 15:35:53 +00:00
|
|
|
QList<ExportFormat> exportFormats() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Exports the document in the given @p format and saves it under @p fileName.
|
|
|
|
*/
|
2006-10-25 15:35:53 +00:00
|
|
|
bool exportTo(const QString &fileName, const ExportFormat &format) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the document history is at the begin.
|
|
|
|
*/
|
2005-01-27 17:31:07 +00:00
|
|
|
bool historyAtBegin() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the document history is at the end.
|
|
|
|
*/
|
2005-01-27 17:31:07 +00:00
|
|
|
bool historyAtEnd() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the meta data for the given @p key and @p option or an empty variant
|
|
|
|
* if the key doesn't exists.
|
|
|
|
*/
|
|
|
|
QVariant metaData(const QString &key, const QVariant &option = QVariant()) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the current rotation of the document.
|
|
|
|
*/
|
2007-01-05 17:09:47 +00:00
|
|
|
Rotation rotation() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* If all pages have the same size this method returns it, if the page sizes
|
|
|
|
* differ an empty size object is returned.
|
|
|
|
*/
|
2006-10-15 19:37:14 +00:00
|
|
|
QSizeF allPagesSize() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the size string for the given @p page or an empty string
|
|
|
|
* if the page is out of range.
|
|
|
|
*/
|
|
|
|
QString pageSizeString(int page) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-08-28 23:17:00 +00:00
|
|
|
* Returns the gui client of the generator, if it provides one.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-08-28 23:17:00 +00:00
|
|
|
KXMLGUIClient *guiClient();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Sets the current document viewport to the given @p page.
|
|
|
|
*
|
2018-10-19 06:00:06 +00:00
|
|
|
* @param page The number of the page.
|
2013-02-24 21:58:53 +00:00
|
|
|
* @param excludeObserver The observer ids which shouldn't be effected by this change.
|
2007-01-02 22:37:55 +00:00
|
|
|
* @param smoothMove Whether the move shall be animated smoothly.
|
|
|
|
*/
|
2017-09-05 21:27:18 +00:00
|
|
|
void setViewportPage(int page, DocumentObserver *excludeObserver = nullptr, bool smoothMove = false);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Sets the current document viewport to the given @p viewport.
|
|
|
|
*
|
2018-10-19 06:00:06 +00:00
|
|
|
* @param viewport The document viewport.
|
2013-02-24 21:58:53 +00:00
|
|
|
* @param excludeObserver The observer which shouldn't be effected by this change.
|
2007-01-02 22:37:55 +00:00
|
|
|
* @param smoothMove Whether the move shall be animated smoothly.
|
2020-08-16 14:21:35 +00:00
|
|
|
* @param updateHistory Whether to consider the change of viewport for the history navigation
|
|
|
|
*/
|
2023-05-12 10:39:41 +00:00
|
|
|
void setViewport(const DocumentViewport &viewport, DocumentObserver *excludeObserver = nullptr, bool smoothMove = false, bool updateHistory = true);
|
2020-08-16 14:21:35 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Sets the current document viewport to the next viewport in the
|
|
|
|
* viewport history.
|
|
|
|
*/
|
2005-01-27 17:31:07 +00:00
|
|
|
void setPrevViewport();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Sets the current document viewport to the previous viewport in the
|
|
|
|
* viewport history.
|
|
|
|
*/
|
2005-01-27 17:31:07 +00:00
|
|
|
void setNextViewport();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Sets the next @p viewport in the viewport history.
|
|
|
|
*/
|
|
|
|
void setNextDocumentViewport(const DocumentViewport &viewport);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2009-05-13 14:24:30 +00:00
|
|
|
/**
|
|
|
|
* Sets the next @p namedDestination in the viewport history.
|
|
|
|
*
|
|
|
|
* @since 0.9 (KDE 4.3)
|
|
|
|
*/
|
|
|
|
void setNextDocumentDestination(const QString &namedDestination);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-08 14:25:08 +00:00
|
|
|
/**
|
|
|
|
* Sets the zoom for the current document.
|
|
|
|
*/
|
2017-09-05 21:27:18 +00:00
|
|
|
void setZoom(int factor, DocumentObserver *excludeObserver = nullptr);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-03-07 15:50:48 +00:00
|
|
|
/**
|
|
|
|
* Describes the possible options for the pixmap requests.
|
|
|
|
*/
|
|
|
|
enum PixmapRequestFlag {
|
|
|
|
NoOption = 0, ///< No options
|
|
|
|
RemoveAllPrevious = 1 ///< Remove all the previous requests, even for non requested page pixmaps
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(PixmapRequestFlags, PixmapRequestFlag)
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Sends @p requests for pixmap generation.
|
2008-03-07 15:50:48 +00:00
|
|
|
*
|
|
|
|
* The same as requestPixmaps( requests, RemoveAllPrevious );
|
2022-03-19 00:00:01 +00:00
|
|
|
*
|
|
|
|
* @since 22.08
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2022-03-19 00:00:01 +00:00
|
|
|
void requestPixmaps(const QList<PixmapRequest *> &requests);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-03-07 15:50:48 +00:00
|
|
|
/**
|
|
|
|
* Sends @p requests for pixmap generation.
|
2008-03-07 16:12:48 +00:00
|
|
|
*
|
2018-10-19 06:00:06 +00:00
|
|
|
* @param requests the linked list of requests
|
2008-03-07 16:12:48 +00:00
|
|
|
* @param reqOptions the options for the request
|
|
|
|
*
|
2022-03-19 00:00:01 +00:00
|
|
|
* @since 22.08
|
2008-03-07 15:50:48 +00:00
|
|
|
*/
|
2022-03-19 00:00:01 +00:00
|
|
|
void requestPixmaps(const QList<PixmapRequest *> &requests, PixmapRequestFlags reqOptions);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Sends a request for text page generation for the given page @p pageNumber.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2019-12-20 15:40:59 +00:00
|
|
|
void requestTextPage(uint pageNumber);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Adds a new @p annotation to the given @p page.
|
|
|
|
*/
|
|
|
|
void addPageAnnotation(int page, Annotation *annotation);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-03-09 13:59:24 +00:00
|
|
|
/**
|
|
|
|
* Tests if the @p annotation can be modified
|
|
|
|
*
|
|
|
|
* @since 0.15 (KDE 4.9)
|
|
|
|
*/
|
|
|
|
bool canModifyPageAnnotation(const Annotation *annotation) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2013-04-05 22:22:48 +00:00
|
|
|
* Prepares to modify the properties of the given @p annotation.
|
|
|
|
* Must be called before the annotation's properties are modified
|
2012-05-13 22:50:41 +00:00
|
|
|
*
|
2013-04-05 22:22:48 +00:00
|
|
|
* @since 0.17 (KDE 4.11)
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2013-04-05 22:22:48 +00:00
|
|
|
void prepareToModifyAnnotationProperties(Annotation *annotation);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-05-13 22:50:41 +00:00
|
|
|
/**
|
|
|
|
* Modifies the given @p annotation on the given @p page.
|
2013-04-05 22:22:48 +00:00
|
|
|
* Must be preceded by a call to prepareToModifyAnnotationProperties before
|
|
|
|
* the annotation's properties are modified
|
2012-05-13 22:50:41 +00:00
|
|
|
*
|
2013-04-05 22:22:48 +00:00
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void modifyPageAnnotationProperties(int page, Annotation *annotation);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
|
|
|
* Translates the position of the given @p annotation on the given @p page by a distance @p delta in normalized coordinates.
|
2012-05-13 22:50:41 +00:00
|
|
|
*
|
2013-04-05 22:22:48 +00:00
|
|
|
* Consecutive translations applied to the same @p annotation are merged together on the undo stack if the
|
2018-10-18 19:04:49 +00:00
|
|
|
* BeingMoved flag is set on the @p annotation.
|
2013-04-05 22:22:48 +00:00
|
|
|
*
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void translatePageAnnotation(int page, Annotation *annotation, const Okular::NormalizedPoint &delta);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
Add annotation resize functionality
Usage:
If you left-click an annotation, it gets selected. Resize handles appear on the selection rectangle. When cursor is moved over one of the 8 resize handles on the corners/edges, the cursor shape changes to indicate resize mode. Everywhere else on the annotation means "move", just as it was before resize feature was added. Pressing ESC or clicking an area outside the annotation cancels a selection. Pressing Del deletes a selected annotation.
Feature is only applicable for annotation types AText, AStamp and AGeom.
Implementation:
It works by eventually changing AnnotationPrivate::m_boundary and notifying generator (i.e. poppler) about that change. Annotation state handling is shifted out of PageView into a new class MouseAnnotation (ui/pageviewmouseannotation.cpp). Some functionality not related to resizing but to annotation interaction in general is also shifted to class MouseAnnotation, to build a single place of responsiblity.
Other changes:
Add method Document::adjustPageAnnotation, backed by a QUndoCommand.
class Okular::AdjustAnnotationCommand.
Add Annotation::adjust and Annotation::canBeResized methods.
Draw resize handles in PagePainter::paintCroppedPageOnPainter.
Resize and move work
-for types AText, AStamp and AGeom
-on all pages of document
-when viewport position changes
-when zoom level changes
-for all page rotations (0°, 90°, 180°, 270°)
Selection is canceled
-when currently selected annotation is deleted
-on mouse click outside of currently selected annotation
-ESC is pressed
Viewport is shifted when mouse cursor during move/resize comes close to viewport border.
Resize to negative is prevented.
Tiny annotations are still selectable.
If mouse is moved over an annotation type that we can focus, and the annotation is not yet focused, mouse cursor shape changes to arrow.
If mouse cursor rests over an annotation A, while annotation B is focused, a tooltip for annotation A is shown.
Selected Annotation is deleted when Del is pressed.
Test for regressions:
-Annotation interaction (focus, move, resize, start playback, ...) are only done in mode EnumMouseMode::Browse.
-If mouse is moved over an annotation type where we can start an action, mouse cursor shape changes to pointing hand.
-If mouse is moved over an annotation type that we can't interact with, mouse cursor shape stays a open hand.
-If mouse cursor rests over an annotation of any type, a tooltip for that annotation is shown.
-Grab/move scroll area (on left click + mouse move) is prevented, if mouse is over focused annotation, or over AMovie/AScreen/AFileAttachment annotation.
-A double click on a annotation starts the "annotator".
REVIEW: 127366
BUG: 177778
BUG: 314843
BUG: 358060
2017-03-19 22:16:06 +00:00
|
|
|
/**
|
|
|
|
* Adjusts the position of the top-left and bottom-right corners of given @p annotation on the given @p page.
|
|
|
|
*
|
|
|
|
* Can be used to implement resize functionality.
|
|
|
|
* @p delta1 in normalized coordinates is added to top-left.
|
|
|
|
* @p delta2 in normalized coordinates is added to bottom-right.
|
|
|
|
*
|
|
|
|
* Consecutive adjustments applied to the same @p annotation are merged together on the undo stack if the
|
2018-10-18 19:04:49 +00:00
|
|
|
* BeingResized flag is set on the @p annotation.
|
Add annotation resize functionality
Usage:
If you left-click an annotation, it gets selected. Resize handles appear on the selection rectangle. When cursor is moved over one of the 8 resize handles on the corners/edges, the cursor shape changes to indicate resize mode. Everywhere else on the annotation means "move", just as it was before resize feature was added. Pressing ESC or clicking an area outside the annotation cancels a selection. Pressing Del deletes a selected annotation.
Feature is only applicable for annotation types AText, AStamp and AGeom.
Implementation:
It works by eventually changing AnnotationPrivate::m_boundary and notifying generator (i.e. poppler) about that change. Annotation state handling is shifted out of PageView into a new class MouseAnnotation (ui/pageviewmouseannotation.cpp). Some functionality not related to resizing but to annotation interaction in general is also shifted to class MouseAnnotation, to build a single place of responsiblity.
Other changes:
Add method Document::adjustPageAnnotation, backed by a QUndoCommand.
class Okular::AdjustAnnotationCommand.
Add Annotation::adjust and Annotation::canBeResized methods.
Draw resize handles in PagePainter::paintCroppedPageOnPainter.
Resize and move work
-for types AText, AStamp and AGeom
-on all pages of document
-when viewport position changes
-when zoom level changes
-for all page rotations (0°, 90°, 180°, 270°)
Selection is canceled
-when currently selected annotation is deleted
-on mouse click outside of currently selected annotation
-ESC is pressed
Viewport is shifted when mouse cursor during move/resize comes close to viewport border.
Resize to negative is prevented.
Tiny annotations are still selectable.
If mouse is moved over an annotation type that we can focus, and the annotation is not yet focused, mouse cursor shape changes to arrow.
If mouse cursor rests over an annotation A, while annotation B is focused, a tooltip for annotation A is shown.
Selected Annotation is deleted when Del is pressed.
Test for regressions:
-Annotation interaction (focus, move, resize, start playback, ...) are only done in mode EnumMouseMode::Browse.
-If mouse is moved over an annotation type where we can start an action, mouse cursor shape changes to pointing hand.
-If mouse is moved over an annotation type that we can't interact with, mouse cursor shape stays a open hand.
-If mouse cursor rests over an annotation of any type, a tooltip for that annotation is shown.
-Grab/move scroll area (on left click + mouse move) is prevented, if mouse is over focused annotation, or over AMovie/AScreen/AFileAttachment annotation.
-A double click on a annotation starts the "annotator".
REVIEW: 127366
BUG: 177778
BUG: 314843
BUG: 358060
2017-03-19 22:16:06 +00:00
|
|
|
*
|
|
|
|
* @since 1.1.0
|
|
|
|
*/
|
|
|
|
void adjustPageAnnotation(int page, Annotation *annotation, const Okular::NormalizedPoint &delta1, const Okular::NormalizedPoint &delta2);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
|
|
|
* Edits the plain text contents of the given @p annotation on the given @p page.
|
|
|
|
*
|
|
|
|
* The contents are set to @p newContents with cursor position @p newCursorPos.
|
|
|
|
* The previous cursor position @p prevCursorPos and previous anchor position @p prevAnchorPos
|
|
|
|
* must also be supplied so that they can be restored if the edit action is undone.
|
|
|
|
*
|
|
|
|
* The Annotation's internal contents should not be modified prior to calling this method.
|
|
|
|
*
|
|
|
|
* @since 0.17 (KDE 4.11)
|
2012-05-13 22:50:41 +00:00
|
|
|
*/
|
2013-04-05 22:22:48 +00:00
|
|
|
void editPageAnnotationContents(int page, Annotation *annotation, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-05-13 22:50:41 +00:00
|
|
|
/**
|
|
|
|
* Tests if the @p annotation can be removed
|
|
|
|
*
|
|
|
|
* @since 0.15 (KDE 4.9)
|
|
|
|
*/
|
|
|
|
bool canRemovePageAnnotation(const Annotation *annotation) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Removes the given @p annotation from the given @p page.
|
|
|
|
*/
|
|
|
|
void removePageAnnotation(int page, Annotation *annotation);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Removes the given @p annotations from the given @p page.
|
|
|
|
*/
|
2007-05-26 19:25:18 +00:00
|
|
|
void removePageAnnotations(int page, const QList<Annotation *> &annotations);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2019-05-09 08:47:19 +00:00
|
|
|
* Clears the text selection highlights for the given @p page,
|
|
|
|
* creates new ones if @p rect is not nullptr,
|
|
|
|
* and deletes @p rect.
|
2007-01-02 22:37:55 +00:00
|
|
|
*
|
2018-10-19 06:00:06 +00:00
|
|
|
* @param page The number of the page.
|
2007-01-02 22:37:55 +00:00
|
|
|
* @param rect The rectangle of the selection.
|
|
|
|
* @param color The color of the selection.
|
|
|
|
*/
|
2006-09-26 22:22:01 +00:00
|
|
|
void setPageTextSelection(int page, RegularAreaRect *rect, const QColor &color);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
|
|
|
* Returns true if there is an undo command available; otherwise returns false.
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
bool canUndo() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
|
|
|
* Returns true if there is a redo command available; otherwise returns false.
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
bool canRedo() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Describes the possible search types.
|
|
|
|
*/
|
|
|
|
enum SearchType {
|
|
|
|
NextMatch, ///< Search next match
|
|
|
|
PreviousMatch, ///< Search previous match
|
|
|
|
AllDocument, ///< Search complete document
|
2017-01-31 23:49:21 +00:00
|
|
|
GoogleAll, ///< Search complete document (all words in google style)
|
|
|
|
GoogleAny ///< Search complete document (any words in google style)
|
2007-01-02 22:37:55 +00:00
|
|
|
};
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-08-13 22:25:27 +00:00
|
|
|
/**
|
|
|
|
* Describes how search ended
|
|
|
|
*/
|
|
|
|
enum SearchStatus {
|
2021-12-14 22:52:30 +00:00
|
|
|
MatchFound, ///< Any match was found
|
|
|
|
NoMatchFound, ///< No match was found
|
|
|
|
SearchCancelled ///< The search was cancelled
|
2007-08-13 22:25:27 +00:00
|
|
|
};
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Searches the given @p text in the document.
|
|
|
|
*
|
|
|
|
* @param searchID The unique id for this search request.
|
2018-10-19 06:00:06 +00:00
|
|
|
* @param text The text to be searched.
|
2007-01-02 22:37:55 +00:00
|
|
|
* @param fromStart Whether the search should be started at begin of the document.
|
|
|
|
* @param caseSensitivity Whether the search is case sensitive.
|
2007-01-13 22:55:00 +00:00
|
|
|
* @param type The type of the search. @ref SearchType
|
2007-01-02 22:37:55 +00:00
|
|
|
* @param moveViewport Whether the viewport shall be moved to the position of the matches.
|
|
|
|
* @param color The highlighting color of the matches.
|
|
|
|
*/
|
2007-08-13 22:25:27 +00:00
|
|
|
void searchText(int searchID, const QString &text, bool fromStart, Qt::CaseSensitivity caseSensitivity, SearchType type, bool moveViewport, const QColor &color);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Continues the search for the given @p searchID.
|
|
|
|
*/
|
2007-08-13 22:25:27 +00:00
|
|
|
void continueSearch(int searchID);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-03-14 13:57:01 +00:00
|
|
|
/**
|
2008-04-13 13:15:15 +00:00
|
|
|
* Continues the search for the given @p searchID, optionally specifying
|
2014-05-10 08:26:30 +00:00
|
|
|
* a new type for the search.
|
2008-03-14 13:57:01 +00:00
|
|
|
*
|
|
|
|
* @since 0.7 (KDE 4.1)
|
|
|
|
*/
|
|
|
|
void continueSearch(int searchID, SearchType type);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Resets the search for the given @p searchID.
|
|
|
|
*/
|
2005-02-01 18:26:56 +00:00
|
|
|
void resetSearch(int searchID);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the bookmark manager of the document.
|
|
|
|
*/
|
2007-10-28 18:31:33 +00:00
|
|
|
BookmarkManager *bookmarkManager() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* Processes the given @p action.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-04-20 12:49:17 +00:00
|
|
|
void processAction(const Action *action);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2019-06-26 00:58:28 +00:00
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Processes the given format @p action on @p fft.
|
2019-06-26 00:58:28 +00:00
|
|
|
*
|
2019-08-14 12:56:07 +00:00
|
|
|
* @since 1.9
|
2019-06-26 00:58:28 +00:00
|
|
|
*/
|
2019-12-20 15:40:59 +00:00
|
|
|
void processFormatAction(const Action *action, Okular::FormFieldText *fft);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2019-07-27 17:53:31 +00:00
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Processes the given keystroke @p action on @p fft.
|
2019-07-27 17:53:31 +00:00
|
|
|
*
|
|
|
|
* @since 1.9
|
|
|
|
*/
|
2022-02-04 15:52:29 +00:00
|
|
|
void processKeystrokeAction(const Action *action, Okular::FormFieldText *fft, const QVariant &newValue);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2022-01-21 17:59:20 +00:00
|
|
|
/**
|
|
|
|
* Processes the given keystroke @p action on @p fft.
|
|
|
|
* This will set event.willCommit=true
|
|
|
|
*
|
|
|
|
* @since 22.04
|
|
|
|
*/
|
|
|
|
void processKeystrokeCommitAction(const Action *action, Okular::FormFieldText *fft);
|
|
|
|
|
2019-07-30 20:25:35 +00:00
|
|
|
/**
|
|
|
|
* Processes the given focus action on the field.
|
|
|
|
*
|
|
|
|
* @since 1.9
|
|
|
|
*/
|
|
|
|
void processFocusAction(const Action *action, Okular::FormField *field);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2019-08-16 23:15:47 +00:00
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Processes the given keystroke @p action on @p fft.
|
2019-08-16 23:15:47 +00:00
|
|
|
*
|
|
|
|
* @since 1.9
|
|
|
|
*/
|
2019-12-20 15:40:59 +00:00
|
|
|
void processValidateAction(const Action *action, Okular::FormFieldText *fft, bool &returnCode);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2023-08-01 23:25:25 +00:00
|
|
|
/**
|
|
|
|
* Processes the mouse up @p action on @p ff.
|
|
|
|
*
|
|
|
|
* @since 23.12
|
|
|
|
*/
|
|
|
|
void processFormMouseUpScripAction(const Action *action, Okular::FormField *ff);
|
|
|
|
|
2007-11-26 21:43:54 +00:00
|
|
|
/**
|
|
|
|
* Returns a list of the bookmarked.pages
|
|
|
|
*/
|
|
|
|
QList<int> bookmarkedPageList() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-11-26 21:43:54 +00:00
|
|
|
/**
|
|
|
|
* Returns the range of the bookmarked.pages
|
|
|
|
*/
|
|
|
|
QString bookmarkedPageRange() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Processes/Executes the given source @p reference.
|
|
|
|
*/
|
|
|
|
void processSourceReference(const SourceReference *reference);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the document can configure the printer itself.
|
|
|
|
*/
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
bool canConfigurePrinter() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-11-26 21:43:54 +00:00
|
|
|
/**
|
|
|
|
* What type of printing a document supports
|
|
|
|
*/
|
|
|
|
enum PrintingType {
|
|
|
|
NoPrinting, ///< Printing Not Supported
|
|
|
|
NativePrinting, ///< Native Cross-Platform Printing
|
|
|
|
PostscriptPrinting ///< Postscript file printing
|
|
|
|
};
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-11-26 21:43:54 +00:00
|
|
|
/**
|
|
|
|
* Returns what sort of printing the document supports:
|
|
|
|
* Native, Postscript, None
|
|
|
|
*/
|
|
|
|
PrintingType printingSupport() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-11-26 21:43:54 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the document supports printing to both PDF and PS files.
|
|
|
|
*/
|
|
|
|
bool supportsPrintToFile() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2021-12-14 22:52:30 +00:00
|
|
|
/// @since 22.04
|
|
|
|
enum PrintError {
|
|
|
|
NoPrintError, ///< Printing succeeded
|
|
|
|
UnknownPrintError,
|
|
|
|
TemporaryFileOpenPrintError,
|
|
|
|
FileConversionPrintError,
|
|
|
|
PrintingProcessCrashPrintError,
|
|
|
|
PrintingProcessStartPrintError,
|
|
|
|
PrintToFilePrintError,
|
|
|
|
InvalidPrinterStatePrintError,
|
|
|
|
UnableToFindFilePrintError,
|
|
|
|
NoFileToPrintError,
|
|
|
|
NoBinaryToPrintError,
|
|
|
|
InvalidPageSizePrintError
|
|
|
|
};
|
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Prints the document to the given @p printer.
|
|
|
|
*/
|
2021-12-14 22:52:30 +00:00
|
|
|
Document::PrintError print(QPrinter &printer);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2021-12-14 22:52:30 +00:00
|
|
|
/// @since 22.04
|
|
|
|
static QString printErrorString(PrintError error);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* Returns a custom printer configuration page or 0 if no
|
|
|
|
* custom printer configuration page is available.
|
Add option to ignore print margins for non-PDF generators
Summary:
This adds a combobox in the print dialog of the non-PDF
generators to allow selecting whether or not to take
print margins into account.
For the PDF case and rasterized printing, new print otions have
been implemented in commit 2e97d587508dff08aaf86ff149c8ed6b7658950d
already, which adds an additional option to do no scaling at all.
For consistency reasons, the same terms also used for the PDF
case are used in the combobox (i.e. the two of the three that
apply).
This adds a new abstract class 'PrintOptionsWidget' with a
'ignorePrintMargins()' method to indicate whether print margins
should be ignored or not, and a default implementation.
The existing widget for the PDF generator now derives from this
class.
In order to avoid an ABI breakage, the return value of
'Document::printConfigurationWidget' is left as a 'QWidget *'
and a dynamic_cast is done on use.
FilePrinter is adapted to take into account the value set by
'QPrinter::setFullPage()' and the margin options
are now passed accordingly (either the values set in the dialog or '0').
A big thanks to Albert Astals Cid <aacid@kde.org> for showing how
to extend the initial implementation to cover more generators.
Test Plan:
1) Open a PostScript file in Okular (using a document size that matches
a paper size available on the printer used later makes it easier
to see things behave as expected)
2) open print dialog, go to "Print options" and notice that there is a new
"Scale mode" combobox whose value is set to "Fit to printable area"
by default.
3) don't change any options, print to a printer that has hardware margins
Expected result: the document is scaled to the printable area (e.g.
scaled down so that the printer's hardware margins remain empty) as it
has been without this change.
4) Set the value of the "Print Options" -> "Scale mode" combobox to
"Fit to full page" and print again
Expected result: The document is scaled to the full page size, i.e. ignoring
the printer's hardware margins.
5) Try steps 1-4 with other document formats supported by Okular and
observe that they behave the same (except for the PDF case, where
there's a combobox with three options that has been implemented
independent of this change).
Reviewers: #okular, ngraham
Reviewed By: ngraham
Subscribers: fvogt, rkflx, arthurpeters, ltoscano, okular-devel, aacid, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10974
2019-04-03 13:58:21 +00:00
|
|
|
*
|
|
|
|
* The returned object should be of a PrintOptionsWidget subclass
|
|
|
|
* (which is not officially enforced by the signature for binary
|
|
|
|
* compatibility reasons).
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
2007-10-15 23:01:27 +00:00
|
|
|
QWidget *printConfigurationWidget() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-28 15:46:10 +00:00
|
|
|
/**
|
|
|
|
* Fill the KConfigDialog @p dialog with the setting pages of the
|
|
|
|
* generators.
|
|
|
|
*/
|
|
|
|
void fillConfigDialog(KConfigDialog *dialog);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-12 17:52:14 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of generators that have a configuration widget.
|
|
|
|
*/
|
|
|
|
int configurableGenerators() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-28 15:46:10 +00:00
|
|
|
/**
|
2007-02-05 13:50:36 +00:00
|
|
|
* Returns the list with the supported MIME types.
|
2007-01-28 15:46:10 +00:00
|
|
|
*/
|
|
|
|
QStringList supportedMimeTypes() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-03-07 18:15:00 +00:00
|
|
|
/**
|
2015-11-28 19:24:41 +00:00
|
|
|
* Returns the metadata associated with the generator. May be invalid.
|
2007-03-07 18:15:00 +00:00
|
|
|
*/
|
2015-11-28 19:24:41 +00:00
|
|
|
KPluginMetaData generatorInfo() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-09 22:53:39 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the generator supports hot-swapping the current file
|
|
|
|
* with another identical file
|
|
|
|
*
|
2017-11-06 05:10:13 +00:00
|
|
|
* @since 1.3
|
2014-05-09 22:53:39 +00:00
|
|
|
*/
|
|
|
|
bool canSwapBackingFile() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-09 22:53:39 +00:00
|
|
|
/**
|
|
|
|
* Reload the document from a new location, without any visible effect
|
|
|
|
* to the user.
|
|
|
|
*
|
|
|
|
* The new file must be identical to the current one or, if the document
|
|
|
|
* has been modified (eg the user edited forms and annotations), the new
|
|
|
|
* document must have these changes too. For example, you can call
|
|
|
|
* saveChanges first to write changes to a file and then swapBackingFile
|
|
|
|
* to switch to the new location.
|
|
|
|
*
|
2017-11-06 05:10:13 +00:00
|
|
|
* @since 1.3
|
2014-05-09 22:53:39 +00:00
|
|
|
*/
|
2017-11-06 05:12:03 +00:00
|
|
|
bool swapBackingFile(const QString &newFileName, const QUrl &url);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-09 22:53:39 +00:00
|
|
|
/**
|
|
|
|
* Same as swapBackingFile, but newFileName must be a .okular file.
|
|
|
|
*
|
|
|
|
* The new file must be identical to the current one or, if the document
|
|
|
|
* has been modified (eg the user edited forms and annotations), the new
|
|
|
|
* document must have these changes too. For example, you can call
|
|
|
|
* saveDocumentArchive first to write changes to a file and then
|
|
|
|
* swapBackingFileArchive to switch to the new location.
|
|
|
|
*
|
2017-11-06 05:10:13 +00:00
|
|
|
* @since 1.3
|
2014-05-09 22:53:39 +00:00
|
|
|
*/
|
2017-11-06 05:12:03 +00:00
|
|
|
bool swapBackingFileArchive(const QString &newFileName, const QUrl &url);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2017-11-14 13:52:02 +00:00
|
|
|
/**
|
|
|
|
* Sets the history to be clean
|
|
|
|
*
|
|
|
|
* @since 1.3
|
|
|
|
*/
|
|
|
|
void setHistoryClean(bool clean);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2020-11-26 12:19:52 +00:00
|
|
|
bool isHistoryClean() const;
|
|
|
|
|
2012-06-13 13:33:49 +00:00
|
|
|
/**
|
|
|
|
* Saving capabilities. Their availability varies according to the
|
|
|
|
* underlying generator and/or the document type.
|
|
|
|
*
|
|
|
|
* @see canSaveChanges (SaveCapability)
|
|
|
|
* @since 0.15 (KDE 4.9)
|
|
|
|
*/
|
|
|
|
enum SaveCapability {
|
2012-06-13 22:27:22 +00:00
|
|
|
SaveFormsCapability = 1, ///< Can save form changes
|
|
|
|
SaveAnnotationsCapability = 2 ///< Can save annotation changes
|
2012-06-13 13:33:49 +00:00
|
|
|
};
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-06-13 13:33:49 +00:00
|
|
|
/**
|
|
|
|
* Returns whether it's possible to save a given category of changes to
|
|
|
|
* another document.
|
|
|
|
*
|
|
|
|
* @since 0.15 (KDE 4.9)
|
|
|
|
*/
|
|
|
|
bool canSaveChanges(SaveCapability cap) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-03-11 23:40:59 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the changes to the document (modified annotations,
|
|
|
|
* values in form fields, etc) can be saved to another document.
|
|
|
|
*
|
2012-06-13 13:33:49 +00:00
|
|
|
* Equivalent to the logical OR of canSaveChanges(SaveCapability) for
|
|
|
|
* each capability.
|
|
|
|
*
|
2008-03-11 23:40:59 +00:00
|
|
|
* @since 0.7 (KDE 4.1)
|
|
|
|
*/
|
|
|
|
bool canSaveChanges() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-03-11 23:40:59 +00:00
|
|
|
/**
|
|
|
|
* Save the document and the optional changes to it to the specified
|
|
|
|
* @p fileName.
|
|
|
|
*
|
|
|
|
* @since 0.7 (KDE 4.1)
|
|
|
|
*/
|
|
|
|
bool saveChanges(const QString &fileName);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2009-10-19 23:00:52 +00:00
|
|
|
/**
|
|
|
|
* Save the document and the optional changes to it to the specified
|
|
|
|
* @p fileName and returns a @p errorText if fails.
|
|
|
|
*
|
|
|
|
* @since 0.10 (KDE 4.4)
|
|
|
|
*/
|
|
|
|
bool saveChanges(const QString &fileName, QString *errorText);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-04-27 11:05:59 +00:00
|
|
|
/**
|
|
|
|
* Register the specified @p view for the current document.
|
|
|
|
*
|
|
|
|
* It is unregistered from the previous document, if any.
|
|
|
|
*
|
|
|
|
* @since 0.7 (KDE 4.1)
|
|
|
|
*/
|
|
|
|
void registerView(View *view);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-04-27 11:05:59 +00:00
|
|
|
/**
|
|
|
|
* Unregister the specified @p view from the current document.
|
|
|
|
*
|
|
|
|
* @since 0.7 (KDE 4.1)
|
|
|
|
*/
|
|
|
|
void unregisterView(View *view);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-08-01 20:26:22 +00:00
|
|
|
/**
|
|
|
|
* Gets the font data for the given font
|
|
|
|
*
|
|
|
|
* @since 0.8 (KDE 4.2)
|
|
|
|
*/
|
|
|
|
QByteArray fontData(const FontInfo &font) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-11-15 14:15:31 +00:00
|
|
|
/**
|
|
|
|
* Opens a document archive.
|
|
|
|
*
|
2014-05-09 17:56:16 +00:00
|
|
|
* @since 0.20 (KDE 4.14)
|
2008-11-15 14:15:31 +00:00
|
|
|
*/
|
2015-01-29 19:55:57 +00:00
|
|
|
OpenResult openDocumentArchive(const QString &docFile, const QUrl &url, const QString &password = QString());
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-11-15 14:15:31 +00:00
|
|
|
/**
|
|
|
|
* Saves a document archive.
|
|
|
|
*
|
|
|
|
* @since 0.8 (KDE 4.2)
|
|
|
|
*/
|
|
|
|
bool saveDocumentArchive(const QString &fileName);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-10 14:34:53 +00:00
|
|
|
/**
|
|
|
|
* Extract the document file from the current archive.
|
|
|
|
*
|
|
|
|
* @warning This function only works if the current file is a document archive
|
|
|
|
*
|
2017-11-06 05:10:13 +00:00
|
|
|
* @since 1.3
|
2014-05-10 14:34:53 +00:00
|
|
|
*/
|
|
|
|
bool extractArchivedFile(const QString &destFileName);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2009-07-27 14:15:33 +00:00
|
|
|
/**
|
2009-07-27 17:12:34 +00:00
|
|
|
* Asks the generator to dynamically generate a SourceReference for a given
|
2009-07-27 14:15:33 +00:00
|
|
|
* page number and absolute X and Y position on this page.
|
|
|
|
*
|
|
|
|
* @attention Ownership of the returned SourceReference is transferred to the caller.
|
|
|
|
* @note This method does not call processSourceReference( const SourceReference * )
|
|
|
|
*
|
|
|
|
* @since 0.10 (KDE 4.4)
|
|
|
|
*/
|
|
|
|
const SourceReference *dynamicSourceReference(int pageNr, double absX, double absY);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2011-06-05 22:40:22 +00:00
|
|
|
/**
|
|
|
|
* Returns the orientation of the document (for printing purposes). This
|
|
|
|
* is used in the KPart to initialize the print dialog and in the
|
|
|
|
* generators to check whether the document needs to be rotated or not.
|
|
|
|
*
|
|
|
|
* @since 0.14 (KDE 4.8)
|
|
|
|
*/
|
2023-07-24 00:33:00 +00:00
|
|
|
QPageLayout::Orientation orientation() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-05-23 21:43:44 +00:00
|
|
|
/**
|
|
|
|
* Control annotation editing (creation, modification and removal),
|
|
|
|
* which is enabled by default.
|
|
|
|
*
|
|
|
|
* @since 0.15 (KDE 4.9)
|
|
|
|
*/
|
|
|
|
void setAnnotationEditingEnabled(bool enable);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-05-10 13:31:59 +00:00
|
|
|
/**
|
|
|
|
* Returns which wallet data to use to read/write the password for the given fileName
|
|
|
|
*
|
|
|
|
* @since 0.20 (KDE 4.14)
|
|
|
|
*/
|
|
|
|
void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-09-09 14:08:32 +00:00
|
|
|
/**
|
|
|
|
* Since version 0.21, okular does not allow editing annotations and
|
|
|
|
* form data if they are stored in the docdata directory (like older
|
|
|
|
* okular versions did by default).
|
|
|
|
* If this flag is set, then annotations and forms cannot be edited.
|
|
|
|
*
|
2017-11-06 05:10:13 +00:00
|
|
|
* @since 1.3
|
2014-09-09 14:08:32 +00:00
|
|
|
*/
|
|
|
|
bool isDocdataMigrationNeeded() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-09-09 14:08:32 +00:00
|
|
|
/**
|
|
|
|
* Delete annotations and form data from the docdata folder. Call it if
|
|
|
|
* isDocdataMigrationNeeded() was true and you've just saved them to an
|
|
|
|
* external file.
|
|
|
|
*
|
2017-11-06 05:10:13 +00:00
|
|
|
* @since 1.3
|
2014-09-09 14:08:32 +00:00
|
|
|
*/
|
|
|
|
void docdataMigrationDone();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2015-05-27 13:56:56 +00:00
|
|
|
/**
|
2015-09-14 23:38:09 +00:00
|
|
|
* Returns the model for rendering layers (NULL if the document has no layers)
|
|
|
|
*
|
|
|
|
* @since 0.24
|
2015-05-27 13:56:56 +00:00
|
|
|
*/
|
|
|
|
QAbstractItemModel *layersModel() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2020-02-10 23:22:06 +00:00
|
|
|
/**
|
|
|
|
* Returns the reason why the file opening failed, if any.
|
2020-02-10 23:17:27 +00:00
|
|
|
*
|
|
|
|
* @since 1.10
|
2020-02-10 23:22:06 +00:00
|
|
|
*/
|
|
|
|
QString openError() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2020-10-21 14:11:46 +00:00
|
|
|
/**
|
2020-10-29 16:14:05 +00:00
|
|
|
* Digitally sign document
|
2020-10-21 14:11:46 +00:00
|
|
|
*
|
2020-10-29 16:14:05 +00:00
|
|
|
* @since 21.04
|
2020-10-21 14:11:46 +00:00
|
|
|
*/
|
2020-11-26 14:02:28 +00:00
|
|
|
bool sign(const NewSignatureData &data, const QString &newPath);
|
2020-10-21 14:11:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the generator's certificate store (if any)
|
|
|
|
*
|
2020-10-29 16:14:05 +00:00
|
|
|
* @since 21.04
|
2020-10-21 14:11:46 +00:00
|
|
|
*/
|
2020-11-26 12:54:57 +00:00
|
|
|
CertificateStore *certificateStore() const;
|
2020-10-21 14:11:46 +00:00
|
|
|
|
2022-02-18 13:33:28 +00:00
|
|
|
/** sets the editor command to the command \p editCmd, as
|
|
|
|
* given at the commandline.
|
|
|
|
*
|
|
|
|
* @since 22.04
|
|
|
|
*/
|
|
|
|
void setEditorCommandOverride(const QString &editCmd);
|
|
|
|
|
|
|
|
/** returns the overriding editor command.
|
|
|
|
*
|
|
|
|
* If the editor command was not overriden, the string is empty.
|
|
|
|
*
|
|
|
|
* @since 22.04
|
|
|
|
*/
|
|
|
|
QString editorCommandOverride() const;
|
|
|
|
|
2006-11-20 07:53:32 +00:00
|
|
|
public Q_SLOTS:
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* This slot is called whenever the user changes the @p rotation of
|
|
|
|
* the document.
|
|
|
|
*/
|
2007-05-01 23:09:45 +00:00
|
|
|
void setRotation(int rotation);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-01-05 23:12:06 +00:00
|
|
|
* This slot is called whenever the user changes the page @p size
|
2007-01-02 22:37:55 +00:00
|
|
|
* of the document.
|
|
|
|
*/
|
2020-02-20 09:59:54 +00:00
|
|
|
void setPageSize(const Okular::PageSize &size);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-08-13 22:25:27 +00:00
|
|
|
/**
|
|
|
|
* Cancels the current search
|
|
|
|
*/
|
|
|
|
void cancelSearch();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
|
|
|
* Undo last edit command
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void undo();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
|
|
|
* Redo last undone edit command
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void redo();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
|
|
|
* Edit the text contents of the specified @p form on page @p page to be @p newContents.
|
|
|
|
* The new text cursor position (@p newCursorPos), previous text cursor position (@p prevCursorPos),
|
|
|
|
* and previous cursor anchor position will be restored by the undo / redo commands.
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void editFormText(int pageNumber, Okular::FormFieldText *form, const QString &newContents, int newCursorPos, int prevCursorPos, int prevAnchorPos);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
|
|
|
* Edit the selected list entries in @p form on page @p page to be @p newChoices.
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void editFormList(int pageNumber, Okular::FormFieldChoice *form, const QList<int> &newChoices);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
|
|
|
* Set the active choice in the combo box @p form on page @p page to @p newText
|
|
|
|
* The new cursor position (@p newCursorPos), previous cursor position
|
|
|
|
* (@p prevCursorPos), and previous anchor position (@p prevAnchorPos)
|
|
|
|
* will be restored by the undo / redo commands.
|
|
|
|
*
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void editFormCombo(int pageNumber, Okular::FormFieldChoice *form, const QString &newText, int newCursorPos, int prevCursorPos, int prevAnchorPos);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
|
|
|
* Set the states of the group of form buttons @p formButtons on page @p page to @p newButtonStates.
|
|
|
|
* The lists @p formButtons and @p newButtonStates should be the same length and true values
|
|
|
|
* in @p newButtonStates indicate that the corresponding entry in @p formButtons should be enabled.
|
|
|
|
*/
|
|
|
|
void editFormButtons(int pageNumber, const QList<Okular::FormFieldButton *> &formButtons, const QList<bool> &newButtonStates);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2015-05-27 13:56:56 +00:00
|
|
|
/**
|
2015-09-14 23:38:09 +00:00
|
|
|
* Reloads the pixmaps for whole document
|
|
|
|
*
|
|
|
|
* @since 0.24
|
2015-05-27 13:56:56 +00:00
|
|
|
*/
|
|
|
|
void reloadDocument() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2019-01-05 22:30:25 +00:00
|
|
|
/**
|
|
|
|
* Returns the part of document covered by the given signature @p info.
|
|
|
|
*
|
|
|
|
* @since 1.7
|
|
|
|
*/
|
|
|
|
QByteArray requestSignedRevisionData(const Okular::SignatureInfo &info);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2019-12-19 22:18:31 +00:00
|
|
|
/**
|
|
|
|
* Refresh the pixmaps for the given @p pageNumber.
|
|
|
|
*
|
|
|
|
* @since 1.10
|
|
|
|
*/
|
|
|
|
void refreshPixmaps(int pageNumber);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-20 07:53:32 +00:00
|
|
|
Q_SIGNALS:
|
2018-10-21 20:25:47 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted whenever the document is about to close.
|
|
|
|
* @since 1.5.3
|
|
|
|
*/
|
|
|
|
void aboutToClose();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* This signal is emitted whenever an action requests a
|
2007-01-02 22:37:55 +00:00
|
|
|
* document close operation.
|
|
|
|
*/
|
2005-11-04 11:59:51 +00:00
|
|
|
void close();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2022-01-19 21:44:23 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted whenever an action requests a
|
|
|
|
* document print operation.
|
|
|
|
* @since 22.04
|
|
|
|
*/
|
|
|
|
void requestPrint();
|
|
|
|
|
2022-03-01 23:03:34 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted whenever an action requests a
|
|
|
|
* document save as operation.
|
|
|
|
* @since 22.04
|
|
|
|
*/
|
|
|
|
void requestSaveAs();
|
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* This signal is emitted whenever an action requests an
|
2007-01-02 22:37:55 +00:00
|
|
|
* application quit operation.
|
|
|
|
*/
|
2005-11-04 11:59:51 +00:00
|
|
|
void quit();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* This signal is emitted whenever an action requests a
|
2007-01-02 22:37:55 +00:00
|
|
|
* find operation.
|
|
|
|
*/
|
2005-01-01 21:50:34 +00:00
|
|
|
void linkFind();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* This signal is emitted whenever an action requests a
|
2007-01-02 22:37:55 +00:00
|
|
|
* goto operation.
|
|
|
|
*/
|
2005-01-01 21:50:34 +00:00
|
|
|
void linkGoToPage();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* This signal is emitted whenever an action requests a
|
2007-01-02 22:37:55 +00:00
|
|
|
* start presentation operation.
|
|
|
|
*/
|
2005-04-07 09:53:15 +00:00
|
|
|
void linkPresentation();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* This signal is emitted whenever an action requests an
|
2007-01-02 22:37:55 +00:00
|
|
|
* end presentation operation.
|
|
|
|
*/
|
2005-04-07 09:53:15 +00:00
|
|
|
void linkEndPresentation();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-04-20 12:58:15 +00:00
|
|
|
* This signal is emitted whenever an action requests an
|
2007-01-02 22:37:55 +00:00
|
|
|
* open url operation for the given document @p url.
|
|
|
|
*/
|
2015-01-29 19:55:57 +00:00
|
|
|
void openUrl(const QUrl &url);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
2007-01-04 15:22:28 +00:00
|
|
|
* This signal is emitted whenever an error occurred.
|
2007-01-02 22:37:55 +00:00
|
|
|
*
|
|
|
|
* @param text The description of the error.
|
2017-01-29 17:30:03 +00:00
|
|
|
* @param duration The time in milliseconds the message should be shown to the user.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
|
|
|
void error(const QString &text, int duration);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted to signal a warning.
|
|
|
|
*
|
|
|
|
* @param text The description of the warning.
|
2017-01-29 17:30:03 +00:00
|
|
|
* @param duration The time in milliseconds the message should be shown to the user.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
|
|
|
void warning(const QString &text, int duration);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 22:37:55 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted to signal a notice.
|
|
|
|
*
|
|
|
|
* @param text The description of the notice.
|
2017-01-29 17:30:03 +00:00
|
|
|
* @param duration The time in milliseconds the message should be shown to the user.
|
2007-01-02 22:37:55 +00:00
|
|
|
*/
|
|
|
|
void notice(const QString &text, int duration);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
/**
|
|
|
|
* Emitted when a new font is found during the reading of the fonts of
|
|
|
|
* the document.
|
|
|
|
*/
|
|
|
|
void gotFont(const Okular::FontInfo &font);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
/**
|
|
|
|
* Reports the progress when reading the fonts in the document.
|
|
|
|
*
|
|
|
|
* \param page is the page that was just finished to scan for fonts
|
|
|
|
*/
|
|
|
|
void fontReadingProgress(int page);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
/**
|
|
|
|
* Reports that the reading of the fonts in the document is finished.
|
|
|
|
*/
|
|
|
|
void fontReadingEnded();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-08-13 22:25:27 +00:00
|
|
|
/**
|
|
|
|
* Reports that the current search finished
|
|
|
|
*/
|
2014-05-10 08:27:44 +00:00
|
|
|
void searchFinished(int searchID, Okular::Document::SearchStatus endStatus);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2011-10-31 21:41:50 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted whenever a source reference with the given parameters has been
|
|
|
|
* activated.
|
|
|
|
*
|
2018-10-19 06:00:06 +00:00
|
|
|
* \param absFileName absolute name of the file.
|
|
|
|
* \param line line number.
|
|
|
|
* \param col column number.
|
2011-10-31 21:41:50 +00:00
|
|
|
* \param handled should be set to 'true' if a slot handles this source reference; the
|
|
|
|
* default action to launch the configured editor will then not be performed
|
|
|
|
* by the document
|
|
|
|
*
|
|
|
|
* @since 0.14 (KDE 4.8)
|
|
|
|
*/
|
2011-10-23 13:22:58 +00:00
|
|
|
void sourceReferenceActivated(const QString &absFileName, int line, int col, bool *handled);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-04-03 12:18:10 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted whenever an movie action is triggered and the UI should process it.
|
|
|
|
*/
|
|
|
|
void processMovieAction(const Okular::MovieAction *action);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the availability of the undo function changes
|
2013-04-05 22:22:48 +00:00
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void canUndoChanged(bool undoAvailable);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the availability of the redo function changes
|
2013-04-05 22:22:48 +00:00
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void canRedoChanged(bool redoAvailable);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2017-11-14 13:52:02 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the undo history is clean (i.e. the same status the last time it was saved)
|
2017-11-14 13:52:02 +00:00
|
|
|
* @since 1.3
|
|
|
|
*/
|
|
|
|
void undoHistoryCleanChanged(bool clean);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-09-27 12:15:04 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted whenever an rendition action is triggered and the UI should process it.
|
|
|
|
*
|
|
|
|
* @since 0.16 (KDE 4.10)
|
|
|
|
*/
|
|
|
|
void processRenditionAction(const Okular::RenditionAction *action);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-04-05 22:22:48 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the contents of the given @p annotation are changed by an undo
|
2013-04-05 22:22:48 +00:00
|
|
|
* or redo action.
|
|
|
|
*
|
|
|
|
* The new contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are
|
|
|
|
* included
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void annotationContentsChangedByUndoRedo(Okular::Annotation *annotation, const QString &contents, int cursorPos, int anchorPos);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the text contents of the given text @p form on the given @p page
|
2013-06-03 20:46:41 +00:00
|
|
|
* are changed by an undo or redo action.
|
|
|
|
*
|
|
|
|
* The new text contents (@p contents), cursor position (@p cursorPos), and anchor position (@p anchorPos) are
|
|
|
|
* included
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void formTextChangedByUndoRedo(int page, Okular::FormFieldText *form, const QString &contents, int cursorPos, int anchorPos);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the selected @p choices for the given list @p form on the
|
2013-06-03 20:46:41 +00:00
|
|
|
* given @p page are changed by an undo or redo action.
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void formListChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QList<int> &choices);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the active @p text for the given combo @p form on the
|
2013-06-03 20:46:41 +00:00
|
|
|
* given @p page is changed by an undo or redo action.
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void formComboChangedByUndoRedo(int page, Okular::FormFieldChoice *form, const QString &text, int cursorPos, int anchorPos);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2013-06-03 20:46:41 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever the state of the specified group of form buttons (@p formButtons) on the
|
2013-06-03 20:46:41 +00:00
|
|
|
* given @p page is changed by an undo or redo action.
|
|
|
|
* @since 0.17 (KDE 4.11)
|
|
|
|
*/
|
|
|
|
void formButtonsChangedByUndoRedo(int page, const QList<Okular::FormFieldButton *> &formButtons);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2018-02-21 22:56:43 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* This signal is emitted whenever a FormField was changed programmatically and the
|
2018-02-21 22:56:43 +00:00
|
|
|
* according widget should be updated.
|
|
|
|
* @since 1.4
|
|
|
|
*/
|
|
|
|
void refreshFormWidget(Okular::FormField *field);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2004-11-09 17:20:19 +00:00
|
|
|
private:
|
2007-09-01 22:48:28 +00:00
|
|
|
/// @cond PRIVATE
|
2007-04-14 19:44:07 +00:00
|
|
|
friend class DocumentPrivate;
|
2013-02-24 21:58:53 +00:00
|
|
|
friend class ::DocumentItem;
|
2013-04-05 22:22:48 +00:00
|
|
|
friend class EditAnnotationContentsCommand;
|
2013-06-03 20:46:41 +00:00
|
|
|
friend class EditFormTextCommand;
|
|
|
|
friend class EditFormListCommand;
|
|
|
|
friend class EditFormComboCommand;
|
|
|
|
friend class EditFormButtonsCommand;
|
2007-09-01 22:48:28 +00:00
|
|
|
/// @endcond
|
2007-04-14 19:44:07 +00:00
|
|
|
DocumentPrivate *const d;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
Q_DISABLE_COPY(Document)
|
2004-09-08 12:41:14 +00:00
|
|
|
};
|
|
|
|
|
2005-01-03 15:51:05 +00:00
|
|
|
/**
|
2005-01-09 23:37:07 +00:00
|
|
|
* @short A view on the document.
|
2005-01-03 15:51:05 +00:00
|
|
|
*
|
2005-01-09 23:37:07 +00:00
|
|
|
* The Viewport structure is the 'current view' over the document. Contained
|
2007-01-04 15:22:28 +00:00
|
|
|
* data is broadcasted between observers to synchronize their viewports to get
|
2005-01-09 23:37:07 +00:00
|
|
|
* the 'I scroll one view and others scroll too' views.
|
2005-01-03 15:51:05 +00:00
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT DocumentViewport
|
2005-01-03 15:51:05 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
public:
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Creates a new viewport for the given page @p number.
|
|
|
|
*/
|
2021-08-21 23:14:34 +00:00
|
|
|
explicit DocumentViewport(int number = -1);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Creates a new viewport from the given @p xmlDesc.
|
2007-01-02 19:05:49 +00:00
|
|
|
*/
|
2021-08-21 23:14:34 +00:00
|
|
|
explicit DocumentViewport(const QString &xmlDesc);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the viewport as xml description.
|
|
|
|
*/
|
|
|
|
QString toString() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the viewport is valid.
|
|
|
|
*/
|
|
|
|
bool isValid() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
bool operator==(const DocumentViewport &other) const;
|
2012-06-04 14:10:33 +00:00
|
|
|
bool operator<(const DocumentViewport &other) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* The number of the page nearest the center of the viewport.
|
|
|
|
*/
|
2005-01-09 23:37:07 +00:00
|
|
|
int pageNumber;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Describes the relative position of the viewport.
|
|
|
|
*/
|
|
|
|
enum Position {
|
|
|
|
Center = 1, ///< Relative to the center of the page.
|
|
|
|
TopLeft = 2 ///< Relative to the top left corner of the page.
|
|
|
|
};
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* If 'rePos.enabled == true' then this structure contains the
|
2010-08-11 21:01:33 +00:00
|
|
|
* viewport center or top left depending on the value of pos.
|
2007-01-02 19:05:49 +00:00
|
|
|
*/
|
2005-01-09 23:37:07 +00:00
|
|
|
struct {
|
|
|
|
bool enabled;
|
2005-06-13 11:53:47 +00:00
|
|
|
double normalizedX;
|
|
|
|
double normalizedY;
|
|
|
|
Position pos;
|
|
|
|
} rePos;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
2018-10-19 06:00:06 +00:00
|
|
|
* If 'autoFit.enabled == true' then the page must be autofit in the viewport.
|
2007-01-02 19:05:49 +00:00
|
|
|
*/
|
2005-01-09 23:37:07 +00:00
|
|
|
struct {
|
|
|
|
bool enabled;
|
|
|
|
bool width;
|
|
|
|
bool height;
|
|
|
|
} autoFit;
|
2005-01-03 15:51:05 +00:00
|
|
|
};
|
|
|
|
|
2004-12-10 16:04:45 +00:00
|
|
|
/**
|
2005-06-13 15:46:23 +00:00
|
|
|
* @short A DOM tree that describes the Table of Contents.
|
2004-12-11 17:25:03 +00:00
|
|
|
*
|
|
|
|
* The Synopsis (TOC or Table Of Contents for friends) is represented via
|
2008-11-30 16:04:49 +00:00
|
|
|
* a dom tree where each node has an internal name (displayed in the TOC)
|
2004-12-11 17:25:03 +00:00
|
|
|
* and one or more attributes.
|
|
|
|
*
|
2005-01-07 13:07:29 +00:00
|
|
|
* In the tree the tag name is the 'screen' name of the entry. A tag can have
|
|
|
|
* attributes. Here follows the list of tag attributes with meaning:
|
2008-11-30 16:04:49 +00:00
|
|
|
* - Destination: A string description of the referred viewport
|
|
|
|
* - DestinationName: A 'named reference' to the viewport that must be converted
|
|
|
|
* using metaData( "NamedViewport", viewport_name )
|
|
|
|
* - ExternalFileName: A document to be opened, whose destination is specified
|
|
|
|
* with Destination or DestinationName
|
|
|
|
* - Open: a boolean saying whether its TOC branch is open or not (default: false)
|
|
|
|
* - URL: a URL to be open as destination; if set, no other Destination* or
|
|
|
|
* ExternalFileName entry is used
|
2004-12-10 16:04:45 +00:00
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT DocumentSynopsis : public QDomDocument
|
2004-12-10 16:04:45 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Creates a new document synopsis object.
|
|
|
|
*/
|
2005-01-03 15:51:05 +00:00
|
|
|
DocumentSynopsis();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Creates a new document synopsis object with the given
|
|
|
|
* @p document as parent node.
|
|
|
|
*/
|
2021-08-21 23:14:34 +00:00
|
|
|
explicit DocumentSynopsis(const QDomDocument &document);
|
2004-12-10 16:04:45 +00:00
|
|
|
};
|
|
|
|
|
2006-05-28 16:54:54 +00:00
|
|
|
/**
|
2006-12-28 16:28:28 +00:00
|
|
|
* @short An embedded file into the document.
|
|
|
|
*
|
|
|
|
* This class represents a sort of interface of an embedded file in a document.
|
|
|
|
*
|
|
|
|
* Generators \b must re-implement its members to give the all the information
|
|
|
|
* about an embedded file, like its name, its description, the date of creation
|
|
|
|
* and modification, and the real data of the file.
|
2006-05-28 16:54:54 +00:00
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT EmbeddedFile
|
2006-05-28 16:54:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Creates a new embedded file.
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
EmbeddedFile();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Destroys the embedded file.
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
virtual ~EmbeddedFile();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2020-02-21 15:11:42 +00:00
|
|
|
EmbeddedFile(const EmbeddedFile &) = delete;
|
|
|
|
EmbeddedFile &operator=(const EmbeddedFile &) = delete;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-12-28 16:28:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the name of the file
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
virtual QString name() const = 0;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-12-28 16:28:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the description of the file, or an empty string if not
|
|
|
|
* available
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
virtual QString description() const = 0;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-12-28 16:28:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the real data representing the file contents
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
virtual QByteArray data() const = 0;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-07-03 14:47:16 +00:00
|
|
|
/**
|
|
|
|
* Returns the size (in bytes) of the file, if available, or -1 otherwise.
|
|
|
|
*
|
|
|
|
* @note this method should be a fast way to know the size of the file
|
|
|
|
* with no need to extract all the data from it
|
|
|
|
*/
|
|
|
|
virtual int size() const = 0;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-12-28 16:28:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the modification date of the file, or an invalid date
|
|
|
|
* if not available
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
virtual QDateTime modificationDate() const = 0;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-12-28 16:28:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the creation date of the file, or an invalid date
|
|
|
|
* if not available
|
|
|
|
*/
|
2006-05-28 16:54:54 +00:00
|
|
|
virtual QDateTime creationDate() const = 0;
|
|
|
|
};
|
|
|
|
|
2006-06-23 21:11:52 +00:00
|
|
|
/**
|
|
|
|
* @short An area of a specified page
|
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT VisiblePageRect
|
2006-06-23 21:11:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* Creates a new visible page rectangle.
|
|
|
|
*
|
|
|
|
* @param pageNumber The page number where the rectangle is located.
|
|
|
|
* @param rectangle The rectangle in normalized coordinates.
|
|
|
|
*/
|
2007-04-19 18:30:20 +00:00
|
|
|
explicit VisiblePageRect(int pageNumber = -1, const NormalizedRect &rectangle = NormalizedRect());
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* The page number where the rectangle is located.
|
|
|
|
*/
|
2006-06-23 21:11:52 +00:00
|
|
|
int pageNumber;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-01-02 19:05:49 +00:00
|
|
|
/**
|
|
|
|
* The rectangle in normalized coordinates.
|
|
|
|
*/
|
2006-06-23 21:11:52 +00:00
|
|
|
NormalizedRect rect;
|
|
|
|
};
|
|
|
|
|
2020-10-29 16:14:05 +00:00
|
|
|
/**
|
|
|
|
* @short Data needed to create a new signature
|
|
|
|
*
|
|
|
|
* @since 21.04
|
|
|
|
*/
|
|
|
|
class OKULARCORE_EXPORT NewSignatureData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NewSignatureData();
|
|
|
|
~NewSignatureData();
|
|
|
|
NewSignatureData(const NewSignatureData &) = delete;
|
|
|
|
NewSignatureData &operator=(const NewSignatureData &) = delete;
|
|
|
|
|
|
|
|
QString certNickname() const;
|
|
|
|
void setCertNickname(const QString &certNickname);
|
|
|
|
|
|
|
|
QString certSubjectCommonName() const;
|
|
|
|
void setCertSubjectCommonName(const QString &certSubjectCommonName);
|
|
|
|
|
|
|
|
QString password() const;
|
|
|
|
void setPassword(const QString &password);
|
|
|
|
|
|
|
|
int page() const;
|
|
|
|
void setPage(int page);
|
|
|
|
|
|
|
|
NormalizedRect boundingRectangle() const;
|
|
|
|
void setBoundingRectangle(const NormalizedRect &rect);
|
|
|
|
|
2023-06-14 19:43:01 +00:00
|
|
|
/// @since 22.04
|
|
|
|
QString documentPassword() const;
|
|
|
|
|
|
|
|
/// @since 22.04
|
|
|
|
void setDocumentPassword(const QString &password);
|
|
|
|
|
|
|
|
/// @since 23.08
|
2023-04-20 08:16:04 +00:00
|
|
|
QString reason() const;
|
|
|
|
|
2023-06-14 19:43:01 +00:00
|
|
|
/// @since 23.08
|
|
|
|
void setReason(const QString &reason);
|
|
|
|
|
|
|
|
/// @since 23.08
|
2023-04-20 08:16:04 +00:00
|
|
|
QString location() const;
|
|
|
|
|
2023-06-14 19:43:01 +00:00
|
|
|
/// @since 23.08
|
|
|
|
void setLocation(const QString &location);
|
2023-04-20 14:17:41 +00:00
|
|
|
|
2023-06-14 19:43:01 +00:00
|
|
|
/// @since 23.08
|
|
|
|
QString backgroundImagePath() const;
|
2021-12-29 18:28:34 +00:00
|
|
|
|
2023-06-14 19:43:01 +00:00
|
|
|
/// @since 23.08
|
|
|
|
void setBackgroundImagePath(const QString &path);
|
2021-12-29 18:28:34 +00:00
|
|
|
|
2020-10-29 16:14:05 +00:00
|
|
|
private:
|
|
|
|
NewSignatureDataPrivate *const d;
|
|
|
|
};
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
}
|
|
|
|
|
2008-02-08 14:13:55 +00:00
|
|
|
Q_DECLARE_METATYPE(Okular::DocumentInfo::Key)
|
2008-03-07 15:50:48 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::Document::PixmapRequestFlags)
|
2008-02-08 14:13:55 +00:00
|
|
|
|
2004-09-08 12:41:14 +00:00
|
|
|
#endif
|
2009-11-16 00:46:33 +00:00
|
|
|
|
|
|
|
/* kate: replace-tabs on; indent-width 4; */
|