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