]> git.lyx.org Git - features.git/commitdiff
Minor code re-organization
authorRichard Heck <rgheck@lyx.org>
Fri, 24 Nov 2017 20:34:25 +0000 (15:34 -0500)
committerRichard Heck <rgheck@lyx.org>
Fri, 24 Nov 2017 23:15:27 +0000 (18:15 -0500)
src/insets/InsetCollapsible.cpp

index c429c51b417c2ed34999f876ff78f1503c1ca1ce..32c78752d233471a08b3729f5a761ed235a2aa91 100644 (file)
@@ -672,23 +672,23 @@ void InsetCollapsible::addToToc(DocIterator const & cpit, bool output_active,
 {
        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<InsetCollapsible &>(*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);
+       if (!layout.addToToc())
+               return InsetText::addToToc(cpit, doing_output, utype, backend);
+
+       TocBuilder & b = backend.builder(layout.tocType());
+       // Cursor inside the inset
+       DocIterator pit = cpit;
+       pit.push_back(CursorSlice(const_cast<InsetCollapsible &>(*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();
 }