]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
fix Herbert's up/down problem
[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);
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::idxDelete(idx_type &, bool & popit, bool & deleteit)
153 {
154         popit    = false;
155         deleteit = false;
156 }
157
158
159 void MathInset::normalize(NormalStream & os) const
160 {
161         os << "[unknown ";
162         WriteStream wi(os.os(), false);
163         write(wi);
164         os << "] ";
165 }
166
167
168 void MathInset::dump() const
169 {
170         lyxerr << "---------------------------------------------\n";
171         WriteStream wi(lyxerr, false);
172         write(wi);
173         lyxerr << "\n---------------------------------------------\n";
174 }
175
176
177 void MathInset::validate(LaTeXFeatures &) const
178 {}
179
180
181 vector<MathInset::idx_type>
182         MathInset::idxBetween(idx_type from, idx_type to) const
183 {
184         vector<idx_type> res;
185         for (idx_type i = from; i <= to; ++i)
186                 res.push_back(i);
187         return res;
188 }
189
190
191 void MathInset::metrics(MathMetricsInfo const &) const
192 {
193         lyxerr << "MathInset::metrics() called directly!\n";
194 }
195
196
197 void MathInset::draw(Painter &, int, int) const
198 {
199         lyxerr << "MathInset::draw() called directly!\n";
200 }
201
202
203 void MathInset::metricsT(TextMetricsInfo const &) const
204 {
205         lyxerr << "MathInset::metricsT(Text) called directly!\n";
206 }
207
208
209 void MathInset::drawT(TextPainter &, int, int) const
210 {
211         lyxerr << "MathInset::drawT(Text) called directly!\n";
212 }
213
214
215
216 void MathInset::write(WriteStream &) const
217 {
218         lyxerr << "MathInset::write() called directly!\n";
219 }
220
221
222 void MathInset::octavize(OctaveStream & os) const
223 {
224         NormalStream ns(os.os());
225         normalize(ns);
226 }
227
228
229 void MathInset::maplize(MapleStream & os) const
230 {
231         NormalStream ns(os.os());
232         normalize(ns);
233 }
234
235
236 void MathInset::mathmlize(MathMLStream & os) const
237 {
238         NormalStream ns(os.os());
239         normalize(ns);
240 }