diff options
author | Sebastian Geerken <devnull@localhost> | 2014-09-01 11:33:57 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-09-01 11:33:57 +0200 |
commit | f4b8928574720c0de84ad2245e60ed9db4bfdd99 (patch) | |
tree | 5f69b3631acb10e1444733984f1917a773965fc6 /dw/textblock.hh | |
parent | 710cd1504ba1d34aedd02e8d5f1e90e388e1a7fa (diff) |
Simplified and fixed TextblockIterator.
Diffstat (limited to 'dw/textblock.hh')
-rw-r--r-- | dw/textblock.hh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/dw/textblock.hh b/dw/textblock.hh index bee7dad8..f46edaa4 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -500,14 +500,23 @@ protected: class TextblockIterator: public core::Iterator { private: - int oofmIndex; // -1 means in flow + enum { NUM_SECTIONS = NUM_OOFM + 1 }; + int sectionIndex; // 0 means in flow, otherwise OOFM index + 1 int index; + TextblockIterator (Textblock *textblock, core::Content::Type mask, + int sectionIndex, int index); + + int numParts (int sectionIndex); + void getPart (int sectionIndex, int index, core::Content *content); + public: TextblockIterator (Textblock *textblock, core::Content::Type mask, bool atEnd); - TextblockIterator (Textblock *textblock, core::Content::Type mask, - int oofmIndex, int index); + + inline static TextblockIterator *createWordIndexIterator + (Textblock *textblock, core::Content::Type mask, int wordIndex) + { return new TextblockIterator (textblock, mask, 0, wordIndex); } lout::object::Object *clone(); int compareTo(lout::object::Comparable *other); @@ -856,8 +865,8 @@ public: static void setPenaltyEmDashRight2 (int penaltyRightEmDash2); static void setStretchabilityFactor (int stretchabilityFactor); - Textblock(bool limitTextWidth); - ~Textblock(); + Textblock (bool limitTextWidth); + ~Textblock (); core::Iterator *iterator (core::Content::Type mask, bool atEnd); |