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"
26 InsetMathBrace::InsetMathBrace()
31 InsetMathBrace::InsetMathBrace(MathData const & ar)
38 Inset * InsetMathBrace::clone() const
40 return new InsetMathBrace(*this);
44 void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
47 Dimension t = theFontMetrics(mi.base.font).dimension('{');
48 dim.asc = std::max(cell(0).ascent(), t.asc);
49 dim.des = std::max(cell(0).descent(), t.des);
50 dim.wid = cell(0).width() + 2 * t.wid;
52 // Cache the inset dimension.
57 void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
59 Font font = pi.base.font;
60 font.setColor(Color::latex);
61 Dimension t = theFontMetrics(font).dimension('{');
62 pi.pain.text(x, y, '{', font);
63 cell(0).draw(pi, x + t.wid, y);
64 pi.pain.text(x + t.wid + cell(0).width(), y, '}', font);
65 drawMarkers(pi, x, y);
69 void InsetMathBrace::write(WriteStream & os) const
71 os << '{' << cell(0) << '}';
75 void InsetMathBrace::normalize(NormalStream & os) const
77 os << "[block " << cell(0) << ']';
81 void InsetMathBrace::maple(MapleStream & os) const
87 void InsetMathBrace::octave(OctaveStream & os) const
93 void InsetMathBrace::mathmlize(MathStream & os) const
95 os << MTag("mrow") << cell(0) << ETag("mrow");
99 void InsetMathBrace::mathematica(MathematicaStream & os) const
105 void InsetMathBrace::infoize(odocstream & os) const
107 os << "Nested Block: ";