]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetFormulaMacro.h
rename mathed/math_xinset into mathed/InsetMathX
[lyx.git] / src / mathed / InsetFormulaMacro.h
1 // -*- C++ -*-
2 /**
3  * \file InsetFormulaMacro.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author André Pönitz
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSET_FORMULA_MACRO_H
14 #define INSET_FORMULA_MACRO_H
15
16 #include "InsetMathNest.h"
17
18 class MathMacroTemplate;
19 class LyXLex;
20
21
22 // An InsetFormulaMacro only knows its name and asks the global
23 // MathMacroTable if it needs to know more.
24
25 /// Main LyX Inset for defining math macros
26 class InsetFormulaMacro : public InsetMathNest {
27 public:
28         ///
29         InsetFormulaMacro();
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);
34         ///
35         void metrics(MetricsInfo & mi, Dimension & dim) const;
36         ///
37         void draw(PainterInfo & pi, int x, int y) const;
38
39         ///
40         void read(Buffer const &, LyXLex & lex);
41         ///
42         void write(Buffer const &, std::ostream & os) const;
43         ///
44         int plaintext(Buffer const &, std::ostream &,
45                   OutputParams const &) const;
46         ///
47         int latex(Buffer const &, std::ostream & os,
48                   OutputParams const &) const;
49         ///
50         int docbook(Buffer const &, std::ostream &,
51                     OutputParams const &) const;
52
53         ///
54         std::auto_ptr<InsetBase> clone() const;
55         ///
56         InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
57         ///
58         std::string const & getInsetName() const { return name_; }
59         ///
60         EDITABLE editable() const { return HIGHLY_EDITABLE; }
61 private:
62         ///
63         MathAtom & tmpl() const;
64         ///
65         void read(std::istream & is);
66         /// prefix in inset
67         std::string prefix() const;
68         ///
69         std::string name_;
70 };
71
72 #endif