]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
Need some std declarations and qualifiers to compile with DEC cxx.
[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: Mathed
10  *
11  *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
12  *
13  *   Version: 0.2, Mathed & Lyx project.
14  *
15  *   This code is under the GNU General Public Licence version 2 or later.
16  */
17 #ifndef MATH_MACRO
18 #define MATH_MACRO
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include <vector>
25 #include <iosfwd>
26 #include <boost/smart_ptr.hpp>
27
28 #include "math_parinset.h"
29 #include "math_macroarg.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 MathParInset {
39 public:
40         /// A macro can be built from an existing template
41         explicit MathMacro(MathMacroTemplate const &);
42         ///
43         void draw(Painter &, int, int);
44         ///
45         void Metrics();
46         ///
47         MathedInset * Clone();
48         ///
49         void Write(std::ostream &, bool fragile);
50         /// Index 0 is the template, index 1..nargs() are the parameters
51         bool setArgumentIdx(int);
52         ///
53         int getArgumentIdx() const;
54         ///
55         int getMaxArgumentIdx() const;
56         ///
57         int nargs() const;
58         ///
59         int GetColumns() const;
60         ///
61         void GetXY(int &, int &) const;
62         ///
63         void SetFocus(int, int);
64         ///
65         MathedArray & GetData();
66         ///
67         MathedArray const & GetData() const;
68         ///
69         void setData(MathedArray const &);
70         ///
71         void setData(MathedArray const &, int);
72         ///
73         MathedTextCodes getTCode() const;
74         ///
75         bool Permit(short) const;
76         ///
77         void expand();
78         ///
79         void dump(std::ostream & os) const;
80         ///
81         MathParInset const * arg(int) const;
82         ///
83         MathParInset * arg(int);
84         ///
85         MathMacroTemplate * tmplate() const;
86 private:
87         ///
88         MathMacroTemplate * tmplate_;
89         /// our arguments
90         std::vector< boost::shared_ptr<MathParInset> > args_;
91         /// the expanded version fror drawing
92         boost::shared_ptr<MathParInset> expanded_;
93         ///
94         int idx_;
95
96         /// unimplemented
97         void operator=(MathMacro const &);
98 };
99
100 inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)
101 {
102         m.dump(os);
103         return os;
104 }
105 #endif