#ifndef MATH_MACRO_H
#define MATH_MACRO_H
-
#include "math_nestinset.h"
-#include "metricsinfo.h"
-#include "math_macroarg.h"
-#include "support/std_string.h"
-
-class MathMacroTemplate;
+#include "math_data.h"
+#include "math_nestinset.h"
+#include "math_macrotable.h"
/// This class contains the data for a macro.
class MathMacro : public MathNestInset {
public:
/// A macro can be built from an existing template
- explicit MathMacro(string const &);
- ///
- MathMacro(MathMacro const &);
+ MathMacro(std::string const & name, int numargs);
///
void draw(PainterInfo & pi, int x, int y) const;
///
- void metrics(MetricsInfo & mi, Dimension & dim) const;
+ void drawExpanded(PainterInfo & pi, int x, int y) const;
///
- virtual std::auto_ptr<InsetBase> clone() const;
- ///
- void dump() const;
-
- ///
- bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
///
- bool idxLeft(idx_type & idx, pos_type & pos) const;
+ std::string name() const;
///
- bool idxRight(idx_type & idx, pos_type & pos) const;
+ void setExpansion(MathArray const & exp, MathArray const & args) const;
///
void validate(LaTeXFeatures &) const;
- ///
- bool isMacro() const { return true; }
- ///
- bool match(MathAtom const &) const { return false; }
///
void maple(MapleStream &) const;
void infoize2(std::ostream &) const;
private:
- ///
- void operator=(MathMacro const &);
- ///
- string name() const;
- ///
- bool defining() const;
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
void updateExpansion() const;
///
void expand() const;
- ///
- MathAtom & tmplate_;
- ///
+ /// name of macro
+ std::string name_;
+ /// the unexpanded macro defintition
+ mutable MathArray tmpl_;
+ /// the matcro substituted with our args
mutable MathArray expanded_;
- ///
- mutable MetricsInfo mi_;
- ///
- mutable LyXFont font_;
};