X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FSpacing.cpp;h=9ac8345ab4647077b42a92e1d5b0216c293677dc;hb=a17dfeee0ea15100be4ff615339f96c2f7db9598;hp=cd5816e60031398f5cc9450e5c8ebe3a41c15ca1;hpb=e30f3d76d2bee0011ceaeb5f0cc221156458cbad;p=lyx.git diff --git a/src/Spacing.cpp b/src/Spacing.cpp index cd5816e600..9ac8345ab4 100644 --- a/src/Spacing.cpp +++ b/src/Spacing.cpp @@ -99,6 +99,18 @@ string envName(Spacing::Space space, bool useSetSpace) return useSetSpace ? name : support::ascii_lowercase(name); } +string cmdName(Spacing::Space space, bool useSetSpace) +{ + static char const * const cmd_names[] + = { "SingleSpacing", "OnehalfSpacing", "DoubleSpacing", "SetStretch", ""}; + string const name = cmd_names[space]; + + if (useSetSpace && name == "SetStretch") + return "setSpacing"; + + return useSetSpace ? name : support::ascii_lowercase(name); +} + } // namespace string const Spacing::writeEnvirBegin(bool useSetSpace) const @@ -118,6 +130,16 @@ string const Spacing::writeEnvirEnd(bool useSetSpace) const } +string const Spacing::writeCmd(bool useSetSpace) const +{ + string const name = cmdName(space, useSetSpace); + if (space == Other) + return "\\" + name + "{" + getValueAsString() + '}'; + else + return name.empty() ? string() : "\\" + name + "{}"; +} + + string const Spacing::writePreamble(bool useSetSpace) const { string preamble;