]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
FINISHED_POP -> FINISHED
[lyx.git] / src / mathed / formula.h
1 // -*- C++ -*-
2 /**
3  * \file formula.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author André Pönitz
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSET_FORMULA_H
14 #define INSET_FORMULA_H
15
16 #include "formulabase.h"
17 #include "math_atom.h"
18
19 #include <boost/scoped_ptr.hpp>
20
21 class RenderPreview;
22
23
24 /// The main LyX math inset
25 class InsetFormula : public InsetFormulaBase {
26 public:
27         ///
28         InsetFormula(bool chemistry = false);
29         ///
30         explicit InsetFormula(BufferView *);
31         ///
32         explicit InsetFormula(std::string const & data);
33         ///
34         InsetFormula(InsetFormula const &);
35         ///
36         ~InsetFormula();
37         ///
38         void metrics(MetricsInfo & mi, Dimension & dim) const;
39         ///
40         void draw(PainterInfo & pi, int x, int y) const;
41
42         ///
43         void write(Buffer const &, std::ostream &) const;
44         ///
45         void read(Buffer const &, LyXLex & lex);
46         ///
47         int latex(Buffer const &, std::ostream &,
48                   LatexRunParams const &) const;
49         ///
50         int ascii(Buffer const &, std::ostream &, int linelen) const;
51         ///
52         int linuxdoc(Buffer const &, std::ostream &) const;
53         ///
54         int docbook(Buffer const &, std::ostream &, bool mixcont) const;
55
56         ///
57         virtual std::auto_ptr<InsetBase> clone() const;
58         ///
59         void validate(LaTeXFeatures & features) const;
60         ///
61         InsetOld::Code lyxCode() const;
62         ///
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;
67         ///
68         MathAtom const & par() const { return par_; }
69         ///
70         MathAtom & par() { return par_; }
71         ///
72         void generatePreview(Buffer const &) const;
73         ///
74         void addPreview(lyx::graphics::PreviewLoader &) const;
75         ///
76         void mutate(std::string const & type);
77
78 private:
79         /// Slot receiving a signal that the preview is ready to display.
80         void statusChanged() const;
81         /// available in AMS only?
82         bool ams() const;
83
84         /// contents
85         MathAtom par_;
86
87         /// The pointer never changes although *preview_'s contents may.
88         boost::scoped_ptr<RenderPreview> const preview_;
89 };
90 #endif