]> git.lyx.org Git - lyx.git/blob - src/mathed/formulamacro.h
small up/down tweaking
[lyx.git] / src / mathed / formulamacro.h
1 // -*- C++ -*-
2
3 /*
4  *  Main LyX Inset for defining math macros
5  *
6  *  \author Alejandro Aguilar Sierra
7  *  \author André Pönitz
8  *
9  *  Full author contact details are available in file CREDITS
10  *
11  *  You are free to use and modify this code under the terms of
12  *  the GNU General Public Licence version 2 or later.
13  */
14
15 #ifndef INSET_FORMULA_MACRO_H
16 #define INSET_FORMULA_MACRO_H
17
18 #include "formulabase.h"
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 class MathMacroTemplate;
25
26 // An InsetFormulaMacro only knows its name and asks the global
27 // MathMacroTable if it needs to know more.
28
29 ///
30 class InsetFormulaMacro : public InsetFormulaBase {
31 public:
32         ///
33         InsetFormulaMacro();
34         /// construct a macro hull from its name and the number of arguments
35         explicit InsetFormulaMacro(string const & name, int nargs);
36         /// constructs a mocro from its LaTeX definition
37         explicit InsetFormulaMacro(string const & s);
38         ///
39         int ascent(BufferView *, LyXFont const &) const;
40         ///
41         int descent(BufferView *, LyXFont const &) const;
42         ///
43         int width(BufferView *, LyXFont const &) const;
44         ///
45         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
46
47         ///
48         void read(Buffer const *, LyXLex & lex);
49         ///
50         void write(Buffer const *, std::ostream & os) const;
51         ///
52         int ascii(Buffer const *, std::ostream &, int linelen) const;
53         ///
54         int latex(Buffer const *, std::ostream & os, bool fragile, bool free_spc) const;
55         ///
56         int linuxdoc(Buffer const *, std::ostream & os) const;
57         ///
58         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
59
60         ///
61         Inset * clone(Buffer const &, bool same_id = false) const;
62         ///
63         Inset::Code lyxCode() const;
64         ///
65         MathAtom const & par() const;
66         ///
67         MathAtom & par();
68 private:
69         ///
70         void read(std::istream & is);
71         /// prefix in inset
72         string prefix() const;
73 };
74
75 #endif