mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
de6418f377
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15462 a592a061-630c-0410-9148-cb99ea01b6c8
116 lines
1.9 KiB
C
116 lines
1.9 KiB
C
/**
|
|
* \file InsetMathMatrix.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author André Pönitz
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "InsetMathMatrix.h"
|
|
#include "MathData.h"
|
|
#include "MathStream.h"
|
|
|
|
|
|
namespace lyx {
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
|
|
: InsetMathGrid(p)
|
|
{}
|
|
|
|
|
|
auto_ptr<InsetBase> InsetMathMatrix::doClone() const
|
|
{
|
|
return auto_ptr<InsetBase>(new InsetMathMatrix(*this));
|
|
}
|
|
|
|
|
|
void InsetMathMatrix::write(WriteStream & os) const
|
|
{
|
|
InsetMathGrid::write(os);
|
|
}
|
|
|
|
|
|
void InsetMathMatrix::normalize(NormalStream & os) const
|
|
{
|
|
InsetMathGrid::normalize(os);
|
|
}
|
|
|
|
|
|
void InsetMathMatrix::maple(MapleStream & os) const
|
|
{
|
|
os << "matrix(" << int(nrows()) << ',' << int(ncols()) << ",[";
|
|
for (idx_type idx = 0; idx < nargs(); ++idx) {
|
|
if (idx)
|
|
os << ',';
|
|
os << cell(idx);
|
|
}
|
|
os << "])";
|
|
}
|
|
|
|
|
|
void InsetMathMatrix::maxima(MaximaStream & os) const
|
|
{
|
|
os << "matrix(";
|
|
for (row_type row = 0; row < nrows(); ++row) {
|
|
if (row)
|
|
os << ',';
|
|
os << '[';
|
|
for (col_type col = 0; col < ncols(); ++col) {
|
|
if (col)
|
|
os << ',';
|
|
os << cell(index(row, col));
|
|
}
|
|
os << ']';
|
|
}
|
|
os << ')';
|
|
}
|
|
|
|
|
|
void InsetMathMatrix::mathematica(MathematicaStream & os) const
|
|
{
|
|
os << '{';
|
|
for (row_type row = 0; row < nrows(); ++row) {
|
|
if (row)
|
|
os << ',';
|
|
os << '{';
|
|
for (col_type col = 0; col < ncols(); ++col) {
|
|
if (col)
|
|
os << ',';
|
|
os << cell(index(row, col));
|
|
}
|
|
os << '}';
|
|
}
|
|
os << '}';
|
|
}
|
|
|
|
|
|
void InsetMathMatrix::mathmlize(MathStream & os) const
|
|
{
|
|
InsetMathGrid::mathmlize(os);
|
|
}
|
|
|
|
|
|
void InsetMathMatrix::octave(OctaveStream & os) const
|
|
{
|
|
os << '[';
|
|
for (row_type row = 0; row < nrows(); ++row) {
|
|
if (row)
|
|
os << ';';
|
|
os << '[';
|
|
for (col_type col = 0; col < ncols(); ++col)
|
|
os << cell(index(row, col)) << ' ';
|
|
os << ']';
|
|
}
|
|
os << ']';
|
|
}
|
|
|
|
|
|
} // namespace lyx
|