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
19 #include "formulabase.h"
20 #include "math_atom.h"
22 #include <boost/scoped_ptr.hpp>
24 /// The main LyX math inset
25 class InsetFormula : public InsetFormulaBase {
28 InsetFormula(bool chemistry = false);
30 explicit InsetFormula(BufferView *);
32 explicit InsetFormula(const string & data);
34 InsetFormula(InsetFormula const &);
38 void dimension(BufferView *, LyXFont const &, Dimension &) const;
40 void draw(PainterInfo & pi, int x, int y) const;
43 void write(Buffer const *, std::ostream &) const;
45 void read(Buffer const *, LyXLex & lex);
47 int latex(Buffer const *, std::ostream &,
48 LatexRunParams const &) const;
50 int ascii(Buffer const *, std::ostream &, int linelen) const;
52 int linuxdoc(Buffer const *, std::ostream &) const;
54 int docbook(Buffer const *, std::ostream &, bool mixcont) const;
57 Inset * clone(Buffer const &) const;
59 void validate(LaTeXFeatures & features) const;
61 Inset::Code lyxCode() const;
63 bool insetAllowed(Inset::Code code) const;
65 std::vector<string> const getLabelList() const;
67 MathAtom const & par() const { return par_; }
69 MathAtom & par() { return par_; }
71 void generatePreview() const;
73 void addPreview(grfx::PreviewLoader &) const;
75 void mutate(string const & type);
78 /// available in AMS only?
84 /// Use the Pimpl idiom to hide the internals of the previewer.
86 friend class PreviewImpl;
87 /// The pointer never changes although *preview_'s contents may.
88 boost::scoped_ptr<PreviewImpl> const preview_;