]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetVSpace.cpp
InsetTabular.cpp: fix #6585 also for wrapped floats - thanks Vincent
[lyx.git] / src / insets / InsetVSpace.cpp
index 24a26d10afd779d1c00cfeaa2d7365d5d3de51ff..a43b122052888383dcf114a5f7dd3123d055cce6 100644 (file)
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
+#include "output_xhtml.h"
 #include "Text.h"
 
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 
@@ -47,19 +49,13 @@ int const ADD_TO_VSPACE_WIDTH = 5;
 
 
 InsetVSpace::InsetVSpace(VSpace const & space)
-       : space_(space)
+       : Inset(0), space_(space)
 {}
 
 
-InsetVSpace::~InsetVSpace()
-{
-       hideDialogs("vspace", this);
-}
-
-
 void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
-       switch (cmd.action) {
+       switch (cmd.action()) {
 
        case LFUN_INSET_MODIFY: {
                InsetVSpace::string2params(to_utf8(cmd.argument()), space_);
@@ -76,7 +72,7 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
 bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
        FuncStatus & status) const
 {
-       switch (cmd.action) {
+       switch (cmd.action()) {
        // we handle these
        case LFUN_INSET_MODIFY:
                if (cmd.getArg(0) == "vspace") {
@@ -93,14 +89,6 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-bool InsetVSpace::showInsetDialog(BufferView * bv) const
-{
-       bv->showDialog("vspace", params2string(space()),
-               const_cast<InsetVSpace *>(this));
-       return true;
-}
-
-
 void InsetVSpace::read(Lexer & lex)
 {
        LASSERT(lex.isOK(), /**/);
@@ -233,14 +221,14 @@ int InsetVSpace::docbook(odocstream & os, OutputParams const &) const
 }
 
 
-void InsetVSpace::xhtml(odocstream & os, OutputParams const &) const
+docstring InsetVSpace::xhtml(XHTMLStream &, OutputParams const &) const
 {
-       string len = space_.asHTMLLength();
-       if (len.empty())
-               // we didn't understand it
-               os << "<br />\n";
-       else
-               os << "<div style='height:" << from_ascii(len) << "'></div>\n";
+       odocstringstream ods;
+       XHTMLStream xds(ods);
+       string const len = space_.asHTMLLength();
+       string const attr = "style='height:" + (len.empty() ? "1em" : len) + "'";
+       xds << html::StartTag("div", attr, true) << html::EndTag("div");
+       return ods.str();
 }