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