• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • khtml
  • LinearDocument
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
khtml::LinearDocument Class Reference

#include <khtml_caret_p.h>

Public Types

typedef LineIterator Iterator
 

Public Member Functions

 LinearDocument (KHTMLPart *part, DOM::NodeImpl *node, long offset, CaretAdvancePolicy advancePolicy, DOM::ElementImpl *baseElem)
 
virtual ~LinearDocument ()
 
CaretAdvancePolicy advancePolicy () const
 
RenderObject * baseObject () const
 
Iterator begin ()
 
int count () const
 
Iterator current ()
 
const Iterator & end () const
 
bool isValid () const
 
const Iterator & preBegin () const
 
Iterator preEnd ()
 

Protected Member Functions

void initEndIterator ()
 
void initPreBeginIterator ()
 

Protected Attributes

Iterator _end
 
Iterator _preBegin
 
CaretAdvancePolicy advPol
 
RenderObject * base
 
CaretBoxLineDeleter cblDeleter
 
KHTMLPart * m_part
 
DOM::NodeImpl * node
 
long offset
 

Detailed Description

Represents the whole document in terms of lines.

SGML documents are trees. But for navigation, this representation is not practical. Therefore this class serves as a helper to represent the document as a linear list of lines. Its usage somewhat resembles STL semantics like begin and end as well as iterators.

The lines itself are represented as caret line boxes.

LinearDocument instances are not meant to be kept over the lifetime of their associated document, but constructed from (node, offset) pairs whenever line traversal is needed. This is because the underlying InlineFlowBox objects may be destroyed and recreated (e. g. by resizing the window, adding/removing elements).

Author
Leo Savernik

Definition at line 622 of file khtml_caret_p.h.

Member Typedef Documentation

typedef LineIterator khtml::LinearDocument::Iterator

Definition at line 624 of file khtml_caret_p.h.

Constructor & Destructor Documentation

khtml::LinearDocument::LinearDocument ( KHTMLPart *  part,
DOM::NodeImpl *  node,
long  offset,
CaretAdvancePolicy  advancePolicy,
DOM::ElementImpl *  baseElem 
)

Creates a new instance, and initializes it to the line specified by the parameters below.

Creation will fail if node is invisible or defect.

Parameters
partpart within which everything is taking place.
nodedocument node with which to start
offsetzero-based offset within this node.
advancePolicycaret advance policy
baseElembase element which the caret must not advance beyond (0 means whole document). The base element will be ignored if it cannot serve as a base (to see if this is the case, check whether LinearDocument::baseFlow()->element() != base)

Definition at line 1244 of file khtml_caret.cpp.

khtml::LinearDocument::~LinearDocument ( )
virtual

Definition at line 1261 of file khtml_caret.cpp.

Member Function Documentation

CaretAdvancePolicy khtml::LinearDocument::advancePolicy ( ) const
inline

Returns the current caret advance policy.

Definition at line 697 of file khtml_caret_p.h.

RenderObject* khtml::LinearDocument::baseObject ( ) const
inline

Returns the base render object which the caret must not advance beyond.

Note that HTML documents are usually restricted to the body element.

Returns
the base render object or 0 if the whole document is valid.

Definition at line 706 of file khtml_caret_p.h.

LinearDocument::Iterator khtml::LinearDocument::begin ( )

Returns a line iterator pointing to the very first line of the document.

Definition at line 1276 of file khtml_caret.cpp.

int khtml::LinearDocument::count ( ) const

Returns the count of lines.

Warning: This function is expensive. Call it once and cache the value.

FIXME: It's not implemented yet (and maybe never will)

Definition at line 1265 of file khtml_caret.cpp.

LinearDocument::Iterator khtml::LinearDocument::current ( )

Returns a line iterator containing the current position as its starting value.

Definition at line 1271 of file khtml_caret.cpp.

const Iterator& khtml::LinearDocument::end ( ) const
inline

Returns a line iterator pointing right after the end of the document.

Definition at line 676 of file khtml_caret_p.h.

void khtml::LinearDocument::initEndIterator ( )
protected

Definition at line 1309 of file khtml_caret.cpp.

void khtml::LinearDocument::initPreBeginIterator ( )
protected

Definition at line 1304 of file khtml_caret.cpp.

bool khtml::LinearDocument::isValid ( ) const
inline

Tells whether this list contains any lines.

Returns
true if this document contains lines, false otherwise. Note that an empty document contains at least one line, so this method only returns false if the document could not be initialised for some reason.

Definition at line 653 of file khtml_caret_p.h.

const Iterator& khtml::LinearDocument::preBegin ( ) const
inline

Returns a line iterator pointing just before the very first line of the document (this is somewhat an emulation of reverse iterators).

Definition at line 692 of file khtml_caret_p.h.

LinearDocument::Iterator khtml::LinearDocument::preEnd ( )

Returns a line iterator pointing to the very last line of the document.

Definition at line 1290 of file khtml_caret.cpp.

Member Data Documentation

Iterator khtml::LinearDocument::_end
protected

Definition at line 718 of file khtml_caret_p.h.

Iterator khtml::LinearDocument::_preBegin
protected

Definition at line 717 of file khtml_caret_p.h.

CaretAdvancePolicy khtml::LinearDocument::advPol
protected

Definition at line 721 of file khtml_caret_p.h.

RenderObject* khtml::LinearDocument::base
protected

Definition at line 722 of file khtml_caret_p.h.

CaretBoxLineDeleter khtml::LinearDocument::cblDeleter
protected

Definition at line 713 of file khtml_caret_p.h.

KHTMLPart* khtml::LinearDocument::m_part
protected

Definition at line 720 of file khtml_caret_p.h.

DOM::NodeImpl* khtml::LinearDocument::node
protected

Definition at line 714 of file khtml_caret_p.h.

long khtml::LinearDocument::offset
protected

Definition at line 715 of file khtml_caret_p.h.


The documentation for this class was generated from the following files:
  • khtml_caret_p.h
  • khtml_caret.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:24 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal