]> git.lyx.org Git - lyx.git/blobdiff - src/Spacing.C
small changes to ButtonController usage
[lyx.git] / src / Spacing.C
index 19f9d1fa65fd6ff084b859faed282a6ccc50f1e2..d34c163e770b611f569da15bcca109de435203fb 100644 (file)
@@ -1,9 +1,23 @@
+/* This file is part of
+ * ====================================================== 
+ * 
+ *           LyX, The Document Processor
+ *        
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
 #include <config.h>
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
 
 #ifdef HAVE_SSTREAM
 #include <sstream>
 using std::istringstream;
+using std::ostringstream;
 #else
 #include <strstream>
 #endif
@@ -74,3 +88,50 @@ void Spacing::writeFile(ostream & os, bool para) const
                os << cmd << spacing_string[getSpace()] << " \n";
        }       
 }
+
+
+string Spacing::writeEnvirBegin() const
+{
+       switch(space) {
+       case Default: break; // do nothing
+       case Single:
+               return "\\begin{singlespace}";
+       case Onehalf:
+               return "\\begin{onehalfspace}";
+       case Double:
+               return "\\begin{doublespace}";
+       case Other:
+#ifdef HAVE_SSTREAM
+               ostringstream ost;
+               ost << "\\begin{spacing}{"
+                   << getValue() << "}";
+               return ost.str().c_str();
+#else
+               {
+                       char tmp[512];
+                       ostrstream ost(tmp, 512);
+                       ost << "\\begin{spacing}{"
+                           << getValue() << "}";
+                       return ost.str();
+               }
+#endif
+       }
+       return string();
+}
+
+
+string Spacing::writeEnvirEnd() const
+{
+       switch(space) {
+       case Default: break; // do nothing
+       case Single:
+               return "\\end{singlespace}";
+       case Onehalf:
+               return "\\end{onehalfspace}";
+       case Double:
+               return "\\end{doublespace}";
+       case Other:
+               return "\\end{spacing}";
+       }
+       return string();
+}