/usr/include/okular/core/textpage.h is in okular-dev 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | /***************************************************************************
* Copyright (C) 2005 by Piotr Szymanski <niedakh@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef _OKULAR_TEXTPAGE_H_
#define _OKULAR_TEXTPAGE_H_
#include <QtCore/QList>
#include <QtCore/QString>
#include "okular_export.h"
#include "global.h"
class QTransform;
namespace Okular {
class NormalizedPoint;
class NormalizedRect;
class Page;
class PagePrivate;
class TextPagePrivate;
class TextSelection;
class RegularAreaRect;
/*! @class TextEntity
* @short Abstract textentity of Okular
* @par The context
* A document can provide different forms of information about textual representation
* of its contents. It can include information about positions of every character on the
* page, this is the best possibility.
*
* But also it can provide information only about positions of every word on the page (not the character).
* Furthermore it can provide information only about the position of the whole page's text on the page.
*
* Also some document types have glyphes - sets of characters rendered as one, so in search they should
* appear as a text but are only one character when drawn on screen. We need to allow this.
*/
class OKULAR_EXPORT TextEntity
{
public:
typedef QList<TextEntity*> List;
/**
* Creates a new text entity with the given @p text and the
* given @p area.
*/
TextEntity( const QString &text, NormalizedRect *area );
/**
* Destroys the text entity.
*/
~TextEntity();
/**
* Returns the text of the text entity.
*/
QString text() const;
/**
* Returns the bounding area of the text entity.
*/
NormalizedRect* area() const;
/**
* Returns the transformed area of the text entity.
*/
NormalizedRect transformedArea(const QTransform &matrix) const;
private:
QString m_text;
NormalizedRect* m_area;
class Private;
const Private *d;
Q_DISABLE_COPY( TextEntity )
};
/**
* The TextPage class represents the text of a page by
* providing @see TextEntity items for every word/character of
* the page.
*/
class OKULAR_EXPORT TextPage
{
/// @cond PRIVATE
friend class Page;
friend class PagePrivate;
/// @endcond
public:
/**
* Defines the behaviour of adding characters to text() result
* @since 0.10 (KDE 4.4)
*/
enum TextAreaInclusionBehaviour
{
AnyPixelTextAreaInclusionBehaviour, ///< A character is included into text() result if any pixel of his bounding box is in the given area
CentralPixelTextAreaInclusionBehaviour ///< A character is included into text() result if the central pixel of his bounding box is in the given area
};
/**
* Creates a new text page.
*/
TextPage();
/**
* Creates a new text page with the given @p words.
*/
TextPage( const TextEntity::List &words );
/**
* Destroys the text page.
*/
~TextPage();
/**
* Appends the given @p text with the given @p area as new
* @ref TextEntity to the page.
*/
void append( const QString &text, NormalizedRect *area );
/**
* Returns the bounding rect of the text which matches the following criteria
* or 0 if the search is not successful.
*
* @param id An unique id for this search.
* @param text The search text.
* @param direction The direction of the search (@ref SearchDirection)
* @param caseSensitivity If Qt::CaseSensitive, the search is case sensitive; otherwise
* the search is case insensitive.
* @param lastRect If 0 the search starts at the beginning of the page, otherwise
* right/below the coordinates of the given rect.
*/
RegularAreaRect* findText( int id, const QString &text, SearchDirection direction,
Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect );
/**
* Text extraction function.
*
* Returns:
* - a null string if @p rect is a valid pointer to a null area
* - the whole page text if @p rect is a null pointer
* - the text which is included by rectangular area @p rect otherwise
* Uses AnyPixelTextAreaInclusionBehaviour
*/
QString text( const RegularAreaRect *rect = 0 ) const;
/**
* Text extraction function.
*
* Returns:
* - a null string if @p rect is a valid pointer to a null area
* - the whole page text if @p rect is a null pointer
* - the text which is included by rectangular area @p rect otherwise
* @since 0.10 (KDE 4.4)
*/
QString text( const RegularAreaRect * rect, TextAreaInclusionBehaviour b ) const;
/**
* Text entity extraction function. Similar to text() but returns
* the words including their bounding rectangles. Note that
* ownership of the contents of the returned list belongs to the
* caller.
* @since 0.14 (KDE 4.8)
*/
TextEntity::List words( const RegularAreaRect * rect, TextAreaInclusionBehaviour b ) const;
/**
* Returns the area and text of the word at the given point
* Note that ownership of the returned area belongs to the caller.
* @since 0.15 (KDE 4.9)
*/
RegularAreaRect * wordAt( const NormalizedPoint &p, QString *word = 0 ) const;
/**
* Returns the rectangular area of the given @p selection.
*/
RegularAreaRect *textArea( TextSelection *selection ) const;
private:
TextPagePrivate* const d;
Q_DISABLE_COPY( TextPage )
};
}
#endif
|