]> git.lyx.org Git - lyx.git/blob - src/mathed/math_commentinset.C
Andreas' patch to prevent crash on click on previewd inset
[lyx.git] / src / mathed / math_commentinset.C
1 /**
2  * \file math_commentinset.C
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 "math_commentinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_support.h"
17 #include "support/std_ostream.h"
18
19 using std::string;
20 using std::auto_ptr;
21
22
23 MathCommentInset::MathCommentInset()
24         : MathNestInset(1)
25 {}
26
27
28 MathCommentInset::MathCommentInset(string const & str)
29         : MathNestInset(1)
30 {
31         asArray(str, cell(0));
32 }
33
34
35 auto_ptr<InsetBase> MathCommentInset::doClone() const
36 {
37         return auto_ptr<InsetBase>(new MathCommentInset(*this));
38 }
39
40
41 void MathCommentInset::metrics(MetricsInfo & mi, Dimension & dim) const
42 {
43         cell(0).metrics(mi, dim);
44         metricsMarkers(dim);
45         dim_ = dim;
46 }
47
48
49 void MathCommentInset::draw(PainterInfo & pi, int x, int y) const
50 {
51         cell(0).draw(pi, x + 1, y);
52         drawMarkers(pi, x, y);
53 }
54
55
56 void MathCommentInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
57 {
58         cell(0).metricsT(mi, dim);
59 }
60
61
62 void MathCommentInset::drawT(TextPainter & pain, int x, int y) const
63 {
64         cell(0).drawT(pain, x, y);
65 }
66
67
68 void MathCommentInset::write(WriteStream & os) const
69 {
70         os << '%' << cell(0) << "\n";
71 }
72
73
74 void MathCommentInset::maple(MapleStream & os) const
75 {
76         os << '#' << cell(0) << "\n";
77 }
78
79
80 void MathCommentInset::mathematica(MathematicaStream &) const
81 {}
82
83
84 void MathCommentInset::octave(OctaveStream &) const
85 {}
86
87
88 void MathCommentInset::mathmlize(MathMLStream & os) const
89 {
90         os << MTag("comment") << cell(0) << cell(1) << ETag("comment");
91 }
92
93
94 void MathCommentInset::infoize(std::ostream & os) const
95 {
96         os << "Comment";
97 }