mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Introduce the InsetMathHull::outerDisplay method and use it
This commit is contained in:
parent
4065f596ad
commit
ab3e1ddc34
@ -2405,18 +2405,9 @@ void Paragraph::latex(BufferParams const & bparams,
|
||||
if (d->text_[i] == META_INSET
|
||||
&& i >= start_pos && (end_pos == -1 || i < end_pos)) {
|
||||
InsetMath const * im = getInset(i)->asInsetMath();
|
||||
if (im && im->asHullInset()) {
|
||||
switch (im->asHullInset()->getType()) {
|
||||
case hullEquation:
|
||||
case hullEqnArray:
|
||||
case hullAlign:
|
||||
case hullFlAlign:
|
||||
case hullGather:
|
||||
case hullMultline:
|
||||
runparams.inDisplayMath = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (im && im->asHullInset()
|
||||
&& im->asHullInset()->outerDisplay())
|
||||
runparams.inDisplayMath = true;
|
||||
}
|
||||
|
||||
column += Changes::latexMarkChange(os, bparams, runningChange,
|
||||
|
@ -898,6 +898,29 @@ bool InsetMathHull::ams() const
|
||||
}
|
||||
|
||||
|
||||
bool InsetMathHull::outerDisplay() const
|
||||
{
|
||||
switch (type_) {
|
||||
case hullEquation:
|
||||
case hullEqnArray:
|
||||
case hullAlign:
|
||||
case hullFlAlign:
|
||||
case hullGather:
|
||||
case hullMultline:
|
||||
return true;
|
||||
case hullNone:
|
||||
case hullSimple:
|
||||
case hullAlignAt:
|
||||
case hullXAlignAt:
|
||||
case hullXXAlignAt:
|
||||
case hullUnknown:
|
||||
case hullRegexp:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Inset::DisplayType InsetMathHull::display() const
|
||||
{
|
||||
switch (type_) {
|
||||
@ -953,26 +976,7 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
|
||||
if (ams())
|
||||
features.require("amsmath");
|
||||
|
||||
switch(type_) {
|
||||
case hullNone:
|
||||
case hullSimple:
|
||||
case hullAlignAt:
|
||||
case hullXAlignAt:
|
||||
case hullXXAlignAt:
|
||||
case hullUnknown:
|
||||
break;
|
||||
|
||||
case hullEquation:
|
||||
case hullEqnArray:
|
||||
case hullAlign:
|
||||
case hullFlAlign:
|
||||
case hullGather:
|
||||
case hullMultline:
|
||||
if (features.inDeletedInset() && !features.mustProvide("ct-dvipost"))
|
||||
features.require("ct-tikz-math-sout");
|
||||
break;
|
||||
|
||||
case hullRegexp:
|
||||
if (type_ == hullRegexp) {
|
||||
features.require("color");
|
||||
docstring frcol = from_utf8(lcolor.getLaTeXName(Color_regexpframe));
|
||||
docstring bgcol = from_ascii("white");
|
||||
@ -982,7 +986,9 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
|
||||
+ bgcol + "}{\\ensuremath{\\mathtt{#1}}}}");
|
||||
features.addPreambleSnippet(
|
||||
from_ascii("\\newcommand{\\endregexp}{}"));
|
||||
break;
|
||||
} else if (outerDisplay() && features.inDeletedInset()
|
||||
&& !features.mustProvide("ct-dvipost")) {
|
||||
features.require("ct-tikz-math-sout");
|
||||
}
|
||||
|
||||
// Validation is necessary only if not using AMS math.
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
///
|
||||
bool ams() const;
|
||||
///
|
||||
bool outerDisplay() const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
/// identifies HullInset
|
||||
InsetMathHull const * asHullInset() const { return this; }
|
||||
|
Loading…
Reference in New Issue
Block a user