]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
small up/down tweaking
[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 #ifdef __GNUG__
19 #pragma interface
20 #endif
21
22 #include "formulabase.h"
23 #include "math_atom.h"
24
25 #include <boost/scoped_ptr.hpp>
26
27 /// The main LyX math inset
28 class InsetFormula : public InsetFormulaBase {
29 public:
30         ///
31         InsetFormula();
32         ///
33         explicit InsetFormula(BufferView *);
34         ///
35         explicit InsetFormula(const string & data);
36         ///
37         InsetFormula(InsetFormula const &);
38         ///
39         ~InsetFormula();
40         ///
41         int ascent(BufferView *, LyXFont const &) const;
42         ///
43         int descent(BufferView *, LyXFont const &) const;
44         ///
45         int width(BufferView *, LyXFont const &) const;
46         ///
47         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
48
49         ///
50         void write(Buffer const *, std::ostream &) const;
51         ///
52         void read(Buffer const *, LyXLex & lex);
53         ///
54         int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
55         ///
56         int ascii(Buffer const *, std::ostream &, int linelen) const;
57         ///
58         int linuxdoc(Buffer const *, std::ostream &) const;
59         ///
60         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
61
62         ///
63         Inset * clone(Buffer const &, bool same_id = false) const;
64         ///
65         void validate(LaTeXFeatures & features) const;
66         ///
67         Inset::Code lyxCode() const;
68         ///
69         bool insetAllowed(Inset::Code code) const;
70         ///
71         std::vector<string> const getLabelList() const;
72         ///
73         MathAtom const & par() const { return par_; }
74         ///
75         MathAtom & par() { return par_; }
76         ///
77         void generatePreview() const;
78         ///
79         void addPreview(grfx::PreviewLoader &) const;
80         ///
81         //void mutate(string const & type);
82
83 private:
84         /// available in AMS only?
85         bool ams() const;
86
87         /// contents
88         MathAtom par_;
89
90         /// Use the Pimpl idiom to hide the internals of the previewer.
91         class PreviewImpl;
92         friend class PreviewImpl;
93         /// The pointer never changes although *preview_'s contents may.
94         boost::scoped_ptr<PreviewImpl> const preview_;
95 };
96 #endif