]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetFormulaMacro.h
* up/down jumps between macro parameters
[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         bool metrics(MetricsInfo & mi, Dimension & dim) const;
39         ///
40         void draw(PainterInfo & pi, int x, int y) const;
41
42         ///
43         void read(Buffer const &, Lexer & lex);
44         ///
45         void write(Buffer const &, std::ostream & os) const;
46         ///
47         int latex(Buffer const &, odocstream & os,
48                   OutputParams const &) const;
49         ///
50         int plaintext(Buffer const &, odocstream &,
51                       OutputParams const &) const;
52         ///
53         int docbook(Buffer const &, odocstream &,
54                     OutputParams const &) const;
55
56         ///
57         std::auto_ptr<Inset> clone() const;
58         ///
59         Inset::Code lyxCode() const { return MATHMACRO_CODE; }
60         ///
61         docstring const & getInsetName() const { return name_; }
62         ///
63         EDITABLE editable() const { return HIGHLY_EDITABLE; }
64 private:
65         ///
66         MathAtom & tmpl() const;
67         ///
68         void read(std::istream & is);
69         /// prefix in inset
70         docstring prefix() const;
71         ///
72         docstring name_;
73 };
74
75
76 } // namespace lyx
77
78 #endif