]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
Standardise the header blurb in mathed.
[lyx.git] / src / mathed / math_inset.C
1 /**
2  * \file math_inset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "math_inset.h"
15 #include "math_scriptinset.h"
16 #include "math_mathmlstream.h"
17 #include "math_cursor.h"
18 #include "debug.h"
19
20 #include "frontends/LyXView.h"
21 #include "frontends/Dialogs.h"
22 #include "BufferView.h"
23 #include "formulabase.h"
24
25 using std::ostream;
26 using std::endl;
27
28
29 BufferView * MathInset::view() const
30 {
31         return mathcursor ? mathcursor->formula()->view() : 0;
32 }
33
34
35 MathInset::size_type MathInset::nargs() const
36 {
37         return 0;
38 }
39
40
41 MathArray dummyCell;
42
43 MathArray & MathInset::cell(idx_type)
44 {
45         lyxerr << "I don't have a cell 1" << endl;
46         return dummyCell;
47 }
48
49
50 MathArray const & MathInset::cell(idx_type) const
51 {
52         lyxerr << "I don't have a cell 2" << endl;
53         return dummyCell;
54 }
55
56
57 MathInset::idx_type MathInset::index(row_type row, col_type col) const
58 {
59         if (row != 0)
60                 lyxerr << "illegal row: " << row << endl;
61         if (col != 0)
62                 lyxerr << "illegal col: " << col << endl;
63         return 0;
64 }
65
66 void MathInset::substitute(MathMacro const &)
67 {}
68
69
70 bool MathInset::idxNext(idx_type &, pos_type &) const
71 {
72         return false;
73 }
74
75
76 bool MathInset::idxRight(idx_type &, pos_type &) const
77 {
78         return false;
79 }
80
81
82 bool MathInset::idxPrev(idx_type &, pos_type &) const
83 {
84         return false;
85 }
86
87
88 bool MathInset::idxLeft(idx_type &, pos_type &) const
89 {
90         return false;
91 }
92
93
94 bool MathInset::idxUpDown(idx_type &, pos_type &, bool, int) const
95 {
96         return false;
97 }
98
99
100 bool MathInset::idxUpDown2(idx_type &, pos_type &, bool, int) const
101 {
102         return false;
103 }
104
105
106 bool MathInset::idxFirst(idx_type &, pos_type &) const
107 {
108         return false;
109 }
110
111
112 bool MathInset::idxLast(idx_type &, pos_type &) const
113 {
114         return false;
115 }
116
117
118 bool MathInset::idxHome(idx_type &, pos_type &) const
119 {
120         return false;
121 }
122
123
124 bool MathInset::idxEnd(idx_type &, pos_type &) const
125 {
126         return false;
127 }
128
129
130 void MathInset::getPos(idx_type, pos_type, int & x, int & y) const
131 {
132         lyxerr << "MathInset::getPos() called directly!" << endl;
133         x = y = 0;
134 }
135
136
137 void MathInset::dump() const
138 {
139         lyxerr << "---------------------------------------------" << endl;
140         WriteStream wi(lyxerr, false, true);
141         write(wi);
142         lyxerr << "\n---------------------------------------------" << endl;
143 }
144
145
146 bool MathInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
147 {
148         return from <= idx && idx <= to;
149 }
150
151
152 void MathInset::drawSelection(PainterInfo &,
153         idx_type, pos_type, idx_type, pos_type) const
154 {
155         lyxerr << "MathInset::drawSelection() called directly!" << endl;
156 }
157
158
159 void MathInset::metricsT(TextMetricsInfo const &, Dimension &) const
160 {
161 #ifdef WITH_WARNINGS
162         lyxerr << "MathInset::metricsT(Text) called directly!" << endl;
163 #endif
164 }
165
166
167 void MathInset::drawT(TextPainter &, int, int) const
168 {
169 #ifdef WITH_WARNINGS
170         lyxerr << "MathInset::drawT(Text) called directly!" << endl;
171 #endif
172 }
173
174
175
176 void MathInset::write(WriteStream & os) const
177 {
178         os << '\\' << name().c_str();
179         os.pendingSpace(true);
180 }
181
182
183 void MathInset::normalize(NormalStream & os) const
184 {
185         os << '[' << name().c_str() << "] ";
186 }
187
188
189 void MathInset::octave(OctaveStream & os) const
190 {
191         NormalStream ns(os.os());
192         normalize(ns);
193 }
194
195
196 void MathInset::maple(MapleStream & os) const
197 {
198         NormalStream ns(os.os());
199         normalize(ns);
200 }
201
202
203 void MathInset::maxima(MaximaStream & os) const
204 {
205         MapleStream ns(os.os());
206         maple(ns);
207 }
208
209
210 void MathInset::mathematica(MathematicaStream & os) const
211 {
212         NormalStream ns(os.os());
213         normalize(ns);
214 }
215
216
217 void MathInset::mathmlize(MathMLStream & os) const
218 {
219         NormalStream ns(os.os());
220         normalize(ns);
221 }
222
223
224 int MathInset::ascii(std::ostream &, int) const
225 {
226         return 0;
227 }
228
229
230 int MathInset::linuxdoc(std::ostream &) const
231 {
232         return 0;
233 }
234
235
236 int MathInset::docbook(std::ostream &, bool) const
237 {
238         return 0;
239 }
240
241
242 string const & MathInset::getType() const
243 {
244         static string const t("none");
245         return t;
246 }
247
248
249 string MathInset::name() const
250 {
251         return "unknown";
252 }
253
254
255 ostream & operator<<(ostream & os, MathAtom const & at)
256 {
257         WriteStream wi(os, false, false);
258         at->write(wi);
259         return os;
260 }
261
262
263 string MathInset::fileInsetLabel() const
264 {
265         return "Formula";
266 }