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"
27 #include <boost/scoped_ptr.hpp>
32 class InsetFormula : public InsetFormulaBase {
37 explicit InsetFormula(BufferView *);
39 explicit InsetFormula(const string & data);
41 InsetFormula(InsetFormula const &);
45 int ascent(BufferView *, LyXFont const &) const;
47 int descent(BufferView *, LyXFont const &) const;
49 int width(BufferView *, LyXFont const &) const;
51 void draw(BufferView *, LyXFont const &, int, float &, bool) const;
54 void write(Buffer const *, std::ostream &) const;
56 void read(Buffer const *, LyXLex & lex);
58 int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
60 int ascii(Buffer const *, std::ostream &, int linelen) const;
62 int linuxdoc(Buffer const *, std::ostream &) const;
64 int docbook(Buffer const *, std::ostream &, bool mixcont) const;
67 Inset * clone(Buffer const &, bool same_id = false) const;
69 void validate(LaTeXFeatures & features) const;
71 Inset::Code lyxCode() const;
73 bool insetAllowed(Inset::Code code) const;
75 virtual RESULT localDispatch(BufferView *, kb_action, string const &);
77 std::vector<string> const getLabelList() const;
79 string hullType() const;
81 MathAtom const & par() const { return par_; }
83 MathAtom & par() { return par_; }
85 void generatePreview(grfx::PreviewLoader &) const;
87 void mutate(string const & type);
90 /// Is this a displayed environment?
92 /// available in AMS only?
95 MathHullInset * hull() const;
97 void handleExtern(string const & arg);
102 /// Use the Pimpl idiom to hide the internals of the previewer.
104 friend class PreviewImpl;
105 /// The pointer never changes although *preview_'s contents may.
106 boost::scoped_ptr<PreviewImpl> const preview_;