]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
show the 'empty base dot' less frequently
[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 <vector>
25 #include <iosfwd>
26
27 #include "math_nestinset.h"
28 #include "math_macroarg.h"
29 #include "LString.h"
30
31 class MathMacroTemplate;
32
33
34 /** This class contains the data for a macro
35     \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
36     \version November 1996
37  */
38 class MathMacro : public MathNestInset {
39 public:
40         /// A macro can be built from an existing template
41         explicit MathMacro(string const &);
42         ///
43         MathMacro(MathMacro const &);
44         ///
45         void draw(Painter &, int x, int y) const;
46         ///
47         void metrics(MathMetricsInfo const & st) const;
48         ///
49         MathInset * clone() const;
50         ///
51         void dump() const;
52
53         ///
54         bool idxUp(idx_type &) const;
55         ///
56         bool idxDown(idx_type &) const;
57         ///
58         bool idxLeft(idx_type &, pos_type &) const;
59         ///
60         bool idxRight(idx_type &, pos_type &) const;
61
62         ///
63         void validate(LaTeXFeatures &) const;
64         ///
65         bool isMacro() const { return true; }
66         ///
67         bool match(MathInset *) const { return false; }
68
69         ///
70         void normalize(NormalStream &) const;
71         ///
72         void maplize(MapleStream &) const;
73         ///
74         void mathmlize(MathMLStream &) const;
75         ///
76         void octavize(OctaveStream &) const;
77         ///
78         void write(WriteStream & os) const;
79
80 private:
81         ///
82         void operator=(MathMacro const &);
83         ///
84         char const * name() const;
85         ///
86         bool defining() const;
87         ///
88         void updateExpansion() const;
89
90         ///
91         MathAtom & tmplate_;
92         ///
93         mutable MathXArray expanded_;
94         ///
95         mutable MathMetricsInfo mi_;
96 };
97
98
99 #endif