Okular

textpage.h
1 /***************************************************************************
2  * Copyright (C) 2005 by Piotr Szymanski <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 #ifndef _OKULAR_TEXTPAGE_H_
11 #define _OKULAR_TEXTPAGE_H_
12 
13 #include <QList>
14 #include <QString>
15 
16 #include "global.h"
17 #include "okularcore_export.h"
18 
19 class QTransform;
20 
21 namespace Okular
22 {
23 class NormalizedPoint;
24 class NormalizedRect;
25 class Page;
26 class PagePrivate;
27 class TextPagePrivate;
28 class TextSelection;
29 class RegularAreaRect;
30 
54 class OKULARCORE_EXPORT TextEntity
55 {
56 public:
57  typedef QList<TextEntity *> List;
58 
63  TextEntity(const QString &text, NormalizedRect *area);
64 
68  ~TextEntity();
69 
73  QString text() const;
74 
78  NormalizedRect *area() const;
79 
83  NormalizedRect transformedArea(const QTransform &matrix) const;
84 
85 private:
86  QString m_text;
87  NormalizedRect *m_area;
88 
89  class Private;
90  const Private *d;
91 
92  Q_DISABLE_COPY(TextEntity)
93 };
94 
108 class OKULARCORE_EXPORT TextPage
109 {
111  friend class Page;
112  friend class PagePrivate;
114 
115 public:
122  CentralPixelTextAreaInclusionBehaviour
123  };
124 
128  TextPage();
129 
133  explicit TextPage(const TextEntity::List &words);
134 
138  ~TextPage();
139 
144  void append(const QString &text, NormalizedRect *area);
145 
158  RegularAreaRect *findText(int searchID, const QString &query, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *area);
159 
169  QString text(const RegularAreaRect *area = nullptr) const;
170 
180  QString text(const RegularAreaRect *area, TextAreaInclusionBehaviour b) const;
181 
189  TextEntity::List words(const RegularAreaRect *area, TextAreaInclusionBehaviour b) const;
190 
196  RegularAreaRect *wordAt(const NormalizedPoint &p, QString *word = nullptr) const;
197 
201  RegularAreaRect *textArea(TextSelection *selection) const;
202 
203 private:
204  TextPagePrivate *const d;
205 
206  Q_DISABLE_COPY(TextPage)
207 };
208 
209 }
210 
211 #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
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:191
This is a list of NormalizedRect, to describe an area consisting of multiple rectangles using normali...
Definition: area.h:911
global.h
Definition: action.h:19
Represents a piece of text on a TextPage, containing its textual representation and its bounding box...
Definition: textpage.h:54
CaseSensitivity
Collector for all the data belonging to a page.
Definition: page.h:52
A character is included into text() result if any pixel of his bounding box is in the given area...
Definition: textpage.h:121
TextAreaInclusionBehaviour
Defines the behaviour of adding characters to text() result.
Definition: textpage.h:120
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 Fri Nov 27 2020 22:37:30 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.