- // Now find the caption in the float...
- ParagraphList::iterator tmp = inset.paragraphs.begin();
- ParagraphList::iterator end = inset.paragraphs.end();
-
- for (; tmp != end; ++tmp) {
- if (tmp->layout()->name() == caplayout) {
- string const name = floatname(params_.type, buf.params);
- string const str =
- tostr(toclist[name].size() + 1)
- + ". " + tmp->asString(buf, false);
- lyx::toc::TocItem const item(tmp->id(), 0 , str);
- toclist[name].push_back(item);
+ ParConstIterator pit = par_const_iterator_begin(*this);
+ ParConstIterator end = par_const_iterator_end(*this);
+
+ // Find a caption layout in one of the (child inset's) pars
+ for (; pit != end; ++pit) {
+ if (pit->layout()->labeltype == LABEL_SENSITIVE) {
+ Toc & toc = toclist[params_.type];
+ docstring const str =
+ convert<docstring>(toc.size() + 1)
+ + ". " + pit->asString(buf, false);
+ toc.push_back(TocItem(pit, 0, str));