2002-07-08 11:29:51 +00:00
|
|
|
|
|
|
|
#include "math_parboxinset.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_streamstr.h"
|
|
|
|
#include "lyxlength.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
2002-07-17 12:07:57 +00:00
|
|
|
using std::vector;
|
2002-07-08 11:29:51 +00:00
|
|
|
|
2002-07-31 17:26:14 +00:00
|
|
|
|
2002-07-08 11:29:51 +00:00
|
|
|
MathParboxInset::MathParboxInset()
|
2002-07-31 17:26:14 +00:00
|
|
|
: lyx_width_(0), tex_width_("0mm"), position_('c')
|
2002-07-08 11:29:51 +00:00
|
|
|
{
|
|
|
|
lyxerr << "constructing MathParboxInset\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathParboxInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathParboxInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathParboxInset::setPosition(string const & p)
|
|
|
|
{
|
|
|
|
position_ = p.size() > 0 ? p[0] : 'c';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathParboxInset::setWidth(string const & w)
|
|
|
|
{
|
|
|
|
tex_width_ = w;
|
|
|
|
lyx_width_ = LyXLength(w).inBP();
|
|
|
|
lyxerr << "setting " << w << " to " << lyx_width_ << " pixel\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathParboxInset::metrics(MathMetricsInfo & mi) const
|
|
|
|
{
|
2002-07-31 17:26:14 +00:00
|
|
|
MathFontSetChanger dummy1(mi.base, "textnormal");
|
|
|
|
MathWidthChanger dummy2(mi.base, lyx_width_);
|
|
|
|
MathTextInset::metrics(mi);
|
2002-07-26 14:11:19 +00:00
|
|
|
metricsMarkers2();
|
2002-07-08 11:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathParboxInset::draw(MathPainterInfo & pi, int x, int y) const
|
|
|
|
{
|
2002-07-09 08:24:33 +00:00
|
|
|
MathFontSetChanger dummy(pi.base, "textnormal");
|
2002-07-31 17:26:14 +00:00
|
|
|
MathTextInset::draw(pi, x + 1, y);
|
2002-07-26 14:11:19 +00:00
|
|
|
drawMarkers2(pi, x, y);
|
2002-07-08 11:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathParboxInset::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
os << "\\parbox";
|
|
|
|
if (position_ != 'c')
|
|
|
|
os << '[' << position_ << ']';
|
|
|
|
os << '{' << tex_width_ << "}{" << cell(0) << '}';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathParboxInset::infoize(std::ostream & os) const
|
|
|
|
{
|
2002-07-10 07:15:36 +00:00
|
|
|
os << "Box: Parbox " << tex_width_;
|
2002-07-08 11:29:51 +00:00
|
|
|
}
|
|
|
|
|