]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
enable direct input of #1...#9; some whitespace changes
[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::idxDeleteRange(idx_type, idx_type)
162 {}
163
164
165 void MathInset::normalize(NormalStream & os) const
166 {
167         os << "[unknown ";
168         WriteStream wi(os.os(), false);
169         write(wi);
170         os << "] ";
171 }
172
173
174 void MathInset::dump() const
175 {
176         lyxerr << "---------------------------------------------\n";
177         WriteStream wi(lyxerr, false);
178         write(wi);
179         lyxerr << "\n---------------------------------------------\n";
180 }
181
182
183 void MathInset::validate(LaTeXFeatures &) const
184 {}
185
186
187 std::vector<MathInset::idx_type>
188         MathInset::idxBetween(idx_type from, idx_type to) const
189 {
190         std::vector<idx_type> res;
191         for (idx_type i = from; i <= to; ++i)
192                 res.push_back(i);
193         return res;
194 }
195
196
197 void MathInset::metrics(MathMetricsInfo const &) const
198 {
199         lyxerr << "MathInset::metrics() called directly!\n";
200 }
201
202
203 void MathInset::draw(Painter &, int, int) const
204 {
205         lyxerr << "MathInset::draw() called directly!\n";
206 }
207
208
209 void MathInset::write(WriteStream &) const
210 {
211         lyxerr << "MathInset::write() called directly!\n";
212 }
213
214
215 void MathInset::octavize(OctaveStream & os) const
216 {
217         NormalStream ns(os.os());
218         normalize(ns);
219 }
220
221
222 void MathInset::maplize(MapleStream & os) const
223 {
224         NormalStream ns(os.os());
225         normalize(ns);
226 }
227
228
229 void MathInset::mathmlize(MathMLStream & os) const
230 {
231         NormalStream ns(os.os());
232         normalize(ns);
233 }