]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
Point fix, earlier forgotten
[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
22 /// The main LyX math inset
23 class InsetFormula : public InsetFormulaBase {
24 public:
25         ///
26         InsetFormula(bool chemistry = false);
27         ///
28         explicit InsetFormula(BufferView *);
29         ///
30         explicit InsetFormula(string const & data);
31         ///
32         InsetFormula(InsetFormula const &);
33         ///
34         ~InsetFormula();
35         ///
36         void metrics(MetricsInfo & mi, Dimension & dim) const;
37         ///
38         void draw(PainterInfo & pi, int x, int y) const;
39
40         ///
41         void write(Buffer const &, std::ostream &) const;
42         ///
43         void read(Buffer const &, LyXLex & lex);
44         ///
45         int latex(Buffer const &, std::ostream &,
46                   LatexRunParams const &) const;
47         ///
48         int ascii(Buffer const &, std::ostream &, int linelen) const;
49         ///
50         int linuxdoc(Buffer const &, std::ostream &) const;
51         ///
52         int docbook(Buffer const &, std::ostream &, bool mixcont) const;
53
54         ///
55         virtual std::auto_ptr<InsetBase> clone() const;
56         ///
57         void validate(LaTeXFeatures & features) const;
58         ///
59         InsetOld::Code lyxCode() const;
60         ///
61         bool insetAllowed(InsetOld::Code code) const;
62         ///
63         void getLabelList(std::vector<string> &) const;
64         ///
65         MathAtom const & par() const { return par_; }
66         ///
67         MathAtom & par() { return par_; }
68         ///
69         void generatePreview() const;
70         ///
71         void addPreview(lyx::graphics::PreviewLoader &) const;
72         ///
73         void mutate(string const & type);
74
75 private:
76         /// available in AMS only?
77         bool ams() const;
78
79         /// contents
80         MathAtom par_;
81         /// x offset for drawing displayed formula
82         mutable int offset_;
83
84         /// Use the Pimpl idiom to hide the internals of the previewer.
85         class PreviewImpl;
86         friend class PreviewImpl;
87         /// The pointer never changes although *preview_'s contents may.
88         boost::scoped_ptr<PreviewImpl> const preview_;
89 };
90 #endif