+bool InsetCollapsable::canPaintChange(BufferView const & bv) const
+{
+ // return false to let RowPainter draw the change tracking cue consistently
+ // with the surrounding text, when the inset is inline: for buttons, for
+ // non-allowMultiPar insets.
+ switch (geometry(bv)) {
+ case Corners:
+ case SubLabel:
+ return allowMultiPar();
+ case ButtonOnly:
+ return false;
+ default:
+ break;
+ }
+ return true;
+}
+
+
+void InsetCollapsable::addToToc(DocIterator const & cpit, bool output_active,
+ UpdateType utype, TocBackend & backend) const
+{
+ bool doing_output = output_active && producesOutput();
+ InsetLayout const & layout = getLayout();
+ if (layout.addToToc()) {
+ 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, backend);
+ if (layout.isTocCaption()) {
+ docstring str;
+ text().forOutliner(str, TOC_ENTRY_LENGTH);
+ b.argumentItem(str);
+ }
+ b.pop();
+ } else
+ InsetText::addToToc(cpit, doing_output, utype, backend);
+}
+
+
+