]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
enable direct input of #1...#9; some whitespace changes
[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_defs.h"
26 #include "math_atom.h"
27
28 class MathHullInset;
29
30 ///
31 class InsetFormula : public InsetFormulaBase {
32 public:
33         ///
34         InsetFormula();
35         ///
36         explicit InsetFormula(MathInsetTypes);
37         ///
38         explicit InsetFormula(string const &);
39         ///
40         int ascent(BufferView *, LyXFont const &) const;
41         ///
42         int descent(BufferView *, LyXFont const &) const;
43         ///
44         int width(BufferView *, LyXFont const &) const;
45         ///
46         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
47
48         ///
49         void write(Buffer const *, std::ostream &) const;
50         ///
51         void read(Buffer const *, LyXLex & lex);
52         ///
53         int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
54         ///
55         int ascii(Buffer const *, std::ostream &, int linelen) const;
56         ///
57         int linuxdoc(Buffer const *, std::ostream &) const;
58         ///
59         int docbook(Buffer const *, std::ostream &) const;
60
61         ///
62         Inset * clone(Buffer const &, bool same_id = false) const;
63         ///
64         void validate(LaTeXFeatures & features) const;
65         ///
66         Inset::Code lyxCode() const;
67         ///
68         bool insetAllowed(Inset::Code code) const;
69         ///
70         virtual RESULT localDispatch(BufferView *, kb_action, string const &);
71         ///
72         std::vector<string> const getLabelList() const;
73         ///
74         MathInsetTypes getType() const;
75         ///
76         MathAtom const & par() const { return par_; }
77         ///
78         MathAtom & par() { return par_; }
79
80 private:
81         /// Is this a displayed environment?
82         bool display() const;
83         /// available in AMS only?
84         bool ams() const;
85         /// access to hull
86         MathHullInset * hull();
87         /// access to hull
88         MathHullInset const * hull() const;
89         ///
90         void handleExtern(string const & arg);
91
92         ///
93         MathAtom par_;
94 };
95 #endif