00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
#ifndef KOTEXTITERATOR_H
00020
#define KOTEXTITERATOR_H
00021
00022
#include <qvaluelist.h>
00023
#include <qstring.h>
00024
#include <qpair.h>
00025
#include <qobject.h>
00026
class KoTextParag;
00027
class KoTextObject;
00028
class KoTextView;
00029
00035 class KoTextIterator :
public QObject
00036 {
00037 Q_OBJECT
00038
public:
00042 KoTextIterator(
const QValueList<KoTextObject *> & lstObjects,
KoTextView* textView,
int options ) {
00043
init( lstObjects, textView, options );
00044 }
00045
void init(
const QValueList<KoTextObject *> & lstObjects,
KoTextView* textView,
int options );
00046
00050
void restart();
00051
00057
void setOptions(
int options );
00058
00062 int options()
const {
return m_options; }
00063
00067
void operator++();
00068
00072
bool atEnd() const;
00073
00078
bool hasText() const;
00079
00083
QString currentText() const;
00084
00088 KoTextParag* currentParag()
const {
return m_currentParag; }
00089
00093 KoTextObject*
currentTextObject()
const {
return *m_currentTextObj; }
00094
00098
int currentStartIndex() const;
00099
00106
QPair<
int,
QString> currentTextAndIndex() const;
00107
00108 signals:
00113
void currentParagraphModified(
int modifyType,
int pos,
int length );
00114
00115 protected:
00116
void connectTextObjects();
00117
void nextTextObject();
00118
00119 protected slots:
00120
void slotParagraphDeleted( KoTextParag* parag );
00121
void slotParagraphModified( KoTextParag* parag,
int ,
int pos,
int length );
00122
00123 private:
00124
00125
00126
00127
QValueList<
KoTextObject *> m_lstObjects;
00128
int m_options;
00129
00130
00131
00132 KoTextParag* m_firstParag;
00133
int m_firstIndex;
00134
00135
00136
00137 KoTextParag* m_lastParag;
00138
int m_lastIndex;
00139
00140
00141
QValueList<
KoTextObject *>::Iterator m_currentTextObj;
00142 KoTextParag* m_currentParag;
00143 };
00144
00145 #endif