X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTocBackend.cpp;h=a253d57ca337ec2903d4ecc6b9b8f5d9975e82e9;hb=77a7df10037c64040c5910d7e997af3026bd5c39;hp=4630d85b9deb5da15875c0347a6e0aca6351bd61;hpb=461fda9ca9a8079f235fe6d26031aa6b9c5ff36e;p=lyx.git diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index 4630d85b9d..a253d57ca3 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -22,7 +22,7 @@ #include "Paragraph.h" #include "TextClass.h" -#include "insets/InsetText.h" +#include "insets/InsetArgument.h" #include "support/debug.h" #include "support/docstream.h" @@ -162,7 +162,7 @@ bool TocBackend::updateItem(DocIterator const & dit_in) return false; if (toc("tableofcontents")->empty()) { - // FIXME: should not happen, + // FIXME: should not happen, // a call to TocBackend::update() is missing somewhere LYXERR0("TocBackend::updateItem called but the TOC is empty!"); return false; @@ -181,18 +181,14 @@ bool TocBackend::updateItem(DocIterator const & dit_in) // FIXME: This is supposed to accomplish the same as the body of // InsetText::iterateForToc(), probably Paragraph & par = toc_item->dit().paragraph(); - InsetList::const_iterator it = par.insetList().begin(); - InsetList::const_iterator end = par.insetList().end(); - for (; it != end; ++it) { - Inset & inset = *it->inset; - if (inset.lyxCode() == ARG_CODE) { + for (auto const & table : par.insetList()) + if (InsetArgument const * arg = table.inset->asInsetArgument()) { tocstring = par.labelString(); if (!tocstring.empty()) tocstring += ' '; - inset.asInsetText()->text().forOutliner(tocstring,TOC_ENTRY_LENGTH); + arg->text().forOutliner(tocstring,TOC_ENTRY_LENGTH); break; } - } int const toclevel = toc_item->dit().text()-> getTocLevel(toc_item->dit().pit()); @@ -217,7 +213,7 @@ void TocBackend::update(bool output_active, UpdateType utype) resetOutlinerNames(); if (!buffer_->isInternal()) { DocIterator dit; - buffer_->inset().addToToc(dit, output_active, utype); + buffer_->inset().addToToc(dit, output_active, utype, *this); } }