]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBox.cpp
Pure HTML output for math macros.
[lyx.git] / src / insets / InsetBox.cpp
index ecf9f4fb94e4423686d2d76fa5bff81d7b7bafc3..3b7dec3e19a9ffe49e03f82a10025d903bf88b3c 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,23 +97,11 @@ BoxTranslatorLoc const & boxtranslator_loc()
 //
 /////////////////////////////////////////////////////////////////////////
 
-InsetBox::InsetBox(Buffer const & buffer, string const & label)
+InsetBox::InsetBox(Buffer * buffer, string const & label)
        : InsetCollapsable(buffer), params_(label)
 {}
 
 
-InsetBox::~InsetBox()
-{
-       hideDialogs("box", this);
-}
-
-
-docstring InsetBox::editMessage() const
-{
-       return _("Opened Box Inset");
-}
-
-
 docstring InsetBox::name() const 
 {
        // FIXME: UNICODE
@@ -195,14 +184,6 @@ bool InsetBox::forcePlainLayout(idx_type) const
 }
 
 
-bool InsetBox::showInsetDialog(BufferView * bv) const
-{
-       bv->showDialog("box", params2string(params_),
-               const_cast<InsetBox *>(this));
-       return true;
-}
-
-
 void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action) {
@@ -213,13 +194,10 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
                        params_.type = cmd.getArg(1);
                else
                        string2params(to_utf8(cmd.argument()), params_);
+               setButtonLabel();
                break;
        }
 
-       case LFUN_INSET_DIALOG_UPDATE:
-               cur.bv().updateDialog("box", params2string(params_));
-               break;
-
        default:
                InsetCollapsable::doDispatch(cur, cmd);
                break;
@@ -484,24 +462,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 << html::StartTag("div", attrs);
+       XHTMLOptions const opts = InsetText::WriteLabel | InsetText::WriteInnerTag;
+       docstring defer = InsetText::insetAsXHTML(xs, runparams, opts);
+       xs << html::EndTag("div");
+       xs << defer;
+       return docstring();
 }