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
|
|
|
|
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "math_data.h"
|
2001-08-03 17:10:22 +00:00
|
|
|
|
#include "math_nestinset.h"
|
2003-03-21 14:20:48 +00:00
|
|
|
|
#include "metricsinfo.h"
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
class MathMacroTemplate;
|
|
|
|
|
|
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
/// This class contains the data for a macro.
|
2001-08-03 17:10:22 +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
|
2003-10-06 15:43:21 +00:00
|
|
|
|
explicit MathMacro(std::string const &);
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2001-07-12 11:55:57 +00:00
|
|
|
|
MathMacro(MathMacro 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
|
|
|
|
///
|
2003-06-02 10:03:27 +00:00
|
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2003-07-25 17:11:25 +00:00
|
|
|
|
virtual std::auto_ptr<InsetBase> clone() const;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2001-09-26 15:20:45 +00:00
|
|
|
|
void dump() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2004-01-15 17:34:44 +00:00
|
|
|
|
bool idxUpDown(BufferView &, bool up, int targetx) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2004-01-15 17:34:44 +00:00
|
|
|
|
bool idxLeft(BufferView &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2004-01-15 17:34:44 +00:00
|
|
|
|
bool idxRight(BufferView &) 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-08-17 09:48:24 +00:00
|
|
|
|
///
|
|
|
|
|
bool isMacro() const { return true; }
|
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-08-08 17:26:30 +00:00
|
|
|
|
///
|
|
|
|
|
void operator=(MathMacro const &);
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string name() const;
|
2001-10-12 16:12:32 +00:00
|
|
|
|
///
|
|
|
|
|
bool defining() const;
|
2001-12-11 11:33:43 +00:00
|
|
|
|
///
|
|
|
|
|
void updateExpansion() const;
|
2002-03-25 12:11:25 +00:00
|
|
|
|
///
|
|
|
|
|
void expand() const;
|
2001-08-08 17:26:30 +00:00
|
|
|
|
|
2001-04-24 16:13:38 +00:00
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
MathAtom & tmplate_;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2002-08-02 14:29:42 +00:00
|
|
|
|
mutable MathArray expanded_;
|
2001-10-22 15:37:49 +00:00
|
|
|
|
///
|
2003-03-21 14:20:48 +00:00
|
|
|
|
mutable MetricsInfo mi_;
|
2002-03-19 16:55:58 +00:00
|
|
|
|
///
|
|
|
|
|
mutable LyXFont font_;
|
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
|