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