]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
fix pullArg when pressing <Delete> at the end of an cell
[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_inset.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 MathInset {
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, int);
45         ///
46         void Metrics(MathStyles st, int asc = 0, int des = 0);
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         MathMacroTemplate const * const tmplate_;
71         ///
72         MathXArray expanded_;
73         ///
74         void operator=(MathMacro const &);
75 };
76
77
78 inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)
79 {
80         m.dump(os);
81         return os;
82 }
83 #endif