2 * \file InsetMathXYMatrix.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathXYMatrix.h"
15 #include "MathStream.h"
17 #include "LaTeXFeatures.h"
18 #include "MetricsInfo.h"
25 InsetMathXYMatrix::InsetMathXYMatrix(Buffer * buf, Length const & s, char c,
26 bool e) : InsetMathGrid(buf, 1, 1), spacing_(s), spacing_code_(c),
32 Inset * InsetMathXYMatrix::clone() const
34 return new InsetMathXYMatrix(*this);
38 int InsetMathXYMatrix::colsep() const
44 int InsetMathXYMatrix::rowsep() const
50 void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
52 FontInfo & f = mi.base.font;
53 Changer dummy = f.changeStyle(LM_ST_TEXT, f.style() == LM_ST_DISPLAY);
54 InsetMathGrid::metrics(mi, dim);
58 void InsetMathXYMatrix::draw(PainterInfo & pi, int x, int y) const
60 setPosCache(pi, x, y);
61 FontInfo & f = pi.base.font;
62 Changer dummy = f.changeStyle(LM_ST_TEXT, f.style() == LM_ST_DISPLAY);
63 InsetMathGrid::draw(pi, x, y);
67 void InsetMathXYMatrix::write(WriteStream & os) const
69 MathEnsurer ensurer(os);
71 bool open = os.startOuterRow();
74 switch (spacing_code_) {
81 switch (spacing_code_) {
88 os << '@' << spacing_code_ << '='
89 << from_ascii(spacing_.asLatexString());
92 if (!spacing_.empty())
93 os << "@=" << from_ascii(spacing_.asLatexString());
97 InsetMathGrid::write(os);
105 void InsetMathXYMatrix::infoize(odocstream & os) const
108 if (equal_spacing_) {
109 switch (spacing_code_) {
113 os << '!' << spacing_code_ << ' ';
116 switch (spacing_code_) {
123 os << spacing_code_ << ' '
124 << from_ascii(spacing_.asLatexString()) << ' ';
127 if (!spacing_.empty())
128 os << from_ascii(spacing_.asLatexString()) << ' ';
131 InsetMathGrid::infoize(os);
135 void InsetMathXYMatrix::normalize(NormalStream & os) const
138 InsetMathGrid::normalize(os);
143 void InsetMathXYMatrix::maple(MapleStream & os) const
146 InsetMathGrid::maple(os);
151 void InsetMathXYMatrix::validate(LaTeXFeatures & features) const
153 features.require("xy");
154 InsetMathGrid::validate(features);
158 void InsetMathXYMatrix::mathmlize(MathStream &) const
160 throw MathExportException();
164 void InsetMathXYMatrix::htmlize(HtmlStream &) const
166 throw MathExportException();