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