]> git.lyx.org Git - lyx.git/blob - src/mathed/math_matrixinset.C
Andreas' patch to prevent crash on click on previewd inset
[lyx.git] / src / mathed / math_matrixinset.C
1 /**
2  * \file math_matrixinset.C
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 "math_matrixinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16
17 using std::auto_ptr;
18
19
20 MathMatrixInset::MathMatrixInset(MathGridInset const & p)
21         : MathGridInset(p)
22 {}
23
24
25 auto_ptr<InsetBase> MathMatrixInset::doClone() const
26 {
27         return auto_ptr<InsetBase>(new MathMatrixInset(*this));
28 }
29
30
31 void MathMatrixInset::write(WriteStream & os) const
32 {
33         MathGridInset::write(os);
34 }
35
36
37 void MathMatrixInset::normalize(NormalStream & os) const
38 {
39         MathGridInset::normalize(os);
40 }
41
42
43 void MathMatrixInset::maple(MapleStream & os) const
44 {
45         os << "matrix(" << int(nrows()) << ',' << int(ncols()) << ",[";
46         for (idx_type idx = 0; idx < nargs(); ++idx) {
47                 if (idx)
48                         os << ',';
49                 os << cell(idx);
50         }
51         os << "])";
52 }
53
54
55 void MathMatrixInset::maxima(MaximaStream & os) const
56 {
57         os << "matrix(";
58         for (row_type row = 0; row < nrows(); ++row) {
59                 if (row)
60                         os << ',';
61                 os << '[';
62                 for (col_type col = 0; col < ncols(); ++col) {
63                         if (col)
64                                 os << ',';
65                         os << cell(index(row, col));
66                 }
67                 os << ']';
68         }
69         os << ')';
70 }
71
72
73 void MathMatrixInset::mathmlize(MathMLStream & os) const
74 {
75         MathGridInset::mathmlize(os);
76 }
77
78
79 void MathMatrixInset::octave(OctaveStream & os) const
80 {
81         os << '[';
82         for (row_type row = 0; row < nrows(); ++row) {
83                 if (row)
84                         os << ';';
85                 os << '[';
86                 for (col_type col = 0; col < ncols(); ++col)
87                         os << cell(index(row, col)) << ' ';
88                 os << ']';
89         }
90         os << ']';
91 }