4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
11 * Common parts of the math LyX insets.
14 #ifndef INSET_FORMULABASE_H
15 #define INSET_FORMULABASE_H
17 #include "insets/updatableinset.h"
24 /// An abstract base class for all math related LyX insets
25 class InsetFormulaBase : public UpdatableInset {
29 /// lowest x coordinate
30 virtual int xlow() const;
31 /// highest x coordinate
32 virtual int xhigh() const;
33 /// lowest y coordinate
34 virtual int ylow() const;
35 /// highest y coordinate
36 virtual int yhigh() const;
40 // Don't use this for AMS validation as long as there is no
41 // user-accessible way to override "false positives"
42 virtual void validate(LaTeXFeatures &) const;
44 virtual InsetOld::Code lyxCode() const;
45 /// what appears in the minibuffer when opening
46 virtual std::string const editMessage() const;
48 virtual void fitInsetCursor(BufferView *) const;
50 virtual void getCursorPos(BufferView *, int &, int &) const;
51 /// get the absolute document x,y of the cursor
52 virtual void getCursor(BufferView & bv, int & x, int & y) const;
54 virtual void toggleInsetSelection(BufferView * bv);
56 virtual void insetUnlock(BufferView *);
58 /// To allow transparent use of math editing functions
59 //virtual void status(FuncRequest const &);
62 virtual MathAtom const & par() const = 0;
64 virtual MathAtom & par() = 0;
67 virtual bool searchForward(BufferView *, std::string const &,
68 bool = true, bool = false);
70 virtual bool searchBackward(BufferView *, std::string const &,
71 bool = true, bool = false);
73 virtual bool isTextInset() const { return true; }
75 virtual void mutateToText();
77 virtual void revealCodes(BufferView *) const;
79 virtual EDITABLE editable() const { return HIGHLY_EDITABLE; }
82 // return the selection as std::string
83 std::string selectionAsString() const;
85 /// To allow transparent use of math editing functions
88 priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
91 void operator=(const InsetFormulaBase &);
92 /// common base for handling accents
93 void handleAccent(BufferView * bv, std::string const & arg, std::string const & name);
95 DispatchResult lfunMousePress(FuncRequest const &);
97 DispatchResult lfunMouseRelease(FuncRequest const &);
99 DispatchResult lfunMouseMotion(FuncRequest const &);
103 /** Find the PreviewLoader, add a LaTeX snippet to it and
104 * start the loading process.
106 * Most insets have no interest in this capability, so the method
109 virtual void generatePreview(Buffer const &) const {}
112 void handleFont(BufferView * bv, std::string const & arg, std::string const & font);
114 void handleFont2(BufferView * bv, std::string const & arg);
122 // We don't really mess want around with mathed stuff outside mathed.
124 void mathDispatch(FuncRequest const &);
127 void releaseMathCursor(BufferView * bv);