]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
more IU
[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                   OutputParams const &) const;
49         ///
50         int plaintext(Buffer const &, std::ostream &,
51                   OutputParams const &) const;
52         ///
53         int linuxdoc(Buffer const &, std::ostream &,
54                      OutputParams const &) const;
55         ///
56         int docbook(Buffer const &, std::ostream &,
57                     OutputParams const &) const;
58
59         ///
60         virtual std::auto_ptr<InsetBase> clone() const;
61         ///
62         void validate(LaTeXFeatures & features) const;
63         ///
64         InsetOld::Code lyxCode() const;
65         ///
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;
70         ///
71         MathAtom const & par() const { return par_; }
72         ///
73         MathAtom & par() { return par_; }
74         ///
75         void generatePreview(Buffer const &) const;
76         ///
77         void addPreview(lyx::graphics::PreviewLoader &) const;
78         ///
79         void mutate(std::string const & type);
80
81 private:
82         /// Slot receiving a signal that the preview is ready to display.
83         void statusChanged() const;
84         /// available in AMS only?
85         bool ams() const;
86
87         /// contents
88         MathAtom par_;
89
90         /// The pointer never changes although *preview_'s contents may.
91         boost::scoped_ptr<RenderPreview> const preview_;
92 };
93 #endif