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 "area.h"
19 #include "global.h"
20 #include "okularcore_export.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:
58  enum PageAction {
60  Closing
61  };
62 
71  Page(uint pageNumber, double width, double height, Rotation orientation);
72 
76  ~Page();
77 
81  int number() const;
82 
86  Rotation orientation() const;
87 
91  Rotation rotation() const;
92 
97  Rotation totalOrientation() const;
98 
102  double width() const;
103 
107  double height() const;
108 
112  double ratio() const;
113 
122  NormalizedRect boundingBox() const;
123 
130  bool isBoundingBoxKnown() const;
131 
140  void setBoundingBox(const NormalizedRect &bbox);
141 
147  bool hasPixmap(DocumentObserver *observer, int width = -1, int height = -1, const NormalizedRect &rect = NormalizedRect()) const;
148 
152  bool hasTextPage() const;
153 
158  bool hasObjectRect(double x, double y, double xScale, double yScale) const;
159 
164  bool hasHighlights(int id = -1) const;
165 
169  bool hasTransition() const;
170 
174  bool hasAnnotations() const;
175 
188  RegularAreaRect *findText(int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect = nullptr) const;
189 
194  QString text(const RegularAreaRect *area = nullptr) const;
195 
202 
211 
218  RegularAreaRect *wordAt(const NormalizedPoint &p, QString *word = nullptr) const;
219 
223  RegularAreaRect *textArea(TextSelection *selection) const;
224 
228  const ObjectRect *objectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const;
229 
234  QLinkedList<const ObjectRect *> objectRects(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale) const;
235 
241  const ObjectRect *nearestObjectRect(ObjectRect::ObjectType type, double x, double y, double xScale, double yScale, double *distance) const;
242 
247  const PageTransition *transition() const;
248 
252  QLinkedList<Annotation *> annotations() const;
253 
258  Annotation *annotation(const QString &uniqueName) const;
259 
264  const Action *pageAction(PageAction action) const;
265 
269  QLinkedList<FormField *> formFields() const;
270 
277  void setPixmap(DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect = NormalizedRect());
278 
282  void setTextPage(TextPage *text);
283 
287  void setObjectRects(const QLinkedList<ObjectRect *> &rects);
288 
292  void setSourceReferences(const QLinkedList<SourceRefObjectRect *> &rects);
293 
299  void setDuration(double seconds);
300 
306  double duration() const;
307 
311  void setLabel(const QString &label);
312 
316  QString label() const;
317 
321  const RegularAreaRect *textSelection() const;
322 
327  QColor textSelectionColor() const;
328 
332  void addAnnotation(Annotation *annotation);
333 
337  bool removeAnnotation(Annotation *annotation);
338 
342  void setTransition(PageTransition *transition);
343 
347  void setPageAction(PageAction action, Action *link);
348 
352  void setFormFields(const QLinkedList<FormField *> &fields);
353 
357  void deletePixmap(DocumentObserver *observer);
358 
362  void deletePixmaps();
363 
367  void deleteRects();
368 
372  void deleteSourceReferences();
373 
377  void deleteAnnotations();
378 
385  bool hasTilesManager(const DocumentObserver *observer) const;
386 
394  QList<Tile> tilesAt(const DocumentObserver *observer, const NormalizedRect &rect) const;
395 
396 private:
397  PagePrivate *d;
399  friend class PagePrivate;
400  friend class Document;
401  friend class DocumentPrivate;
402  friend class PixmapRequestPrivate;
403 
408  friend class ::PagePainter;
410 
411  const QPixmap *_o_nearestPixmap(DocumentObserver *, int, int) const;
412 
415  QLinkedList<Annotation *> m_annotations;
416 
417  Q_DISABLE_COPY(Page)
418 };
419 
420 }
421 
422 #endif
SearchDirection
Describes the direction of searching.
Definition: global.h:38
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:119
Rotation
A rotation.
Definition: global.h:48
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:913
global.h
Definition: action.h:19
An area with normalized coordinates that contains a reference to an object.
Definition: area.h:455
PageAction
An action to be executed when particular events happen.
Definition: page.h:58
CaseSensitivity
The Document.
Definition: document.h:193
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:461
An action to be executed when the page is "opened".
Definition: page.h:59
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:88
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-2021 The KDE developers.
Generated on Sat Jan 16 2021 22:37:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.