]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetFormulaMacro.h
Fix bug 5802 (http://bugzilla.lyx.org/show_bug.cgi?id=5802)
[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();
33         /// construct a macro hull from its name and the number of arguments
34         InsetFormulaMacro(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; }
55         ///
56         docstring const & getInsetName() const { return name_; }
57         ///
58         EDITABLE editable() const { return HIGHLY_EDITABLE; }
59 private:
60         ///
61         MathAtom & tmpl() const;
62         ///
63         void read(std::istream & is);
64         /// prefix in inset
65         docstring prefix() const;
66         ///
67         docstring name_;
68         ///
69         Inset * clone() const;
70 };
71
72
73 } // namespace lyx
74
75 #endif