#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"
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;
}
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") {
}
-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(), /**/);
}
-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;
}
}
-docstring InsetVSpace::contextMenu(BufferView const &, int, int) const
+docstring InsetVSpace::xhtml(XHTMLStream &, 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();
+}
+
+
+docstring InsetVSpace::contextMenuName() const
{
return from_ascii("context-vspace");
}