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.
14 #ifndef INSET_FORMULA_H
15 #define INSET_FORMULA_H
17 #include "formulabase.h"
18 #include "math_atom.h"
20 #include <boost/scoped_ptr.hpp>
25 /// The main LyX math inset
26 class InsetFormula : public InsetFormulaBase {
31 explicit InsetFormula(std::string const & data);
33 InsetFormula(InsetFormula const &);
37 void metrics(MetricsInfo & mi, Dimension & dim) const;
39 void draw(PainterInfo & pi, int x, int y) const;
42 void write(Buffer const &, std::ostream &) const;
44 void read(Buffer const &, LyXLex & lex);
46 int latex(Buffer const &, std::ostream &,
47 OutputParams const &) const;
49 int plaintext(Buffer const &, std::ostream &,
50 OutputParams const &) const;
52 int linuxdoc(Buffer const &, std::ostream &,
53 OutputParams const &) const;
55 int docbook(Buffer const &, std::ostream &,
56 OutputParams const &) const;
59 virtual std::auto_ptr<InsetBase> clone() const;
61 void validate(LaTeXFeatures & features) const;
63 InsetOld::Code lyxCode() const;
65 bool insetAllowed(InsetOld::Code code) const;
66 /// Appends \c list with all labels found within this inset.
67 void getLabelList(Buffer const &,
68 std::vector<std::string> & list) const;
70 MathAtom const & par() const { return par_; }
72 MathAtom & par() { return par_; }
74 void generatePreview(Buffer const &) const;
76 void addPreview(lyx::graphics::PreviewLoader &) const;
78 void mutate(std::string const & type);
81 /// Slot receiving a signal that the preview is ready to display.
82 void statusChanged() const;
83 /// available in AMS only?
89 /// The pointer never changes although *preview_'s contents may.
90 boost::scoped_ptr<RenderPreview> const preview_;