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-08-03 17:10:22 +00:00
|
|
|
#include "math_nestinset.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
|
|
|
|
\author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
\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 &);
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
void draw(Painter &, int x, int y) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-10-19 11:25:48 +00:00
|
|
|
void metrics(MathMetricsInfo const & st) 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-10-19 11:25:48 +00:00
|
|
|
void write(MathWriteInfo & os) const;
|
2001-04-25 15:43:57 +00:00
|
|
|
///
|
2001-07-26 06:56:43 +00:00
|
|
|
void writeNormal(std::ostream &) const;
|
1999-09-27 18:44:28 +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
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxUp(idx_type &, pos_type &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxDown(idx_type &, pos_type &) const;
|
2001-02-13 17:08:51 +00:00
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxLeft(idx_type &, pos_type &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxRight(idx_type &, pos_type &) 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-04-24 16:13:38 +00:00
|
|
|
private:
|
2001-08-08 17:26:30 +00:00
|
|
|
///
|
|
|
|
void operator=(MathMacro const &);
|
|
|
|
///
|
2001-08-09 09:19:18 +00:00
|
|
|
char const * name() const;
|
2001-10-12 16:12:32 +00:00
|
|
|
///
|
|
|
|
bool editing() const;
|
|
|
|
///
|
|
|
|
bool defining() 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
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
mutable 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
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|