]> git.lyx.org Git - lyx.git/blobdiff - src/TocBackend.cpp
Fix bug #2213 (part 1): GuiChanges lacks "Previous Change" button.
[lyx.git] / src / TocBackend.cpp
index 6ce5f4044bef194c450b62631464e963d7c51679..a0105a6124a2cb3438533e025cabcc9ad7df6d3c 100644 (file)
@@ -137,7 +137,7 @@ bool TocBackend::updateItem(DocIterator const & dit)
                                *static_cast<InsetOptArg&>(inset).paragraphs().begin();
                        if (!par.labelString().empty())
                                tocstring = par.labelString() + ' ';
-                       tocstring += inset_par.asString();
+                       tocstring += inset_par.asString(AS_STR_INSETS);
                        break;
                }
        }
@@ -145,10 +145,11 @@ bool TocBackend::updateItem(DocIterator const & dit)
        int const toclevel = par.layout().toclevel;
        if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel
                && tocstring.empty())
-                       tocstring = par.asString(AS_STR_LABEL);
+                       tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS);
 
        const_cast<TocItem &>(*toc_item).str_ = tocstring;
 
+       buffer_->updateTocItem("tableofcontents", dit);
        return true;
 }
 
@@ -202,6 +203,20 @@ TocIterator Toc::item(DocIterator const & dit) const
 }
 
 
+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);