]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
iterators for MathArray; cosmetics;
[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
30 class MathMacroTemplate;
31
32
33 /** This class contains the data for a macro
34     \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
35     \version November 1996
36  */
37 class MathMacro : public MathNestInset {
38 public:
39         /// A macro can be built from an existing template
40         explicit MathMacro(MathMacroTemplate const &);
41         ///
42         MathMacro(MathMacro const &);
43         ///
44         void draw(Painter &, int x, int y) const;
45         ///
46         void metrics(MathStyles st) const;
47         ///
48         MathInset * clone() const;
49         ///
50         void write(std::ostream &, bool fragile) const;
51         ///
52         void writeNormal(std::ostream &) const;
53         ///
54         void dump(std::ostream & os) const;
55
56         ///
57         bool idxUp(int &, int &) const;
58         ///
59         bool idxDown(int &, int &) const;
60         ///
61         bool idxLeft(int &, int &) const;
62         ///
63         bool idxRight(int &, int &) const;
64
65         ///
66         void validate(LaTeXFeatures &) const;
67
68 private:
69         ///
70         void operator=(MathMacro const &);
71         ///
72         string const & name() const;
73
74         ///
75         MathMacroTemplate const * const tmplate_;
76         ///
77         mutable MathXArray expanded_;
78 };
79
80
81 inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)
82 {
83         m.dump(os);
84         return os;
85 }
86 #endif