2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2004 Enrico Ros <eros.kde@email.it>
|
|
|
|
SPDX-FileCopyrightText: 2007 Pino Toscano <pino@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
|
|
|
|
*/
|
2007-03-24 00:18:54 +00:00
|
|
|
|
|
|
|
#ifndef _OKULAR_PAGE_PRIVATE_H_
|
|
|
|
#define _OKULAR_PAGE_PRIVATE_H_
|
|
|
|
|
|
|
|
// qt/kde includes
|
2020-07-08 11:54:37 +00:00
|
|
|
#include <QMap>
|
|
|
|
#include <QString>
|
|
|
|
#include <QTransform>
|
2012-05-30 16:38:51 +00:00
|
|
|
#include <qdom.h>
|
2007-03-24 00:18:54 +00:00
|
|
|
|
|
|
|
// local includes
|
2007-05-05 18:07:34 +00:00
|
|
|
#include "area.h"
|
2007-03-24 00:18:54 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
2007-05-05 18:07:34 +00:00
|
|
|
class QColor;
|
2007-04-14 19:58:17 +00:00
|
|
|
|
2007-03-24 00:18:54 +00:00
|
|
|
namespace Okular
|
|
|
|
{
|
2007-04-20 12:37:12 +00:00
|
|
|
class Action;
|
2007-04-17 19:55:18 +00:00
|
|
|
class Annotation;
|
2013-02-24 21:58:53 +00:00
|
|
|
class DocumentObserver;
|
2011-01-29 15:38:18 +00:00
|
|
|
class DocumentPrivate;
|
2007-03-24 00:18:54 +00:00
|
|
|
class FormField;
|
2007-03-30 14:08:20 +00:00
|
|
|
class HighlightAreaRect;
|
2007-03-24 00:18:54 +00:00
|
|
|
class Page;
|
2007-05-01 23:36:57 +00:00
|
|
|
class PageSize;
|
2007-03-24 00:18:54 +00:00
|
|
|
class PageTransition;
|
2007-03-24 10:47:22 +00:00
|
|
|
class RotationJob;
|
2007-03-24 00:18:54 +00:00
|
|
|
class TextPage;
|
2012-08-17 18:23:58 +00:00
|
|
|
class TilesManager;
|
2007-03-24 00:18:54 +00:00
|
|
|
|
2008-11-14 23:38:02 +00:00
|
|
|
enum PageItem {
|
|
|
|
None = 0,
|
|
|
|
AnnotationPageItems = 0x01,
|
|
|
|
FormFieldPageItems = 0x02,
|
2012-05-30 16:38:51 +00:00
|
|
|
AllPageItems = 0xff,
|
|
|
|
|
|
|
|
/* If set along with AnnotationPageItems, tells saveLocalContents to save
|
|
|
|
* the original annotations (if any) instead of the modified ones */
|
2014-05-11 13:06:27 +00:00
|
|
|
OriginalAnnotationPageItems = 0x100,
|
|
|
|
|
|
|
|
/* If set along with FormFieldPageItems, tells saveLocalContents to save
|
|
|
|
* the original form contents (if any) instead of the modified one */
|
|
|
|
OriginalFormFieldPageItems = 0x200
|
2008-11-14 23:38:02 +00:00
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(PageItems, PageItem)
|
|
|
|
|
2007-03-24 00:18:54 +00:00
|
|
|
class PagePrivate
|
|
|
|
{
|
2020-07-10 22:15:05 +00:00
|
|
|
public:
|
2007-03-24 00:18:54 +00:00
|
|
|
PagePrivate(Page *page, uint n, double w, double h, Rotation o);
|
|
|
|
~PagePrivate();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2017-03-02 23:32:08 +00:00
|
|
|
static PagePrivate *get(Page *page);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-03-24 10:47:22 +00:00
|
|
|
void imageRotationDone(RotationJob *job);
|
2012-09-08 15:06:02 +00:00
|
|
|
QTransform rotationMatrix() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-04-14 19:58:17 +00:00
|
|
|
* Loads the local contents (e.g. annotations) of the page.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2014-09-09 14:08:32 +00:00
|
|
|
bool restoreLocalContents(const QDomNode &pageNode);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-04-14 19:58:17 +00:00
|
|
|
* Saves the local contents (e.g. annotations) of the page.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2008-11-14 23:38:02 +00:00
|
|
|
void saveLocalContents(QDomNode &parentNode, QDomDocument &document, PageItems what = AllPageItems) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-05-01 23:36:57 +00:00
|
|
|
* Rotates the image and object rects of the page to the given @p orientation.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2007-05-01 23:36:57 +00:00
|
|
|
void rotateAt(Rotation orientation);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-05-01 23:36:57 +00:00
|
|
|
* Changes the size of the page to the given @p size.
|
2020-07-10 22:15:05 +00:00
|
|
|
*
|
2007-05-01 23:36:57 +00:00
|
|
|
* The @p size is meant to be referred to the page not rotated.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2007-05-01 23:36:57 +00:00
|
|
|
void changeSize(const PageSize &size);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2019-05-09 08:47:19 +00:00
|
|
|
* Clears current text selection highlight areas,
|
2019-12-20 15:40:59 +00:00
|
|
|
* creates new ones if @p r is not nullptr,
|
|
|
|
* and deletes @p r.
|
2020-07-10 22:15:05 +00:00
|
|
|
*
|
2019-12-20 15:40:59 +00:00
|
|
|
* @param r Areas of new text selections.
|
2019-05-09 08:47:19 +00:00
|
|
|
* @param color Color of new text selections.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2024-03-04 12:22:25 +00:00
|
|
|
void setTextSelections(const RegularAreaRect &r, const QColor &color);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Sets the @p color and @p rect of the highlight for the observer with
|
2007-05-05 18:07:34 +00:00
|
|
|
* the given @p id.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2019-12-20 15:40:59 +00:00
|
|
|
void setHighlight(int id, RegularAreaRect *rect, const QColor &color);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-05-05 18:07:34 +00:00
|
|
|
* Deletes all highlight objects for the observer with the given @p id.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2007-05-05 18:07:34 +00:00
|
|
|
void deleteHighlights(int id = -1);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-09-03 23:47:12 +00:00
|
|
|
* Deletes all text selection objects of the page.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2007-09-03 23:47:12 +00:00
|
|
|
void deleteTextSelections();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2018-10-18 19:04:49 +00:00
|
|
|
* Get the tiles manager for the tiled @p observer
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2014-02-19 22:40:43 +00:00
|
|
|
TilesManager *tilesManager(const DocumentObserver *observer) const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2018-10-18 19:04:49 +00:00
|
|
|
* Set the tiles manager for the tiled @p observer
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2014-02-19 22:40:43 +00:00
|
|
|
void setTilesManager(const DocumentObserver *observer, TilesManager *tm);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-26 07:47:18 +00:00
|
|
|
* Moves contents that are generated from oldPage to this. And clears them from page
|
|
|
|
* so it can be deleted fine.
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2017-10-26 07:47:18 +00:00
|
|
|
void adoptGeneratedContents(PagePrivate *oldPage);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
|
|
|
/*
|
2017-10-26 07:47:18 +00:00
|
|
|
* Tries to find an equivalent form field to oldField by looking into the rect, type and name
|
2020-07-10 22:15:05 +00:00
|
|
|
*/
|
2017-10-26 07:47:18 +00:00
|
|
|
OKULARCORE_EXPORT static FormField *findEquivalentForm(const Page *p, FormField *oldField);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2018-02-01 18:42:37 +00:00
|
|
|
void setPixmap(DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect, bool isPartialPixmap);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-03-25 22:36:41 +00:00
|
|
|
class PixmapObject
|
2020-07-10 22:15:05 +00:00
|
|
|
{
|
2007-03-24 00:18:54 +00:00
|
|
|
public:
|
2019-12-20 15:40:59 +00:00
|
|
|
QPixmap *m_pixmap = nullptr;
|
2007-03-24 00:18:54 +00:00
|
|
|
Rotation m_rotation;
|
2020-02-23 23:12:53 +00:00
|
|
|
bool m_isPartialPixmap = false;
|
2020-07-10 22:15:05 +00:00
|
|
|
};
|
2007-03-24 00:18:54 +00:00
|
|
|
QMap<DocumentObserver *, PixmapObject> m_pixmaps;
|
2014-02-19 22:40:43 +00:00
|
|
|
QMap<const DocumentObserver *, TilesManager *> m_tilesManagers;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-03-24 00:18:54 +00:00
|
|
|
Page *m_page;
|
|
|
|
int m_number;
|
|
|
|
Rotation m_orientation;
|
|
|
|
double m_width, m_height;
|
2011-01-29 15:38:18 +00:00
|
|
|
DocumentPrivate *m_doc;
|
2008-05-18 23:06:21 +00:00
|
|
|
NormalizedRect m_boundingBox;
|
2007-03-24 00:18:54 +00:00
|
|
|
Rotation m_rotation;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-03-24 00:18:54 +00:00
|
|
|
TextPage *m_text;
|
|
|
|
PageTransition *m_transition;
|
2007-03-30 14:08:20 +00:00
|
|
|
HighlightAreaRect *m_textSelections;
|
2022-03-21 23:59:42 +00:00
|
|
|
QList<FormField *> formfields;
|
2007-04-20 12:37:12 +00:00
|
|
|
Action *m_openingAction;
|
|
|
|
Action *m_closingAction;
|
2007-03-24 00:18:54 +00:00
|
|
|
double m_duration;
|
|
|
|
QString m_label;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2008-05-18 23:06:21 +00:00
|
|
|
bool m_isBoundingBoxKnown : 1;
|
2012-05-30 16:38:51 +00:00
|
|
|
QDomDocument restoredLocalAnnotationList; // <annotationList>...</annotationList>
|
2014-05-11 13:06:27 +00:00
|
|
|
QDomDocument restoredFormFieldList; // <forms>...</forms>
|
2007-03-24 00:18:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-11-14 23:38:02 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::PageItems)
|
|
|
|
|
2007-03-24 00:18:54 +00:00
|
|
|
#endif
|