4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alejandro Aguilar Sierra
10 * Full author contact details are available in file CREDITS.
16 #include "InsetMathNest.h"
17 #include "MathArray.h"
18 #include "InsetMathNest.h"
19 #include "MathMacroTable.h"
25 /// This class contains the data for a macro.
26 class MathMacro : public InsetMathNest {
28 /// A macro can be built from an existing template
29 MathMacro(docstring const & name, int numargs);
31 void draw(PainterInfo & pi, int x, int y) const;
33 void drawExpanded(PainterInfo & pi, int x, int y) const;
34 /// draw selection background
35 void drawSelection(PainterInfo & pi, int x, int y) const;
37 void drawDecoration(PainterInfo & pi, int x, int y) const
38 { drawMarkers2(pi, x, y); }
40 bool metrics(MetricsInfo & mi, Dimension & dim) const;
41 /// get cursor position
42 void cursorPos(BufferView const & bv, CursorSlice const & sl,
43 bool boundary, int & x, int & y) const;
45 InsetBase * editXY(LCursor & cur, int x, int y);
46 /// target pos when we enter the inset from the left by pressing "Right"
47 bool idxFirst(LCursor &) const;
48 /// target pos when we enter the inset from the right by pressing "Left"
49 bool idxLast(LCursor &) const;
51 virtual bool notifyCursorLeaves(LCursor &);
53 docstring name() const;
55 void setExpansion(MathArray const & exp, MathArray const & args) const;
58 void validate(LaTeXFeatures &) const;
61 void maple(MapleStream &) const;
63 void mathmlize(MathStream &) const;
65 void octave(OctaveStream &) const;
67 void infoize(odocstream &) const;
69 void infoize2(odocstream &) const;
72 virtual std::auto_ptr<InsetBase> doClone() const;
74 void updateExpansion() const;
80 /// the unexpanded macro defintition
81 mutable MathArray tmpl_;
82 /// the macro substituted with our args
83 mutable MathArray expanded_;