]> git.lyx.org Git - lyx.git/blob - src/mathed/math_hullinset.h
fix #1073
[lyx.git] / src / mathed / math_hullinset.h
1 // -*- C++ -*-
2 #ifndef MATH_HULLINSET_H
3 #define MATH_HULLINSET_H
4
5 #include "math_gridinset.h"
6
7
8 /** This provides an interface between "LyX insets" and "LyX math insets"
9  *  \author André Pönitz
10  *
11  * Full author contact details are available in file CREDITS
12  */
13
14 class LaTeXFeatures;
15
16 class MathHullInset : public MathGridInset {
17 public:
18         ///
19         MathHullInset();
20         ///
21         explicit MathHullInset(string const & type);
22         ///
23         MathInset * clone() const;
24         ///
25         mode_type currentMode() const;
26         ///
27         void metrics(MetricsInfo & mi) const;
28         ///
29         void draw(PainterInfo &, int x, int y) const;
30         ///
31         void metricsT(TextMetricsInfo const & mi) const;
32         ///
33         void drawT(TextPainter &, int x, int y) const;
34         ///
35         string label(row_type row) const;
36         ///
37         void label(row_type row, string const & label);
38         ///
39         void numbered(row_type row, bool num);
40         ///
41         bool numbered(row_type row) const;
42         ///
43         bool numberedType() const;
44         ///
45         bool display() const;
46         ///
47         bool ams() const;
48         /// local dispatcher
49         dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
50         ///
51         void getLabelList(std::vector<string> &) const;
52         ///
53         void validate(LaTeXFeatures & features) const;
54         /// identifies MatrixInsets
55         MathHullInset const * asHullInset() const { return this; }
56         /// identifies HullInset
57         MathHullInset * asHullInset() { return this; }
58
59         /// add a row
60         void addRow(row_type row);
61         /// delete a row
62         void delRow(row_type row);
63         /// add a column
64         void addCol(col_type col);
65         /// delete a column
66         void delCol(col_type col);
67
68         /// get type
69         string const & getType() const;
70         /// change type
71         void mutate(string const &);
72
73         ///
74         int defaultColSpace(col_type col);
75         ///
76         char defaultColAlign(col_type col);
77         ///
78         bool idxFirst(idx_type &, pos_type &) const;
79         ///
80         bool idxLast(idx_type &, pos_type &) const;
81
82         ///
83         void write(WriteStream & os) const;
84         ///
85         void mathmlize(MathMLStream &) const;
86         ///
87         void normalize(NormalStream &) const;
88         ///
89         void infoize(std::ostream & os) const;
90
91 protected:
92         ///
93         string eolString(row_type row, bool fragile) const;
94
95 private:
96         ///
97         void setType(string const & type);
98         ///
99         void validate1(LaTeXFeatures & features);
100         ///
101         void header_write(WriteStream &) const;
102         ///
103         void footer_write(WriteStream &) const;
104         ///
105         string nicelabel(row_type row) const;
106         ///
107         void doExtern(FuncRequest const & func, idx_type & idx, pos_type & pos);
108         ///
109         void glueall();
110         ///
111         char const * standardFont() const;
112         /// consistency check
113         void check() const;
114         /// can this change its number of cols?
115         bool colChangeOK() const;
116
117         /// "none", "simple", "display", "eqnarray",...
118         string type_;
119         ///
120         std::vector<int> nonum_;
121         ///
122         std::vector<string> label_;
123 };
124
125 #endif