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.
9 * Copyright: 1996, Alejandro Aguilar Sierra
11 * Version: 0.4, Lyx project.
13 * You are free to use and modify this code under the terms of
14 * the GNU General Public Licence version 2 or later.
17 #ifndef INSET_FORMULA_H
18 #define INSET_FORMULA_H
26 #include "insets/lyxinset.h"
33 class InsetFormula: public UpdatableInset {
37 InsetFormula(bool display = false);
40 InsetFormula(MathParInset *);
44 int ascent(BufferView *, LyXFont const &) const;
46 int descent(BufferView *, LyXFont const &) const;
48 int width(BufferView *, LyXFont const &) const;
50 void draw(BufferView *,LyXFont const &, int, float &, bool) const;
52 void Write(Buffer const *, std::ostream &) const;
54 void Read(Buffer const *, LyXLex & lex);
56 int Latex(Buffer const *, std::ostream &,
57 bool fragile, bool free_spc) const;
59 int Ascii(Buffer const *, std::ostream &) const;
61 int Linuxdoc(Buffer const *, std::ostream &) const;
63 int DocBook(Buffer const *, std::ostream &) const;
65 void Validate(LaTeXFeatures &) const;
67 Inset * Clone() const;
69 Inset::Code LyxCode() const { return Inset::MATH_CODE; }
71 LyXFont const ConvertFont(LyXFont const & f) const {
72 // We have already discussed what was here
74 font.setLatex(LyXFont::OFF);
78 /// what appears in the minibuffer when opening
79 string const EditMessage() const;
81 void Edit(BufferView *, int x, int y, unsigned int button);
83 bool display() const { return (disp_flag) ? true: false; }
87 void ToggleInsetCursor(BufferView *);
89 void ShowInsetCursor(BufferView *);
91 void HideInsetCursor(BufferView *);
93 void GetCursorPos(BufferView *, int &, int &) const;
95 void ToggleInsetSelection(BufferView * bv);
97 void InsetButtonPress(BufferView *, int x, int y, int button);
99 void InsetButtonRelease(BufferView *, int x, int y, int button);
101 void InsetKeyPress(XKeyEvent * ev);
103 void InsetMotionNotify(BufferView *, int x, int y, int state);
105 void InsetUnlock(BufferView *);
107 /// To allow transparent use of math editing functions
108 virtual RESULT LocalDispatch(BufferView *, int, string const &);
111 void InsertSymbol(BufferView *, string const &);
113 bool SetNumber(bool);
115 std::vector<string> const getLabelList() const;
119 void UpdateLocal(BufferView * bv);
123 static MathedCursor * mathcursor;
133 // If a mathinset exist at cursor pos, just lock it.
134 // Otherwise create a new one, and lock it.
135 bool OpenMathInset(Buffer *);