]> git.lyx.org Git - lyx.git/blob - src/mathed/math_substackinset.C
Fix math cursor positioning bug
[lyx.git] / src / mathed / math_substackinset.C
1 /**
2  * \file math_substackinset.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 "LaTeXFeatures.h"
14 #include "math_substackinset.h"
15 #include "math_data.h"
16 #include "math_mathmlstream.h"
17 #include "support/std_ostream.h"
18
19 using std::auto_ptr;
20
21
22 MathSubstackInset::MathSubstackInset()
23         : MathGridInset(1, 1)
24 {}
25
26
27 auto_ptr<InsetBase> MathSubstackInset::doClone() const
28 {
29         return auto_ptr<InsetBase>(new MathSubstackInset(*this));
30 }
31
32
33 void MathSubstackInset::metrics(MetricsInfo & mi, Dimension & dim) const
34 {
35         if (mi.base.style == LM_ST_DISPLAY) {
36                 StyleChanger dummy(mi.base, LM_ST_TEXT);
37                 MathGridInset::metrics(mi, dim);
38         } else {
39                 MathGridInset::metrics(mi, dim);
40         }
41         dim_ = dim;
42 }
43
44
45 void MathSubstackInset::draw(PainterInfo & pi, int x, int y) const
46 {
47         MathGridInset::draw(pi, x + 1, y);
48 }
49
50
51 void MathSubstackInset::infoize(std::ostream & os) const
52 {
53         os << "Substack ";
54 }
55
56
57 void MathSubstackInset::write(WriteStream & os) const
58 {
59         os << "\\substack{";
60         MathGridInset::write(os);
61         os << "}\n";
62 }
63
64
65 void MathSubstackInset::normalize(NormalStream & os) const
66 {
67         os << "[substack ";
68         MathGridInset::normalize(os);
69         os << ']';
70 }
71
72
73 void MathSubstackInset::maple(MapleStream & os) const
74 {
75         os << "substack(";
76         MathGridInset::maple(os);
77         os << ')';
78 }
79
80
81 void MathSubstackInset::validate(LaTeXFeatures & features) const
82 {
83         features.require("amsmath");
84         MathGridInset::validate(features);
85 }