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