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
18 #include "formulabase.h"
19 #include "math_atom.h"
21 #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(string const & data);
34 InsetFormula(InsetFormula const &);
38 void metrics(MetricsInfo & mi, Dimension & dim) 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 virtual std::auto_ptr<InsetBase> clone() const;
59 void validate(LaTeXFeatures & features) const;
61 InsetOld::Code lyxCode() const;
63 bool insetAllowed(InsetOld::Code code) const;
65 void getLabelList(std::vector<string> &) const;
67 MathAtom const & par() const { return par_; }
69 MathAtom & par() { return par_; }
71 void generatePreview() const;
73 void addPreview(lyx::graphics::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_;