1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-11 08:26:02 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathMacro.h
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* 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
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathNest.h"
|
|
|
|
|
#include "MathData.h"
|
|
|
|
|
#include "InsetMathNest.h"
|
|
|
|
|
#include "MathMacroTable.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
/// This class contains the data for a macro.
|
2006-09-16 18:11:38 +00:00
|
|
|
|
class MathMacro : public InsetMathNest {
|
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
|
2006-10-22 10:15:23 +00:00
|
|
|
|
MathMacro(docstring const & name, int numargs);
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
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;
|
2005-10-05 21:19:32 +00:00
|
|
|
|
/// draw selection background
|
|
|
|
|
void drawSelection(PainterInfo & pi, int x, int y) const;
|
2007-01-20 00:55:24 +00:00
|
|
|
|
/// draw decorations.
|
|
|
|
|
void drawDecoration(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{ drawMarkers2(pi, x, y); }
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool metrics(MetricsInfo & mi, Dimension & dim) const;
|
2005-10-05 21:19:32 +00:00
|
|
|
|
/// get cursor position
|
2006-10-17 16:23:27 +00:00
|
|
|
|
void cursorPos(BufferView const & bv, CursorSlice const & sl,
|
|
|
|
|
bool boundary, int & x, int & y) const;
|
2005-10-05 21:19:32 +00:00
|
|
|
|
///
|
|
|
|
|
InsetBase * editXY(LCursor & cur, int x, int y);
|
2001-02-13 17:08:51 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring 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
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void mathmlize(MathStream &) const;
|
2001-11-16 08:29:11 +00:00
|
|
|
|
///
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void octave(OctaveStream &) const;
|
2003-01-07 11:24:43 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void infoize(odocstream &) const;
|
2003-01-07 11:24:43 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void infoize2(odocstream &) const;
|
2001-11-16 08:26:41 +00:00
|
|
|
|
|
2001-04-24 16:13:38 +00:00
|
|
|
|
private:
|
2004-11-23 23:04:52 +00:00
|
|
|
|
virtual std::auto_ptr<InsetBase> doClone() const;
|
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
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring name_;
|
2004-04-13 13:54:58 +00:00
|
|
|
|
/// the unexpanded macro defintition
|
|
|
|
|
mutable MathArray tmpl_;
|
2005-10-05 21:19:32 +00:00
|
|
|
|
/// the macro 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
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|