]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathStream.cpp
Produce a cleaner latex output by avoiding \lyxmathsym when in text mode
[lyx.git] / src / mathed / MathStream.cpp
index b5fe0c9a85adb38740404d253bb62063d56fd104..8677358b55f9c653931781cd9dbb0abd87679c33 100644 (file)
 #include "MathExtern.h"
 
 #include "support/textutils.h"
+#include "support/docstring.h"
 
 #include <algorithm>
+#include <cstring>
 #include <ostream>
 
+using namespace std;
 
 namespace lyx {
 
-using std::strlen;
-
 
 //////////////////////////////////////////////////////////////////////
 
@@ -51,7 +52,7 @@ NormalStream & operator<<(NormalStream & ns, docstring const & s)
 }
 
 
-NormalStream & operator<<(NormalStream & ns, const std::string & s)
+NormalStream & operator<<(NormalStream & ns, const string & s)
 {
        ns.os() << from_utf8(s);
        return ns;
@@ -102,15 +103,15 @@ WriteStream & operator<<(WriteStream & ws, docstring const & s)
 }
 
 
-WriteStream::WriteStream(odocstream & os, bool fragile, bool latex)
+WriteStream::WriteStream(odocstream & os, bool fragile, bool latex, bool dryrun)
        : os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
-         pendingspace_(false), line_(0)
+         dryrun_(dryrun), pendingspace_(false), textmode_(false), line_(0)
 {}
 
 
 WriteStream::WriteStream(odocstream & os)
        : os_(os), fragile_(false), firstitem_(false), latex_(false),
-         pendingspace_(false), line_(0)
+         dryrun_(false), pendingspace_(false), textmode_(false), line_(0)
 {}
 
 
@@ -133,6 +134,12 @@ void WriteStream::pendingSpace(bool how)
 }
 
 
+void WriteStream::textMode(bool textmode)
+{
+       textmode_ = textmode;
+}
+
+
 WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
 {
        at->write(ws);
@@ -155,7 +162,7 @@ WriteStream & operator<<(WriteStream & ws, char const * s)
                ws.pendingSpace(false);
        }
        ws.os() << s;
-       ws.addlines(int(std::count(s, s + strlen(s), '\n')));
+       ws.addlines(int(count(s, s + strlen(s), '\n')));
        return ws;
 }
 
@@ -465,7 +472,7 @@ OctaveStream & operator<<(OctaveStream & ns, char_type c)
 }
 
 
-OctaveStream & operator<<(OctaveStream & os, std::string const & s)
+OctaveStream & operator<<(OctaveStream & os, string const & s)
 {
        os.os() << from_utf8(s);
        return os;