]> git.lyx.org Git - features.git/blob - src/mathed/InsetMathEnsureMath.cpp
Introduce a return value for mathmlize(). We will need this to be able
[features.git] / src / mathed / InsetMathEnsureMath.cpp
1 /**
2  * \file InsetMathEnsureMath.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  * \author Enrico Forestieri
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetMathEnsureMath.h"
15
16 #include "MathExtern.h"
17 #include "MathData.h"
18 #include "MathStream.h"
19
20 #include <ostream>
21
22
23 namespace lyx {
24
25 InsetMathEnsureMath::InsetMathEnsureMath(Buffer * buf)
26         : InsetMathNest(buf, 1)
27 {}
28
29
30 Inset * InsetMathEnsureMath::clone() const
31 {
32         return new InsetMathEnsureMath(*this);
33 }
34
35
36 void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const
37 {
38         FontSetChanger dummy(mi.base, "mathnormal");
39         cell(0).metrics(mi, dim);
40         metricsMarkers(dim);
41 }
42
43
44 void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const
45 {
46         FontSetChanger dummy(pi.base, "mathnormal");
47         cell(0).draw(pi, x, y);
48         drawMarkers(pi, x, y);
49 }
50
51
52 void InsetMathEnsureMath::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
53 {
54         cell(0).metricsT(mi, dim);
55 }
56
57
58 void InsetMathEnsureMath::drawT(TextPainter & pain, int x, int y) const
59 {
60         cell(0).drawT(pain, x, y);
61 }
62
63
64 void InsetMathEnsureMath::write(WriteStream & os) const
65 {
66         ModeSpecifier specifier(os, MATH_MODE);
67         os << "\\ensuremath{" << cell(0) << "}";
68 }
69
70
71 docstring InsetMathEnsureMath::mathmlize(MathStream & os) const
72 {
73         return lyx::mathmlize(cell(0), os);
74 }
75
76
77 void InsetMathEnsureMath::infoize(odocstream & os) const
78 {
79         os << "EnsureMath";
80 }
81
82
83 } // namespace lyx