lyx_mirror/src/mathed/math_parboxinset.C

69 lines
1.3 KiB
C++
Raw Normal View History

#include "math_parboxinset.h"
#include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "lyxlength.h"
#include "debug.h"
using std::vector;
MathParboxInset::MathParboxInset()
: lyx_width_(0), tex_width_("0mm"), position_('c')
{
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
{
MathFontSetChanger dummy1(mi.base, "textnormal");
MathWidthChanger dummy2(mi.base, lyx_width_);
MathTextInset::metrics(mi);
metricsMarkers2();
}
void MathParboxInset::draw(MathPainterInfo & pi, int x, int y) const
{
MathFontSetChanger dummy(pi.base, "textnormal");
MathTextInset::draw(pi, x + 1, y);
drawMarkers2(pi, x, y);
}
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
{
os << "Box: Parbox " << tex_width_;
}