diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 323bbac386..2bcc2f35c6 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,10 @@ +2005-04-14 Jean-Marc Lasgouttes + + * insetwrap.C (addToToc): copy the code from InsetFloat::addToToc. + + * insetfloat.C (addToToc): do not use the harcoded "Caption" name, + but the SENSITIVE label type. + 2005-04-18 Angus Leeming * ExternalSupport.[Ch] (doSubstitution): passed an extra boolean diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index cb5a2896a7..f5d31686d3 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -114,10 +114,6 @@ using std::ostringstream; namespace { -// this should not be hardcoded, but be part of the definition -// of the float (JMarc) -string const caplayout("Caption"); - string floatname(string const & type, BufferParams const & bp) { FloatList const & floats = bp.getLyXTextClass().floats(); @@ -421,7 +417,7 @@ void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const // Find a caption layout in one of the (child inset's) pars for (; pit != end; ++pit) { - if (pit->layout()->name() == caplayout) { + if (pit->layout()->labeltype == LABEL_SENSITIVE) { string const name = floatname(params_.type, buf.params()); string const str = convert(toclist[name].size() + 1) diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index 29696e01dc..b43ba83cf7 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -27,6 +27,7 @@ #include "lyxlex.h" #include "outputparams.h" #include "paragraph.h" +#include "pariterator.h" #include "support/convert.h" @@ -42,10 +43,6 @@ using std::ostringstream; namespace { -// this should not be hardcoded, but be part of the definition -// of the float (JMarc) -string const caplayout("Caption"); - string floatname(string const & type, BufferParams const & bp) { FloatList const & floats = bp.getLyXTextClass().floats(); @@ -224,17 +221,17 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const { - // Now find the caption in the float... - ParagraphList::const_iterator tmp = paragraphs().begin(); - ParagraphList::const_iterator end = paragraphs().end(); + ParConstIterator pit = par_const_iterator_begin(*this); + ParConstIterator end = par_const_iterator_end(*this); - for (; tmp != end; ++tmp) { - if (tmp->layout()->name() == caplayout) { + // Find a caption layout in one of the (child inset's) pars + for (; pit != end; ++pit) { + if (pit->layout()->labeltype == LABEL_SENSITIVE) { string const name = floatname(params_.type, buf.params()); string const str = convert(toclist[name].size() + 1) - + ". " + tmp->asString(buf, false); - lyx::toc::TocItem const item(tmp->id(), 0 , str); + + ". " + pit->asString(buf, false); + lyx::toc::TocItem const item(pit->id(), 0 , str); toclist[name].push_back(item); } }