]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
architectural changes to tex2lyx
[lyx.git] / src / mathed / formula.h
1 // -*- C++ -*-
2
3 /**
4  *  \file formula.h
5  *
6  *  This file is part of LyX, the document processor.
7  *  Licence details can be found in the file COPYING.
8  *
9  *  \author Alejandro Aguilar Sierra
10  *  \author André Pönitz
11  *
12  *  Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef INSET_FORMULA_H
16 #define INSET_FORMULA_H
17
18 #include "formulabase.h"
19 #include "math_atom.h"
20
21 #include <boost/scoped_ptr.hpp>
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(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         ///
65         void getLabelList(std::vector<string> &) const;
66         ///
67         MathAtom const & par() const { return par_; }
68         ///
69         MathAtom & par() { return par_; }
70         ///
71         void generatePreview() const;
72         ///
73         void addPreview(lyx::graphics::PreviewLoader &) const;
74         ///
75         void mutate(string const & type);
76
77 private:
78         /// available in AMS only?
79         bool ams() const;
80
81         /// contents
82         MathAtom par_;
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