1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-11 08:26:02 +00:00
|
|
|
/**
|
1999-09-27 18:44:28 +00:00
|
|
|
* File: math_macro.h
|
2002-03-21 17:42:56 +00:00
|
|
|
* Purpose: Declaration of macro class for mathed
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
1999-09-27 18:44:28 +00:00
|
|
|
* Created: November 1996
|
|
|
|
* Description: WYSIWYG math macros
|
|
|
|
*
|
2001-06-25 00:06:33 +00:00
|
|
|
* Dependencies: Math
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright: 1996, 1997 Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2001-06-25 00:06:33 +00:00
|
|
|
* Version: 0.2, Math & Lyx project.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* This code is under the GNU General Public Licence version 2 or later.
|
|
|
|
*/
|
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"
|
2003-03-21 14:20:48 +00:00
|
|
|
#include "metricsinfo.h"
|
2001-03-05 10:18:36 +00:00
|
|
|
#include "math_macroarg.h"
|
2001-10-12 12:02:49 +00:00
|
|
|
#include "LString.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
class MathMacroTemplate;
|
|
|
|
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/** This class contains the data for a macro
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Alejandro Aguilar Sierra
|
2002-09-11 08:26:02 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-02-16 09:25:43 +00:00
|
|
|
\version November 1996
|
|
|
|
*/
|
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
|
2001-10-12 12:02:49 +00:00
|
|
|
explicit MathMacro(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-03-21 14:20:48 +00:00
|
|
|
void metrics(MetricsInfo & mi) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
MathInset * 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
|
|
|
///
|
2002-07-30 13:56:02 +00:00
|
|
|
bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2002-07-26 13:13:20 +00:00
|
|
|
bool idxLeft(idx_type & idx, pos_type & pos) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2002-07-26 13:13:20 +00:00
|
|
|
bool idxRight(idx_type & idx, pos_type & pos) 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-11-16 09:55:37 +00:00
|
|
|
///
|
2002-08-09 10:22:35 +00:00
|
|
|
bool match(MathAtom const &) const { return false; }
|
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 &);
|
|
|
|
///
|
2002-08-01 15:53:46 +00:00
|
|
|
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
|