]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
ws changes only
[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(idx_type & idx, pos_type & pos, bool up, int targetx) const;
42         ///
43         bool idxLeft(idx_type & idx, pos_type & pos) const;
44         ///
45         bool idxRight(idx_type & idx, pos_type & pos) const;
46
47         ///
48         void validate(LaTeXFeatures &) const;
49         ///
50         bool isMacro() const { return true; }
51         ///
52         bool match(MathAtom const &) const { return false; }
53
54         ///
55         void maple(MapleStream &) const;
56         ///
57         void mathmlize(MathMLStream &) const;
58         ///
59         void octave(OctaveStream &) const;
60         ///
61         void infoize(std::ostream &) const;
62         ///
63         void infoize2(std::ostream &) const;
64
65 private:
66         ///
67         void operator=(MathMacro const &);
68         ///
69         std::string name() const;
70         ///
71         bool defining() const;
72         ///
73         void updateExpansion() const;
74         ///
75         void expand() const;
76
77         ///
78         MathAtom & tmplate_;
79         ///
80         mutable MathArray expanded_;
81         ///
82         mutable MetricsInfo mi_;
83         ///
84         mutable LyXFont font_;
85 };
86
87
88 #endif