]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMath.h
When cancelling saving of a children, cancel the whole process.
[lyx.git] / src / mathed / InsetMath.h
index bd72863c3ab5349e5b0a1cbad9744aab396d9c39..578b29fdcfd671926789bf3036b3859003c21941 100644 (file)
 #ifndef MATH_INSET_H
 #define MATH_INSET_H
 
-#include "MathData.h"
+#include "MathClass.h"
 
 #include "insets/Inset.h"
 
-#include "TexRow.h"
-
 
 namespace lyx {
 
@@ -34,7 +32,8 @@ enum HullType {
        hullFlAlign,
        hullMultline,
        hullGather,
-       hullRegexp
+       hullRegexp,
+       hullUnknown
 };
 
 HullType hullType(docstring const & name);
@@ -54,7 +53,10 @@ inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
 
 */
 
+class Cursor;
 class OutputParams;
+class MetricsInfo;
+
 class InsetMathArray;
 class InsetMathAMSArray;
 class InsetMathBrace;
@@ -73,7 +75,6 @@ class InsetMathSpace;
 class InsetMathSpecialChar;
 class InsetMathSymbol;
 class InsetMathUnknown;
-
 class InsetMathRef;
 
 class HtmlStream;
@@ -84,16 +85,18 @@ class MaximaStream;
 class MathematicaStream;
 class MathStream;
 class WriteStream;
-class InfoStream;
 
-class MathMacroTemplate;
-class MathMacro;
-class MathPosFinder;
-class Cursor;
+class MathData;
+class InsetMathMacroTemplate;
+class InsetMathMacro;
+class MathRow;
 class TextPainter;
 class TextMetricsInfo;
 class ReplaceData;
 
+/// Type of unique identifiers for math insets (used in TexRow)
+typedef void const * uid_type;
+
 
 class InsetMath : public Inset {
 public:
@@ -111,6 +114,11 @@ public:
        /// this is overridden by specific insets
        virtual mode_type currentMode() const { return MATH_MODE; }
 
+       // The possible marker types for math insets
+       enum marker_type { NO_MARKER, MARKER2, MARKER, BOX_MARKER };
+       /// this is overridden by insets with specific edit marker type
+       virtual marker_type marker(BufferView const *) const;
+
        /// the ascent of the inset above the baseline
        /// compute the size of the object for text based drawing
        virtual void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
@@ -142,10 +150,10 @@ public:
        virtual InsetMathGrid const     * asGridInset() const     { return 0; }
        virtual InsetMathHull           * asHullInset()           { return 0; }
        virtual InsetMathHull const     * asHullInset() const     { return 0; }
-       virtual MathMacro               * asMacro()               { return 0; }
-       virtual MathMacro const         * asMacro() const         { return 0; }
-       virtual MathMacroTemplate       * asMacroTemplate()       { return 0; }
-       virtual MathMacroTemplate const * asMacroTemplate() const { return 0; }
+       virtual InsetMathMacro               * asMacro()               { return 0; }
+       virtual InsetMathMacro const         * asMacro() const         { return 0; }
+       virtual InsetMathMacroTemplate       * asMacroTemplate()       { return 0; }
+       virtual InsetMathMacroTemplate const * asMacroTemplate() const { return 0; }
        virtual InsetMathMatrix const   * asMatrixInset() const   { return 0; }
        virtual InsetMathNest           * asNestInset()           { return 0; }
        virtual InsetMathNest const     * asNestInset() const     { return 0; }
@@ -161,10 +169,21 @@ public:
        virtual InsetMathRef            * asRefInset()            { return 0; }
        virtual InsetMathSpecialChar const * asSpecialCharInset() const { return 0; }
 
+       /// The class of the math object (used primarily for spacing)
+       virtual MathClass mathClass() const;
+       /// Add this inset to a math row. Return true if contents got added
+       virtual bool addToMathRow(MathRow &, MetricsInfo & mi) const;
+       /// Hook that is run before metrics computation starts
+       virtual void beforeMetrics() const {}
+       /// Hook that is run after metrics computation
+       virtual void afterMetrics() const {}
+       /// Hook that is run before actual drawing
+       virtual void beforeDraw(PainterInfo const &) const {}
+       /// Hook that is run after drawing
+       virtual void afterDraw(PainterInfo const &) const {}
+
        /// identifies things that can get scripts
        virtual bool isScriptable() const { return false; }
-       /// is the a relational operator (used for splitting equations)
-       virtual bool isRelOp() const { return false; }
        /// will this get written as a single block in {..}
        virtual bool extraBraces() const { return false; }
 
@@ -221,7 +240,7 @@ public:
        /// math stuff usually isn't allowed in text mode
        virtual bool allowedIn(mode_type mode) const { return mode == MATH_MODE; }
 
-       /// superscript kerning
+       /// Italic correction as described in InsetMathScript.h
        virtual int kerning(BufferView const *) const { return 0; }
        ///
        bool isInToc() const { return true; }