2 * \file InsetMathOverset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathOverset.h"
15 #include "MathMLStream.h"
18 #include "LaTeXFeatures.h"
24 auto_ptr<InsetBase> InsetMathOverset::doClone() const
26 return auto_ptr<InsetBase>(new InsetMathOverset(*this));
30 void InsetMathOverset::metrics(MetricsInfo & mi, Dimension & dim) const
33 FracChanger dummy(mi.base);
35 dim.wid = max(cell(0).width(), cell(1).width()) + 4;
36 dim.asc = cell(1).ascent() + cell(0).height() + 4;
37 dim.des = cell(1).descent();
43 void InsetMathOverset::draw(PainterInfo & pi, int x, int y) const
45 int m = x + width() / 2;
46 int yo = y - cell(1).ascent() + cell(0).descent() - 1;
47 cell(1).draw(pi, m - cell(1).width() / 2, y);
48 FracChanger dummy(pi.base);
49 cell(0).draw(pi, m - cell(0).width() / 2, yo);
50 drawMarkers(pi, x, y);
54 bool InsetMathOverset::idxFirst(LCursor & cur) const
62 bool InsetMathOverset::idxLast(LCursor & cur) const
65 cur.pos() = cur.lastpos();
70 void InsetMathOverset::write(WriteStream & os) const
72 os << "\\overset{" << cell(0) << "}{" << cell(1) << '}';
76 void InsetMathOverset::normalize(NormalStream & os) const
78 os << "[overset " << cell(0) << ' ' << cell(1) << ']';
82 void InsetMathOverset::validate(LaTeXFeatures & features) const
84 features.require("amsmath");
85 InsetMathNest::validate(features);