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
16 #include "math_data.h"
17 #include "math_macrotable.h"
18 #include "math_nestinset.h"
21 /// This class contains the macro definition.
22 class MathMacroTemplate : public MathNestInset {
27 MathMacroTemplate(std::string const & name, int nargs,
28 std::string const & type,
29 MathArray const & = MathArray(),
30 MathArray const & = MathArray());
32 explicit MathMacroTemplate(std::istream & is);
34 void edit(LCursor & cur, bool left);
36 EDITABLE editable() const { return HIGHLY_EDITABLE; }
38 void read(Buffer const &, LyXLex & lex);
40 void write(Buffer const &, std::ostream & os) const;
42 void write(WriteStream & os) const;
43 /// Number of arguments
48 std::string name() const;
50 MacroData asMacroData() const;
52 void draw(PainterInfo & pi, int x, int y) const;
54 void metrics(MetricsInfo & mi, Dimension & dim) const;
55 /// identifies macro templates
56 MathMacroTemplate * asMacroTemplate() { return this; }
57 /// identifies macro templates
58 MathMacroTemplate const * asMacroTemplate() const { return this; }
60 InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
63 virtual std::auto_ptr<InsetBase> doClone() const;
65 std::string prefix() const;
71 /// newcommand or renewcommand or def