]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathStream.h
Make undo action no-ops when the buffer is read-only
[lyx.git] / src / mathed / MathStream.h
index 153e7df3c584404a43b68ebae48db36a6ba2edce..d6a35c5e89f64476e5fbffcf1fb4b83d11452854 100644 (file)
@@ -13,6 +13,7 @@
 #define MATH_MATHMLSTREAM_H
 
 #include "InsetMath.h"
+#include "FontInfo.h"
 
 #include "TexRow.h"
 #include "texstream.h"
@@ -84,8 +85,10 @@ public:
        /// writes space if next thing is isalpha()
        bool pendingSpace() const { return pendingspace_; }
        /// write braces if a space is pending and next char is [
+       /// or when a prime immediately follows a superscript
        void useBraces(bool braces);
        /// write braces if a space is pending and next char is [
+       /// or when a prime immediately follows a superscript
        bool useBraces() const { return usebraces_; }
        /// tell whether to write the closing brace of \ensuremath
        void pendingBrace(bool brace);
@@ -104,7 +107,7 @@ public:
        /// tell whether to use only ascii chars when producing latex code
        bool asciiOnly() const { return ascii_; }
        /// tell whether we are in a MathClass inset
-       void inMathClass(bool mathclass) { mathclass_ = mathclass; };
+       void inMathClass(bool mathclass) { mathclass_ = mathclass; }
        /// tell whether we are in a MathClass inset
        bool inMathClass() const { return mathclass_; }
        /// LaTeX encoding
@@ -128,7 +131,8 @@ private:
        OutputType output_ = wsDefault;
        /// do we have a space pending?
        bool pendingspace_ = false;
-       /// do we have to write braces when a space is pending and [ follows?
+       /// do we have to write braces when a space is pending and [ follows,
+       /// or when a prime immediately follows a superscript?
        bool usebraces_ = false;
        /// do we have a brace pending?
        bool pendingbrace_ = false;
@@ -316,6 +320,18 @@ public:
        std::string attr_;
 };
 
+/// Start inline tag.
+class MTagInline {
+public:
+       ///
+       MTagInline(char const * const tag, std::string const & attr = std::string())
+               : tag_(tag), attr_(attr) {}
+       ///
+       char const * const tag_;
+       ///
+       std::string attr_;
+};
+
 
 /// End tag.
 class ETag {
@@ -327,6 +343,16 @@ public:
 };
 
 
+/// End inlinetag.
+class ETagInline {
+public:
+       ///
+       explicit ETagInline(char const * const tag) : tag_(tag) {}
+       ///
+       char const * const tag_;
+};
+
+
 /// Compound tag (no content, directly closed).
 class CTag {
 public:
@@ -377,6 +403,10 @@ public:
        std::string namespacedTag(std::string const & tag) const {
                return (xmlns().empty() ? "" : xmlns() + ":") + tag;
        }
+       /// Returns the current math style in the stream.
+       const MathStyle & getFontMathStyle() const { return font_math_style_; }
+       /// Returns the current math style in the stream.
+       void setFontMathStyle(const MathStyle style) { font_math_style_ = style; }
 private:
        ///
        void setTextMode(bool t) { in_text_ = t; }
@@ -394,6 +424,8 @@ private:
        std::string xmlns_;
        ///
        bool xml_mode_;
+       /// The only important part of a FontInfo object.
+       MathStyle font_math_style_;
        ///
        friend class SetMode;
 };
@@ -413,8 +445,12 @@ MathMLStream & operator<<(MathMLStream &, char_type);
 ///
 MathMLStream & operator<<(MathMLStream &, MTag const &);
 ///
+MathMLStream & operator<<(MathMLStream &, MTagInline const &);
+///
 MathMLStream & operator<<(MathMLStream &, ETag const &);
 ///
+MathMLStream & operator<<(MathMLStream &, ETagInline const &);
+///
 MathMLStream & operator<<(MathMLStream &, CTag const &);