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);