]> git.lyx.org Git - features.git/commitdiff
fix 568 (r=lars)
authorJohn Levon <levon@movementarian.org>
Wed, 30 Oct 2002 15:09:55 +0000 (15:09 +0000)
committerJohn Levon <levon@movementarian.org>
Wed, 30 Oct 2002 15:09:55 +0000 (15:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5555 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetfloat.C

index 4284f5a8d1166e5c34aa5e40ee95ab115afea2f9..8dd59712947a0cbf692cc465d0e79b7932648c82 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-30  John Levon  <levon@movementarian.org>
+
+       * insetfloat.C (addToTOC): recursively traverse all
+         contents looking for captions (fix #568)
 2002-10-25  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * insetexternal.C (doSubstitution): do not try to replace
index ac8dcd9d3a578c46aa4e3341aa423cb50f3d7f98..75a6746df9a33bd9a80e8be472d59b0e669e8044 100644 (file)
@@ -30,6 +30,7 @@
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
 #include "lyxlex.h"
+#include "iterators.h"
 
 using std::ostream;
 using std::endl;
@@ -339,11 +340,13 @@ bool InsetFloat::wide() const
 
 void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
 {
-       // Now find the caption in the float...
-       // We now tranverse the paragraphs of
-       // the inset...
-       Paragraph * tmp = inset.paragraph();
-       while (tmp) {
+       ParIterator pit(inset.paragraph());
+       ParIterator end;
+
+       // Find a caption layout in one of the (child inset's) pars
+       for (; pit != end; ++pit) {
+               Paragraph * tmp = *pit;
                if (tmp->layout()->name() == caplayout) {
                        string const str =
                                tostr(toclist[type()].size() + 1)
@@ -351,6 +354,5 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
                        toc::TocItem const item(tmp, 0 , str);
                        toclist[type()].push_back(item);
                }
-               tmp = tmp->next();
        }
 }