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 <q3valuelist.h>
00023 #include <QString>
00024 #include <QPair>
00025 #include <QObject>
00026 #include <koffice_export.h>
00027 class KoTextParag;
00028 class KoTextObject;
00029 class KoTextView;
00030
00036 class KOTEXT_EXPORT KoTextIterator : public QObject
00037 {
00038 Q_OBJECT
00039 public:
00045 KoTextIterator( const Q3ValueList<KoTextObject *> & lstObjects, KoTextView* textView, int options ) {
00046 init( lstObjects, textView, options );
00047 }
00048 void init( const Q3ValueList<KoTextObject *> & lstObjects, KoTextView* textView, int options );
00049
00053 void restart();
00054
00060 void setOptions( int options );
00061
00065 int options() const { return m_options; }
00066
00070 void operator++();
00071
00075 bool atEnd() const;
00076
00081 bool hasText() const;
00082
00086 QString currentText() const;
00087
00091 KoTextParag* currentParag() const { return m_currentParag; }
00092
00096 KoTextObject* currentTextObject() const { return *m_currentTextObj; }
00097
00101 int currentStartIndex() const;
00102
00109 QPair<int, QString> currentTextAndIndex() const;
00110
00111 signals:
00116 void currentParagraphModified( int modifyType, int pos, int length );
00117
00122 void currentParagraphDeleted();
00123
00124 protected:
00125 void connectTextObjects();
00126 void nextTextObject();
00127
00128 protected slots:
00129 void slotParagraphDeleted( KoTextParag* parag );
00130 void slotParagraphModified( KoTextParag* parag, int , int pos, int length );
00131
00132 private:
00133
00134
00135
00136 Q3ValueList<KoTextObject *> m_lstObjects;
00137 int m_options;
00138
00139
00140
00141 KoTextParag* m_firstParag;
00142 int m_firstIndex;
00143
00144
00145
00146 KoTextParag* m_lastParag;
00147 int m_lastIndex;
00148
00149
00150 Q3ValueList<KoTextObject *>::Iterator m_currentTextObj;
00151 KoTextParag* m_currentParag;
00152 };
00153
00154 #endif