]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathBox.h
Give inset codes to all the math insets, so we get more information when
[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         void validate(LaTeXFeatures & features) const;
41         ///
42         InsetCode lyxCode() const { return MATH_BOX_CODE; }
43
44 private:
45         Inset * clone() const { return new InsetMathBox(*this); }
46         ///
47         docstring name_;
48 };
49
50
51 /// Non-AMS-style frame
52 class InsetMathFBox : public InsetMathNest {
53 public:
54         ///
55         InsetMathFBox();
56         ///
57         mode_type currentMode() const { return TEXT_MODE; }
58         ///
59         void metrics(MetricsInfo & mi, Dimension & dim) const;
60         ///
61         void draw(PainterInfo & pi, int x, int y) const;
62         ///
63         void write(WriteStream & os) const;
64         /// write normalized content
65         void normalize(NormalStream & ns) const;
66         ///
67         void infoize(odocstream & os) const;
68 private:
69         ///
70         Inset * clone() const { return new InsetMathFBox(*this); }
71 };
72
73
74 /// Extra nesting: \\makebox or \\framebox.
75 class InsetMathMakebox : public InsetMathNest {
76 public:
77         ///
78         InsetMathMakebox(bool framebox);
79         ///
80         void metrics(MetricsInfo & mi, Dimension & dim) const;
81         ///
82         void draw(PainterInfo & pi, int x, int y) const;
83         ///
84         void write(WriteStream & os) const;
85         /// write normalized content
86         void normalize(NormalStream & ns) const;
87         ///
88         mode_type currentMode() const { return TEXT_MODE; }
89         ///
90         void infoize(odocstream & os) const;
91 private:
92         Inset * clone() const { return new InsetMathMakebox(*this); }
93         ///
94         bool framebox_;
95 };
96
97
98
99 /// AMS-style frame
100 class InsetMathBoxed : public InsetMathNest {
101 public:
102         ///
103         InsetMathBoxed();
104         ///
105         void validate(LaTeXFeatures & features) const;
106         ///
107         void metrics(MetricsInfo & mi, Dimension & dim) const;
108         ///
109         void draw(PainterInfo & pi, int x, int y) const;
110         ///
111         void write(WriteStream & os) const;
112         /// write normalized content
113         void normalize(NormalStream & ns) const;
114         ///
115         void infoize(odocstream & os) const;
116 private:
117         Inset * clone() const { return new InsetMathBoxed(*this); }
118 };
119
120
121 } // namespace lyx
122
123 #endif // MATH_MBOX