okular
page.cpp
Go to the documentation of this file.
55 static void deleteObjectRects( QLinkedList< ObjectRect * >& rects, const QSet<ObjectRect::ObjectType>& which )
196 Q_ASSERT( bbox.left >= -epsilon && bbox.top >= -epsilon && bbox.right <= 1 + epsilon && bbox.bottom <= 1 + epsilon );
202 bool Page::hasPixmap( DocumentObserver *observer, int width, int height, const NormalizedRect &rect ) const
216 QMap< DocumentObserver*, PagePrivate::PixmapObject >::const_iterator it = d->m_pixmaps.constFind( observer );
271 QLinkedList< HighlightAreaRect * >::const_iterator it = m_highlights.begin(), end = m_highlights.end();
304 QString Page::text( const RegularAreaRect * area, TextPage::TextAreaInclusionBehaviour b ) const
324 TextEntity::List Page::words( const RegularAreaRect * area, TextPage::TextAreaInclusionBehaviour b ) const
344 ret[i] = new TextEntity( orig->text(), new Okular::NormalizedRect(orig->transformedArea ( d->rotationMatrix() )) );
359 if ( ( (int)m_orientation + (int)m_rotation ) % 2 != ( (int)m_orientation + (int)orientation ) % 2 )
374 RotationJob *job = new RotationJob( object.m_pixmap->toImage(), object.m_rotation, m_rotation, it.key() );
395 QLinkedList< ObjectRect * >::const_iterator objectIt = m_page->m_rects.begin(), end = m_page->m_rects.end();
399 QLinkedList< HighlightAreaRect* >::const_iterator hlIt = m_page->m_highlights.begin(), hlItEnd = m_page->m_highlights.end();
421 const ObjectRect * Page::objectRect( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale ) const
429 if ( ( objrect->objectType() == type ) && objrect->distanceSqr( x, y, xScale, yScale ) < distanceConsideredEqual )
436 QLinkedList< const ObjectRect * > Page::objectRects( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale ) const
445 if ( ( objrect->objectType() == type ) && objrect->distanceSqr( x, y, xScale, yScale ) < distanceConsideredEqual )
453 const ObjectRect* Page::nearestObjectRect( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double * distance ) const
458 QLinkedList< ObjectRect * >::const_iterator it = m_rects.constBegin(), end = m_rects.constEnd();
518 QMap< DocumentObserver*, PagePrivate::PixmapObject >::iterator it = d->m_pixmaps.find( observer );
705 QLinkedList< FormField * >::const_iterator it = d->formfields.begin(), itEnd = d->formfields.end();
752 QLinkedList< HighlightAreaRect* >::iterator it = m_page->m_highlights.begin(), end = m_page->m_highlights.end();
782 QLinkedList< Annotation * >::const_iterator aIt = m_annotations.begin(), aEnd = m_annotations.end();
826 kWarning(OkularDebug).nospace() << "page (" << m_number << "): can't restore an annotation from XML.";
872 void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what ) const
908 QLinkedList< Annotation * >::const_iterator aIt = m_page->m_annotations.constBegin(), aEnd = m_page->m_annotations.constEnd();
936 QLinkedList< FormField * >::const_iterator fIt = formfields.constBegin(), fItEnd = formfields.constEnd();
970 QMap< DocumentObserver*, PagePrivate::PixmapObject >::const_iterator itPixmap = d->m_pixmaps.constFind( observer );
977 QMap< DocumentObserver*, PagePrivate::PixmapObject >::const_iterator it = d->m_pixmaps.constBegin(), end = d->m_pixmaps.constEnd();
Definition: page_p.h:46
void setRotation(Rotation rotation)
Inform the new rotation of the page.
Definition: tilesmanager.cpp:157
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:47
void setUniqueName(const QString &name)
Sets the unique name of the annotation.
Definition: annotations.cpp:551
void deleteHighlights(int id=-1)
Deletes all highlight objects for the observer with the given id.
Definition: page.cpp:749
iterator erase(iterator pos)
PagePrivate(Page *page, uint n, double w, double h, Rotation o)
Definition: page.cpp:68
Definition: page_p.h:55
static QTransform rotationMatrix(Rotation from, Rotation to)
Definition: rotationjob.cpp:69
void performAddPageAnnotation(int page, Annotation *annotation)
Definition: document.cpp:1058
int width() const
The TextPage class represents the text of a page by providing.
Definition: textpage.h:90
Rotation rotation() const
Returns the rotation of the page as defined by the user.
Definition: page.cpp:154
QDomNode appendChild(const QDomNode &newChild)
void correctTextOrder()
Make necessary modifications in the TextList to make the text order correct, so that textselection wo...
Definition: textpage.cpp:1876
RegularAreaRect * textArea(TextSelection *selection) const
Returns the rectangular area of the given selection.
Definition: page.cpp:241
QString attribute(const QString &name, const QString &defValue) const
int length() const
This class describes the object rectangle for a source reference.
Definition: area.h:474
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:202
void setHighlight(int id, RegularAreaRect *area, const QColor &color)
Sets the color and area of the highlight for the observer with the given id.
Definition: page.cpp:572
Rotation totalOrientation() const
Returns the total orientation which is the original orientation plus the user defined rotation...
Definition: page.cpp:159
iterator begin()
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:453
bool isElement() const
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:626
void deletePixmap(DocumentObserver *observer)
Deletes the pixmap for the given observer.
Definition: page.cpp:712
void setFormFields(const QLinkedList< FormField * > &fields)
Sets fields as list of FormField of the page.
Definition: page.cpp:701
bool isBoundingBoxKnown() const
Returns whether the bounding box of the page has been computed.
Definition: page.cpp:184
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
Definition: area.h:105
void toBack()
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
Definition: area.h:860
const_iterator constFind(const Key &key) const
ObjectType objectType() const
Returns the object type of the object rectangle.
Definition: area.cpp:346
TextEntity::List words(const RegularAreaRect *rect, TextPage::TextAreaInclusionBehaviour b) const
Returns the page text (or part of it) including the bounding rectangles.
Definition: page.cpp:324
QDomElement documentElement() const
void deleteSourceReferences()
Deletes all source reference objects of the page.
Definition: page.cpp:772
bool hasPrevious() const
bool hasTextPage() const
Returns whether the page provides a text page (TextPage).
Definition: page.cpp:228
iterator end()
QTransform inverted(bool *invertible) const
QDomNode nextSibling() const
QDomNode importNode(const QDomNode &importedNode, bool deep)
QDomElement toElement() const
This class describes the object rectangle for an annotation.
Definition: area.h:431
NormalizedRect transformedArea(const QTransform &matrix) const
Returns the transformed area of the text entity.
Definition: textpage.cpp:208
void addRotationJob(RotationJob *job)
Definition: pagecontroller.cpp:31
QDomDocument restoredLocalAnnotationList
Definition: page_p.h:144
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, yScale).
Definition: page.cpp:421
int elapsed() const
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:249
void restoreLocalContents(const QDomNode &pageNode)
Loads the local contents (e.g.
Definition: page.cpp:788
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:487
QList< Tile > tilesAt(const NormalizedRect &rect, TileLeaf tileLeaf)
Returns a list of all tiles intersecting with rect.
Definition: tilesmanager.cpp:358
const_iterator constEnd() const
TextEntity::List words(const RegularAreaRect *rect, TextAreaInclusionBehaviour b) const
Text entity extraction function.
Definition: textpage.cpp:1920
void setObjectRects(const QLinkedList< ObjectRect * > &rects)
Sets the list of object rects of the page.
Definition: page.cpp:554
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:189
Item next()
void setAttribute(const QString &name, const QString &value)
int toInt(bool *ok, int base) const
bool isEmpty() const
QMap< DocumentObserver *, PixmapObject > m_pixmaps
Definition: page_p.h:123
NormalizedRect boundingBox() const
Returns the bounding box of the page content in normalized [0,1] coordinates, in terms of the upright...
Definition: page.cpp:179
QString text(const RegularAreaRect *rect=0) const
Returns the page text (or part of it).
Definition: page.cpp:299
RegularAreaRect * wordAt(const NormalizedPoint &p, QString *word=0) const
Returns the area and text of the word at the given point Note that ownership of the returned area bel...
Definition: page.cpp:233
QMap< const DocumentObserver *, TilesManager * > m_tilesManagers
Definition: page_p.h:124
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:128
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:507
RegularAreaRect * findText(int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect=0) const
Returns the bounding rect of the text which matches the following criteria or 0 if the search is not ...
Definition: page.cpp:288
const Key & key() const
bool removeAnnotation(Annotation *annotation)
Removes the annotation from the page.
Definition: page.cpp:651
const T & value() const
static void deleteObjectRects(QLinkedList< ObjectRect * > &rects, const QSet< ObjectRect::ObjectType > &which)
Definition: page.cpp:55
bool hasChildNodes() const
void setDuration(double seconds)
Sets the duration of the page to seconds when displayed in presentation mode.
Definition: page.cpp:601
void setTextSelections(RegularAreaRect *areas, const QColor &color)
Sets the color and areas of text selections.
Definition: page.cpp:581
QLinkedList< Annotation * > annotations() const
Returns the list of annotations of the page.
Definition: page.cpp:482
void setTilesManager(const DocumentObserver *observer, TilesManager *tm)
Set the tiles manager for the tiled .
Definition: page.cpp:1012
void transform(const QTransform &matrix)
Transforms the regular area with the operations defined by matrix.
Definition: area.h:848
int height() const
static NormalizedRect toRotatedRect(const NormalizedRect &rect, Rotation rotation)
Returns a rotated NormalizedRect given a rotation.
Definition: tilesmanager.cpp:606
bool contains(const T &value) const
bool isNull() const
void saveLocalContents(QDomNode &parentNode, QDomDocument &document, PageItems what=AllPageItems) const
Saves the local contents (e.g.
Definition: page.cpp:872
bool canRemovePageAnnotation(const Annotation *annotation) const
Tests if the annotation can be removed.
Definition: document.cpp:3051
QString text(const RegularAreaRect *rect=0) const
Text extraction function.
Definition: textpage.cpp:1068
void setSize(int width, int height)
Inform the new size of the page and mark all tiles to repaint.
Definition: tilesmanager.cpp:136
static Annotation * createAnnotation(const QDomElement &element)
Restore an annotation (with revisions if needed) from the dom element.
Definition: annotations.cpp:90
void changeSize(const PageSize &size)
Changes the size of the page to the given size.
Definition: page.cpp:406
RegularAreaRect * textArea(TextSelection *selection) const
Returns the rectangular area of the given selection.
Definition: textpage.cpp:331
RegularAreaRect * wordAt(const NormalizedPoint &p, QString *word=0) const
Returns the area and text of the word at the given point Note that ownership of the returned area bel...
Definition: textpage.cpp:1957
double duration() const
Returns the duration in seconds of the page when displayed in presentation mode.
Definition: page.cpp:606
QTransform buildRotationMatrix(Rotation rotation)
Return a rotation matrix corresponding to the rotation enumeration.
Definition: utils.cpp:380
QDomNode firstChild() const
void imageRotationDone(RotationJob *job)
Definition: page.cpp:94
A character is included into text() result if any pixel of his bounding box is in the given area...
Definition: textpage.h:104
TextAreaInclusionBehaviour
Defines the behaviour of adding characters to text() result.
Definition: textpage.h:102
double distanceSqr(double x, double y, double xScale, double yScale) const
Returns the square of the distance between the object and the point x, y for the scaling factor xScal...
Definition: area.cpp:379
bool hasHighlights(int id=-1) const
Returns whether the page provides highlighting for the observer with the given id.
Definition: page.cpp:262
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:90
const T & previous()
QLinkedList< const ObjectRect * > objectRects(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const
Returns all object rects of the given type which are at point (x, y) at scale (xScale, yScale).
Definition: page.cpp:436
Base class for objects being notified when something changes.
Definition: observer.h:28
void setPixmap(const QPixmap *pixmap, const NormalizedRect &rect)
Sets the pixmap of the tiles covered by rect (which represents the location of pixmap on the page)...
Definition: tilesmanager.cpp:188
RegularAreaRect * findText(int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect)
Returns the bounding rect of the text which matches the following criteria or 0 if the search is not ...
Definition: textpage.cpp:715
QString uniqueName() const
Returns the unique name of the annotation.
Definition: annotations.cpp:557
Definition: page_p.h:45
const PageTransition * transition() const
Returns the transition effect of the page or 0 if no transition effect is set (see hasTransition())...
Definition: page.cpp:477
void start()
QList< Tile > tilesAt(const DocumentObserver *observer, const NormalizedRect &rect) const
Returns a list of all tiles intersecting with rect.
Definition: page.cpp:998
Definition: rotationjob_p.h:26
QString label() const
Returns the label of the page, or a null string if not set.
Definition: page.cpp:616
QString tagName() const
Rotation orientation() const
Returns the orientation of the page as defined by the document.
Definition: page.cpp:149
void addAnnotation(Annotation *annotation)
Adds a new annotation to the page.
Definition: page.cpp:631
QImage toImage() const
QDomElement createElement(const QString &tagName)
This class stores the coordinates of a highlighting area together with the id of the highlight owner ...
Definition: area.h:878
bool hasTransition() const
Returns whether the page provides a transition effect.
Definition: page.cpp:278
QLinkedList< FormField * > formFields() const
Returns the list of FormField of the page.
Definition: page.cpp:502
bool hasPixmap(const NormalizedRect &rect)
Checks whether all tiles intersecting with rect are available.
Definition: tilesmanager.cpp:325
Definition: page_p.h:51
PageController * m_pageController
Definition: document_p.h:251
void setSourceReferences(const QLinkedList< SourceRefObjectRect * > &rects)
Sets the list of source reference objects rects.
Definition: page.cpp:594
bool hasTilesManager(const DocumentObserver *observer) const
Returns whether pixmaps for the tiled observer are handled by a tile manager.
Definition: page.cpp:993
Information object for the transition effect of a page.
Definition: pagetransition.h:24
TilesManager * tilesManager(const DocumentObserver *observer) const
Get the tiles manager for the tiled .
Definition: page.cpp:1007
QString toString() const
Wrapper around the information needed to generate the selection area There are two assumptions inside...
Definition: misc.h:36
void rotateAt(Rotation orientation)
Rotates the image and object rects of the page to the given orientation.
Definition: page.cpp:351
void setPageAction(PageAction action, Action *link)
Sets the link object for the given page action.
Definition: page.cpp:686
QUuid createUuid()
bool hasNext() const
void append(const T &value)
const RegularAreaRect * textSelection() const
Returns the current text selection.
Definition: page.cpp:621
Definition: page_p.h:117
Page(uint number, double width, double height, Rotation orientation)
Creates a new page.
Definition: page.cpp:127
void setTransition(PageTransition *transition)
Sets the page transition effect.
Definition: page.cpp:680
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.