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