}
-void TocBackend::updateItem(DocIterator const & dit)
+bool TocBackend::updateItem(DocIterator const & dit)
{
+ if (dit.paragraph().layout().toclevel == Layout::NOT_IN_TOC)
+ return false;
+
if (toc("tableofcontents").empty()) {
// FIXME: should not happen,
// a call to TocBackend::update() is missing somewhere
LYXERR0("TocBackend::updateItem called but the TOC is empty!");
- return;
+ return false;
}
BufferParams const & bufparams = buffer_->params();
tocstring = par.asString(AS_STR_LABEL);
const_cast<TocItem &>(*toc_item).str_ = tocstring;
+
+ buffer_->updateTocItem("tableofcontents", dit);
+ return true;
}
}
+Toc::iterator Toc::item(int depth, docstring const & str)
+{
+ if (empty())
+ return end();
+ iterator it = begin();
+ iterator itend = end();
+ for (; it != itend; ++it) {
+ if (it->depth() == depth && it->str() == str)
+ break;
+ }
+ return it;
+}
+
+
void TocBackend::writePlaintextTocList(string const & type, odocstream & os) const
{
TocList::const_iterator cit = tocs_.find(type);