4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alejandro Aguilar Sierra
10 * Full author contact details are available in file CREDITS.
13 #ifndef INSET_FORMULA_H
14 #define INSET_FORMULA_H
16 #include "formulabase.h"
17 #include "math_atom.h"
19 #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(std::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 &,
51 LatexRunParams const &) const;
53 int linuxdoc(Buffer const &, std::ostream &,
54 LatexRunParams const &) const;
56 int docbook(Buffer const &, std::ostream &,
57 LatexRunParams const &) const;
60 virtual std::auto_ptr<InsetBase> clone() const;
62 void validate(LaTeXFeatures & features) const;
64 InsetOld::Code lyxCode() const;
66 bool insetAllowed(InsetOld::Code code) const;
67 /// Appends \c list with all labels found within this inset.
68 void getLabelList(Buffer const &,
69 std::vector<std::string> & list) const;
71 MathAtom const & par() const { return par_; }
73 MathAtom & par() { return par_; }
75 void generatePreview(Buffer const &) const;
77 void addPreview(lyx::graphics::PreviewLoader &) const;
79 void mutate(std::string const & type);
82 /// Slot receiving a signal that the preview is ready to display.
83 void statusChanged() const;
84 /// available in AMS only?
90 /// The pointer never changes although *preview_'s contents may.
91 boost::scoped_ptr<RenderPreview> const preview_;