]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
remove noload/don't typeset
[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 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include "math_nestinset.h"
25 #include "math_metricsinfo.h"
26 #include "math_macroarg.h"
27 #include "LString.h"
28
29 class MathMacroTemplate;
30
31
32 /** This class contains the data for a macro
33     \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
34     \version November 1996
35  */
36 class MathMacro : public MathNestInset {
37 public:
38         /// A macro can be built from an existing template
39         explicit MathMacro(string const &);
40         ///
41         MathMacro(MathMacro const &);
42         ///
43         void draw(MathPainterInfo & pi, int x, int y) const;
44         ///
45         void metrics(MathMetricsInfo & mi) const;
46         ///
47         MathInset * clone() const;
48         ///
49         void dump() const;
50
51         ///
52         bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
53         ///
54         bool idxLeft(idx_type & idx, pos_type & pos) const;
55         ///
56         bool idxRight(idx_type & idx, pos_type & pos) const;
57
58         ///
59         void validate(LaTeXFeatures &) const;
60         ///
61         bool isMacro() const { return true; }
62         ///
63         bool match(MathAtom const &) const { return false; }
64
65         ///
66         void maplize(MapleStream &) const;
67         ///
68         void mathmlize(MathMLStream &) const;
69         ///
70         void octavize(OctaveStream &) const;
71
72 private:
73         ///
74         void operator=(MathMacro const &);
75         ///
76         string name() const;
77         ///
78         bool defining() const;
79         ///
80         void updateExpansion() const;
81         ///
82         void expand() const;
83
84         ///
85         MathAtom & tmplate_;
86         ///
87         mutable MathArray expanded_;
88         ///
89         mutable MathMetricsInfo mi_;
90         ///
91         mutable LyXFont font_;
92 };
93
94
95 #endif