F:/KPlato/koffice/libs/kotext/KoTextIterator.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016  * Boston, MA 02110-1301, USA.
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 /*ParagModifyType*/, int pos, int length );
00131 
00132 private:
00133     // The reason we use a QValueList of pointers instead of QPtrList
00134     // is that having a QPtrListIterator member var can't work, one can't
00135     // initialize it afterwards.
00136     Q3ValueList<KoTextObject *> m_lstObjects;
00137     int m_options;
00138 
00139     // This is relative to the first textobject in m_lstObjects
00140     // We always start from this paragraph (even when going backwards)
00141     KoTextParag* m_firstParag;
00142     int m_firstIndex;
00143 
00144     // This is relative to the last textobject in m_lstObjects
00145     // We're done when we hit this paragraph
00146     KoTextParag* m_lastParag;
00147     int m_lastIndex;
00148 
00149     // Our current position
00150     Q3ValueList<KoTextObject *>::Iterator m_currentTextObj;
00151     KoTextParag* m_currentParag;
00152 };
00153 
00154 #endif

Généré le Wed Nov 22 23:41:09 2006 pour KPlato par  doxygen 1.5.1-p1