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
11 * Copyright: 1996, 1997 Alejandro Aguilar Sierra
13 * Version: 0.2, Mathed & Lyx project.
15 * This code is under the GNU General Public Licence version 2 or later.
26 #include <boost/smart_ptr.hpp>
28 #include "math_parinset.h"
29 #include "math_macroarg.h"
31 class MathMacroTemplate;
34 /** This class contains the data for a macro
35 \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
36 \version November 1996
38 class MathMacro : public MathParInset {
40 /// A macro can be built from an existing template
41 explicit MathMacro(MathMacroTemplate const &);
43 void draw(Painter &, int, int);
47 MathedInset * Clone();
49 void Write(std::ostream &, bool fragile);
50 /// Index 0 is the template, index 1..nargs() are the parameters
51 bool setArgumentIdx(int);
53 int getArgumentIdx() const;
55 int getMaxArgumentIdx() const;
59 int GetColumns() const;
61 void GetXY(int &, int &) const;
63 void SetFocus(int, int);
65 MathedArray & GetData();
67 MathedArray const & GetData() const;
69 void setData(MathedArray const &);
71 void setData(MathedArray const &, int);
73 MathedTextCodes getTCode() const;
75 bool Permit(short) const;
79 void dump(std::ostream & os) const;
81 MathParInset const * arg(int) const;
83 MathParInset * arg(int);
85 MathMacroTemplate * tmplate() const;
88 MathMacroTemplate * tmplate_;
90 std::vector< boost::shared_ptr<MathParInset> > args_;
91 /// the expanded version fror drawing
92 boost::shared_ptr<MathParInset> expanded_;
97 void operator=(MathMacro const &);
100 inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)