]> git.lyx.org Git - lyx.git/blob - src/mathed/formula.h
This moves all LyXText related LyXFuncs to BufferView::Dispatch so that they
[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 <iosfwd>
25
26 #include "insets/lyxinset.h"
27
28 class MathParInset;
29 class MathedCursor;
30 class Buffer;
31
32 ///
33 class InsetFormula: public UpdatableInset {
34 public:
35         ///
36         explicit
37         InsetFormula(bool display = false);
38         ///
39         explicit
40         InsetFormula(MathParInset *);
41         ///
42         ~InsetFormula();
43         ///
44         int ascent(BufferView *, LyXFont const &) const;
45         ///
46         int descent(BufferView *, LyXFont const &) const;
47         ///
48         int width(BufferView *, LyXFont const &) const;
49         ///
50         void draw(BufferView *,LyXFont const &, int, float &, bool) const;
51         ///
52         void Write(Buffer const *, std::ostream &) const;
53         ///
54         void Read(Buffer const *, LyXLex & lex);
55         ///
56         int Latex(Buffer const *, std::ostream &,
57                   bool fragile, bool free_spc) const;
58         ///
59         int Ascii(Buffer const *, std::ostream &, int linelen) const;
60         ///
61         int Linuxdoc(Buffer const *, std::ostream &) const;
62         ///
63         int DocBook(Buffer const *, std::ostream &) const;
64         ///
65         void Validate(LaTeXFeatures &) const;
66         ///
67         Inset * Clone(Buffer const &) const;
68         ///
69         Inset::Code LyxCode() const { return Inset::MATH_CODE; }
70         ///
71         LyXFont const ConvertFont(LyXFont const & f) const {
72                 // We have already discussed what was here
73                 LyXFont font(f);
74                 font.setLatex(LyXFont::OFF);
75                 return font;
76         }
77
78         /// what appears in the minibuffer when opening
79         string const EditMessage() const;
80         ///
81         void Edit(BufferView *, int x, int y, unsigned int button);
82         ///
83         bool display() const { return (disp_flag) ? true: false; }
84         ///
85         void display(bool);
86         ///
87         void ToggleInsetCursor(BufferView *);
88         ///
89         void ShowInsetCursor(BufferView *, bool show=true);
90         ///
91         void HideInsetCursor(BufferView *);
92         ///
93         void GetCursorPos(BufferView *, int &, int &) const;
94         ///
95         void ToggleInsetSelection(BufferView * bv);
96         ///
97         void InsetButtonPress(BufferView *, int x, int y, int button);
98         ///
99         void InsetButtonRelease(BufferView *, int x, int y, int button);
100         ///
101         void InsetKeyPress(XKeyEvent * ev);
102         ///
103         void InsetMotionNotify(BufferView *, int x, int y, int state);
104         ///
105         void InsetUnlock(BufferView *);
106    
107         ///  To allow transparent use of math editing functions
108         virtual RESULT LocalDispatch(BufferView *, kb_action, string const &);
109     
110         ///
111         void InsertSymbol(BufferView *, string const &);
112         ///
113         bool SetNumber(bool);
114         ///
115         std::vector<string> const getLabelList() const;
116    
117 protected:
118         ///
119         void UpdateLocal(BufferView * bv);
120         ///
121         MathParInset * par;
122         ///
123         static MathedCursor * mathcursor;
124     
125 private:
126         ///
127         bool disp_flag;
128         ///
129         string label;
130 };
131 #endif