1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/*
|
|
|
|
* File: math_macro.h
|
|
|
|
* Purpose: Declaration of macro class for mathed
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
* 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
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
#include <vector>
|
2001-04-24 16:13:38 +00:00
|
|
|
#include <iosfwd>
|
2001-03-01 14:07:43 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "math_inset.h"
|
2001-03-05 10:18:36 +00:00
|
|
|
#include "math_macroarg.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
|
|
|
|
\author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
\version November 1996
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
class MathMacro : public MathInset {
|
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
|
|
|
|
explicit MathMacro(MathMacroTemplate const &);
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
|
|
|
void draw(Painter &, int, int);
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void Metrics(MathStyles st);
|
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-06-25 00:06:33 +00:00
|
|
|
void Write(std::ostream &, bool fragile) const;
|
2001-04-25 15:43:57 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void WriteNormal(std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-04-25 11:14:01 +00:00
|
|
|
void dump(std::ostream & os) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
bool idxUp(int &, int &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
bool idxDown(int &, int &) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
bool idxLeft(int &, int &) const;
|
|
|
|
///
|
|
|
|
bool idxRight(int &, int &) const;
|
|
|
|
|
2001-04-24 16:13:38 +00:00
|
|
|
private:
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
MathMacroTemplate const * const tmplate_;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
MathXArray 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
|
|
|
|
2001-04-25 11:14:01 +00:00
|
|
|
inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)
|
2001-04-24 16:13:38 +00:00
|
|
|
{
|
|
|
|
m.dump(os);
|
|
|
|
return os;
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|