]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathStream.h
Another warning.
[lyx.git] / src / mathed / MathStream.h
index cf08afe23c5890405a6664fb4ce4617a7bbacf2d..7da9a9b9f9177d0949a6a1c71f4ac8e0b3d750ba 100644 (file)
@@ -59,6 +59,10 @@ public:
        bool & firstitem() { return firstitem_; }
        ///
        void addlines(unsigned int);
+       /// record whether we can write an immediately following newline char
+       void canBreakLine(bool breakline) { canbreakline_ = breakline; }
+       /// tell whether we can write an immediately following newline char
+       bool canBreakLine() const { return canbreakline_; }
        /// writes space if next thing is isalpha()
        void pendingSpace(bool how);
        /// writes space if next thing is isalpha()
@@ -102,6 +106,8 @@ private:
        bool locked_;
        /// should we use only ascii chars when producing latex code?
        bool ascii_;
+       /// are we allowed to output an immediately following newline?
+       bool canbreakline_;
        ///
        int line_;
        ///
@@ -262,6 +268,13 @@ public:
 };
 
 
+/// Throw MathExportException to signal that the attempt to export
+/// some math in the current format did not succeed. E.g., we can't
+/// export xymatrix as MathML, so that will throw, and we'll fall back
+/// to images.
+class MathExportException : public std::exception {};
+
+
 class MathStream {
 public:
        ///
@@ -296,8 +309,6 @@ private:
        ///
        int line_;
        ///
-       char lastchar_;
-       ///
        bool in_text_;
        ///
        odocstringstream deferred_;
@@ -335,14 +346,14 @@ MathStream & operator<<(MathStream &, ETag const &);
 class SetMode {
 public:
        ///
-       explicit SetMode(MathStream & os, bool text, docstring attrs);
+       explicit SetMode(MathStream & os, bool text, std::string const & attrs);
        ///
        explicit SetMode(MathStream & os, bool text);
        ///
        ~SetMode();
 private:
        ///
-       void init(bool, docstring);
+       void init(bool, std::string const &);
        ///
        MathStream & os_;
        ///
@@ -386,13 +397,11 @@ private:
        ///
        int line_;
        ///
-       char lastchar_;
-       ///
        bool in_text_;
        ///
        odocstringstream deferred_;
        ///
-       friend class SetMode;
+       friend class SetHTMLMode;
 };
 
 ///
@@ -413,6 +422,26 @@ HtmlStream & operator<<(HtmlStream &, MTag const &);
 HtmlStream & operator<<(HtmlStream &, ETag const &);
 
 
+class SetHTMLMode {
+public:
+       ///
+       explicit SetHTMLMode(HtmlStream & os, bool text, std::string attrs);
+       ///
+       explicit SetHTMLMode(HtmlStream & os, bool text);
+       ///
+       ~SetHTMLMode();
+private:
+       ///
+       void init(bool, std::string const &);
+       ///
+       HtmlStream & os_;
+       ///
+       bool opened_;
+       ///
+       bool was_text_;
+};
+
+
 //
 // Debugging
 //