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