]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathMatrix.C
Avoid processing empty lines when reading the symbols file
[lyx.git] / src / mathed / InsetMathMatrix.C
1 /**
2  * \file InsetMathMatrix.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 "InsetMathMatrix.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16
17
18 namespace lyx {
19
20 using std::auto_ptr;
21
22
23 InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
24         : InsetMathGrid(p)
25 {}
26
27
28 auto_ptr<InsetBase> InsetMathMatrix::doClone() const
29 {
30         return auto_ptr<InsetBase>(new InsetMathMatrix(*this));
31 }
32
33
34 void InsetMathMatrix::write(WriteStream & os) const
35 {
36         InsetMathGrid::write(os);
37 }
38
39
40 void InsetMathMatrix::normalize(NormalStream & os) const
41 {
42         InsetMathGrid::normalize(os);
43 }
44
45
46 void InsetMathMatrix::maple(MapleStream & os) const
47 {
48         os << "matrix(" << int(nrows()) << ',' << int(ncols()) << ",[";
49         for (idx_type idx = 0; idx < nargs(); ++idx) {
50                 if (idx)
51                         os << ',';
52                 os << cell(idx);
53         }
54         os << "])";
55 }
56
57
58 void InsetMathMatrix::maxima(MaximaStream & os) const
59 {
60         os << "matrix(";
61         for (row_type row = 0; row < nrows(); ++row) {
62                 if (row)
63                         os << ',';
64                 os << '[';
65                 for (col_type col = 0; col < ncols(); ++col) {
66                         if (col)
67                                 os << ',';
68                         os << cell(index(row, col));
69                 }
70                 os << ']';
71         }
72         os << ')';
73 }
74
75
76 void InsetMathMatrix::mathematica(MathematicaStream & os) const
77 {
78         os << '{';
79         for (row_type row = 0; row < nrows(); ++row) {
80                 if (row)
81                         os << ',';
82                 os << '{';
83                 for (col_type col = 0; col < ncols(); ++col) {
84                         if (col)
85                                 os << ',';
86                         os << cell(index(row, col));
87                 }
88                 os << '}';
89         }
90         os << '}';
91 }
92
93
94 void InsetMathMatrix::mathmlize(MathStream & os) const
95 {
96         InsetMathGrid::mathmlize(os);
97 }
98
99
100 void InsetMathMatrix::octave(OctaveStream & os) const
101 {
102         os << '[';
103         for (row_type row = 0; row < nrows(); ++row) {
104                 if (row)
105                         os << ';';
106                 os << '[';
107                 for (col_type col = 0; col < ncols(); ++col)
108                         os << cell(index(row, col)) << ' ';
109                 os << ']';
110         }
111         os << ']';
112 }
113
114
115 } // namespace lyx