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_FORMULABASE_H
18 #define INSET_FORMULABASE_H
25 #include <boost/smart_ptr.hpp>
27 #include "insets/inset.h"
33 class InsetFormulaBase : public UpdatableInset {
36 InsetFormulaBase(InsetFormulaBase const & p);
38 explicit InsetFormulaBase(MathInset *);
40 virtual ~InsetFormulaBase();
42 virtual int ascent(BufferView *, LyXFont const &) const = 0;
44 virtual int descent(BufferView *, LyXFont const &) const = 0;
46 virtual int width(BufferView *, LyXFont const &) const = 0;
48 virtual void draw(BufferView *,LyXFont const &, int, float &, bool) const = 0;
50 virtual void Write(Buffer const *, std::ostream &) const = 0;
52 virtual void Read(Buffer const *, LyXLex & lex) = 0;
54 virtual int Latex(Buffer const *, std::ostream &,
55 bool fragile, bool free_spc) const = 0;
57 virtual int Ascii(Buffer const *, std::ostream &, int linelen) const = 0;
59 virtual int Linuxdoc(Buffer const *, std::ostream &) const = 0;
61 virtual int DocBook(Buffer const *, std::ostream &) const = 0;
63 virtual void Validate(LaTeXFeatures &) const;
65 virtual Inset * Clone(Buffer const &) const = 0;
67 virtual Inset::Code LyxCode() const;
69 virtual LyXFont const ConvertFont(LyXFont const & f) const;
70 /// what appears in the minibuffer when opening
71 virtual string const EditMessage() const;
73 virtual void Edit(BufferView *, int x, int y, unsigned int button);
75 virtual void ToggleInsetCursor(BufferView *);
77 virtual void ShowInsetCursor(BufferView *, bool show = true);
79 virtual void HideInsetCursor(BufferView *);
81 virtual void GetCursorPos(BufferView *, int &, int &) const;
83 virtual void ToggleInsetSelection(BufferView * bv);
85 virtual void InsetButtonPress(BufferView *, int x, int y, int button);
87 virtual void InsetButtonRelease(BufferView *, int x, int y, int button);
89 virtual void InsetKeyPress(XKeyEvent * ev);
91 virtual void InsetMotionNotify(BufferView *, int x, int y, int state);
93 virtual void InsetUnlock(BufferView *);
95 /// To allow transparent use of math editing functions
96 virtual RESULT LocalDispatch(BufferView *, kb_action, string const &);
99 virtual std::vector<string> const getLabelList() const;
101 MathInset * par() const;
104 virtual void UpdateLocal(BufferView * bv);