* Created: November 1996
* Description: WYSIWYG math macros
*
- * Dependencies: Mathed
+ * Dependencies: Math
*
* Copyright: 1996, 1997 Alejandro Aguilar Sierra
*
- * Version: 0.2, Mathed & Lyx project.
+ * Version: 0.2, Math & Lyx project.
*
* This code is under the GNU General Public Licence version 2 or later.
*/
-#ifndef MATH_MACRO
-#define MATH_MACRO
+#ifndef MATH_MACRO_H
+#define MATH_MACRO_H
#ifdef __GNUG__
#pragma interface
#endif
#include <vector>
-#include <boost/smart_ptr.hpp>
+#include <iosfwd>
-#include "math_parinset.h"
+#include "math_nestinset.h"
+#include "math_macroarg.h"
class MathMacroTemplate;
\author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
\version November 1996
*/
-class MathMacro : public MathParInset {
+class MathMacro : public MathNestInset {
public:
- /// A macro can only be built from an existing template
- explicit
- MathMacro(boost::shared_ptr<MathMacroTemplate> const &);
+ /// A macro can be built from an existing template
+ explicit MathMacro(MathMacroTemplate const &);
///
- void draw(Painter &, int, int);
+ MathMacro(MathMacro const &);
///
- void Metrics();
+ void draw(Painter &, int x, int y) const;
///
- MathedInset * Clone();
+ void metrics(MathStyles st) const;
///
- void Write(std::ostream &, bool fragile);
+ MathInset * clone() const;
///
- bool setArgumentIdx(int);
+ void write(std::ostream &, bool fragile) const;
///
- int getArgumentIdx() const;
+ void writeNormal(std::ostream &) const;
///
- int getMaxArgumentIdx() const;
- ///
- int GetColumns() const;
- ///
- void GetXY(int &, int &) const;
- ///
- void SetFocus(int, int);
+ void dump() const;
+
///
- MathedArray & GetData();
+ bool idxUp(unsigned int &, unsigned int &) const;
///
- MathedArray const & GetData() const;
+ bool idxDown(unsigned int &, unsigned int &) const;
///
- MathedRowSt * getRowSt() const;
+ bool idxLeft(unsigned int &, unsigned int &) const;
///
- void setData(MathedArray const &);
+ bool idxRight(unsigned int &, unsigned int &) const;
+
///
- MathedTextCodes getTCode() const;
+ void validate(LaTeXFeatures &) const;
///
- bool Permit(short) const;
+ bool isMacro() const { return true; }
+
private:
///
- boost::shared_ptr<MathMacroTemplate> tmplate_;
- ///
- struct MacroArgumentBase {
- ///
- MathedRowSt * row;
- ///
- MathedArray array;
- ///
- MacroArgumentBase()
- : row(0)
- {}
- };
- std::vector<MacroArgumentBase> args_;
+ void operator=(MathMacro const &);
///
- int idx_;
+ char const * name() const;
+
///
- int nargs_;
+ MathMacroTemplate const * const tmplate_;
///
- MathedTextCodes tcode_;
+ mutable MathXArray expanded_;
};
+
+
#endif