]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
1df6ed4bb0181cbe88a144c6be12cb99ffa3c6eb
[lyx.git] / src / mathed / math_macro.h
1 // -*- C++ -*-
2 /**
3  * \file math_macro.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 "math_data.h"
17 #include "math_nestinset.h"
18 #include "metricsinfo.h"
19
20
21 class MathMacroTemplate;
22
23
24 /// This class contains the data for a macro.
25 class MathMacro : public MathNestInset {
26 public:
27         /// A macro can be built from an existing template
28         explicit MathMacro(std::string const &);
29         ///
30         MathMacro(MathMacro const &);
31         ///
32         void draw(PainterInfo & pi, int x, int y) const;
33         ///
34         void metrics(MetricsInfo & mi, Dimension & dim) const;
35         ///
36         virtual std::auto_ptr<InsetBase> clone() const;
37         ///
38         void dump() const;
39
40         ///
41         bool idxUpDown(LCursor &, bool up, int targetx) const;
42         ///
43         bool idxLeft(LCursor &) const;
44         ///
45         bool idxRight(LCursor &) const;
46
47         ///
48         void validate(LaTeXFeatures &) const;
49         ///
50         bool isMacro() const { return true; }
51
52         ///
53         void maple(MapleStream &) const;
54         ///
55         void mathmlize(MathMLStream &) const;
56         ///
57         void octave(OctaveStream &) const;
58         ///
59         void infoize(std::ostream &) const;
60         ///
61         void infoize2(std::ostream &) const;
62
63 private:
64         ///
65         void operator=(MathMacro const &);
66         ///
67         std::string name() const;
68         ///
69         bool defining() const;
70         ///
71         void updateExpansion() const;
72         ///
73         void expand() const;
74
75         ///
76         MathAtom & tmplate_;
77         ///
78         mutable MathArray expanded_;
79         ///
80         mutable MetricsInfo mi_;
81         ///
82         mutable LyXFont font_;
83 };
84
85
86 #endif