// -*- 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 "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(PainterInfo & pi, int x, int y) const;
+ ///
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
+ ///
+ virtual std::auto_ptr<InsetBase> clone() const;
///
- void Metrics(MathStyles st, int asc = 0, int des = 0);
+ void dump() const;
+
+ ///
+ bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
///
- MathInset * clone() const;
+ bool idxLeft(idx_type & idx, pos_type & pos) const;
///
- void Write(std::ostream &, bool fragile) const;
+ bool idxRight(idx_type & idx, pos_type & pos) const;
+
///
- void WriteNormal(std::ostream &) const;
+ void validate(LaTeXFeatures &) const;
///
- void dump(std::ostream & os) const;
+ bool isMacro() const { return true; }
+ ///
+ bool match(MathAtom const &) const { return false; }
///
- bool idxUp(int &, int &) const;
+ void maple(MapleStream &) const;
+ ///
+ void mathmlize(MathMLStream &) const;
///
- bool idxDown(int &, int &) const;
+ void octave(OctaveStream &) const;
///
- bool idxLeft(int &, int &) const;
+ void infoize(std::ostream &) const;
///
- bool idxRight(int &, int &) 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 MetricsInfo mi_;
+ ///
+ mutable LyXFont font_;
};
-inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)
-{
- m.dump(os);
- return os;
-}
#endif