]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
Andreas' patch to prevent crash on click on previewd inset
[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_nestinset.h"
17 #include "math_data.h"
18 #include "math_nestinset.h"
19 #include "math_macrotable.h"
20
21
22 /// This class contains the data for a macro.
23 class MathMacro : public MathNestInset {
24 public:
25         /// A macro can be built from an existing template
26         MathMacro(std::string const & name, int numargs);
27         ///
28         void draw(PainterInfo & pi, int x, int y) const;
29         ///
30         void drawExpanded(PainterInfo & pi, int x, int y) const;
31         ///
32         void metrics(MetricsInfo & mi, Dimension & dim) const;
33         ///
34         std::string name() const;
35         ///
36         void setExpansion(MathArray const & exp, MathArray const & args) const;
37
38         ///
39         void validate(LaTeXFeatures &) const;
40
41         ///
42         void maple(MapleStream &) const;
43         ///
44         void mathmlize(MathMLStream &) const;
45         ///
46         void octave(OctaveStream &) const;
47         ///
48         void infoize(std::ostream &) const;
49         ///
50         void infoize2(std::ostream &) const;
51
52 private:
53         virtual std::auto_ptr<InsetBase> doClone() const;
54         ///
55         void updateExpansion() const;
56         ///
57         void expand() const;
58
59         /// name of macro
60         std::string name_;
61         /// the unexpanded macro defintition
62         mutable MathArray tmpl_;
63         /// the matcro substituted with our args
64         mutable MathArray expanded_;
65 };
66
67
68 #endif