]> git.lyx.org Git - lyx.git/blob - src/mathed/math_hullinset.h
soem more IU for \mbox
[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 /// This provides an interface between "LyX insets" and "LyX math insets"
19 class MathHullInset : public MathGridInset {
20 public:
21         ///
22         MathHullInset();
23         ///
24         explicit MathHullInset(std::string const & type);
25         ///
26         std::auto_ptr<InsetBase> clone() const;
27         ///
28         mode_type currentMode() const;
29         ///
30         void metrics(MetricsInfo & mi, Dimension & dim) const;
31         ///
32         void draw(PainterInfo &, int x, int y) const;
33         ///
34         void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
35         ///
36         void drawT(TextPainter &, int x, int y) const;
37         ///
38         std::string label(row_type row) const;
39         ///
40         void label(row_type row, std::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 ams() const;
49         /// Appends \c list with all labels found within this inset.
50         void getLabelList(Buffer const &,
51                           std::vector<std::string> & list) 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         ///
64         void swapRow(row_type row);
65         /// add a column
66         void addCol(col_type col);
67         /// delete a column
68         void delCol(col_type col);
69
70         /// get type
71         std::string const & getType() const;
72         /// change type
73         void mutate(std::string const &);
74
75         ///
76         int defaultColSpace(col_type col);
77         ///
78         char defaultColAlign(col_type col);
79         ///
80         bool idxFirst(LCursor &) const;
81         ///
82         bool idxLast(LCursor &) const;
83
84         ///
85         void write(WriteStream & os) const;
86         ///
87         void mathmlize(MathMLStream &) const;
88         ///
89         void normalize(NormalStream &) const;
90         ///
91         void infoize(std::ostream & os) const;
92
93         ///
94         void write(Buffer const &, std::ostream & os) const;
95         ///
96         void read(Buffer const &, LyXLex & lex);
97         ///
98         int plaintext(Buffer const &, std::ostream &,
99                   OutputParams const &) const;
100         ///
101         int linuxdoc(Buffer const &, std::ostream &,
102                      OutputParams const &) const;
103         ///
104         int docbook(Buffer const &, std::ostream &,
105                     OutputParams const &) const;
106
107         ///
108         //bool insetAllowed(Code code) const;
109         ///
110         //void addPreview(lyx::graphics::PreviewLoader &) const;
111
112
113 protected:
114         ///
115         void priv_dispatch(LCursor & cur, FuncRequest & cmd);
116         /// do we want to handle this event?
117         bool getStatus(LCursor & cur, FuncRequest const & cmd,
118                 FuncStatus & status) const;
119         ///
120         std::string eolString(row_type row, bool fragile) const;
121
122 private:
123         ///
124         void setType(std::string const & type);
125         ///
126         void validate1(LaTeXFeatures & features);
127         ///
128         void header_write(WriteStream &) const;
129         ///
130         void footer_write(WriteStream &) const;
131         ///
132         std::string nicelabel(row_type row) const;
133         ///
134         void doExtern(LCursor & cur, FuncRequest & func);
135         ///
136         void glueall();
137         ///
138         char const * standardFont() const;
139         /// consistency check
140         void check() const;
141         /// can this change its number of cols?
142         bool colChangeOK() const;
143
144         /// "none", "simple", "display", "eqnarray",...
145         std::string type_;
146         ///
147         std::vector<int> nonum_;
148         ///
149         std::vector<std::string> label_;
150
151 //
152 // Incorporate me
153 //
154 public:
155         /// what appears in the minibuffer when opening
156         virtual std::string const editMessage() const;
157         ///
158         virtual void getCursorDim(int &, int &) const;
159
160         /// To allow transparent use of math editing functions
161         //virtual void status(FuncRequest &);
162
163         ///
164         virtual bool searchForward(BufferView *, std::string const &,
165                                    bool = true, bool = false);
166         ///
167         virtual bool searchBackward(BufferView *, std::string const &,
168                                     bool = true, bool = false);
169         ///
170         virtual bool isTextInset() const { return true; }
171         ///
172         virtual void mutateToText();
173         ///
174         virtual void revealCodes(LCursor & cur) const;
175         ///
176         virtual EDITABLE editable() const { return HIGHLY_EDITABLE; }
177         ///
178         void edit(LCursor & cur, bool left);
179         ///
180         bool display() const;
181         ///
182         Code lyxCode() const;
183
184 protected:
185         ///
186         void handleFont(LCursor &, std::string const & arg, std::string const & font);
187         ///
188         void handleFont2(LCursor &, std::string const & arg);
189 };
190
191 #endif