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"
16 #include "MathStream.h"
17 #include "MathSupport.h"
18 #include "MetricsInfo.h"
20 #include "frontends/FontMetrics.h"
21 #include "frontends/Painter.h"
30 InsetMathBrace::InsetMathBrace(Buffer * buf)
31 : InsetMathNest(buf, 1)
35 InsetMathBrace::InsetMathBrace(MathData const & ar)
36 : InsetMathNest(const_cast<Buffer *>(ar.buffer()), 1)
42 Inset * InsetMathBrace::clone() const
44 return new InsetMathBrace(*this);
48 void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
51 cell(0).metrics(mi, dim0);
52 FontInfo font = mi.base.font;
53 augmentFont(font, "mathnormal");
54 Dimension t = theFontMetrics(font).dimension('{');
55 dim.asc = max(dim0.asc, t.asc);
56 dim.des = max(dim0.des, t.des);
57 dim.wid = dim0.width() + 2 * t.wid;
61 void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
63 FontInfo font = pi.base.font;
64 augmentFont(font, "mathnormal");
65 font.setShape(UP_SHAPE);
66 font.setColor(Color_latex);
67 Dimension t = theFontMetrics(font).dimension('{');
68 pi.pain.text(x, y, '{', font);
69 cell(0).draw(pi, x + t.wid, y);
70 Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
71 pi.pain.text(x + t.wid + dim0.width(), y, '}', font);
75 void InsetMathBrace::write(TeXMathStream & 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(MathMLStream & ms) const
101 ms << MTag("mrow") << cell(0) << ETag("mrow");
105 void InsetMathBrace::htmlize(HtmlStream & os) const
111 void InsetMathBrace::mathematica(MathematicaStream & os) const
117 void InsetMathBrace::infoize(odocstream & os) const
119 os << "Nested Block: ";