1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/*
|
|
|
|
* File: formula.h
|
|
|
|
* Purpose: Declaration of formula inset
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
* Created: January 1996
|
|
|
|
* Description: Allows the edition of math paragraphs inside Lyx.
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright: 1996, Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* Version: 0.4, Lyx project.
|
|
|
|
*
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
*/
|
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
#ifndef INSET_FORMULA_MACRO_H
|
|
|
|
#define INSET_FORMULA_MACRO_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "formulabase.h"
|
2001-03-01 14:07:43 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class MathMacroTemplate;
|
|
|
|
|
2001-08-14 07:46:11 +00:00
|
|
|
// InsetFormulaMacro's only knows its name and asks the global
|
|
|
|
// MathMacroTable if it needs to know more.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
class InsetFormulaMacro: public InsetFormulaBase {
|
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
|
2001-06-25 00:06:33 +00:00
|
|
|
explicit InsetFormulaMacro(string name, int na);
|
2001-08-14 07:46:11 +00:00
|
|
|
/// constructs a mocro from its LaTeX definition
|
|
|
|
explicit InsetFormulaMacro(string const & s);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int ascent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int descent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int width(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-06-23 15:02:46 +00:00
|
|
|
void draw(BufferView *,LyXFont const &, int, float &, bool) const;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
void read(LyXLex & lex);
|
2001-04-24 16:13:38 +00:00
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
void write(std::ostream & os) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
int ascii(std::ostream &, int linelen) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
int latex(std::ostream & os, bool fragile, bool free_spc) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
int linuxdoc(std::ostream & os) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2001-09-04 11:02:09 +00:00
|
|
|
int docbook(std::ostream &) const;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
Inset * clone(Buffer const &, bool same_id = false) const;
|
2000-11-02 16:31:05 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
Inset::Code lyxCode() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
RESULT localDispatch(BufferView *, kb_action, string const &);
|
2001-08-01 13:28:45 +00:00
|
|
|
///
|
|
|
|
MathInsetTypes getType() const;
|
2001-08-03 09:54:48 +00:00
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
MathInset const * par() const;
|
2001-08-03 09:54:48 +00:00
|
|
|
///
|
|
|
|
void metrics() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2001-08-03 09:54:48 +00:00
|
|
|
///
|
|
|
|
MathMacroTemplate const & tmacro() const;
|
2001-04-24 16:13:38 +00:00
|
|
|
/// prefix in inset
|
|
|
|
string prefix() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|