]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetCollapsable.cpp
Make the generation of children's tocs more robust
[features.git] / src / insets / InsetCollapsable.cpp
index fa9f01056ab685e00ae67280e2faafa1541dec5f..beb9f6d4f151c6cc6a7151a151bdb503761682b3 100644 (file)
@@ -662,19 +662,19 @@ bool InsetCollapsable::canPaintChange(BufferView const & bv) const
 
 
 void InsetCollapsable::addToToc(DocIterator const & cpit, bool output_active,
-                                UpdateType utype) const
+                                UpdateType utype, TocBackend & backend) const
 {
        bool doing_output = output_active && producesOutput();
        InsetLayout const & layout = getLayout();
        if (layout.addToToc()) {
-               TocBuilder & b = buffer().tocBackend().builder(layout.tocType());
+               TocBuilder & b = backend.builder(layout.tocType());
                // Cursor inside the inset
                DocIterator pit = cpit;
                pit.push_back(CursorSlice(const_cast<InsetCollapsable &>(*this)));
                docstring const label = getLabel();
                b.pushItem(pit, label + (label.empty() ? "" : ": "), output_active);
                // Proceed with the rest of the inset.
-               InsetText::addToToc(cpit, doing_output, utype);
+               InsetText::addToToc(cpit, doing_output, utype, backend);
                if (layout.isTocCaption()) {
                        docstring str;
                        text().forOutliner(str, TOC_ENTRY_LENGTH);
@@ -682,7 +682,7 @@ void InsetCollapsable::addToToc(DocIterator const & cpit, bool output_active,
                }
                b.pop();
        } else
-               InsetText::addToToc(cpit, doing_output, utype);
+               InsetText::addToToc(cpit, doing_output, utype, backend);
 }