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);
51 void WriteNormal(std::ostream &);
52 /// Index 0 is the template, index 1..nargs() are the parameters
53 bool setArgumentIdx(int);
55 int getArgumentIdx() const;
57 int getMaxArgumentIdx() const;
61 int GetColumns() const;
63 void GetXY(int &, int &) const;
65 void SetFocus(int, int);
67 MathedArray & GetData();
69 MathedArray const & GetData() const;
71 void setData(MathedArray const &);
73 void setData(MathedArray const &, int);
75 MathedTextCodes getTCode() const;
77 bool Permit(short) const;
81 void dump(std::ostream & os) const;
83 MathParInset const * arg(int) const;
85 MathParInset * arg(int);
87 MathMacroTemplate * tmplate() const;
90 MathMacroTemplate * tmplate_;
92 std::vector< boost::shared_ptr<MathParInset> > args_;
93 /// the expanded version fror drawing
94 boost::shared_ptr<MathParInset> expanded_;
99 void operator=(MathMacro const &);
102 inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)