6 * This file is part of LyX, the document processor.
7 * Licence details can be found in the file COPYING.
9 * \author Alejandro Aguilar Sierra
10 * \author André Pönitz
12 * Full author contact details are available in file CREDITS.
15 #ifndef INSET_FORMULA_H
16 #define INSET_FORMULA_H
22 #include "formulabase.h"
23 #include "math_atom.h"
25 #include <boost/scoped_ptr.hpp>
27 /// The main LyX math inset
28 class InsetFormula : public InsetFormulaBase {
33 explicit InsetFormula(BufferView *);
35 explicit InsetFormula(const string & data);
37 InsetFormula(InsetFormula const &);
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 std::vector<string> const getLabelList() const;
73 MathAtom const & par() const { return par_; }
75 MathAtom & par() { return par_; }
77 void generatePreview() const;
79 void addPreview(grfx::PreviewLoader &) const;
81 //void mutate(string const & type);
84 /// available in AMS only?
90 /// Use the Pimpl idiom to hide the internals of the previewer.
92 friend class PreviewImpl;
93 /// The pointer never changes although *preview_'s contents may.
94 boost::scoped_ptr<PreviewImpl> const preview_;