Okular
page.cpp
5 SPDX-FileCopyrightText: 2017 Klarälvdalens Datakonsult AB a KDAB Group company <[email protected]>
54 static void deleteObjectRects(QList<ObjectRect *> &rects, const QSet<ObjectRect::ObjectType> &which)
213 Q_ASSERT(bbox.left >= -epsilon && bbox.top >= -epsilon && bbox.right <= 1 + epsilon && bbox.bottom <= 1 + epsilon);
219 bool Page::hasPixmap(DocumentObserver *observer, int width, int height, const NormalizedRect &rect) const
230 QMap<DocumentObserver *, PagePrivate::PixmapObject>::const_iterator it = d->m_pixmaps.constFind(observer);
323 RegularAreaRect *Page::findText(int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect) const
359 TextEntity::List Page::words(const RegularAreaRect *area, TextPage::TextAreaInclusionBehaviour b) const
378 retI = new TextEntity(orig->text(), new Okular::NormalizedRect(orig->transformedArea(d->rotationMatrix())));
393 if (((int)m_orientation + (int)m_rotation) % 2 != ((int)m_orientation + (int)orientation) % 2) {
409 RotationJob *job = new RotationJob(object.m_pixmap->toImage(), object.m_rotation, m_rotation, it.key());
435 const QTransform highlightRotationMatrix = Okular::buildRotationMatrix((Rotation)(((int)m_rotation - (int)oldRotation + 4) % 4));
458 const ObjectRect *Page::objectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const
465 if ((objrect->objectType() == type) && objrect->distanceSqr(x, y, xScale, yScale) < distanceConsideredEqual) {
473 QList<const ObjectRect *> Page::objectRects(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const
481 if ((objrect->objectType() == type) && objrect->distanceSqr(x, y, xScale, yScale) < distanceConsideredEqual) {
489 const ObjectRect *Page::nearestObjectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double *distance) const
554 void PagePrivate::setPixmap(DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect, bool isPartialPixmap)
863 qCWarning(OkularCoreDebug).nospace() << "page (" << m_number << "): can't restore an annotation from XML.";
917 void PagePrivate::saveLocalContents(QDomNode &parentNode, QDomDocument &document, PageItems what) const
998 QMap<DocumentObserver *, PagePrivate::PixmapObject>::const_iterator itPixmap = d->m_pixmaps.constFind(observer);
1004 QMap<DocumentObserver *, PagePrivate::PixmapObject>::const_iterator it = d->m_pixmaps.constBegin(), end = d->m_pixmaps.constEnd();
1072 if (f->rect() == oldField->rect() && f->type() == oldField->type() && f->id() == oldField->id()) {
1084 if (f->type() == oldField->type() && f->id() == oldField->id() && qFuzzyCompare(f->rect().left, oldField->rect().left) && qFuzzyCompare(f->rect().top, oldField->rect().top) &&
1085 qFuzzyCompare(f->rect().right, oldField->rect().right) && qFuzzyCompare(f->rect().bottom, oldField->rect().bottom)) {
void append(const T &value)
This class describes the object rectangle for a source reference.
Definition: area.h:598
void setBoundingBox(const NormalizedRect &bbox)
Sets the bounding box of the page content in normalized [0,1] coordinates, in terms of the upright or...
Definition: page.cpp:205
ObjectType objectType() const
Returns the object type of the object rectangle.
Definition: area.cpp:352
void setObjectRects(const QList< ObjectRect * > &rects)
Sets the list of object rects of the page.
Definition: page.cpp:599
QDomNode firstChild() const const
QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags)
QDomElement toElement() const const
const ObjectRect * nearestObjectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double *distance) const
Returns the object rect of the given type which is nearest to the point (x, y) at scale (xScale,...
Definition: page.cpp:489
const T & value() const const
NormalizedRect transformedArea(const QTransform &matrix) const
Returns the transformed area of the text entity.
Definition: textpage.cpp:205
RegularAreaRect * wordAt(const NormalizedPoint &p, QString *word=nullptr) const
Returns the area and text of the word at the given point Note that ownership of the returned area bel...
Definition: page.cpp:261
const Action * pageAction(PageAction action) const
Returns the Action object which is associated with the given page action or 0 if no page action is se...
Definition: page.cpp:530
CaseSensitivity
QDomNode importNode(const QDomNode &importedNode, bool deep)
QString tagName() const const
bool hasPrevious() const const
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:95
static void storeAnnotation(const Annotation *annotation, QDomElement &element, QDomDocument &document)
Saves the annotation as a child of element taking care of saving all revisions if it has any.
Definition: annotations.cpp:130
virtual void transform(const QTransform &matrix)
Transforms the object rectangle with the operations defined by matrix.
Definition: area.cpp:379
bool isNull() const const
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:116
Base class for objects being notified when something changes.
Definition: observer.h:28
Information object for the transition effect of a page.
Definition: pagetransition.h:21
bool hasNext() const const
double duration() const
Returns the duration in seconds of the page when displayed in presentation mode.
Definition: page.cpp:656
This class describes the object rectangle for an annotation.
Definition: area.h:555
QDomElement createElement(const QString &tagName)
const ObjectRect * objectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const
Returns the object rect of the given type which is at point (x, y) at scale (xScale,...
Definition: page.cpp:458
Rotation rotation() const
Returns the rotation of the page as defined by the user.
Definition: page.cpp:170
QString text(const RegularAreaRect *area=nullptr) const
Returns the page text (or part of it).
Definition: page.cpp:334
Rotation orientation() const
Returns the orientation of the page as defined by the document.
Definition: page.cpp:165
void setAttribute(const QString &name, const QString &value)
const PageTransition * transition() const
Returns the transition effect of the page or 0 if no transition effect is set (see hasTransition()).
Definition: page.cpp:510
void setSourceReferences(const QList< SourceRefObjectRect * > &rects)
Sets the list of source reference objects rects.
Definition: page.cpp:643
TextAreaInclusionBehaviour
Defines the behaviour of adding characters to text() result.
Definition: textpage.h:117
const T & previous()
void deletePixmap(DocumentObserver *observer)
Deletes the pixmap for the given observer.
Definition: page.cpp:758
void setPixmap(DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect=NormalizedRect())
Sets the region described by rect with pixmap for the given observer.
Definition: page.cpp:549
Wrapper around the information needed to generate the selection area There are two assumptions inside...
Definition: misc.h:33
KOSM_EXPORT double distance(const std::vector< const OSM::Node * > &path, Coordinate coord)
RegularAreaRect * textArea(TextSelection *selection) const
Returns the rectangular area of the given selection.
Definition: page.cpp:270
void addAnnotation(Annotation *annotation)
Adds a new annotation to the page.
Definition: page.cpp:681
This is a list of NormalizedRect, to describe an area consisting of multiple rectangles using normali...
Definition: area.h:932
bool hasTransition() const
Returns whether the page provides a transition effect.
Definition: page.cpp:313
QHash::const_iterator constEnd() const const
bool isEmpty() const const
QUuid createUuid()
This class stores the geometry of a highlighting area in normalized coordinates, together with highli...
Definition: area.h:950
const RegularAreaRect * textSelection() const
Returns the current text selection.
Definition: page.cpp:671
int toInt(bool *ok, int base) const const
TextEntity::List words(const RegularAreaRect *area, TextPage::TextAreaInclusionBehaviour b) const
Returns the page text (or part of it) including the bounding rectangles.
Definition: page.cpp:359
void setUniqueName(const QString &name)
Sets the unique name of the annotation.
Definition: annotations.cpp:611
bool hasObjectRect(double x, double y, double xScale, double yScale) const
Returns whether the page has an object rect which includes the point (x, y) at scale (xScale,...
Definition: page.cpp:279
virtual NormalizedRect rect() const =0
The bounding rect of the field, in normalized coordinates.
bool hasChildNodes() const const
int height() const const
QHash::const_iterator constFind(const Key &key) const const
A NormalizedRect is a rectangle which can be defined by two NormalizedPoints.
Definition: area.h:188
void setTransition(PageTransition *transition)
Sets the page transition effect.
Definition: page.cpp:728
QImage toImage() const const
void setFormFields(const QList< FormField * > &fields)
Sets fields as list of FormField of the page.
Definition: page.cpp:748
QString toString() const const
bool contains(const T &value) const const
static Annotation * createAnnotation(const QDomElement &element)
Restore an annotation (with revisions if needed) from the dom element.
Definition: annotations.cpp:92
void toBack()
QList< FormField * > formFields() const
Returns the list of FormField of the page.
Definition: page.cpp:544
QMapIterator::Item next()
void transform(const QTransform &matrix)
Transforms the regular area with the operations defined by matrix.
Definition: area.h:909
QList::iterator erase(QList::iterator pos)
void start()
QDomNode appendChild(const QDomNode &newChild)
Annotation * annotation(const QString &uniqueName) const
Returns the annotation with the given unique name.
Definition: page.cpp:520
int elapsed() const const
QString label() const
Returns the label of the page, or a null string if not set.
Definition: page.cpp:666
void setPageAction(PageAction action, Action *link)
Sets the link object for the given page action.
Definition: page.cpp:734
NormalizedRect boundingBox() const
Returns the bounding box of the page content in normalized [0,1] coordinates, in terms of the upright...
Definition: page.cpp:195
QColor textSelectionColor() const
Returns the color of the current text selection, or an invalid color if no text selection has been se...
Definition: page.cpp:676
void deleteSourceReferences()
Deletes all source reference objects of the page.
Definition: page.cpp:813
Page(uint pageNumber, double width, double height, Rotation orientation)
Creates a new page.
Definition: page.cpp:141
QDomNode nextSibling() const const
QList::iterator begin()
double distanceSqr(double x, double y, double xScale, double yScale) const
Returns the squared distance between the object and the point with normalized coordinates (x,...
Definition: area.cpp:384
bool hasHighlights(int id=-1) const
Returns whether the page provides highlighting for the observer with the given id.
Definition: page.cpp:294
void setDuration(double seconds)
Sets the duration of the page to seconds when displayed in presentation mode.
Definition: page.cpp:651
KGuiItem ok()
QString attribute(const QString &name, const QString &defValue) const const
Represents a piece of text on a TextPage, containing its textual representation and its bounding box.
Definition: textpage.h:51
bool removeAnnotation(Annotation *annotation)
Removes the annotation from the page.
Definition: page.cpp:700
bool isElement() const const
RegularAreaRect * findText(int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect=nullptr) const
Returns the bounding rect of the text which matches the following criteria or 0 if the search is not ...
Definition: page.cpp:323
QList::iterator end()
bool hasTilesManager(const DocumentObserver *observer) const
Returns whether pixmaps for the tiled observer are handled by a tile manager.
Definition: page.cpp:1017
@ AnyPixelTextAreaInclusionBehaviour
A character is included into text() result if any pixel of his bounding box is in the given area.
Definition: textpage.h:118
QList< Annotation * > annotations() const
Returns the list of annotations of the page.
Definition: page.cpp:515
An area with normalized coordinates that contains a reference to an object.
Definition: area.h:457
void setPageSize(DocumentObserver *observer, int width, int height)
Sets the size of the page (in screen pixels) if there is a TilesManager.
Definition: page.cpp:248
Rotation totalOrientation() const
Returns the total orientation which is the original orientation plus the user defined rotation.
Definition: page.cpp:175
const QList< ObjectRect * > & objectRects() const
Gets the list of object rects of the page.
Definition: page.cpp:617
QList< Tile > tilesAt(const DocumentObserver *observer, const NormalizedRect &rect) const
Returns a list of all tiles intersecting with rect.
Definition: page.cpp:1022
const QList< QKeySequence > & end()
int width() const const
virtual QVariant get(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName)
bool isBoundingBoxKnown() const
Returns whether the bounding box of the page has been computed.
Definition: page.cpp:200
bool hasPixmap(DocumentObserver *observer, int width=-1, int height=-1, const NormalizedRect &rect=NormalizedRect()) const
Returns whether the page of size width x height has a pixmap in the region given by rect for the give...
Definition: page.cpp:219
bool hasTextPage() const
Returns whether the page provides a text page (TextPage).
Definition: page.cpp:256
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:04:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:04:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.