]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
Use references instead of pointers where possible
[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(MathStyles st) const;
48         ///
49         MathInset * clone() const;
50         ///
51         void write(std::ostream &, bool fragile) const;
52         ///
53         void writeNormal(std::ostream &) const;
54         ///
55         void dump() const;
56
57         ///
58         bool idxUp(idx_type &, pos_type &) const;
59         ///
60         bool idxDown(idx_type &, pos_type &) const;
61         ///
62         bool idxLeft(idx_type &, pos_type &) const;
63         ///
64         bool idxRight(idx_type &, pos_type &) const;
65
66         ///
67         void validate(LaTeXFeatures &) const;
68         ///
69         bool isMacro() const { return true; }
70
71 private:
72         ///
73         void operator=(MathMacro const &);
74         ///
75         char const * name() const;
76
77         ///
78         MathAtom & tmplate_;
79         ///
80         mutable MathXArray expanded_;
81 };
82
83
84 #endif