]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetWrap.cpp
XHTML/DocBook: merge code duplicates for vertical alignment.
[features.git] / src / insets / InsetWrap.cpp
index fe56091a75501992e30281450a58cb7a1c2254f1..8987405cb8157c39cd0c4294fc705ac3b90ce5fc 100644 (file)
@@ -26,7 +26,7 @@
 #include "FuncStatus.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
-#include "output_xhtml.h"
+#include "xml.h"
 #include "texstream.h"
 #include "TextClass.h"
 
@@ -47,10 +47,6 @@ InsetWrap::InsetWrap(Buffer * buf, string const & type)
        : InsetCaptionable(buf)
 {
        setCaptionType(type);
-       params_.lines = 0;
-       params_.placement = "o";
-       params_.overhang = Length(0, Length::PCW);
-       params_.width = Length(50, Length::PCW);
 }
 
 
@@ -65,7 +61,7 @@ void InsetWrap::setCaptionType(std::string const & type)
 {
        InsetCaptionable::setCaptionType(type);
        params_.type = captionType();
-       setLabel(_("wrap: ") + floatName(type));
+       setLabel(_("Wrap: ") + floatName(type));
 }
 
 
@@ -207,27 +203,27 @@ int InsetWrap::plaintext(odocstringstream & os,
 }
 
 
-int InsetWrap::docbook(odocstream & os, OutputParams const & runparams) const
+void InsetWrap::docbook(XMLStream & xs, OutputParams const & runparams) const
 {
-       // FIXME UNICODE
-       os << '<' << from_ascii(params_.type) << '>';
-       int const i = InsetText::docbook(os, runparams);
-       os << "</" << from_ascii(params_.type) << '>';
-       return i;
+       InsetLayout const & il = getLayout();
+
+       xs << xml::StartTag(il.docbooktag(), il.docbookattr()); // TODO: Detect when there is a title.
+       InsetText::docbook(xs, runparams);
+       xs << xml::EndTag(il.docbooktag());
 }
 
 
-docstring InsetWrap::xhtml(XHTMLStream & xs, OutputParams const & rp) const
+docstring InsetWrap::xhtml(XMLStream & xs, OutputParams const & rp) const
 {
        string const len = params_.width.asHTMLString();
        string const width = len.empty() ? "50%" : len;
        InsetLayout const & il = getLayout();
        string const & tag = il.htmltag();
        string const attr = il.htmlattr() + " style='width:" + width + ";'";
-       xs << html::StartTag(tag, attr);
+       xs << xml::StartTag(tag, attr);
        docstring const deferred =
                InsetText::insetAsXHTML(xs, rp, InsetText::WriteInnerTag);
-       xs << html::EndTag(tag);
+       xs << xml::EndTag(tag);
        return deferred;
 }