]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathBox.h
Fix bug #12772
[lyx.git] / src / mathed / InsetMathBox.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathBox.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef MATH_BOXINSET_H
13 #define MATH_BOXINSET_H
14
15 #include "InsetMathNest.h"
16
17
18 namespace lyx {
19
20 /// Support for \\mbox
21 class InsetMathBox : public InsetMathNest {
22 public:
23         ///
24         explicit InsetMathBox(Buffer * buf, docstring const & name);
25         ///
26         mode_type currentMode() const override { return TEXT_MODE; }
27         ///
28         void metrics(MetricsInfo & mi, Dimension & dim) const override;
29         ///
30         void draw(PainterInfo & pi, int x, int y) const override;
31         ///
32         void write(TeXMathStream & os) const override;
33         ///
34         void normalize(NormalStream & ns) const override;
35         ///
36         void mathmlize(MathMLStream & ms) const override;
37         ///
38         void htmlize(HtmlStream & ms) const override;
39         ///
40         void infoize(odocstream & os) const override;
41         ///
42         void validate(LaTeXFeatures & features) const override;
43         ///
44         InsetCode lyxCode() const override { return MATH_BOX_CODE; }
45
46 private:
47         Inset * clone() const override { return new InsetMathBox(*this); }
48         ///
49         docstring name_;
50 };
51
52
53 /// Non-AMS-style frame
54 class InsetMathFBox : public InsetMathNest {
55 public:
56         ///
57         explicit InsetMathFBox(Buffer * buf);
58         ///
59         mode_type currentMode() const override { return TEXT_MODE; }
60         ///
61         marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; }
62         ///
63         void metrics(MetricsInfo & mi, Dimension & dim) const override;
64         ///
65         void draw(PainterInfo & pi, int x, int y) const override;
66         ///
67         void write(TeXMathStream & os) const override;
68         /// write normalized content
69         void normalize(NormalStream & ns) const override;
70         ///
71         void mathmlize(MathMLStream & ms) const override;
72         ///
73         void htmlize(HtmlStream & ms) const override;
74         ///
75         void infoize(odocstream & os) const override;
76         ///
77         void validate(LaTeXFeatures & features) const override;
78 private:
79         ///
80         Inset * clone() const override { return new InsetMathFBox(*this); }
81 };
82
83
84 /// Extra nesting: \\makebox or \\framebox.
85 class InsetMathMakebox : public InsetMathNest {
86 public:
87         ///
88         InsetMathMakebox(Buffer * buf, bool framebox);
89         ///
90         void metrics(MetricsInfo & mi, Dimension & dim) const override;
91         ///
92         void draw(PainterInfo & pi, int x, int y) const override;
93         ///
94         void write(TeXMathStream & os) const override;
95         /// write normalized content
96         void normalize(NormalStream & ns) const override;
97         ///
98         void mathmlize(MathMLStream & ms) const override;
99         ///
100         void htmlize(HtmlStream & ms) const override;
101         ///
102         mode_type currentMode() const override { return TEXT_MODE; }
103         ///
104         void infoize(odocstream & os) const override;
105         ///
106         void validate(LaTeXFeatures & features) const override;
107 private:
108         Inset * clone() const override { return new InsetMathMakebox(*this); }
109         ///
110         bool framebox_;
111 };
112
113
114
115 /// AMS-style frame
116 class InsetMathBoxed : public InsetMathNest {
117 public:
118         ///
119         explicit InsetMathBoxed(Buffer * buf);
120         ///
121         marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; }
122         ///
123         void validate(LaTeXFeatures & features) const override;
124         ///
125         void metrics(MetricsInfo & mi, Dimension & dim) const override;
126         ///
127         void draw(PainterInfo & pi, int x, int y) const override;
128         ///
129         void write(TeXMathStream & os) const override;
130         ///
131         void mathmlize(MathMLStream & ms) const override;
132         ///
133         void htmlize(HtmlStream & ms) const override;
134         /// write normalized content
135         void normalize(NormalStream & ns) const override;
136         ///
137         void infoize(odocstream & os) const override;
138 private:
139         Inset * clone() const override { return new InsetMathBoxed(*this); }
140 };
141
142
143 } // namespace lyx
144
145 #endif // MATH_MBOX