3 * \file math_hullinset.h
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.
12 #ifndef MATH_HULLINSET_H
13 #define MATH_HULLINSET_H
15 #include "math_gridinset.h"
20 /// This provides an interface between "LyX insets" and "LyX math insets"
21 class MathHullInset : public MathGridInset {
26 explicit MathHullInset(std::string const & type);
28 virtual std::auto_ptr<InsetBase> clone() const;
30 mode_type currentMode() const;
32 void metrics(MetricsInfo & mi, Dimension & dim) const;
34 void draw(PainterInfo &, int x, int y) const;
36 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
38 void drawT(TextPainter &, int x, int y) const;
40 std::string label(row_type row) const;
42 void label(row_type row, std::string const & label);
44 void numbered(row_type row, bool num);
46 bool numbered(row_type row) const;
48 bool numberedType() const;
51 /// Appends \c list with all labels found within this inset.
52 void getLabelList(Buffer const &,
53 std::vector<std::string> & list) const;
55 void validate(LaTeXFeatures & features) const;
56 /// identifies MatrixInsets
57 MathHullInset const * asHullInset() const { return this; }
58 /// identifies HullInset
59 MathHullInset * asHullInset() { return this; }
62 void addRow(row_type row);
64 void delRow(row_type row);
66 void swapRow(row_type row);
68 void addCol(col_type col);
70 void delCol(col_type col);
73 std::string const & getType() const;
75 void mutate(std::string const &);
78 int defaultColSpace(col_type col);
80 char defaultColAlign(col_type col);
82 bool idxFirst(LCursor &) const;
84 bool idxLast(LCursor &) const;
87 std::string fileInsetLabel() const;
89 void write(WriteStream & os) const;
91 void mathmlize(MathMLStream &) const;
93 void normalize(NormalStream &) const;
95 void infoize(std::ostream & os) const;
99 DispatchResult priv_dispatch(LCursor & cur, FuncRequest const & cmd);
101 std::string eolString(row_type row, bool fragile) const;
105 void setType(std::string const & type);
107 void validate1(LaTeXFeatures & features);
109 void header_write(WriteStream &) const;
111 void footer_write(WriteStream &) const;
113 std::string nicelabel(row_type row) const;
115 void doExtern(LCursor & cur, FuncRequest const & func);
119 char const * standardFont() const;
120 /// consistency check
122 /// can this change its number of cols?
123 bool colChangeOK() const;
125 /// "none", "simple", "display", "eqnarray",...
128 std::vector<int> nonum_;
130 std::vector<std::string> label_;
136 /// lowest x coordinate
138 /// highest x coordinate
140 /// lowest y coordinate
142 /// highest y coordinate
146 /// what appears in the minibuffer when opening
147 virtual std::string const editMessage() const;
148 /// get the absolute document x,y of the cursor
149 virtual void getCursorPos(BufferView & bv, int & x, int & y) const;
151 virtual void getCursorDim(int &, int &) const;
153 virtual void insetUnlock(BufferView & bv);
155 /// To allow transparent use of math editing functions
156 //virtual void status(FuncRequest const &);
159 virtual bool searchForward(BufferView *, std::string const &,
160 bool = true, bool = false);
162 virtual bool searchBackward(BufferView *, std::string const &,
163 bool = true, bool = false);
165 virtual bool isTextInset() const { return true; }
167 virtual void mutateToText();
169 virtual void revealCodes(LCursor & cur) const;
171 virtual EDITABLE editable() const { return HIGHLY_EDITABLE; }
173 bool display() const;
175 void edit(LCursor & cur, bool);
177 void edit(LCursor & cur, int, int);
179 Code MathHullInset::lyxCode() const;
182 /// common base for handling accents
183 void handleAccent(BufferView & bv, std::string const & arg,
184 std::string const & name);
187 DispatchResult lfunMousePress(LCursor &, FuncRequest const &);
189 DispatchResult lfunMouseRelease(LCursor &, FuncRequest const &);
191 DispatchResult lfunMouseMotion(LCursor &, FuncRequest const &);
193 int x() const { return xo_; }
195 int y() const { return yo_; }
203 /** Find the PreviewLoader, add a LaTeX snippet to it and
204 * start the loading process.
206 * Most insets have no interest in this capability, so the method
209 virtual void generatePreview(Buffer const &) const {}
212 void handleFont(LCursor &, std::string const & arg, std::string const & font);
214 void handleFont2(LCursor &, std::string const & arg);
217 // We don't really mess want around with mathed stuff outside mathed.
219 void mathDispatch(LCursor & cur, FuncRequest const & cmd);