okular
Okular::TextPage Class Reference
#include <textpage.h>
Detailed Description
The TextPage class represents the text of a page by providing.
- See also:
- TextEntity items for every word/character of the page.
Definition at line 89 of file textpage.h.
Public Member Functions | |
| TextPage () | |
| TextPage (const TextEntity::List &words) | |
| ~TextPage () | |
| void | append (const QString &text, NormalizedRect *area) |
| RegularAreaRect * | findText (int id, const QString &text, SearchDirection direction, Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *lastRect) |
| QString | text (const RegularAreaRect *rect=0) const |
| RegularAreaRect * | textArea (TextSelection *selection) const |
Constructor & Destructor Documentation
| TextPage::TextPage | ( | ) |
| TextPage::TextPage | ( | const TextEntity::List & | words | ) |
| TextPage::~TextPage | ( | ) |
Member Function Documentation
| void TextPage::append | ( | const QString & | text, | |
| NormalizedRect * | area | |||
| ) |
Appends the given text with the given area as new TextEntity to the page.
Definition at line 91 of file textpage.cpp.
| RegularAreaRect * TextPage::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 successful.
- Parameters:
-
id An unique id for this search. text The search text. direction The direction of the search (SearchDirection) caseSensitivity If Qt::CaseSensitive, the search is case sensitive; otherwise the search is case insensitive. lastRect If 0 the search starts at the beginning of the page, otherwise right/below the coordinates of the the given rect.
Definition at line 244 of file textpage.cpp.
| QString TextPage::text | ( | const RegularAreaRect * | rect = 0 |
) | const |
Text extraction function.
Returns:
- a null string if
rectis a valid pointer to a null area - the whole page text if
rectis a null pointer - the text which is included by rectangular area
rectotherwise
Definition at line 423 of file textpage.cpp.
| RegularAreaRect * TextPage::textArea | ( | TextSelection * | selection | ) | const |
Returns the rectangular area of the given selection.
It works like this: There are two cursors, we need to select all the text between them. The coordinates are normalised, leftTop is (0,0) rightBottom is (1,1), so for cursors start (sx,sy) and end (ex,ey) we start with finding text rectangles under those points, if not we search for the first that is to the right to it in the same baseline, if none found, then we search for the first rectangle with a baseline under the cursor, having two points that are the best rectangles to both of the cursors: (rx,ry)x(tx,ty) for start and (ux,uy)x(vx,vy) for end, we do a 1. (rx,ry)x(1,ty) 2. (0,ty)x(1,uy) 3. (0,uy)x(vx,vy)
To find the closest rectangle to cursor (cx,cy) we search for a rectangle that either contains the cursor or that has a left border >= cx and bottom border >= cy.
Definition at line 96 of file textpage.cpp.
The documentation for this class was generated from the following files:
KDE 4.0 API Reference