]> git.lyx.org Git - lyx.git/blobdiff - src/Spacing.cpp
Update some files
[lyx.git] / src / Spacing.cpp
index 0239a090dbab6500395a6deaa743eed0f4ce6992..9ac8345ab4647077b42a92e1d5b0216c293677dc 100644 (file)
@@ -99,8 +99,20 @@ 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
 {
        string const name = envName(space, useSetSpace);
@@ -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;