2003-03-03 16:15:38 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "math_tabularinset.h"
|
|
|
|
#include "math_parser.h"
|
|
|
|
#include "math_mathmlstream.h"
|
2003-03-21 14:20:48 +00:00
|
|
|
#include "metricsinfo.h"
|
2003-03-03 16:15:38 +00:00
|
|
|
#include "math_streamstr.h"
|
|
|
|
#include "Lsstream.h"
|
|
|
|
|
|
|
|
#include <iterator>
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
using std::istringstream;
|
|
|
|
using std::getline;
|
|
|
|
using std::istream_iterator;
|
|
|
|
|
|
|
|
|
|
|
|
MathTabularInset::MathTabularInset(string const & name, int m, int n)
|
|
|
|
: MathGridInset(m, n), name_(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathTabularInset::MathTabularInset(string const & name, int m, int n,
|
|
|
|
char valign, string const & halign)
|
|
|
|
: MathGridInset(m, n, valign, halign), name_(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathTabularInset::MathTabularInset(string const & name, char valign,
|
|
|
|
string const & halign)
|
|
|
|
: MathGridInset(valign, halign), name_(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathTabularInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathTabularInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
void MathTabularInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
2003-03-03 16:15:38 +00:00
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
FontSetChanger dummy(mi.base, "textnormal");
|
2003-05-28 13:22:36 +00:00
|
|
|
return MathGridInset::metrics(mi);
|
2003-03-03 16:15:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
|
2003-03-03 16:15:38 +00:00
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
FontSetChanger dummy(pi.base, "textnormal");
|
2003-03-03 16:15:38 +00:00
|
|
|
MathGridInset::draw(pi, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathTabularInset::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
if (os.fragile())
|
|
|
|
os << "\\protect";
|
|
|
|
os << "\\begin{" << name_ << '}';
|
|
|
|
|
|
|
|
if (v_align_ == 't' || v_align_ == 'b')
|
|
|
|
os << '[' << char(v_align_) << ']';
|
|
|
|
os << '{' << halign() << "}\n";
|
|
|
|
|
|
|
|
MathGridInset::write(os);
|
|
|
|
|
|
|
|
if (os.fragile())
|
|
|
|
os << "\\protect";
|
|
|
|
os << "\\end{" << name_ << '}';
|
|
|
|
// adding a \n here is bad if the tabular is the last item
|
|
|
|
// in an \eqnarray...
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathTabularInset::normalize(NormalStream & os) const
|
|
|
|
{
|
|
|
|
os << '[' << name_ << ' ';
|
|
|
|
MathGridInset::normalize(os);
|
|
|
|
os << ']';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathTabularInset::maple(MapleStream & os) const
|
|
|
|
{
|
|
|
|
os << "array(";
|
|
|
|
MathGridInset::maple(os);
|
|
|
|
os << ')';
|
|
|
|
}
|