2 * \file InsetMathSubstack.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 "InsetMathSubstack.h"
15 #include "LaTeXFeatures.h"
17 #include "MathStream.h"
19 #include "FuncRequest.h"
20 #include "FuncStatus.h"
21 #include "support/gettext.h"
23 #include "support/lstrings.h"
31 using support::bformat
;
34 InsetMathSubstack::InsetMathSubstack(Buffer
* buf
)
35 : InsetMathGrid(buf
, 1, 1)
39 Inset
* InsetMathSubstack::clone() const
41 return new InsetMathSubstack(*this);
45 void InsetMathSubstack::metrics(MetricsInfo
& mi
, Dimension
& dim
) const
47 if (mi
.base
.style
== LM_ST_DISPLAY
) {
48 StyleChanger
dummy(mi
.base
, LM_ST_TEXT
);
49 InsetMathGrid::metrics(mi
, dim
);
51 InsetMathGrid::metrics(mi
, dim
);
56 void InsetMathSubstack::draw(PainterInfo
& pi
, int x
, int y
) const
58 InsetMathGrid::draw(pi
, x
+ 1, y
);
62 bool InsetMathSubstack::getStatus(Cursor
& cur
, FuncRequest
const & cmd
,
63 FuncStatus
& flag
) const
66 case LFUN_TABULAR_FEATURE
: {
67 string
const name
= "substack";
68 docstring
const & s
= cmd
.argument();
69 if (s
== "add-vline-left" || s
== "add-vline-right") {
71 from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
73 flag
.setEnabled(false);
76 return InsetMathGrid::getStatus(cur
, cmd
, flag
);
79 return InsetMathGrid::getStatus(cur
, cmd
, flag
);
84 void InsetMathSubstack::infoize(odocstream
& os
) const
90 void InsetMathSubstack::write(WriteStream
& os
) const
92 MathEnsurer
ensurer(os
);
94 InsetMathGrid::write(os
);
99 void InsetMathSubstack::normalize(NormalStream
& os
) const
102 InsetMathGrid::normalize(os
);
107 void InsetMathSubstack::maple(MapleStream
& os
) const
110 InsetMathGrid::maple(os
);
115 void InsetMathSubstack::validate(LaTeXFeatures
& features
) const
117 features
.require("amsmath");
118 InsetMathGrid::validate(features
);