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"
18 /// This provides an interface between "LyX insets" and "LyX math insets"
19 class MathHullInset : public MathGridInset {
24 explicit MathHullInset(std::string const & type);
26 std::auto_ptr<InsetBase> clone() const;
28 mode_type currentMode() const;
30 void metrics(MetricsInfo & mi, Dimension & dim) const;
32 void draw(PainterInfo &, int x, int y) const;
34 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
36 void drawT(TextPainter &, int x, int y) const;
38 std::string label(row_type row) const;
40 void label(row_type row, std::string const & label);
42 void numbered(row_type row, bool num);
44 bool numbered(row_type row) const;
46 bool numberedType() const;
49 /// Appends \c list with all labels found within this inset.
50 void getLabelList(Buffer const &,
51 std::vector<std::string> & list) const;
53 void validate(LaTeXFeatures & features) const;
54 /// identifies MatrixInsets
55 MathHullInset const * asHullInset() const { return this; }
56 /// identifies HullInset
57 MathHullInset * asHullInset() { return this; }
60 void addRow(row_type row);
62 void delRow(row_type row);
64 void swapRow(row_type row);
66 void addCol(col_type col);
68 void delCol(col_type col);
71 std::string const & getType() const;
73 void mutate(std::string const &);
76 int defaultColSpace(col_type col);
78 char defaultColAlign(col_type col);
80 bool idxFirst(LCursor &) const;
82 bool idxLast(LCursor &) const;
85 std::string fileInsetLabel() const;
87 void write(WriteStream & os) const;
89 void mathmlize(MathMLStream &) const;
91 void normalize(NormalStream &) const;
93 void infoize(std::ostream & os) const;
96 void write(Buffer const &, std::ostream & os) const;
98 void read(Buffer const &, LyXLex & lex);
100 int latex(Buffer const &, std::ostream &,
101 OutputParams const &) const;
103 int plaintext(Buffer const &, std::ostream &,
104 OutputParams const &) const;
106 int linuxdoc(Buffer const &, std::ostream &,
107 OutputParams const &) const;
109 int docbook(Buffer const &, std::ostream &,
110 OutputParams const &) const;
113 //bool insetAllowed(Code code) const;
115 //void addPreview(lyx::graphics::PreviewLoader &) const;
120 DispatchResult priv_dispatch(LCursor & cur, FuncRequest const & cmd);
122 std::string eolString(row_type row, bool fragile) const;
126 void setType(std::string const & type);
128 void validate1(LaTeXFeatures & features);
130 void header_write(WriteStream &) const;
132 void footer_write(WriteStream &) const;
134 std::string nicelabel(row_type row) const;
136 void doExtern(LCursor & cur, FuncRequest const & func);
140 char const * standardFont() const;
141 /// consistency check
143 /// can this change its number of cols?
144 bool colChangeOK() const;
146 /// "none", "simple", "display", "eqnarray",...
149 std::vector<int> nonum_;
151 std::vector<std::string> label_;
157 /// lowest x coordinate
159 /// highest x coordinate
161 /// lowest y coordinate
163 /// highest y coordinate
167 /// what appears in the minibuffer when opening
168 virtual std::string const editMessage() const;
170 virtual void getCursorDim(int &, int &) const;
172 virtual void insetUnlock(BufferView & bv);
174 /// To allow transparent use of math editing functions
175 //virtual void status(FuncRequest const &);
178 virtual bool searchForward(BufferView *, std::string const &,
179 bool = true, bool = false);
181 virtual bool searchBackward(BufferView *, std::string const &,
182 bool = true, bool = false);
184 virtual bool isTextInset() const { return true; }
186 virtual void mutateToText();
188 virtual void revealCodes(LCursor & cur) const;
190 virtual EDITABLE editable() const { return HIGHLY_EDITABLE; }
192 bool display() const;
194 void edit(LCursor & cur, bool left);
196 Code lyxCode() const;
199 /// common base for handling accents
200 void handleAccent(BufferView & bv, std::string const & arg,
201 std::string const & name);
204 DispatchResult lfunMousePress(LCursor &, FuncRequest const &);
206 DispatchResult lfunMouseRelease(LCursor &, FuncRequest const &);
208 DispatchResult lfunMouseMotion(LCursor &, FuncRequest const &);
212 /** Find the PreviewLoader, add a LaTeX snippet to it and
213 * start the loading process.
215 * Most insets have no interest in this capability, so the method
218 virtual void generatePreview(Buffer const &) const {}
221 void handleFont(LCursor &, std::string const & arg, std::string const & font);
223 void handleFont2(LCursor &, std::string const & arg);
226 // We don't really want to mess around with mathed stuff outside mathed.
228 void mathDispatch(LCursor & cur, FuncRequest const & cmd);