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