-#include <config.h>
+/**
+ * \file math_braceinset.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include <config.h>
#include "math_braceinset.h"
-#include "math_parser.h"
-#include "math_support.h"
+#include "math_data.h"
#include "math_mathmlstream.h"
+#include "math_support.h"
+#include "LColor.h"
+#include "support/std_ostream.h"
+
+using std::max;
+using std::auto_ptr;
MathBraceInset::MathBraceInset()
{}
-MathInset * MathBraceInset::clone() const
-{
- return new MathBraceInset(*this);
+MathBraceInset::MathBraceInset(MathArray const & ar)
+ : MathNestInset(1)
+{
+ cell(0) = ar;
}
-void MathBraceInset::metrics(MathMetricsInfo const & mi) const
+auto_ptr<InsetBase> MathBraceInset::clone() const
{
- xcell(0).metrics(mi);
- int a, d;
- mathed_char_dim(LM_TC_TEX, mi, '{', a, d, wid_);
- ascent_ = std::max(xcell(0).ascent(), a);
- descent_ = std::max(xcell(0).descent(), a);
- width_ = xcell(0).width() + 2 * wid_;
+ return auto_ptr<InsetBase>(new MathBraceInset(*this));
}
-void MathBraceInset::draw(Painter & pain, int x, int y) const
-{
- drawChar(pain, LM_TC_TEX, mi_, x, y, '{');
- xcell(0).draw(pain, x + wid_, y);
- drawChar(pain, LM_TC_TEX, mi_, x + width_ - wid_, y, '}');
+void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+ cell(0).metrics(mi);
+ Dimension t;
+ mathed_char_dim(mi.base.font, '{', t);
+ wid_ = t.wid;
+ dim_.asc = max(cell(0).ascent(), t.asc);
+ dim_.des = max(cell(0).descent(), t.des);
+ dim_.wid = cell(0).width() + 2 * wid_;
+ dim = dim_;
+}
+
+
+void MathBraceInset::draw(PainterInfo & pi, int x, int y) const
+{
+ LyXFont font = pi.base.font;
+ font.setColor(LColor::latex);
+ drawChar(pi, font, x, y, '{');
+ cell(0).draw(pi, x + wid_, y);
+ drawChar(pi, font, x + dim_.width() - wid_, y, '}');
}
}
+void MathBraceInset::maple(MapleStream & os) const
+{
+ os << cell(0);
+}
+
+
+void MathBraceInset::octave(OctaveStream & os) const
+{
+ os << cell(0);
+}
+
+
+void MathBraceInset::mathmlize(MathMLStream & os) const
+{
+ os << MTag("mrow") << cell(0) << ETag("mrow");
+}
+
+
+void MathBraceInset::mathematica(MathematicaStream & os) const
+{
+ os << cell(0);
+}
+
+
+void MathBraceInset::infoize(std::ostream & os) const
+{
+ os << "Nested Block: ";
+}