]> git.lyx.org Git - lyx.git/blob - src/mathed/math_hullinset.h
preview as preview can...
[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(MathInsetTypes t);
23         ///
24         MathHullInset(MathInsetTypes t, MathGridInset const & grid);
25         ///
26         MathHullInset(MathInsetTypes t, col_type cols);
27         ///
28         MathInset * clone() const;
29         ///
30         void metrics(MathMetricsInfo & mi) const;
31         ///
32         void draw(MathPainterInfo &, int x, int y) const;
33         ///
34         void metricsT(TextMetricsInfo const & mi) const;
35         ///
36         void drawT(TextPainter &, int x, int y) const;
37         ///
38         string label(row_type row) const;
39         ///
40         void label(row_type row, string const & label);
41         ///
42         void numbered(row_type row, bool num);
43         ///
44         bool numbered(row_type row) const;
45         ///
46         bool numberedType() const;
47         ///
48         bool display() const;
49         ///
50         bool ams() const;
51         ///
52         std::vector<string> const getLabelList() 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         /// change type
70         void mutate(string const &);
71         ///
72         void mutate(MathInsetTypes);
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         MathInsetTypes getType() const;
85         ///
86         void write(WriteStream & os) const;
87         ///
88         void mathmlize(MathMLStream &) const;
89         ///
90         void normalize(NormalStream &) const;
91         ///
92         void infoize(std::ostream & os) const;
93
94 private:
95         ///
96         void setType(MathInsetTypes t);
97         ///
98         void validate1(LaTeXFeatures & features);
99         ///
100         void header_write(WriteStream &) const;
101         ///
102         void footer_write(WriteStream &) const;
103         ///
104         string nicelabel(row_type row) const;
105         ///
106         void glueall();
107         ///
108         char const * standardFont() const;
109         /// consistency check
110         void check() const;
111
112         ///
113         MathInsetTypes objtype_;
114         ///
115         std::vector<int> nonum_;
116         ///
117         std::vector<string> label_;
118 };
119
120
121 class MathParInset : public MathHullInset {
122 public:
123         ///
124         MathParInset();
125         ///
126         MathParInset * asParInset() { return this; }
127         ///
128         void metrics(MathMetricsInfo & mi) const;
129         ///
130         void draw(MathPainterInfo &, int x, int y) const;
131         ///
132         void infoize(std::ostream & os) const;
133         ///
134         void write(WriteStream & os) const;
135 private:
136         ///
137         void rebreak();
138 };
139
140
141 #endif