]> git.lyx.org Git - features.git/blob - src/mathed/InsetMathLim.cpp
Introduce a return value for mathmlize(). We will need this to be able
[features.git] / src / mathed / InsetMathLim.cpp
1 /**
2  * \file InsetMathLim.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathLim.h"
14 #include "MathData.h"
15 #include "MathExtern.h"
16 #include "MathStream.h"
17
18 #include "support/debug.h"
19
20
21 namespace lyx {
22
23 InsetMathLim::InsetMathLim(Buffer * buf, MathData const & f, MathData const & x,
24         MathData const & x0)
25         : InsetMathNest(buf, 3)
26 {
27         cell(0) = f;
28         cell(1) = x;
29         cell(2) = x0;
30 }
31
32
33 Inset * InsetMathLim::clone() const
34 {
35         return new InsetMathLim(*this);
36 }
37
38
39 void InsetMathLim::normalize(NormalStream & os) const
40 {
41         os << "[lim " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
42 }
43
44
45 void InsetMathLim::metrics(MetricsInfo &, Dimension &) const
46 {
47         LYXERR0("should not happen");
48 }
49
50
51 void InsetMathLim::draw(PainterInfo &, int, int) const
52 {
53         LYXERR0("should not happen");
54 }
55
56
57 void InsetMathLim::maple(MapleStream & os) const
58 {
59         os << "limit(" << cell(0) << ',' << cell(1) << '=' << cell(2) << ')';
60 }
61
62
63 void InsetMathLim::maxima(MaximaStream & os) const
64 {
65         os << "limit(" << cell(0) << ',' << cell(1) << ',' << cell(2) << ')';
66 }
67
68
69 void InsetMathLim::mathematica(MathematicaStream & os) const
70 {
71         os << "Limit[" << cell(0) << ',' << cell(1) << "-> " << cell(2) << ']';
72 }
73
74
75 docstring       InsetMathLim::mathmlize(MathStream & os) const
76 {
77         // FIXME XHTML We need a form of MTag that takes attributes.
78         os << "<munder>"
79            << "<mo form='prefix'>" << "lim" << "</mo>"
80                  << "<mrow>" << cell(1) << "<mo>&rarr;</mo>" << cell(2)
81                  << "</mrow></munder>" << "<mo>(</mo>";
82         docstring const rv = lyx::mathmlize(cell(0), os);
83         os << "<mo>)</mo>";
84         return rv;
85 }
86
87
88 void InsetMathLim::write(WriteStream &) const
89 {
90         LYXERR0("should not happen");
91 }
92
93
94 } // namespace lyx