setChangesPresent(false);
Buffer & cbuf = const_cast<Buffer &>(*this);
+ // if we are reloading, then we could have a dangling TOC,
+ // in effect. so we need to go ahead and reset, even though
+ // we will do so again when we rebuild the TOC later.
+ cbuf.tocBackend().reset();
// do the real work
ParIterator parit = cbuf.par_iterator_begin();
}
-void TocBackend::update(bool output_active, UpdateType utype)
+void TocBackend::reset()
{
- for (TocList::iterator it = tocs_.begin(); it != tocs_.end(); ++it)
- it->second->clear();
+ for (auto const & t: tocs_)
+ t.second->clear();
tocs_.clear();
builders_.clear();
resetOutlinerNames();
- if (!buffer_->isInternal()) {
- DocIterator dit;
- buffer_->inset().addToToc(dit, output_active, utype, *this);
- }
+}
+
+
+void TocBackend::update(bool output_active, UpdateType utype)
+{
+ reset();
+ if (buffer_->isInternal())
+ return;
+
+ DocIterator dit;
+ buffer_->inset().addToToc(dit, output_active, utype, *this);
}
void setBuffer(Buffer const * buffer) { buffer_ = buffer; }
///
void update(bool output_active, UpdateType utype);
+ ///
+ void reset();
/// \return true if the item was updated.
bool updateItem(DocIterator const & pit);
///