]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathMacro.h
move everything into namespace lyx
[lyx.git] / src / mathed / InsetMathMacro.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathMacro.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 MATH_MACRO_H
14 #define MATH_MACRO_H
15
16 #include "InsetMathNest.h"
17 #include "MathData.h"
18 #include "InsetMathNest.h"
19 #include "MathMacroTable.h"
20
21
22 namespace lyx {
23
24
25 /// This class contains the data for a macro.
26 class MathMacro : public InsetMathNest {
27 public:
28         /// A macro can be built from an existing template
29         MathMacro(std::string const & name, int numargs);
30         ///
31         void draw(PainterInfo & pi, int x, int y) const;
32         ///
33         void drawExpanded(PainterInfo & pi, int x, int y) const;
34         /// draw selection background
35         void drawSelection(PainterInfo & pi, int x, int y) const;
36         ///
37         void metrics(MetricsInfo & mi, Dimension & dim) const;
38         /// get cursor position
39         void cursorPos(BufferView const & bv, CursorSlice const & sl,
40                 bool boundary, int & x, int & y) const;
41         ///
42         InsetBase * editXY(LCursor & cur, int x, int y);
43         ///
44         std::string name() const;
45         ///
46         void setExpansion(MathArray const & exp, MathArray const & args) const;
47
48         ///
49         void validate(LaTeXFeatures &) const;
50
51         ///
52         void maple(MapleStream &) const;
53         ///
54         void mathmlize(MathMLStream &) const;
55         ///
56         void octave(OctaveStream &) const;
57         ///
58         void infoize(std::ostream &) const;
59         ///
60         void infoize2(std::ostream &) const;
61
62 private:
63         virtual std::auto_ptr<InsetBase> doClone() const;
64         ///
65         void updateExpansion() const;
66         ///
67         void expand() const;
68
69         /// name of macro
70         std::string name_;
71         /// the unexpanded macro defintition
72         mutable MathArray tmpl_;
73         /// the macro substituted with our args
74         mutable MathArray expanded_;
75 };
76
77
78
79
80 } // namespace lyx
81 #endif