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"
25 /// An abstract base class for all math related LyX insets
26 class InsetFormulaBase : public UpdatableInset {
30 /// lowest x coordinate
31 virtual int xlow() const;
32 /// highest x coordinate
33 virtual int xhigh() const;
34 /// lowest y coordinate
35 virtual int ylow() const;
36 /// highest y coordinate
37 virtual int yhigh() const;
41 // Don't use this for AMS validation as long as there is no
42 // user-accessible way to override "false positives"
43 virtual void validate(LaTeXFeatures &) const;
45 virtual InsetOld::Code lyxCode() const;
46 /// what appears in the minibuffer when opening
47 virtual std::string const editMessage() const;
49 virtual void fitInsetCursor(BufferView *) const;
51 virtual void getCursorPos(BufferView *, int &, int &) const;
52 /// get the absolute document x,y of the cursor
53 virtual void getCursor(BufferView & bv, int & x, int & y) const;
55 virtual void toggleInsetSelection(BufferView * bv);
57 virtual void insetUnlock(BufferView *);
59 /// To allow transparent use of math editing functions
60 virtual dispatch_result localDispatch(FuncRequest const &);
61 /// To allow transparent use of math editing functions
62 //virtual void status(FuncRequest const &);
65 virtual MathAtom const & par() const = 0;
67 virtual MathAtom & par() = 0;
69 // And shouldn't this really return a shared_ptr<BufferView> instead?
70 BufferView * view() const;
73 virtual bool searchForward(BufferView *, std::string const &,
74 bool = true, bool = false);
76 virtual bool searchBackward(BufferView *, std::string const &,
77 bool = true, bool = false);
79 virtual bool isTextInset() const { return true; }
81 virtual void mutateToText();
83 virtual void revealCodes(BufferView *) const;
85 virtual EDITABLE editable() const { return HIGHLY_EDITABLE; }
88 // return the selection as std::string
89 std::string selectionAsString() const;
93 void operator=(const InsetFormulaBase &);
94 /// common base for handling accents
95 void handleAccent(BufferView * bv, std::string const & arg, std::string const & name);
97 dispatch_result lfunMousePress(FuncRequest const &);
99 dispatch_result lfunMouseRelease(FuncRequest const &);
101 dispatch_result lfunMouseMotion(FuncRequest const &);
105 //mutable boost::weak_ptr<BufferView> view_;
106 mutable BufferView * view_;
110 void handleFont(BufferView * bv, std::string const & arg, std::string const & font);
112 void handleFont2(BufferView * bv, std::string const & arg);
120 // We don't really mess want around with mathed stuff outside mathed.
122 void mathDispatch(FuncRequest const &);
125 void releaseMathCursor(BufferView * bv);