]> git.lyx.org Git - lyx.git/blob - src/mathed/math_hullinset.h
The std::string mammoth path.
[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         /// local dispatcher
54         dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
55         /// Appends \c list with all labels found within this inset.
56         void getLabelList(Buffer const &,
57                           std::vector<std::string> & list) const;
58         ///
59         void validate(LaTeXFeatures & features) const;
60         /// identifies MatrixInsets
61         MathHullInset const * asHullInset() const { return this; }
62         /// identifies HullInset
63         MathHullInset * asHullInset() { return this; }
64
65         /// add a row
66         void addRow(row_type row);
67         /// delete a row
68         void delRow(row_type row);
69         ///
70         void swapRow(row_type row);
71         /// add a column
72         void addCol(col_type col);
73         /// delete a column
74         void delCol(col_type col);
75
76         /// get type
77         std::string const & getType() const;
78         /// change type
79         void mutate(std::string const &);
80
81         ///
82         int defaultColSpace(col_type col);
83         ///
84         char defaultColAlign(col_type col);
85         ///
86         bool idxFirst(idx_type &, pos_type &) const;
87         ///
88         bool idxLast(idx_type &, pos_type &) const;
89
90         ///
91         std::string fileInsetLabel() const;
92         ///
93         void write(WriteStream & os) const;
94         ///
95         void mathmlize(MathMLStream &) const;
96         ///
97         void normalize(NormalStream &) const;
98         ///
99         void infoize(std::ostream & os) const;
100
101 protected:
102         ///
103         std::string eolString(row_type row, bool fragile) const;
104
105 private:
106         ///
107         void setType(std::string const & type);
108         ///
109         void validate1(LaTeXFeatures & features);
110         ///
111         void header_write(WriteStream &) const;
112         ///
113         void footer_write(WriteStream &) const;
114         ///
115         std::string nicelabel(row_type row) const;
116         ///
117         void doExtern(FuncRequest const & func, idx_type & idx, pos_type & pos);
118         ///
119         void glueall();
120         ///
121         char const * standardFont() const;
122         /// consistency check
123         void check() const;
124         /// can this change its number of cols?
125         bool colChangeOK() const;
126
127         /// "none", "simple", "display", "eqnarray",...
128         std::string type_;
129         ///
130         std::vector<int> nonum_;
131         ///
132         std::vector<std::string> label_;
133 };
134
135 #endif