4 * Main LyX Inset for defining math macros
6 * \author Alejandro Aguilar Sierra
9 * Full author contact details are available in file CREDITS
11 * You are free to use and modify this code under the terms of
12 * the GNU General Public Licence version 2 or later.
15 #ifndef INSET_FORMULA_MACRO_H
16 #define INSET_FORMULA_MACRO_H
18 #include "formulabase.h"
21 class MathMacroTemplate;
23 // An InsetFormulaMacro only knows its name and asks the global
24 // MathMacroTable if it needs to know more.
27 class InsetFormulaMacro : public InsetFormulaBase {
31 /// construct a macro hull from its name and the number of arguments
32 explicit InsetFormulaMacro(string const & name, int nargs);
33 /// constructs a mocro from its LaTeX definition
34 explicit InsetFormulaMacro(string const & s);
36 int ascent(BufferView *, LyXFont const &) const;
38 int descent(BufferView *, LyXFont const &) const;
40 int width(BufferView *, LyXFont const &) const;
42 void draw(BufferView *, LyXFont const &, int, float &, bool) const;
45 void read(Buffer const *, LyXLex & lex);
47 void write(Buffer const *, std::ostream & os) const;
49 int ascii(Buffer const *, std::ostream &, int linelen) const;
51 int latex(Buffer const *, std::ostream & os, bool fragile, bool free_spc) const;
53 int linuxdoc(Buffer const *, std::ostream & os) const;
55 int docbook(Buffer const *, std::ostream &, bool mixcont) const;
58 Inset * clone(Buffer const &, bool same_id = false) const;
60 Inset::Code lyxCode() const;
62 MathAtom const & par() const;
67 void read(std::istream & is);
69 string prefix() const;