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 INSET_FORMULA_MACRO_H
14 #define INSET_FORMULA_MACRO_H
16 #include "math_nestinset.h"
18 class MathMacroTemplate;
22 // An InsetFormulaMacro only knows its name and asks the global
23 // MathMacroTable if it needs to know more.
25 /// Main LyX Inset for defining math macros
26 class InsetFormulaMacro : public MathNestInset {
30 /// construct a macro hull from its name and the number of arguments
31 InsetFormulaMacro(std::string const & name, int nargs, std::string const & t);
32 /// constructs a mocro from its LaTeX definition
33 explicit InsetFormulaMacro(std::string const & s);
35 void metrics(MetricsInfo & mi, Dimension & dim) const;
37 void draw(PainterInfo & pi, int x, int y) const;
40 void read(Buffer const &, LyXLex & lex);
42 void write(Buffer const &, std::ostream & os) const;
44 int plaintext(Buffer const &, std::ostream &,
45 OutputParams const &) const;
47 int latex(Buffer const &, std::ostream & os,
48 OutputParams const &) const;
50 int linuxdoc(Buffer const &, std::ostream & os,
51 OutputParams const &) const;
53 int docbook(Buffer const &, std::ostream &,
54 OutputParams const &) const;
57 std::auto_ptr<InsetBase> clone() const;
59 InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
61 std::string const & getInsetName() const { return name_; }
63 EDITABLE editable() const { return HIGHLY_EDITABLE; }
66 MathAtom & tmpl() const;
68 void read(std::istream & is);
70 std::string prefix() const;