3 * \file math_macrotemplate.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.
13 #ifndef MATH_MACROTEMPLATE_H
14 #define MATH_MACROTEMPLATE_H
17 #include "MathMacroTable.h"
18 #include "InsetMathNest.h"
20 #include "support/types.h"
25 /// This class contains the macro definition.
26 class MathMacroTemplate : public InsetMathNest {
31 MathMacroTemplate(docstring const & name, int nargs,
32 docstring const & type,
33 MathArray const & = MathArray(),
34 MathArray const & = MathArray());
36 explicit MathMacroTemplate(const docstring & str);
38 void edit(LCursor & cur, bool left);
40 EDITABLE editable() const { return HIGHLY_EDITABLE; }
42 void read(Buffer const &, LyXLex & lex);
44 void write(Buffer const &, std::ostream & os) const;
46 void write(WriteStream & os) const;
48 int plaintext(Buffer const &, odocstream &,
49 OutputParams const &) const;
51 /// Number of arguments
56 docstring name() const;
58 MacroData asMacroData() const;
60 void draw(PainterInfo & pi, int x, int y) const;
62 bool metrics(MetricsInfo & mi, Dimension & dim) const;
63 /// identifies macro templates
64 MathMacroTemplate * asMacroTemplate() { return this; }
65 /// identifies macro templates
66 MathMacroTemplate const * asMacroTemplate() const { return this; }
68 InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
71 virtual std::auto_ptr<InsetBase> doClone() const;
73 docstring prefix() const;
79 /// newcommand or renewcommand or def