]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetCaption.cpp
Revert "Mark some intentional fall-throughs (in a way understandable to gcc)"
[features.git] / src / insets / InsetCaption.cpp
index 149a40c93b8cb7a5156f27905a078f0abca418cf..1490c2cdb2e39637214136d9ea45266464441b1d 100644 (file)
@@ -53,7 +53,7 @@ namespace lyx {
 
 
 InsetCaption::InsetCaption(Buffer * buf, string const & type)
-    : InsetText(buf, InsetText::PlainLayout), 
+    : InsetText(buf, InsetText::PlainLayout),
       labelwidth_(0), is_subfloat_(false), type_(type)
 {
        setDrawFrame(true);
@@ -94,7 +94,7 @@ void InsetCaption::setCustomLabel(docstring const & label)
 
 
 void InsetCaption::addToToc(DocIterator const & cpit, bool output_active,
-                                                       UpdateType utype) const
+                                                       UpdateType utype, TocBackend & backend) const
 {
        string const & type = floattype_.empty() ? "senseless" : floattype_;
        DocIterator pit = cpit;
@@ -109,9 +109,9 @@ void InsetCaption::addToToc(DocIterator const & cpit, bool output_active,
                str = full_label_;
                text().forOutliner(str, length);
        }
-       buffer().tocBackend().builder(type).captionItem(pit, str, output_active);
+       backend.builder(type).captionItem(pit, str, output_active);
        // Proceed with the rest of the inset.
-       InsetText::addToToc(cpit, output_active, utype);
+       InsetText::addToToc(cpit, output_active, utype, backend);
 }
 
 
@@ -293,7 +293,7 @@ int InsetCaption::docbook(odocstream & os,
 }
 
 
-docstring InsetCaption::xhtml(XHTMLStream &, OutputParams const & rp) const
+docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 {
        if (rp.html_disable_captions)
                return docstring();
@@ -308,14 +308,10 @@ docstring InsetCaption::xhtml(XHTMLStream &, OutputParams const & rp) const
                else
                        attr = attr + " class='" + our_class + "'";
        }
-       odocstringstream ods;
-       XHTMLStream ourxs(ods);
-       ourxs << html::StartTag(tag, attr) << html::CR();
-       docstring def = getCaptionAsHTML(ourxs, rp);
-       ourxs << html::EndTag(tag) << html::CR();
-       if (!def.empty())
-               return ods.str() + "\n" + def;
-       return ods.str();
+       xs << html::StartTag(tag, attr);
+       docstring def = getCaptionAsHTML(xs, rp);
+       xs << html::EndTag(tag);
+       return def;
 }
 
 
@@ -326,7 +322,7 @@ void InsetCaption::getArgument(otexstream & os,
 
        if (!il.leftdelim().empty())
                os << il.leftdelim();
+
        OutputParams rp = runparams;
        if (isPassThru())
                rp.pass_thru = true;