2 * \file InsetMathBrace.cpp
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 "InsetMathBrace.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
19 #include "frontends/FontMetrics.h"
20 #include "frontends/Painter.h"
22 #include "support/std_ostream.h"
30 InsetMathBrace::InsetMathBrace()
35 InsetMathBrace::InsetMathBrace(MathArray const & ar)
42 auto_ptr<InsetBase> InsetMathBrace::doClone() const
44 return auto_ptr<InsetBase>(new InsetMathBrace(*this));
48 bool InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
51 Dimension t = theFontMetrics(mi.base.font).dimension('{');
52 dim.asc = max(cell(0).ascent(), t.asc);
53 dim.des = max(cell(0).descent(), t.des);
54 dim.wid = cell(0).width() + 2 * t.wid;
63 void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
65 LyXFont font = pi.base.font;
66 font.setColor(LColor::latex);
67 Dimension t = theFontMetrics(font).dimension('{');
68 pi.pain.text(x, y, '{', font);
69 cell(0).draw(pi, x + t.wid, y);
70 pi.pain.text(x + t.wid + cell(0).width(), y, '}', font);
71 drawMarkers(pi, x, y);
75 void InsetMathBrace::write(WriteStream & os) const
77 os << '{' << cell(0) << '}';
81 void InsetMathBrace::normalize(NormalStream & os) const
83 os << "[block " << cell(0) << ']';
87 void InsetMathBrace::maple(MapleStream & os) const
93 void InsetMathBrace::octave(OctaveStream & os) const
99 void InsetMathBrace::mathmlize(MathStream & os) const
101 os << MTag("mrow") << cell(0) << ETag("mrow");
105 void InsetMathBrace::mathematica(MathematicaStream & os) const
111 void InsetMathBrace::infoize(odocstream & os) const
113 os << "Nested Block: ";