]> git.lyx.org Git - lyx.git/blob - src/mathed/math_inset.C
Make Helge happy: no more crash on arrow up/down in math macro
[lyx.git] / src / mathed / math_inset.C
1 /**
2  * \file math_inset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "math_inset.h"
15 #include "math_data.h"
16 #include "math_mathmlstream.h"
17 #include "debug.h"
18
19 using std::string;
20 using std::ostream;
21 using std::endl;
22
23
24 MathArray & MathInset::cell(idx_type)
25 {
26         static MathArray dummyCell;
27         lyxerr << "I don't have a cell 1" << endl;
28         return dummyCell;
29 }
30
31
32 MathArray const & MathInset::cell(idx_type) const
33 {
34         static MathArray dummyCell;
35         lyxerr << "I don't have a cell 2" << endl;
36         return dummyCell;
37 }
38
39
40 void MathInset::dump() const
41 {
42         lyxerr << "---------------------------------------------" << endl;
43         WriteStream wi(lyxerr, false, true);
44         write(wi);
45         lyxerr << "\n---------------------------------------------" << endl;
46 }
47
48
49 void MathInset::metricsT(TextMetricsInfo const &, Dimension &) const
50 {
51 #ifdef WITH_WARNINGS
52         lyxerr << "MathInset::metricsT(Text) called directly!" << endl;
53 #endif
54 }
55
56
57 void MathInset::drawT(TextPainter &, int, int) const
58 {
59 #ifdef WITH_WARNINGS
60         lyxerr << "MathInset::drawT(Text) called directly!" << endl;
61 #endif
62 }
63
64
65
66 void MathInset::write(WriteStream & os) const
67 {
68         os << '\\' << name().c_str();
69         os.pendingSpace(true);
70 }
71
72
73 void MathInset::normalize(NormalStream & os) const
74 {
75         os << '[' << name().c_str() << "] ";
76 }
77
78
79 void MathInset::octave(OctaveStream & os) const
80 {
81         NormalStream ns(os.os());
82         normalize(ns);
83 }
84
85
86 void MathInset::maple(MapleStream & os) const
87 {
88         NormalStream ns(os.os());
89         normalize(ns);
90 }
91
92
93 void MathInset::maxima(MaximaStream & os) const
94 {
95         MapleStream ns(os.os());
96         maple(ns);
97 }
98
99
100 void MathInset::mathematica(MathematicaStream & os) const
101 {
102         NormalStream ns(os.os());
103         normalize(ns);
104 }
105
106
107 void MathInset::mathmlize(MathMLStream & os) const
108 {
109         NormalStream ns(os.os());
110         normalize(ns);
111 }
112
113
114 string const & MathInset::getType() const
115 {
116         static string const t("none");
117         return t;
118 }
119
120
121 string MathInset::name() const
122 {
123         return "unknown";
124 }
125
126
127 ostream & operator<<(ostream & os, MathAtom const & at)
128 {
129         WriteStream wi(os, false, false);
130         at->write(wi);
131         return os;
132 }