From eb2352f22732cd224c5309c1b9bd29d55242e591 Mon Sep 17 00:00:00 2001 From: John Levon Date: Wed, 30 Oct 2002 15:09:55 +0000 Subject: [PATCH] fix 568 (r=lars) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5555 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 5 +++++ src/insets/insetfloat.C | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 4284f5a8d1..8dd5971294 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-10-30 John Levon + + * insetfloat.C (addToTOC): recursively traverse all + contents looking for captions (fix #568) + 2002-10-25 Jean-Marc Lasgouttes * insetexternal.C (doSubstitution): do not try to replace diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index ac8dcd9d3a..75a6746df9 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -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(); } } -- 2.39.5