]> git.lyx.org Git - features.git/blob - src/mathed/InsetMathDiff.cpp
Introduce a return value for mathmlize(). We will need this to be able
[features.git] / src / mathed / InsetMathDiff.cpp
1 /**
2  * \file InsetMathDiff.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 "InsetMathDiff.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 InsetMathDiff::InsetMathDiff(Buffer * buf)
24         : InsetMathNest(buf, 1)
25 {}
26
27
28 Inset * InsetMathDiff::clone() const
29 {
30         return new InsetMathDiff(*this);
31 }
32
33
34 void InsetMathDiff::addDer(MathData const & der)
35 {
36         cells_.push_back(der);
37 }
38
39
40 void InsetMathDiff::normalize(NormalStream & os) const
41 {
42         os << "[diff";
43         for (idx_type idx = 0; idx < nargs(); ++idx)
44                 os << ' ' << cell(idx);
45         os << ']';
46 }
47
48
49 void InsetMathDiff::metrics(MetricsInfo &, Dimension &) const
50 {
51         LYXERR0("should not happen");
52 }
53
54
55 void InsetMathDiff::draw(PainterInfo &, int, int) const
56 {
57         LYXERR0("should not happen");
58 }
59
60
61 void InsetMathDiff::maple(MapleStream & os) const
62 {
63         os << "diff(";
64         for (idx_type idx = 0; idx < nargs(); ++idx) {
65                 if (idx != 0)
66                         os << ',';
67                 os << cell(idx);
68         }
69         os << ')';
70 }
71
72
73 void InsetMathDiff::maxima(MaximaStream & os) const
74 {
75         os << "diff(";
76         for (idx_type idx = 0; idx < nargs(); ++idx) {
77                 if (idx != 0)
78                         os << ',';
79                 os << cell(idx);
80                 if (idx != 0)
81                         os << ",1";
82         }
83         os << ')';
84 }
85
86
87 void InsetMathDiff::mathematica(MathematicaStream & os) const
88 {
89         os << "D[";
90         for (idx_type idx = 0; idx < nargs(); ++idx) {
91                 if (idx != 0)
92                         os << ',';
93                 os << cell(idx);
94         }
95         os << ']';
96 }
97
98
99 docstring InsetMathDiff::mathmlize(MathStream & os) const
100 {
101         os << "diff(";
102         docstring rv;
103         for (idx_type idx = 0; idx < nargs(); ++idx) {
104                 if (idx != 0)
105                         os << ',';
106                 rv += lyx::mathmlize(cell(idx), os);
107         }
108         os << ')';
109         return rv;
110 }
111
112
113 void InsetMathDiff::write(WriteStream &) const
114 {
115         LYXERR0("should not happen");
116 }
117
118
119 } // namespace lyx