2001-06-25 00:06:33 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_sizeinset.h"
|
2001-06-27 15:33:55 +00:00
|
|
|
#include "support/LOstream.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
MathSizeInset::MathSizeInset(MathStyles st)
|
|
|
|
: MathInset("", LM_OT_SIMPLE, 1), style_(st)
|
|
|
|
{
|
|
|
|
name_ = verbose();
|
|
|
|
}
|
|
|
|
|
2001-06-27 15:33:55 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
char const * MathSizeInset::verbose() const
|
|
|
|
{
|
|
|
|
switch (style_) {
|
|
|
|
case LM_ST_DISPLAY:
|
|
|
|
return "displaystyle";
|
|
|
|
case LM_ST_TEXT:
|
|
|
|
return "textstyle";
|
|
|
|
case LM_ST_SCRIPT:
|
|
|
|
return "scriptstyle";
|
|
|
|
case LM_ST_SCRIPTSCRIPT:
|
|
|
|
return "scriptscriptstyle";
|
|
|
|
}
|
|
|
|
return "unknownstyle";
|
|
|
|
}
|
|
|
|
|
2001-06-27 15:33:55 +00:00
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
MathInset * MathSizeInset::clone() const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
|
|
|
return new MathSizeInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathSizeInset::draw(Painter & pain, int x, int y)
|
|
|
|
{
|
|
|
|
xo(x);
|
|
|
|
yo(y);
|
|
|
|
xcell(0).draw(pain, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathSizeInset::Metrics(MathStyles /* st */)
|
|
|
|
{
|
|
|
|
xcell(0).Metrics(style_);
|
|
|
|
ascent_ = xcell(0).ascent_;
|
|
|
|
descent_ = xcell(0).descent_;
|
|
|
|
width_ = xcell(0).width_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathSizeInset::Write(std::ostream & os, bool fragile) const
|
|
|
|
{
|
|
|
|
os << "{\\" << name() << " ";
|
|
|
|
cell(0).Write(os, fragile);
|
|
|
|
os << "}";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathSizeInset::WriteNormal(std::ostream & os) const
|
|
|
|
{
|
|
|
|
os << "[" << name() << " ";
|
|
|
|
cell(0).WriteNormal(os);
|
|
|
|
os << "]";
|
|
|
|
}
|