X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetVSpace.cpp;h=1e46425aa65a501506b4a054347b8add6eb8a5ca;hb=90f7007a2e6c78ffd031e4636ff909ab1bc2ddec;hp=b26bda6402ac548fa3a5253f97e2e35f5f0a7573;hpb=819a0172f7ed88d5fb58bd96cb508a7b2c39c21a;p=lyx.git diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index b26bda6402..1e46425aa6 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -23,9 +23,11 @@ #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,21 +49,16 @@ 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: { + cur.recordUndo(); InsetVSpace::string2params(to_utf8(cmd.argument()), space_); break; } @@ -76,7 +73,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 +90,6 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd, } -bool InsetVSpace::showInsetDialog(BufferView * bv) const -{ - bv->showDialog("vspace", params2string(space()), - const_cast(this)); - return true; -} - - void InsetVSpace::read(Lexer & lex) { LASSERT(lex.isOK(), /**/); @@ -212,10 +201,9 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const } -int InsetVSpace::latex(odocstream & os, OutputParams const &) const +void InsetVSpace::latex(otexstream & os, OutputParams const &) const { os << from_ascii(space_.asLatexCommand(buffer().params())) << '\n'; - return 1; } @@ -233,22 +221,20 @@ int InsetVSpace::docbook(odocstream & os, OutputParams const &) const } -int 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 << "
\n"; - return 0; - } - os << "
\n"; - return 1; + 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(); } -docstring InsetVSpace::contextMenu(BufferView const &, int, int) const +string InsetVSpace::contextMenuName() const { - return from_ascii("context-vspace"); + return "context-vspace"; }