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"
20 #include "support/types.h"
22 /// This class contains the macro definition.
23 class MathMacroTemplate : public InsetMathNest {
28 MathMacroTemplate(std::string const & name, int nargs,
29 std::string const & type,
30 MathArray const & = MathArray(),
31 MathArray const & = MathArray());
33 explicit MathMacroTemplate(std::istream & is);
35 void edit(LCursor & cur, bool left);
37 EDITABLE editable() const { return HIGHLY_EDITABLE; }
39 void read(Buffer const &, LyXLex & lex);
41 void write(Buffer const &, std::ostream & os) const;
43 void write(WriteStream & os) const;
44 /// Number of arguments
49 std::string name() const;
51 MacroData asMacroData() const;
53 void draw(PainterInfo & pi, int x, int y) const;
55 void metrics(MetricsInfo & mi, Dimension & dim) const;
56 /// identifies macro templates
57 MathMacroTemplate * asMacroTemplate() { return this; }
58 /// identifies macro templates
59 MathMacroTemplate const * asMacroTemplate() const { return this; }
61 InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
64 virtual std::auto_ptr<InsetBase> doClone() const;
66 lyx::docstring prefix() const;
72 /// newcommand or renewcommand or def