A bit more re-organization.
[lyx.git] / src / mathed / InsetMathBoldSymbol.cpp
blob7382dc4dae30eaf6d1c927369cb789ba734a9f72
1 /**
2 * \file InsetMathBoldSymbol.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author André Pönitz
8 * Full author contact details are available in file CREDITS.
9 */
11 #include <config.h>
13 #include "InsetMathBoldSymbol.h"
15 #include "MathStream.h"
16 #include "MathData.h"
17 #include "LaTeXFeatures.h"
19 #include <ostream>
22 namespace lyx {
24 InsetMathBoldSymbol::InsetMathBoldSymbol(Buffer * buf, Kind kind)
25 : InsetMathNest(buf, 1), kind_(kind)
29 Inset * InsetMathBoldSymbol::clone() const
31 return new InsetMathBoldSymbol(*this);
35 docstring InsetMathBoldSymbol::name() const
37 switch (kind_) {
38 case AMS_BOLD:
39 return from_ascii("boldsymbol");
40 case BM_BOLD:
41 return from_ascii("bm");
42 case BM_HEAVY:
43 return from_ascii("hm");
45 // avoid compiler warning
46 return docstring();
50 void InsetMathBoldSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
52 //FontSetChanger dummy(mi.base, "mathbf");
53 cell(0).metrics(mi, dim);
54 metricsMarkers(dim);
55 ++dim.wid; // for 'double stroke'
59 void InsetMathBoldSymbol::draw(PainterInfo & pi, int x, int y) const
61 //FontSetChanger dummy(pi.base, "mathbf");
62 cell(0).draw(pi, x + 1, y);
63 cell(0).draw(pi, x + 2, y);
64 drawMarkers(pi, x, y);
68 void InsetMathBoldSymbol::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
70 // FIXME: BROKEN!
71 Dimension dim;
72 cell(0).metricsT(mi, dim);
76 void InsetMathBoldSymbol::drawT(TextPainter & pain, int x, int y) const
78 cell(0).drawT(pain, x, y);
82 void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const
84 InsetMathNest::validate(features);
85 if (kind_ == AMS_BOLD)
86 features.require("amsbsy");
87 else
88 features.require("bm");
92 void InsetMathBoldSymbol::write(WriteStream & os) const
94 MathEnsurer ensurer(os);
95 switch (kind_) {
96 case AMS_BOLD:
97 os << "\\boldsymbol{" << cell(0) << "}";
98 break;
99 case BM_BOLD:
100 os << "\\bm{" << cell(0) << "}";
101 break;
102 case BM_HEAVY:
103 os << "\\hm{" << cell(0) << "}";
104 break;
109 void InsetMathBoldSymbol::infoize(odocstream & os) const
111 switch (kind_) {
112 case AMS_BOLD:
113 os << "Boldsymbol ";
114 break;
115 case BM_BOLD:
116 os << "Boldsymbol (bm)";
117 break;
118 case BM_HEAVY:
119 os << "Heavysymbol (bm)";
120 break;
125 } // namespace lyx