• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdegraphics
  • Sitemap
  • Contact Us
 

okular

Okular::TextPage

Okular::TextPage Class Reference

#include <textpage.h>

List of all members.


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 (  ) 

Creates a new text page.

Definition at line 76 of file textpage.cpp.

TextPage::TextPage ( const TextEntity::List &  words  ) 

Creates a new text page with the given words.

Definition at line 81 of file textpage.cpp.

TextPage::~TextPage (  ) 

Destroys the text page.

Definition at line 86 of file textpage.cpp.


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 rect is a valid pointer to a null area
  • the whole page text if rect is a null pointer
  • the text which is included by rectangular area rect otherwise

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:
  • textpage.h
  • textpage.cpp

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdegraphics

Skip menu "kdegraphics"
  • okular
Generated for kdegraphics by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal