2007-03-24 00:18:54 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
|
|
|
|
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
|
2017-11-16 08:57:58 +00:00
|
|
|
* Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group *
|
|
|
|
* company, info@kdab.com. Work sponsored by the *
|
|
|
|
* LiMux project of the city of Munich *
|
2007-03-24 00:18:54 +00:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _OKULAR_PAGE_PRIVATE_H_
|
|
|
|
#define _OKULAR_PAGE_PRIVATE_H_
|
|
|
|
|
|
|
|
// qt/kde includes
|
|
|
|
#include <qlinkedlist.h>
|
2007-03-25 22:36:41 +00:00
|
|
|
#include <qmap.h>
|
2012-09-08 15:06:02 +00:00
|
|
|
#include <qtransform.h>
|
2007-03-24 00:18:54 +00:00
|
|
|
#include <qstring.h>
|
2012-05-30 16:38:51 +00:00
|
|
|
#include <qdom.h>
|
2007-03-24 00:18:54 +00:00
|
|
|
|
|
|
|
// local includes
|
|
|
|
#include "global.h"
|
2007-05-05 18:07:34 +00:00
|
|
|
#include "area.h"
|
2007-03-24 00:18:54 +00:00
|
|
|
|
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
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PagePrivate( Page *page, uint n, double w, double h, Rotation o );
|
|
|
|
~PagePrivate();
|
|
|
|
|
2017-03-02 23:32:08 +00:00
|
|
|
static PagePrivate *get( Page *page );
|
|
|
|
|
2007-03-24 10:47:22 +00:00
|
|
|
void imageRotationDone( RotationJob * job );
|
2012-09-08 15:06:02 +00:00
|
|
|
QTransform rotationMatrix() const;
|
2007-03-24 00:18:54 +00:00
|
|
|
|
2007-04-14 19:58:17 +00:00
|
|
|
/**
|
|
|
|
* Loads the local contents (e.g. annotations) of the page.
|
|
|
|
*/
|
2014-09-09 14:08:32 +00:00
|
|
|
bool restoreLocalContents( const QDomNode & pageNode );
|
2007-04-14 19:58:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves the local contents (e.g. annotations) of the page.
|
|
|
|
*/
|
2008-11-14 23:38:02 +00:00
|
|
|
void saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what = AllPageItems ) const;
|
2007-04-14 19:58:17 +00:00
|
|
|
|
2007-05-01 23:36:57 +00:00
|
|
|
/**
|
|
|
|
* Rotates the image and object rects of the page to the given @p orientation.
|
|
|
|
*/
|
|
|
|
void rotateAt( Rotation orientation );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the size of the page to the given @p size.
|
|
|
|
*
|
|
|
|
* The @p size is meant to be referred to the page not rotated.
|
|
|
|
*/
|
|
|
|
void changeSize( const PageSize &size );
|
|
|
|
|
2007-05-05 18:07:34 +00:00
|
|
|
/**
|
|
|
|
* Sets the @p color and @p areas of text selections.
|
|
|
|
*/
|
|
|
|
void setTextSelections( RegularAreaRect *areas, const QColor & color );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the @p color and @p area of the highlight for the observer with
|
|
|
|
* the given @p id.
|
|
|
|
*/
|
|
|
|
void setHighlight( int id, RegularAreaRect *area, const QColor & color );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deletes all highlight objects for the observer with the given @p id.
|
|
|
|
*/
|
|
|
|
void deleteHighlights( int id = -1 );
|
|
|
|
|
2007-09-03 23:47:12 +00:00
|
|
|
/**
|
|
|
|
* Deletes all text selection objects of the page.
|
|
|
|
*/
|
|
|
|
void deleteTextSelections();
|
|
|
|
|
2012-11-08 19:46:47 +00:00
|
|
|
/**
|
2014-02-19 22:40:43 +00:00
|
|
|
* Get the tiles manager for the tiled @observer
|
2012-11-08 19:46:47 +00:00
|
|
|
*/
|
2014-02-19 22:40:43 +00:00
|
|
|
TilesManager *tilesManager( const DocumentObserver *observer ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the tiles manager for the tiled @observer
|
|
|
|
*/
|
|
|
|
void setTilesManager( const DocumentObserver *observer, TilesManager *tm );
|
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.
|
|
|
|
*/
|
|
|
|
void adoptGeneratedContents( PagePrivate *oldPage );
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tries to find an equivalent form field to oldField by looking into the rect, type and name
|
|
|
|
*/
|
|
|
|
OKULARCORE_EXPORT static FormField *findEquivalentForm( const Page *p, FormField *oldField );
|
2012-11-08 19:46:47 +00:00
|
|
|
|
2007-03-25 22:36:41 +00:00
|
|
|
class PixmapObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QPixmap *m_pixmap;
|
|
|
|
Rotation m_rotation;
|
|
|
|
};
|
2013-02-24 21:58:53 +00:00
|
|
|
QMap< DocumentObserver*, PixmapObject > m_pixmaps;
|
2014-02-19 22:40:43 +00:00
|
|
|
QMap< const DocumentObserver*, TilesManager *> m_tilesManagers;
|
2007-03-25 22:36:41 +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;
|
|
|
|
|
|
|
|
TextPage * m_text;
|
|
|
|
PageTransition * m_transition;
|
2007-03-30 14:08:20 +00:00
|
|
|
HighlightAreaRect *m_textSelections;
|
2007-03-24 00:18:54 +00:00
|
|
|
QLinkedList< 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;
|
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
|