]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
small stuff from Martin's list
[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 #ifdef __GNUG__
19 #pragma implementation
20 #endif
21
22 #include <config.h>
23
24 #include "Lsstream.h"
25 #include "math_inset.h"
26 #include "math_scriptinset.h"
27 #include "math_mathmlstream.h"
28 #include "debug.h"
29
30
31 using std::ostream;
32 using std::vector;
33
34
35 int MathInset::height() const
36 {
37         return ascent() + descent();
38 }
39
40
41 ostream & operator<<(ostream & os, MathInset const & inset)
42 {
43         WriteStream wi(os, false, false);
44         inset.write(wi);
45         return os;
46 }
47
48
49 MathInset::size_type MathInset::nargs() const
50 {
51         return 0;
52 }
53
54
55 MathXArray dummyCell;
56
57 MathXArray & MathInset::xcell(idx_type)
58 {
59         lyxerr << "I don't have a cell 1\n";
60         return dummyCell;
61 }
62
63
64 MathXArray const & MathInset::xcell(idx_type) const
65 {
66         lyxerr << "I don't have a cell 2\n";
67         return dummyCell;
68 }
69
70
71 MathArray & MathInset::cell(idx_type)
72 {
73         lyxerr << "I don't have a cell 3\n";
74         return dummyCell.data_;
75 }
76
77
78 MathArray const & MathInset::cell(idx_type) const
79 {
80         lyxerr << "I don't have a cell 4\n";
81         return dummyCell.data_;
82 }
83
84
85 MathInset::idx_type MathInset::index(row_type row, col_type col) const
86 {
87         if (row != 0)
88                 lyxerr << "illegal row: " << row << "\n";
89         if (col != 0)
90                 lyxerr << "illegal col: " << col << "\n";
91         return 0;
92 }
93
94 void MathInset::substitute(MathMacro const &)
95 {}
96
97
98 bool MathInset::idxNext(idx_type &, pos_type &) const
99 {
100         return false;
101 }
102
103
104 bool MathInset::idxRight(idx_type &, pos_type &) const
105 {
106         return false;
107 }
108
109
110 bool MathInset::idxPrev(idx_type &, pos_type &) const
111 {
112         return false;
113 }
114
115
116 bool MathInset::idxLeft(idx_type &, pos_type &) const
117 {
118         return false;
119 }
120
121
122 bool MathInset::idxUpDown(idx_type &, bool) const
123 {
124         return false;
125 }
126
127
128 bool MathInset::idxFirst(idx_type &, pos_type &) const
129 {
130         return false;
131 }
132
133
134 bool MathInset::idxLast(idx_type &, pos_type &) const
135 {
136         return false;
137 }
138
139
140 bool MathInset::idxHome(idx_type &, pos_type &) const
141 {
142         return false;
143 }
144
145
146 bool MathInset::idxEnd(idx_type &, pos_type &) const
147 {
148         return false;
149 }
150
151
152 void MathInset::normalize(NormalStream & os) const
153 {
154         os << "[unknown ";
155         WriteStream wi(os.os(), false, true);
156         write(wi);
157         os << "] ";
158 }
159
160
161 void MathInset::dump() const
162 {
163         lyxerr << "---------------------------------------------\n";
164         WriteStream wi(lyxerr, false, true);
165         write(wi);
166         lyxerr << "\n---------------------------------------------\n";
167 }
168
169
170 void MathInset::validate(LaTeXFeatures &) const
171 {}
172
173
174 vector<MathInset::idx_type>
175         MathInset::idxBetween(idx_type from, idx_type to) const
176 {
177         vector<idx_type> res;
178         for (idx_type i = from; i <= to; ++i)
179                 res.push_back(i);
180         return res;
181 }
182
183
184 void MathInset::metrics(MathMetricsInfo const &) const
185 {
186         lyxerr << "MathInset::metrics() called directly!\n";
187 }
188
189
190 void MathInset::draw(Painter &, int, int) const
191 {
192         lyxerr << "MathInset::draw() called directly!\n";
193 }
194
195
196 void MathInset::metricsT(TextMetricsInfo const &) const
197 {
198 #ifdef WITH_WARNINGS
199         lyxerr << "MathInset::metricsT(Text) called directly!\n";
200 #endif
201 }
202
203
204 void MathInset::drawT(TextPainter &, int, int) const
205 {
206 #ifdef WITH_WARNINGS
207         lyxerr << "MathInset::drawT(Text) called directly!\n";
208 #endif
209 }
210
211
212
213 void MathInset::write(WriteStream &) const
214 {
215         lyxerr << "MathInset::write() called directly!\n";
216 }
217
218
219 void MathInset::octavize(OctaveStream & os) const
220 {
221         NormalStream ns(os.os());
222         normalize(ns);
223 }
224
225
226 void MathInset::maplize(MapleStream & os) const
227 {
228         NormalStream ns(os.os());
229         normalize(ns);
230 }
231
232
233 void MathInset::mathmlize(MathMLStream & os) const
234 {
235         NormalStream ns(os.os());
236         normalize(ns);
237 }