]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetFormulaMacro.h
Make Buffer argument mandatory in most of the InsetMath based class... boring work...
[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
19 namespace lyx {
20
21 class MathMacroTemplate;
22 class Lexer;
23
24
25 // An InsetFormulaMacro only knows its name and asks the global
26 // MathMacroTable if it needs to know more.
27
28 /// Main LyX Inset for defining math macros
29 class InsetFormulaMacro : public InsetMathNest {
30 public:
31         ///
32         InsetFormulaMacro(Buffer * buf);
33         /// construct a macro hull from its name and the number of arguments
34         InsetFormulaMacro(Buffer * buf, docstring const & name, int nargs, docstring const & t);
35         /// constructs a mocro from its LaTeX definition
36         explicit InsetFormulaMacro(docstring const & s);
37         ///
38         void metrics(MetricsInfo & mi, Dimension & dim) const;
39         ///
40         void draw(PainterInfo & pi, int x, int y) const;
41
42         ///
43         void read(Lexer & lex);
44         ///
45         void write(std::ostream & os) const;
46         ///
47         int latex(odocstream & os, OutputParams const &) const;
48         ///
49         int plaintext(odocstream &, OutputParams const &) const;
50         ///
51         int docbook(odocstream &, OutputParams const &) const;
52
53         ///
54         InsetCode lyxCode() const { return MATHMACRO_CODE_CODE; }
55         ///
56         docstring const & getInsetName() const { return name_; }
57         ///
58         bool editable() const { return true; }
59         ///
60         InsetCode lyxCode() const { return MATH_FORMULA_MACRO_CODE; }
61 private:
62         ///
63         MathAtom & tmpl() const;
64         ///
65         void read(std::istream & is);
66         /// prefix in inset
67         docstring prefix() const;
68         ///
69         docstring name_;
70         ///
71         Inset * clone() const;
72 };
73
74
75 } // namespace lyx
76
77 #endif