]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetVSpace.cpp
Revert "Do not crash is release mode if we stumble across an unrealized font."
[lyx.git] / src / insets / InsetVSpace.cpp
index 55ef4bf94fe38725344aa7ea683cc2eda4bdda3b..461933cb564ef785084ac55a7f3b78a1346557cd 100644 (file)
@@ -24,6 +24,7 @@
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 #include "Text.h"
 
 #include "support/debug.h"
@@ -59,7 +60,12 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_INSET_MODIFY: {
                cur.recordUndo();
-               InsetVSpace::string2params(to_utf8(cmd.argument()), space_);
+               string arg = to_utf8(cmd.argument());
+               if (arg == "vspace custom")
+                       arg = (space_.kind() == VSpace::LENGTH)
+                               ? "vspace " + space_.length().asString()
+                               : "vspace 1" + string(stringFromUnit(Length::defaultUnit()));
+               InsetVSpace::string2params(arg, space_);
                break;
        }
 
@@ -78,7 +84,12 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_INSET_MODIFY:
                if (cmd.getArg(0) == "vspace") {
                        VSpace vspace;
-                       InsetVSpace::string2params(to_utf8(cmd.argument()), vspace);
+                       string arg = to_utf8(cmd.argument());
+                       if (arg == "vspace custom")
+                               arg = (space_.kind() == VSpace::LENGTH)
+                               ? "vspace " + space_.length().asString()
+                               : "vspace 1" + string(stringFromUnit(Length::defaultUnit()));
+                       InsetVSpace::string2params(arg, vspace);
                        status.setOnOff(vspace == space_);
                } 
                status.setEnabled(true);
@@ -222,14 +233,12 @@ int InsetVSpace::docbook(odocstream & os, OutputParams const &) const
 }
 
 
-docstring InsetVSpace::xhtml(XHTMLStream &, OutputParams const &) const
+docstring InsetVSpace::xhtml(XHTMLStream & os, OutputParams const &) const
 {
-       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();
+       os << html::StartTag("div", attr, true) << html::EndTag("div");
+       return docstring();
 }