Give inset codes to all the math insets, so we get more information when
[lyx.git] / src / mathed / InsetFormulaMacro.h
blob7d08dc3d754abbd7a2cf1d5bc7729afa57a96290
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.
7 * \author Alejandro Aguilar Sierra
8 * \author André Pönitz
10 * Full author contact details are available in file CREDITS.
13 #ifndef INSET_FORMULA_MACRO_H
14 #define INSET_FORMULA_MACRO_H
16 #include "InsetMathNest.h"
19 namespace lyx {
21 class MathMacroTemplate;
22 class Lexer;
25 // An InsetFormulaMacro only knows its name and asks the global
26 // MathMacroTable if it needs to know more.
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;
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;
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;
75 } // namespace lyx
77 #endif