#ifndef MATH_INSET_H
#define MATH_INSET_H
-#include "MathData.h"
+#include "MathClass.h"
#include "insets/Inset.h"
-#include "TexRow.h"
-
namespace lyx {
*/
+class Cursor;
class OutputParams;
+class MetricsInfo;
+
class InsetMathArray;
class InsetMathAMSArray;
class InsetMathBrace;
class InsetMathSpecialChar;
class InsetMathSymbol;
class InsetMathUnknown;
-
class InsetMathRef;
class HtmlStream;
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:
/// 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;
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; }
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; }
/// 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; }