]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathComment.cpp
Modify string list in place instead of copying it
[lyx.git] / src / mathed / InsetMathComment.cpp
1 /**
2  * \file InsetMathComment.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  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathComment.h"
14
15 #include "MathData.h"
16 #include "MathStream.h"
17 #include "MathSupport.h"
18
19 #include "frontends/Painter.h"
20
21 #include "MetricsInfo.h"
22
23 #include <ostream>
24
25
26 namespace lyx {
27
28 InsetMathComment::InsetMathComment(Buffer * buf)
29         : InsetMathNest(buf, 1)
30 {}
31
32
33 InsetMathComment::InsetMathComment(MathData const & ar)
34         : InsetMathNest(const_cast<Buffer *>(ar.buffer()), 1)
35 {
36         cell(0) = ar;
37 }
38
39
40 InsetMathComment::InsetMathComment(Buffer * buf, docstring const & str)
41         : InsetMathNest(buf, 1)
42 {
43         // FIXME UNICODE
44         asArray(str, cell(0));
45 }
46
47
48 Inset * InsetMathComment::clone() const
49 {
50         return new InsetMathComment(*this);
51 }
52
53
54 void InsetMathComment::metrics(MetricsInfo & mi, Dimension & dim) const
55 {
56         cell(0).metrics(mi, dim);
57 }
58
59
60 void InsetMathComment::draw(PainterInfo & pi, int x, int y) const
61 {
62         Dimension const & dim = dimension(*pi.base.bv);
63         pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.height(), Color_notebg);
64         cell(0).draw(pi, x, y);
65 }
66
67
68 void InsetMathComment::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
69 {
70         cell(0).metricsT(mi, dim);
71 }
72
73
74 void InsetMathComment::drawT(TextPainter & pain, int x, int y) const
75 {
76         cell(0).drawT(pain, x, y);
77 }
78
79
80 void InsetMathComment::write(TeXMathStream & os) const
81 {
82         os << '%' << cell(0) << "\n";
83 }
84
85
86 void InsetMathComment::maple(MapleStream & os) const
87 {
88         os << '#' << cell(0) << "\n";
89 }
90
91
92 void InsetMathComment::mathmlize(MathMLStream & ms) const
93 {
94         ms << MTag("comment") << cell(0) << ETag("comment");
95 }
96
97
98 void InsetMathComment::htmlize(HtmlStream & os) const
99 {
100         os << "<!-- " << cell(0) << " -->";
101 }
102
103
104 void InsetMathComment::infoize(odocstream & os) const
105 {
106         os << "Comment";
107 }
108
109
110 } // namespace lyx