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