1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
* \file InsetFormulaMacro.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
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pö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
|
|
|
*/
|
|
|
|
|
2002-03-21 17:42:56 +00:00
|
|
|
#ifndef INSET_FORMULA_MACRO_H
|
1999-11-15 11:06:41 +00:00
|
|
|
#define INSET_FORMULA_MACRO_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathNest.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
class MathMacroTemplate;
|
2007-04-26 11:30:54 +00:00
|
|
|
class Lexer;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-07-12 14:24:47 +00:00
|
|
|
// An InsetFormulaMacro only knows its name and asks the global
|
2002-03-21 17:42:56 +00:00
|
|
|
// MathMacroTable if it needs to know more.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
/// Main LyX Inset for defining math macros
|
2006-09-16 18:11:38 +00:00
|
|
|
class InsetFormulaMacro : public InsetMathNest {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
InsetFormulaMacro();
|
2001-08-14 07:46:11 +00:00
|
|
|
/// construct a macro hull from its name and the number of arguments
|
2006-10-22 10:15:23 +00:00
|
|
|
InsetFormulaMacro(docstring const & name, int nargs, docstring const & t);
|
2001-08-14 07:46:11 +00:00
|
|
|
/// constructs a mocro from its LaTeX definition
|
2006-10-22 10:15:23 +00:00
|
|
|
explicit InsetFormulaMacro(docstring const & s);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2003-05-30 06:48:24 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void read(Lexer & lex);
|
2001-04-24 16:13:38 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream & os) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int latex(odocstream & os, OutputParams const &) const;
|
2007-02-24 15:06:04 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return MATHMACRO_CODE; }
|
2004-04-01 10:21:29 +00:00
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
docstring const & getInsetName() const { return name_; }
|
2004-04-01 10:21:29 +00:00
|
|
|
///
|
|
|
|
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
2001-10-12 12:02:49 +00:00
|
|
|
private:
|
2004-03-27 12:58:44 +00:00
|
|
|
///
|
|
|
|
MathAtom & tmpl() const;
|
2002-07-12 14:24:47 +00:00
|
|
|
///
|
|
|
|
void read(std::istream & is);
|
2001-04-24 16:13:38 +00:00
|
|
|
/// prefix in inset
|
2006-10-22 10:15:23 +00:00
|
|
|
docstring prefix() const;
|
2004-01-26 10:13:15 +00:00
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
docstring name_;
|
2007-08-30 18:03:17 +00:00
|
|
|
///
|
|
|
|
Inset * clone() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|