]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBox.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / insets / InsetBox.cpp
index ecf9f4fb94e4423686d2d76fa5bff81d7b7bafc3..1ad78ea2bf3a15b1339c49869e05c9a356b0d169 100644 (file)
@@ -24,6 +24,7 @@
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
+#include "output_xhtml.h"
 #include "TextClass.h"
 
 #include "support/debug.h"
@@ -96,7 +97,7 @@ BoxTranslatorLoc const & boxtranslator_loc()
 //
 /////////////////////////////////////////////////////////////////////////
 
-InsetBox::InsetBox(Buffer const & buffer, string const & label)
+InsetBox::InsetBox(Buffer * buffer, string const & label)
        : InsetCollapsable(buffer), params_(label)
 {}
 
@@ -107,12 +108,6 @@ InsetBox::~InsetBox()
 }
 
 
-docstring InsetBox::editMessage() const
-{
-       return _("Opened Box Inset");
-}
-
-
 docstring InsetBox::name() const 
 {
        // FIXME: UNICODE
@@ -484,24 +479,25 @@ int InsetBox::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
-docstring InsetBox::xhtml(odocstream &, OutputParams const & runparams) const
+docstring InsetBox::xhtml(XHTMLStream & xs, OutputParams const & runparams) const
 {
+       // construct attributes
+       string attrs = "class='" + params_.type + "'";
        string style;
        if (!params_.width.empty())
-               style += ("width: " + params_.width.asHTMLString() + ";");
-       if (!params_.height.empty())
-               style += ("height: " + params_.height.asHTMLString() + ";");
-       
-       docstring retval = from_ascii("<div class='" + params_.type + "'");
+               style += ("width: " + params_.width.asHTMLString() + "; ");
+       // The special heights don't really mean anything for us.
+       if (!params_.height.empty() && params_.height_special == "none")
+               style += ("height: " + params_.height.asHTMLString() + "; ");
        if (!style.empty())
-               retval += from_ascii(" style='" + style + "'");
-       retval += ">\n";
-       odocstringstream os;
-       docstring defer = InsetText::xhtml(os, runparams);
-       retval += os.str();
-       retval += "</div>\n";
-       retval += defer + "\n";
-       return retval;
+               attrs += " style='" + style + "'";
+
+       xs << StartTag("div", attrs);
+       XHTMLOptions const opts = InsetText::WriteLabel | InsetText::WriteInnerTag;
+       docstring defer = InsetText::insetAsXHTML(xs, runparams, opts);
+       xs << EndTag("div");
+       xs << defer;
+       return docstring();
 }