Okular

page.h
1 /***************************************************************************
2  * Copyright (C) 2004 by Enrico Ros <[email protected]> *
3  * Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group *
4  * company, [email protected] Work sponsored by the *
5  * LiMux project of the city of Munich *
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  ***************************************************************************/
12 
13 #ifndef _OKULAR_PAGE_H_
14 #define _OKULAR_PAGE_H_
15 
16 #include <QLinkedList>
17 
18 #include "okularcore_export.h"
19 #include "area.h"
20 #include "global.h"
21 #include "textpage.h"
22 
23 class QPixmap;
24 
25 class PagePainter;
26 
27 namespace Okular {
28 
29 class Annotation;
30 class Document;
31 class DocumentObserver;
32 class DocumentPrivate;
33 class FormField;
34 class PagePrivate;
35 class PageTransition;
36 class SourceReference;
37 class TextSelection;
38 class Tile;
39 
52 class OKULARCORE_EXPORT Page
53 {
54  public:
59  {
61  Closing
62  };
63 
72  Page( uint pageNumber, double width, double height, Rotation orientation );
73 
77  ~Page();
78 
82  int number() const;
83 
87  Rotation orientation() const;
88 
92  Rotation rotation() const;
93 
98  Rotation totalOrientation() const;
99 
103  double width() const;
104 
108  double height() const;
109 
113  double ratio() const;
114 
123  NormalizedRect boundingBox() const;
124 
131  bool isBoundingBoxKnown() const;
132 
141  void setBoundingBox( const NormalizedRect& bbox );
142 
148  bool hasPixmap( DocumentObserver *observer, int width = -1, int height = -1, const NormalizedRect &rect = NormalizedRect() ) const;
149 
153  bool hasTextPage() const;
154 
159  bool hasObjectRect( double x, double y, double xScale, double yScale ) const;
160 
165  bool hasHighlights( int id = -1 ) const;
166 
170  bool hasTransition() const;
171 
175  bool hasAnnotations() const;
176 
189  RegularAreaRect* findText( int id, const QString & text, SearchDirection direction,
190  Qt::CaseSensitivity caseSensitivity, const RegularAreaRect * lastRect=nullptr) const;
191 
196  QString text( const RegularAreaRect * area = nullptr ) const;
197 
203  QString text( const RegularAreaRect * area, TextPage::TextAreaInclusionBehaviour b ) const;
204 
213 
220  RegularAreaRect * wordAt( const NormalizedPoint &p, QString *word = nullptr ) const;
221 
225  RegularAreaRect * textArea( TextSelection *selection ) const;
226 
230  const ObjectRect * objectRect( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale ) const;
231 
236  QLinkedList< const ObjectRect * > objectRects( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale ) const;
237 
243  const ObjectRect * nearestObjectRect( ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double * distance ) const;
244 
249  const PageTransition * transition() const;
250 
254  QLinkedList< Annotation* > annotations() const;
255 
260  Annotation * annotation( const QString & uniqueName ) const;
261 
266  const Action * pageAction( PageAction action ) const;
267 
271  QLinkedList< FormField * > formFields() const;
272 
279  void setPixmap( DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect = NormalizedRect() );
280 
284  void setTextPage( TextPage * text );
285 
289  void setObjectRects( const QLinkedList< ObjectRect * > & rects );
290 
294  void setSourceReferences( const QLinkedList< SourceRefObjectRect * > & rects );
295 
301  void setDuration( double seconds );
302 
308  double duration() const;
309 
313  void setLabel( const QString& label );
314 
318  QString label() const;
319 
323  const RegularAreaRect * textSelection() const;
324 
329  QColor textSelectionColor() const;
330 
334  void addAnnotation( Annotation * annotation );
335 
339  bool removeAnnotation( Annotation * annotation );
340 
344  void setTransition( PageTransition * transition );
345 
349  void setPageAction( PageAction action, Action * link );
350 
354  void setFormFields( const QLinkedList< FormField * >& fields );
355 
359  void deletePixmap( DocumentObserver *observer );
360 
364  void deletePixmaps();
365 
369  void deleteRects();
370 
374  void deleteSourceReferences();
375 
379  void deleteAnnotations();
380 
387  bool hasTilesManager( const DocumentObserver *observer ) const;
388 
396  QList<Tile> tilesAt( const DocumentObserver *observer, const NormalizedRect &rect ) const;
397 
398  private:
399  PagePrivate* d;
401  friend class PagePrivate;
402  friend class Document;
403  friend class DocumentPrivate;
404  friend class PixmapRequestPrivate;
405 
410  friend class ::PagePainter;
412 
413  const QPixmap * _o_nearestPixmap( DocumentObserver *, int, int ) const;
414 
417  QLinkedList< Annotation* > m_annotations;
418 
419  Q_DISABLE_COPY( Page )
420 };
421 
422 }
423 
424 #endif
SearchDirection
Describes the direction of searching.
Definition: global.h:39
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:119
Rotation
A rotation.
Definition: global.h:50
Represents the textual information of a Page.
Definition: textpage.h:108
A NormalizedRect is a rectangle which can be defined by two NormalizedPoints.
Definition: area.h:192
This is a list of NormalizedRect, to describe an area consisting of multiple rectangles using normali...
Definition: area.h:948
global.h
Definition: action.h:19
An area with normalized coordinates that contains a reference to an object.
Definition: area.h:454
PageAction
An action to be executed when particular events happen.
Definition: page.h:58
CaseSensitivity
The Document.
Definition: document.h:192
Collector for all the data belonging to a page.
Definition: page.h:52
Encapsulates data that describes an action.
Definition: action.h:43
ObjectType
Describes the type of storable object.
Definition: area.h:460
An action to be executed when the page is "opened".
Definition: page.h:60
TextAreaInclusionBehaviour
Defines the behaviour of adding characters to text() result.
Definition: textpage.h:120
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:91
Base class for objects being notified when something changes.
Definition: observer.h:31
Information object for the transition effect of a page.
Wrapper around the information needed to generate the selection area There are two assumptions inside...
Definition: misc.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jul 6 2020 22:35:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.