]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
94395953a9001c0af93cff2d3f48186e2d95d812
[lyx.git] / src / mathed / math_macro.h
1 // -*- C++ -*-
2 /**
3  *  File:        math_macro.h
4  *  Purpose:     Declaration of macro class for mathed
5  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
6  *  Created:     November 1996
7  *  Description: WYSIWYG math macros
8  *
9  *  Dependencies: Math
10  *
11  *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
12  *
13  *   Version: 0.2, Math & Lyx project.
14  *
15  *   This code is under the GNU General Public Licence version 2 or later.
16  */
17 #ifndef MATH_MACRO_H
18 #define MATH_MACRO_H
19
20
21 #include "math_nestinset.h"
22 #include "metricsinfo.h"
23 #include "math_macroarg.h"
24 #include "LString.h"
25
26 class MathMacroTemplate;
27
28
29 /** This class contains the data for a macro
30  *  \author Alejandro Aguilar Sierra
31  *
32  * Full author contact details are available in file CREDITS
33     \version November 1996
34  */
35 class MathMacro : public MathNestInset {
36 public:
37         /// A macro can be built from an existing template
38         explicit MathMacro(string const &);
39         ///
40         MathMacro(MathMacro const &);
41         ///
42         void draw(PainterInfo & pi, int x, int y) const;
43         ///
44         void metrics(MetricsInfo & mi, Dimension & dim) const;
45         ///
46         InsetBase * clone() const;
47         ///
48         void dump() const;
49
50         ///
51         bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
52         ///
53         bool idxLeft(idx_type & idx, pos_type & pos) const;
54         ///
55         bool idxRight(idx_type & idx, pos_type & pos) const;
56
57         ///
58         void validate(LaTeXFeatures &) const;
59         ///
60         bool isMacro() const { return true; }
61         ///
62         bool match(MathAtom const &) const { return false; }
63
64         ///
65         void maple(MapleStream &) const;
66         ///
67         void mathmlize(MathMLStream &) const;
68         ///
69         void octave(OctaveStream &) const;
70         ///
71         void infoize(std::ostream &) const;
72         ///
73         void infoize2(std::ostream &) const;
74
75 private:
76         ///
77         void operator=(MathMacro const &);
78         ///
79         string name() const;
80         ///
81         bool defining() const;
82         ///
83         void updateExpansion() const;
84         ///
85         void expand() const;
86
87         ///
88         MathAtom & tmplate_;
89         ///
90         mutable MathArray expanded_;
91         ///
92         mutable MetricsInfo mi_;
93         ///
94         mutable LyXFont font_;
95 };
96
97
98 #endif