]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathBox.h
b68280aaacf7ae60e3d9d2a8e5f8f16f9228d5bf
[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 #include <string>
18
19
20 namespace lyx {
21
22 /// Support for \\mbox
23 class InsetMathBox : public InsetMathNest {
24 public:
25         ///
26         explicit InsetMathBox(docstring const & name);
27         ///
28         mode_type currentMode() const { return TEXT_MODE; }
29         ///
30         void metrics(MetricsInfo & mi, Dimension & dim) const;
31         ///
32         void draw(PainterInfo & pi, int x, int y) const;
33         ///
34         void write(WriteStream & os) const;
35         ///
36         void normalize(NormalStream & ns) const;
37         ///
38         void infoize(odocstream & os) const;
39
40 private:
41         Inset * clone() const { return new InsetMathBox(*this); }
42         ///
43         docstring name_;
44 };
45
46
47 /// Non-AMS-style frame
48 class InsetMathFBox : public InsetMathNest {
49 public:
50         ///
51         InsetMathFBox();
52         ///
53         mode_type currentMode() const { return TEXT_MODE; }
54         ///
55         void metrics(MetricsInfo & mi, Dimension & dim) const;
56         ///
57         void draw(PainterInfo & pi, int x, int y) const;
58         ///
59         void write(WriteStream & os) const;
60         /// write normalized content
61         void normalize(NormalStream & ns) const;
62         ///
63         void infoize(odocstream & os) const;
64 private:
65         ///
66         Inset * clone() const { return new InsetMathFBox(*this); }
67 };
68
69
70 /// Extra nesting
71 class InsetMathFrameBox : public InsetMathNest {
72 public:
73         ///
74         InsetMathFrameBox();
75         ///
76         void metrics(MetricsInfo & mi, Dimension & dim) const;
77         ///
78         void draw(PainterInfo & pi, int x, int y) const;
79         ///
80         void write(WriteStream & os) const;
81         /// write normalized content
82         void normalize(NormalStream & ns) const;
83         ///
84         mode_type currentMode() const { return TEXT_MODE; }
85 private:
86         Inset * clone() const { return new InsetMathFrameBox(*this); }
87 };
88
89
90 /// Extra nesting: \\makebox.
91 // consolidate with InsetMathFrameBox?
92 class InsetMathMakebox : public InsetMathNest {
93 public:
94         ///
95         InsetMathMakebox();
96         ///
97         void metrics(MetricsInfo & mi, Dimension & dim) const;
98         ///
99         void draw(PainterInfo & pi, int x, int y) const;
100         ///
101         void write(WriteStream & os) const;
102         /// write normalized content
103         void normalize(NormalStream & ns) const;
104         ///
105         mode_type currentMode() const { return TEXT_MODE; }
106         ///
107         void infoize(odocstream & os) const;
108 private:
109         Inset * clone() const { return new InsetMathMakebox(*this); }
110         /// width of '[' in current font
111         mutable int w_;
112 };
113
114
115
116 /// AMS-style frame
117 class InsetMathBoxed : public InsetMathNest {
118 public:
119         ///
120         InsetMathBoxed();
121         ///
122         void validate(LaTeXFeatures & features) const;
123         ///
124         void metrics(MetricsInfo & mi, Dimension & dim) const;
125         ///
126         void draw(PainterInfo & pi, int x, int y) const;
127         ///
128         void write(WriteStream & os) const;
129         /// write normalized content
130         void normalize(NormalStream & ns) const;
131         ///
132         void infoize(odocstream & os) const;
133 private:
134         Inset * clone() const { return new InsetMathBoxed(*this); }
135 };
136
137
138 } // namespace lyx
139
140 #endif // MATH_MBOX