3 * \file InsetMathHull.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 "InsetMathGrid.h"
17 #include <boost/scoped_ptr.hpp>
23 class ParConstIterator;
27 /// This provides an interface between "LyX insets" and "LyX math insets"
28 class InsetMathHull : public InsetMathGrid {
33 explicit InsetMathHull(HullType type);
37 void setBuffer(Buffer &);
39 void updateLabels(ParIterator const &);
41 void addToToc(DocIterator const &);
43 InsetMathHull & operator=(InsetMathHull const &);
45 mode_type currentMode() const;
47 void metrics(MetricsInfo & mi, Dimension & dim) const;
49 void draw(PainterInfo &, int x, int y) const;
51 void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
53 void drawT(TextPainter &, int x, int y) const;
55 docstring label(row_type row) const;
57 void label(row_type row, docstring const & label);
59 void numbered(row_type row, bool num);
61 bool numbered(row_type row) const;
63 bool numberedType() const;
67 void validate(LaTeXFeatures & features) const;
68 /// identifies HullInset
69 InsetMathHull const * asHullInset() const { return this; }
70 /// identifies HullInset
71 InsetMathHull * asHullInset() { return this; }
74 void addRow(row_type row);
76 void delRow(row_type row);
78 void swapRow(row_type row);
80 void addCol(col_type col);
82 void delCol(col_type col);
85 HullType getType() const;
87 void mutate(HullType newtype);
90 int defaultColSpace(col_type col);
92 char defaultColAlign(col_type col);
94 bool idxFirst(Cursor &) const;
96 bool idxLast(Cursor &) const;
99 void write(WriteStream & os) const;
101 void mathmlize(MathStream &) const;
103 void normalize(NormalStream &) const;
105 void infoize(odocstream & os) const;
108 void write(std::ostream & os) const;
110 void read(Lexer & lex);
112 void readQuiet(Lexer & lex);
114 int plaintext(odocstream &, OutputParams const &) const;
116 int docbook(odocstream &, OutputParams const &) const;
117 /// the string that is passed to the TOC
118 void textString(odocstream &) const;
120 /// get notification when the cursor leaves this inset
121 bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
123 //bool insetAllowed(InsetCode code) const;
125 void addPreview(graphics::PreviewLoader &) const;
127 void initUnicodeMath() const;
130 static int displayMargin() { return 12; }
132 /// Force inset into LTR environment if surroundings are RTL?
133 virtual bool forceLTR() const { return true; }
136 virtual docstring contextMenu(BufferView const &, int, int) const;
139 InsetMathHull(InsetMathHull const &);
141 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
143 /// do we want to handle this event?
144 bool getStatus(Cursor & cur, FuncRequest const & cmd,
145 FuncStatus & status) const;
147 docstring eolString(row_type row, bool emptyline, bool fragile) const;
150 virtual Inset * clone() const;
152 void setType(HullType type);
154 void validate1(LaTeXFeatures & features);
156 void header_write(WriteStream &) const;
158 void footer_write(WriteStream &) const;
160 docstring nicelabel(row_type row) const;
162 void doExtern(Cursor & cur, FuncRequest & func);
166 * split every row at the first relation operator.
167 * The number of columns must be 1. One column is added.
168 * The first relation operator and everything after it goes to the
173 * split every row at the first relation operator.
174 * The number of columns must be < 3. One or two columns are added.
175 * The first relation operator goes to the second column.
176 * Everything after it goes to the third column.
179 /// change number of columns, split or combine columns if necessary.
180 void changeCols(col_type);
182 docstring standardFont() const;
183 /// consistency check
185 /// can this change its number of rows?
186 bool rowChangeOK() const;
187 /// can this change its number of cols?
188 bool colChangeOK() const;
190 /// "none", "simple", "display", "eqnarray",...
193 std::vector<bool> nonum_;
195 std::vector<InsetLabel *> label_;
197 boost::scoped_ptr<RenderPreview> preview_;
199 mutable bool use_preview_;
204 /// what appears in the minibuffer when opening
205 docstring editMessage() const;
207 virtual void mutateToText();
209 virtual void revealCodes(Cursor & cur) const;
211 EDITABLE editable() const { return HIGHLY_EDITABLE; }
213 void edit(Cursor & cur, bool front,
214 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
216 Inset * editXY(Cursor & cur, int x, int y);
218 DisplayType display() const;
220 InsetCode lyxCode() const;
224 void handleFont(Cursor & cur, docstring const & arg,
225 docstring const & font);
227 void handleFont2(Cursor & cur, docstring const & arg);
229 bool previewState(BufferView * bv) const;