]> git.lyx.org Git - lyx.git/blobdiff - src/TocBackend.cpp
typo
[lyx.git] / src / TocBackend.cpp
index a253d57ca337ec2903d4ecc6b9b8f5d9975e82e9..d401e2250936d31f86c4b6c683088f8731676b5a 100644 (file)
@@ -43,7 +43,7 @@ namespace lyx {
 ///////////////////////////////////////////////////////////////////////////
 
 TocItem::TocItem(DocIterator const & dit, int d, docstring const & s,
-                 bool output_active, FuncRequest action)
+                 bool output_active, FuncRequest const & action)
        : dit_(dit), depth_(d), str_(s), output_(output_active),
          action_(action)
 {
@@ -204,17 +204,24 @@ bool TocBackend::updateItem(DocIterator const & dit_in)
 }
 
 
-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);
 }