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 &, 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;
64 /// Appends \c list with all labels found within this inset.
65 void getLabelList(Buffer const &,
66 std::vector<std::string> & list) const;
68 MathAtom const & par() const { return par_; }
70 MathAtom & par() { return par_; }
72 void generatePreview(Buffer const &) const;
74 void addPreview(lyx::graphics::PreviewLoader &) const;
76 void mutate(std::string const & type);
79 /// Slot receiving a signal that the preview is ready to display.
80 void statusChanged() const;
81 /// available in AMS only?
86 /// x offset for drawing displayed formula
89 /// The pointer never changes although *preview_'s contents may.
90 boost::scoped_ptr<RenderPreview> const preview_;