1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-11 08:26:02 +00:00
|
|
|
|
/**
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* \file math_macro.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* \author Alejandro Aguilar Sierra
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*/
|
2003-08-19 13:00:56 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#ifndef MATH_MACRO_H
|
|
|
|
|
#define MATH_MACRO_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-08-03 17:10:22 +00:00
|
|
|
|
#include "math_nestinset.h"
|
2004-04-13 06:27:29 +00:00
|
|
|
|
#include "math_data.h"
|
2004-04-13 13:54:58 +00:00
|
|
|
|
#include "math_nestinset.h"
|
|
|
|
|
#include "math_macrotable.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
/// This class contains the data for a macro.
|
2004-04-13 13:54:58 +00:00
|
|
|
|
class MathMacro : public MathNestInset {
|
2000-03-07 01:14:37 +00:00
|
|
|
|
public:
|
2001-04-24 16:13:38 +00:00
|
|
|
|
/// A macro can be built from an existing template
|
2004-04-13 13:54:58 +00:00
|
|
|
|
MathMacro(std::string const & name, int numargs);
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2004-04-13 06:27:29 +00:00
|
|
|
|
std::auto_ptr<InsetBase> clone() const;
|
|
|
|
|
///
|
2003-03-21 14:20:48 +00:00
|
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2004-04-13 06:27:29 +00:00
|
|
|
|
void drawExpanded(PainterInfo & pi, int x, int y) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2004-04-13 06:27:29 +00:00
|
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2004-04-13 06:27:29 +00:00
|
|
|
|
std::string name() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2004-04-13 06:27:29 +00:00
|
|
|
|
void setExpansion(MathArray const & exp, MathArray const & args) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-07-13 14:54:56 +00:00
|
|
|
|
///
|
2001-07-26 06:56:43 +00:00
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2001-07-13 14:54:56 +00:00
|
|
|
|
|
2001-11-16 08:26:41 +00:00
|
|
|
|
///
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void maple(MapleStream &) const;
|
2001-11-16 08:26:41 +00:00
|
|
|
|
///
|
2001-11-16 08:29:11 +00:00
|
|
|
|
void mathmlize(MathMLStream &) const;
|
|
|
|
|
///
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void octave(OctaveStream &) const;
|
2003-01-07 11:24:43 +00:00
|
|
|
|
///
|
|
|
|
|
void infoize(std::ostream &) const;
|
|
|
|
|
///
|
|
|
|
|
void infoize2(std::ostream &) const;
|
2001-11-16 08:26:41 +00:00
|
|
|
|
|
2001-04-24 16:13:38 +00:00
|
|
|
|
private:
|
2001-12-11 11:33:43 +00:00
|
|
|
|
///
|
|
|
|
|
void updateExpansion() const;
|
2001-04-24 16:13:38 +00:00
|
|
|
|
///
|
2004-04-13 13:54:58 +00:00
|
|
|
|
void expand() const;
|
2004-04-20 08:51:15 +00:00
|
|
|
|
|
2004-04-13 13:54:58 +00:00
|
|
|
|
/// name of macro
|
2004-04-13 06:27:29 +00:00
|
|
|
|
std::string name_;
|
2004-04-13 13:54:58 +00:00
|
|
|
|
/// the unexpanded macro defintition
|
|
|
|
|
mutable MathArray tmpl_;
|
|
|
|
|
/// the matcro substituted with our args
|
2002-08-02 14:29:42 +00:00
|
|
|
|
mutable MathArray expanded_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
2001-04-24 16:13:38 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|