// -*- C++ -*-
-/*
+/**
* File: math_macro.h
- * Purpose: Declaration of macro class for mathed
- * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
+ * Purpose: Declaration of macro class for mathed
+ * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* Created: November 1996
* Description: WYSIWYG math macros
*
#ifndef MATH_MACRO_H
#define MATH_MACRO_H
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include <vector>
-#include <iosfwd>
-#include "math_inset.h"
+#include "math_nestinset.h"
+#include "math_metricsinfo.h"
#include "math_macroarg.h"
+#include "LString.h"
class MathMacroTemplate;
/** This class contains the data for a macro
- \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
+ * \author Alejandro Aguilar Sierra
+ *
+ * Full author contact details are available in file CREDITS
\version November 1996
*/
-class MathMacro : public MathInset {
+class MathMacro : public MathNestInset {
public:
/// A macro can be built from an existing template
- explicit MathMacro(MathMacroTemplate const &);
+ explicit MathMacro(string const &);
///
MathMacro(MathMacro const &);
///
- void draw(Painter &, int, int);
+ void draw(MathPainterInfo & pi, int x, int y) const;
///
- void metrics(MathStyles st);
+ void metrics(MathMetricsInfo & mi) const;
///
MathInset * clone() const;
///
- void write(std::ostream &, bool fragile) const;
+ void dump() const;
+
///
- void writeNormal(std::ostream &) const;
+ bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
///
- void dump(std::ostream & os) const;
-
+ bool idxLeft(idx_type & idx, pos_type & pos) const;
///
- bool idxUp(int &, int &) const;
+ bool idxRight(idx_type & idx, pos_type & pos) const;
+
///
- bool idxDown(int &, int &) const;
+ void validate(LaTeXFeatures &) const;
///
- bool idxLeft(int &, int &) const;
+ bool isMacro() const { return true; }
///
- bool idxRight(int &, int &) const;
+ bool match(MathAtom const &) const { return false; }
///
- void validate(LaTeXFeatures &) const;
+ void maple(MapleStream &) const;
+ ///
+ void mathmlize(MathMLStream &) const;
+ ///
+ void octave(OctaveStream &) const;
+ ///
+ void infoize(std::ostream &) const;
+ ///
+ void infoize2(std::ostream &) const;
private:
///
- MathMacroTemplate const * const tmplate_;
+ void operator=(MathMacro const &);
///
- MathXArray expanded_;
+ string name() const;
///
- void operator=(MathMacro const &);
+ bool defining() const;
+ ///
+ void updateExpansion() const;
+ ///
+ void expand() const;
+
+ ///
+ MathAtom & tmplate_;
+ ///
+ mutable MathArray expanded_;
+ ///
+ mutable MathMetricsInfo mi_;
+ ///
+ mutable LyXFont font_;
};
-inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)
-{
- m.dump(os);
- return os;
-}
#endif