3 * \file InsetMathMacro.h
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"
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);
31 virtual MathMacro * asMacro() { return this; }
33 virtual MathMacro const * asMacro() const { return this; }
35 void draw(PainterInfo & pi, int x, int y) const;
37 void drawExpanded(PainterInfo & pi, int x, int y) const;
38 /// draw selection background
39 void drawSelection(PainterInfo & pi, int x, int y) const;
41 void drawDecoration(PainterInfo & pi, int x, int y) const
42 { drawMarkers2(pi, x, y); }
44 bool metrics(MetricsInfo & mi, Dimension & dim) const;
46 bool metricsExpanded(MetricsInfo & mi, Dimension & dim) const;
47 /// get cursor position
48 void cursorPos(BufferView const & bv, CursorSlice const & sl,
49 bool boundary, int & x, int & y) const;
51 InsetBase * editXY(LCursor & cur, int x, int y);
52 /// target pos when we enter the inset from the left by pressing "Right"
53 bool idxFirst(LCursor &) const;
54 /// target pos when we enter the inset from the right by pressing "Left"
55 bool idxLast(LCursor &) const;
57 virtual bool notifyCursorLeaves(LCursor &);
59 docstring name() const;
61 void detachArguments(std::vector<MathArray> &args);
63 void attachArguments(std::vector<MathArray> const &args);
66 void validate(LaTeXFeatures &) const;
69 void maple(MapleStream &) const;
71 void mathmlize(MathStream &) const;
73 void octave(OctaveStream &) const;
75 void infoize(odocstream &) const;
77 void infoize2(odocstream &) const;
80 virtual std::auto_ptr<InsetBase> doClone() const;
84 /// the macro template
85 mutable MathArray tmpl_;
86 /// the macro substituted with our args
87 mutable MathArray expanded_;