]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathDiagram.cpp
The previous commit was actually a fix for bug #9158.
[lyx.git] / src / mathed / InsetMathDiagram.cpp
1 /**
2  * \file InsetMathDiagram.cpp
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  * \author Ronen Abravanel
8 *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetMathDiagram.h"
15
16 #include "MathStream.h"
17
18 #include "LaTeXFeatures.h"
19 #include "MetricsInfo.h"
20
21 #include <ostream>
22
23 namespace lyx {
24
25
26 InsetMathDiagram::InsetMathDiagram(Buffer * buf) : InsetMathGrid(buf, 1, 1)
27 {
28 }
29
30
31 Inset * InsetMathDiagram::clone() const
32 {
33         return new InsetMathDiagram(*this);
34 }
35
36
37 int InsetMathDiagram::colsep() const
38 {
39         return 10;
40 }
41
42
43 int InsetMathDiagram::rowsep() const
44 {
45         return 10;
46 }
47
48
49 void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
50 {
51         if (mi.base.style == LM_ST_DISPLAY)
52                 mi.base.style = LM_ST_TEXT;
53         InsetMathGrid::metrics(mi, dim);
54 }
55
56
57 void InsetMathDiagram::write(WriteStream & os) const
58 {
59         MathEnsurer ensurer(os);
60         os << "\\Diagram";
61         bool open = os.startOuterRow();
62         os << '{';
63         InsetMathGrid::write(os);
64         os << "}\n";
65         if (open)
66                 os.startOuterRow();
67 }
68
69
70 void InsetMathDiagram::infoize(odocstream & os) const
71 {
72         os << "Diagram ";
73         InsetMathGrid::infoize(os);
74 }
75
76
77 void InsetMathDiagram::normalize(NormalStream & os) const
78 {
79         os << "[Diagram ";
80         InsetMathGrid::normalize(os);
81         os << ']';
82 }
83
84
85 void InsetMathDiagram::maple(MapleStream & os) const
86 {
87         os << "Diagram(";
88         InsetMathGrid::maple(os);
89         os << ')';
90 }
91
92
93 void InsetMathDiagram::validate(LaTeXFeatures & features) const
94 {
95         features.require("feyn");
96         InsetMathGrid::validate(features);
97 }
98
99
100 } // namespace lyx