lib

#include <KoTextIterator.h>

Inherits TQObject.

Signals

void currentParagraphModified (int modifyType, int pos, int length)
 
void currentParagraphDeleted ()
 

Public Member Functions

 KoTextIterator (const TQValueList< KoTextObject * > &lstObjects, KoTextView *textView, int options)
 
void init (const TQValueList< KoTextObject * > &lstObjects, KoTextView *textView, int options)
 
void restart ()
 
void setOptions (int options)
 
int options () const
 
void operator++ ()
 
bool atEnd () const
 
bool hasText () const
 
TQString currentText () const
 
KoTextParag * currentParag () const
 
KoTextObject * currentTextObject () const
 
int currentStartIndex () const
 
TQPair< int, TQString > currentTextAndIndex () const
 

Protected Slots

void slotParagraphDeleted (KoTextParag *parag)
 
void slotParagraphModified (KoTextParag *parag, int, int pos, int length)
 

Protected Member Functions

void connectTextObjects ()
 
void nextTextObject ()
 

Detailed Description

A convenient way to iterate over paragraphs, possibly in multiple textobjects, with many options (from cursor, backwards, in selection).

General purpose paragraph iterator

Definition at line 36 of file KoTextIterator.h.

Constructor & Destructor Documentation

◆ KoTextIterator()

KoTextIterator::KoTextIterator ( const TQValueList< KoTextObject * > &  lstObjects,
KoTextView *  textView,
int  options 
)
inline
Parameters
lstObjectslist of text objects to iterate over
textViewview in which the objects live
optionssee KFindDialog

Definition at line 46 of file KoTextIterator.h.

Member Function Documentation

◆ atEnd()

bool KoTextIterator::atEnd ( ) const
Returns
true if we have iterated over all paragraphs

Definition at line 283 of file KoTextIterator.cpp.

◆ connectTextObjects()

void KoTextIterator::connectTextObjects ( )
protected

Definition at line 162 of file KoTextIterator.cpp.

◆ currentParag()

KoTextParag * KoTextIterator::currentParag ( ) const
inline
Returns
the string at the current position of the iterator

Definition at line 92 of file KoTextIterator.h.

◆ currentParagraphDeleted

void KoTextIterator::currentParagraphDeleted ( )
signal

Emitted when the current paragraph has been deleted by the user.

When this happens, the iterator automatically moves to the next paragraph (if any).

◆ currentParagraphModified

void KoTextIterator::currentParagraphModified ( int  modifyType,
int  pos,
int  length 
)
signal

Emitted when the current paragraph has been modified by the user.

Apps will often want to call setData again

◆ currentStartIndex()

int KoTextIterator::currentStartIndex ( ) const

Where in currentParag() does currentText() start?

Definition at line 289 of file KoTextIterator.cpp.

◆ currentText()

TQString KoTextIterator::currentText ( ) const
Returns
the string at the current position of the iterator

Definition at line 294 of file KoTextIterator.cpp.

◆ currentTextAndIndex()

TQPair< int, TQString > KoTextIterator::currentTextAndIndex ( ) const
Returns
the string at the current position of the iterator, as well as the index in the current paragraph. Use this instead of separate calls to currentText and currentStartIndex, for performance reasons.

Definition at line 299 of file KoTextIterator.cpp.

◆ currentTextObject()

KoTextObject * KoTextIterator::currentTextObject ( ) const
inline
Returns
the text object in which currentParag() is.

Definition at line 97 of file KoTextIterator.h.

◆ hasText()

bool KoTextIterator::hasText ( ) const
Returns
true if currentText() isn't empty. The implementation is faster than calling currentText().isEmpty() though.

Definition at line 324 of file KoTextIterator.cpp.

◆ init()

void KoTextIterator::init ( const TQValueList< KoTextObject * > &  lstObjects,
KoTextView *  textView,
int  options 
)

The search direction (forward or backward) is handled in a bit of a tricky way.

m_firstParag/m_firstIndex is where the search starts, whichever the direction m_lastParag/m_lastIndex is where the search ends, whichever the direction But the list of textobjects is as given (we assume document order). So we go from the first to the last textobject, or from the last to the first textobject.

Definition at line 36 of file KoTextIterator.cpp.

◆ nextTextObject()

void KoTextIterator::nextTextObject ( )
protected

Definition at line 255 of file KoTextIterator.cpp.

◆ operator++()

void KoTextIterator::operator++ ( )

Go to next paragraph that we must iterate over.

Definition at line 223 of file KoTextIterator.cpp.

◆ options()

int KoTextIterator::options ( ) const
inline

Return the options currently used by the iterator.

Definition at line 66 of file KoTextIterator.h.

◆ restart()

void KoTextIterator::restart ( )

Restart from the beginning - assumes same parameters given to init.

Definition at line 141 of file KoTextIterator.cpp.

◆ setOptions()

void KoTextIterator::setOptions ( int  options)

Change options during iteration.

## Not sure how if all cases will be handled :} At least this is useful for the "Replace All" button during replacing, and for switching to "FindBackwards" temporarily for "find previous".

Definition at line 343 of file KoTextIterator.cpp.

◆ slotParagraphDeleted

void KoTextIterator::slotParagraphDeleted ( KoTextParag *  parag)
protectedslot

Definition at line 183 of file KoTextIterator.cpp.

◆ slotParagraphModified

void KoTextIterator::slotParagraphModified ( KoTextParag *  parag,
int  modifyType,
int  pos,
int  length 
)
protectedslot

Definition at line 177 of file KoTextIterator.cpp.


The documentation for this class was generated from the following files: