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>
22 /// The main LyX math inset
23 class InsetFormula : public InsetFormulaBase {
26 InsetFormula(bool chemistry = false);
28 explicit InsetFormula(BufferView *);
30 explicit InsetFormula(string const & data);
32 InsetFormula(InsetFormula const &);
36 void metrics(MetricsInfo & mi, Dimension & dim) const;
38 void draw(PainterInfo & pi, int x, int y) const;
41 void write(Buffer const &, std::ostream &) const;
43 void read(Buffer const &, LyXLex & lex);
45 int latex(Buffer const &, std::ostream &,
46 LatexRunParams const &) const;
48 int ascii(Buffer const &, std::ostream &, int linelen) const;
50 int linuxdoc(Buffer const &, std::ostream &) const;
52 int docbook(Buffer const &, std::ostream &, bool mixcont) const;
55 virtual std::auto_ptr<InsetBase> clone() const;
57 void validate(LaTeXFeatures & features) const;
59 InsetOld::Code lyxCode() const;
61 bool insetAllowed(InsetOld::Code code) const;
63 void getLabelList(std::vector<string> &) const;
65 MathAtom const & par() const { return par_; }
67 MathAtom & par() { return par_; }
69 void generatePreview() const;
71 void addPreview(lyx::graphics::PreviewLoader &) const;
73 void mutate(string const & type);
76 /// available in AMS only?
81 /// x offset for drawing displayed formula
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_;