2 * \file math_xarrowinset.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 "math_xarrowinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
17 #include "math_support.h"
19 #include "LaTeXFeatures.h"
25 MathXArrowInset::MathXArrowInset(string const & name)
26 : MathFracbaseInset(), name_(name)
30 auto_ptr<InsetBase> MathXArrowInset::doClone() const
32 return auto_ptr<InsetBase>(new MathXArrowInset(*this));
36 void MathXArrowInset::metrics(MetricsInfo & mi, Dimension & dim) const
38 ScriptChanger dummy(mi.base);
41 dim.wid = std::max(cell(0).width(), cell(1).width()) + 10;
42 dim.asc = cell(0).height() + 10;
43 dim.des = cell(1).height();
49 void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const
51 ScriptChanger dummy(pi.base);
52 cell(0).draw(pi, x + 5, y - 10);
53 cell(1).draw(pi, x + 5, y + cell(1).height());
54 mathed_draw_deco(pi, x + 1, y - 7, width() - 2, 5, name_);
55 drawMarkers(pi, x, y);
59 void MathXArrowInset::write(WriteStream & os) const
63 os << '[' << cell(1) << ']';
64 os << '{' << cell(0) << '}';
68 void MathXArrowInset::normalize(NormalStream & os) const
70 os << "[xarrow " << name_ << ' ' << cell(0) << ' ' << cell(1) << ']';
74 void MathXArrowInset::validate(LaTeXFeatures & features) const
76 features.require("amsmath");
77 MathNestInset::validate(features);