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"
16 #include <boost/scoped_ptr.hpp>
21 /// This provides an interface between "LyX insets" and "LyX math insets"
22 class MathHullInset : public MathGridInset {
27 explicit MathHullInset(std::string const & type);
29 MathHullInset(MathHullInset const &);
33 std::auto_ptr<InsetBase> clone() const;
35 void operator=(MathHullInset const &);
37 mode_type currentMode() const;
39 void metrics(MetricsInfo & mi, Dimension & dim) const;
41 void draw(PainterInfo &, int x, int y) const;
43 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
45 void drawT(TextPainter &, int x, int y) const;
47 std::string label(row_type row) const;
49 void label(row_type row, std::string const & label);
51 void numbered(row_type row, bool num);
53 bool numbered(row_type row) const;
55 bool numberedType() const;
58 /// Appends \c list with all labels found within this inset.
59 void getLabelList(Buffer const &,
60 std::vector<std::string> & list) const;
62 void validate(LaTeXFeatures & features) const;
63 /// identifies MatrixInsets
64 MathHullInset const * asHullInset() const { return this; }
65 /// identifies HullInset
66 MathHullInset * asHullInset() { return this; }
69 void addRow(row_type row);
71 void delRow(row_type row);
73 void swapRow(row_type row);
75 void addCol(col_type col);
77 void delCol(col_type col);
80 std::string const & getType() const;
82 void mutate(std::string const &);
85 int defaultColSpace(col_type col);
87 char defaultColAlign(col_type col);
89 bool idxFirst(LCursor &) const;
91 bool idxLast(LCursor &) const;
94 void write(WriteStream & os) const;
96 void mathmlize(MathMLStream &) const;
98 void normalize(NormalStream &) const;
100 void infoize(std::ostream & os) const;
103 void write(Buffer const &, std::ostream & os) const;
105 void read(Buffer const &, LyXLex & lex);
107 int plaintext(Buffer const &, std::ostream &,
108 OutputParams const &) const;
110 int linuxdoc(Buffer const &, std::ostream &,
111 OutputParams const &) const;
113 int docbook(Buffer const &, std::ostream &,
114 OutputParams const &) const;
116 /// get notification when the cursor leaves this inset
117 void notifyCursorLeaves(LCursor & cur);
119 //bool insetAllowed(Code code) const;
121 void addPreview(lyx::graphics::PreviewLoader &) const;
126 void priv_dispatch(LCursor & cur, FuncRequest & cmd);
127 /// do we want to handle this event?
128 bool getStatus(LCursor & cur, FuncRequest const & cmd,
129 FuncStatus & status) const;
131 std::string eolString(row_type row, bool fragile) const;
135 void setType(std::string const & type);
137 void validate1(LaTeXFeatures & features);
139 void header_write(WriteStream &) const;
141 void footer_write(WriteStream &) const;
143 std::string nicelabel(row_type row) const;
145 void doExtern(LCursor & cur, FuncRequest & func);
149 * split every row at the first relation operator.
150 * The number of columns must be 1. One column is added.
151 * The first relation operator and everything after it goes to the
156 * split every row at the first relation operator.
157 * The number of columns must be < 3. One or two columns are added.
158 * The first relation operator goes to the second column.
159 * Everything after it goes to the third column.
162 /// change number of columns, split or combine columns if necessary.
163 void changeCols(col_type);
165 char const * standardFont() const;
166 /// consistency check
168 /// can this change its number of cols?
169 bool colChangeOK() const;
171 /// "none", "simple", "display", "eqnarray",...
174 std::vector<int> nonum_;
176 std::vector<std::string> label_;
178 boost::scoped_ptr<RenderPreview> preview_;
183 /// what appears in the minibuffer when opening
184 virtual std::string const editMessage() const;
186 virtual void getCursorDim(int &, int &) const;
188 virtual bool isTextInset() const { return true; }
190 virtual void mutateToText();
192 virtual void revealCodes(LCursor & cur) const;
194 EDITABLE editable() const { return HIGHLY_EDITABLE; }
196 void edit(LCursor & cur, bool left);
198 bool display() const;
200 Code lyxCode() const;
204 void handleFont(LCursor &, std::string const & arg, std::string const & font);
206 void handleFont2(LCursor &, std::string const & arg);