4 * Purpose: Declaration of formula inset
5 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
6 * Created: January 1996
7 * Description: Allows the edition of math paragraphs inside Lyx.
9 * Copyright: 1996, Alejandro Aguilar Sierra
11 * Version: 0.4, Lyx project.
13 * You are free to use and modify this code under the terms of
14 * the GNU General Public Licence version 2 or later.
17 #ifndef INSET_FORMULA_H
18 #define INSET_FORMULA_H
24 #include "formulabase.h"
25 #include "math_atom.h"
26 #include "graphics/GraphicsTypes.h"
27 #include "graphics/GraphicsLoader.h"
32 class InsetFormula : public InsetFormulaBase {
37 explicit InsetFormula(BufferView *);
39 explicit InsetFormula(const string & data);
41 int ascent(BufferView *, LyXFont const &) const;
43 int descent(BufferView *, LyXFont const &) const;
45 int width(BufferView *, LyXFont const &) const;
47 void draw(BufferView *, LyXFont const &, int, float &, bool) const;
50 void write(Buffer const *, std::ostream &) const;
52 void read(Buffer const *, LyXLex & lex);
54 int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
56 int ascii(Buffer const *, std::ostream &, int linelen) const;
58 int linuxdoc(Buffer const *, std::ostream &) const;
60 int docbook(Buffer const *, std::ostream &, bool mixcont) const;
63 Inset * clone(Buffer const &, bool same_id = false) const;
65 void validate(LaTeXFeatures & features) const;
67 Inset::Code lyxCode() const;
69 bool insetAllowed(Inset::Code code) const;
71 virtual RESULT localDispatch(BufferView *, kb_action, string const &);
73 std::vector<string> const getLabelList() const;
75 string hullType() const;
77 MathAtom const & par() const { return par_; }
79 MathAtom & par() { return par_; }
81 void mutate(string const & type);
84 /// Is this a displayed environment?
86 /// available in AMS only?
89 MathHullInset * hull();
91 MathHullInset const * hull() const;
93 void handleExtern(string const & arg);
99 bool canPreview() const;
103 /// non owning pointer
104 mutable grfx::Loader * loader_;