]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
binom is binom is binom and choose is choose is choose ...
[lyx.git] / src / mathed / formula.h
1 // -*- C++ -*-
2 /*
3  *  File:        formula.h
4  *  Purpose:     Declaration of formula inset
5  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
6  *  Created:     January 1996
7  *  Description: Allows the edition of math paragraphs inside Lyx.
8  *
9  *  Copyright: 1996, Alejandro Aguilar Sierra
10  *
11  *  Version: 0.4, Lyx project.
12  *
13  *   You are free to use and modify this code under the terms of
14  *   the GNU General Public Licence version 2 or later.
15  */
16
17 #ifndef INSET_FORMULA_H
18 #define INSET_FORMULA_H
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include "formulabase.h"
25 #include "math_atom.h"
26 #include "graphics/GraphicsTypes.h"
27 #include "graphics/GraphicsLoader.h"
28
29 class MathHullInset;
30
31 ///
32 class InsetFormula : public InsetFormulaBase {
33 public:
34         ///
35         InsetFormula();
36         ///
37         explicit InsetFormula(BufferView *);
38         ///
39         explicit InsetFormula(const string & data);
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         virtual RESULT localDispatch(BufferView *, kb_action, string const &);
72         ///
73         std::vector<string> const getLabelList() const;
74         ///
75         string hullType() const;
76         ///
77         MathAtom const & par() const { return par_; }
78         ///
79         MathAtom & par() { return par_; }
80         ///
81         void mutate(string const & type);
82
83 private:
84         /// Is this a displayed environment?
85         bool display() const;
86         /// available in AMS only?
87         bool ams() const;
88         /// access to hull
89         MathHullInset * hull();
90         /// access to hull
91         MathHullInset const * hull() const;
92         ///
93         void handleExtern(string const & arg);
94         ///
95         void statusChanged();
96         ///
97         void updatePreview();
98         ///
99         bool canPreview() const;
100
101         /// contents
102         MathAtom par_;
103         /// non owning pointer
104         mutable grfx::Loader * loader_;
105 };
106 #endif