#include "Lexer.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
+#include "output_xhtml.h"
#include "support/debug.h"
#include "support/docstream.h"
InsetSpace::InsetSpace(InsetSpaceParams const & params)
- : params_(params)
+ : Inset(0), params_(params)
{}
}
-Length InsetSpace::length() const
+GlueLength InsetSpace::length() const
{
return params_.length;
}
-InsetSpace::~InsetSpace()
-{
- hideDialogs("space", this);
-}
-
-
docstring InsetSpace::toolTip(BufferView const &, int, int) const
{
docstring message;
message = _("Quad Space");
break;
case InsetSpaceParams::QQUAD:
- message = _("QQuad Space");
+ message = _("Double Quad Space");
break;
case InsetSpaceParams::ENSPACE:
message = _("Enspace");
message = _("Horizontal Fill (Down Brace)");
break;
case InsetSpaceParams::CUSTOM:
+ // FIXME unicode
message = support::bformat(_("Horizontal Space (%1$s)"),
- params_.length.asDocstring());
+ from_ascii(params_.length.asString()));
break;
case InsetSpaceParams::CUSTOM_PROTECTED:
+ // FIXME unicode
message = support::bformat(_("Protected Horizontal Space (%1$s)"),
- params_.length.asDocstring());
+ from_ascii(params_.length.asString()));
break;
}
return message;
void InsetSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY:
string2params(to_utf8(cmd.argument()), params_);
bool InsetSpace::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) == "space") {
}
-bool InsetSpace::showInsetDialog(BufferView * bv) const
-{
- bv->showDialog("space", params2string(params()),
- const_cast<InsetSpace *>(this));
- return true;
-}
-
-
namespace {
int const arrow_size = 8;
}
case InsetSpaceParams::CUSTOM:
case InsetSpaceParams::CUSTOM_PROTECTED: {
int const w =
- params_.length.inPixels(mi.base.textwidth,
+ params_.length.len().inPixels(mi.base.textwidth,
fm.width(char_type('M')));
int const minw = (w < 0) ? 3 * arrow_size : 4;
dim.wid = max(minw, abs(w));
{
Dimension const dim = dimension(*pi.base.bv);
- if (isStretchableSpace() || params_.length.value() < 0) {
+ if (isStretchableSpace() || params_.length.len().value() < 0) {
int const asc = theFontMetrics(pi.base.font).ascent('M');
int const desc = theFontMetrics(pi.base.font).descent('M');
// Pixel height divisible by 2 for prettier fill graphics:
break;
}
- if (!length.empty())
+ if (!length.len().empty())
os << "\n\\length " << length.asString();
}
os << (runparams.free_spacing ? " " : "\\ ");
break;
case InsetSpaceParams::PROTECTED:
- if (runparams.local_font->language()->lang() == "polutonikogreek")
+ if (runparams.local_font &&
+ runparams.local_font->language()->lang() == "polutonikogreek")
// in babel's polutonikogreek, ~ is active
os << (runparams.free_spacing ? " " : "\\nobreakspace{}");
else
}
-docstring InsetSpace::xhtml(odocstream & os, OutputParams const &) const
+docstring InsetSpace::xhtml(XHTMLStream & xs, OutputParams const &) const
{
+ string output;
switch (params_.kind) {
case InsetSpaceParams::NORMAL:
- os << " ";
+ output = " ";
break;
case InsetSpaceParams::ENSKIP:
case InsetSpaceParams::ENSPACE:
- os << " ";
+ output =" ";
break;
case InsetSpaceParams::QQUAD:
- os << " ";
+ output =" ";
case InsetSpaceParams::THICK:
case InsetSpaceParams::QUAD:
- os << " ";
+ output =" ";
break;
case InsetSpaceParams::THIN:
- os << " ";
+ output =" ";
break;
case InsetSpaceParams::PROTECTED:
case InsetSpaceParams::MEDIUM:
case InsetSpaceParams::NEGTHIN:
case InsetSpaceParams::NEGMEDIUM:
case InsetSpaceParams::NEGTHICK:
- os << " ";
+ output =" ";
break;
case InsetSpaceParams::HFILL:
case InsetSpaceParams::HFILL_PROTECTED:
case InsetSpaceParams::RIGHTARROWFILL:
case InsetSpaceParams::UPBRACEFILL:
case InsetSpaceParams::DOWNBRACEFILL:
- // FIXME Can we do anything with those in HTML?
- os << '\n';
+ // FIXME XHTML
+ // Can we do anything with those in HTML?
break;
case InsetSpaceParams::CUSTOM:
case InsetSpaceParams::CUSTOM_PROTECTED:
- // FIXME Probably we could do some sort of blank span?
- os << '\n';
+ // FIXME XHTML
+ // Probably we could do some sort of blank span?
+ break;
}
+ // don't escape the entities!
+ xs << XHTMLStream::NextRaw() << from_ascii(output);
return docstring();
}