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 &, int linelen) 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(Buffer const &) const;
69 Inset::Code LyxCode() const;
71 LyXFont const ConvertFont(LyXFont const & f) const;
72 /// what appears in the minibuffer when opening
73 string const EditMessage() const;
75 void Edit(BufferView *, int x, int y, unsigned int button);
81 void ToggleInsetCursor(BufferView *);
83 void ShowInsetCursor(BufferView *, bool show = true);
85 void HideInsetCursor(BufferView *);
87 void GetCursorPos(BufferView *, int &, int &) const;
89 void ToggleInsetSelection(BufferView * bv);
91 void InsetButtonPress(BufferView *, int x, int y, int button);
93 void InsetButtonRelease(BufferView *, int x, int y, int button);
95 void InsetKeyPress(XKeyEvent * ev);
97 void InsetMotionNotify(BufferView *, int x, int y, int state);
99 void InsetUnlock(BufferView *);
101 /// To allow transparent use of math editing functions
102 virtual RESULT LocalDispatch(BufferView *, kb_action, string const &);
105 void InsertSymbol(BufferView *, string const &);
107 bool SetNumber(bool);
109 std::vector<string> const getLabelList() const;
113 void UpdateLocal(BufferView * bv);
117 static MathedCursor * mathcursor;
128 Inset::Code InsetFormula::LyxCode() const
130 return Inset::MATH_CODE;
135 LyXFont const InsetFormula::ConvertFont(LyXFont const & f) const
137 // We have already discussed what was here
139 font.setLatex(LyXFont::OFF);
145 bool InsetFormula::display() const
147 return (disp_flag_) ? true : false;