MathPhantom

Inheritance: java.lang.Object, com.aspose.slides.MathElementBase

All Implemented Interfaces: com.aspose.slides.IMathPhantom, com.aspose.slides.IHasControlCharacterProperties

public final class MathPhantom extends MathElementBase implements IMathPhantom, IHasControlCharacterProperties

Represents a phantom math object (<m:phant>) that affects the layout of its child element without necessarily displaying it. A phantom can hide its base expression while preserving its width, height, or depth to align formulas or reserve space. Visibility and geometry behavior are controlled by properties such as Show, ZeroWid, ZeroAsc, ZeroDesc, and Transp.


Example:
 
 IMathPhantom phantom = new MathPhantom(new MathematicalText("1/2"));
 phantom.setShow(false);          // Hide the content
 phantom.setZeroWidth(false);     // Keep the width

Constructors

ConstructorDescription
MathPhantom(IMathElement element)Initializes a new instance of the MathPhantom class using the specified base math element.

Methods

MethodDescription
getBase()Base argument
getShow()Gets or sets a value indicating whether the base element is displayed.
setShow(boolean value)Gets or sets a value indicating whether the base element is displayed.
getZeroWidth()Gets or sets a value indicating whether the width of the base element should be treated as zero.
setZeroWidth(boolean value)Gets or sets a value indicating whether the width of the base element should be treated as zero.
getZeroAsc()Gets or sets a value indicating whether the ascent (height above baseline) of the base element should be treated as zero.
setZeroAsc(boolean value)Gets or sets a value indicating whether the ascent (height above baseline) of the base element should be treated as zero.
getZeroDesc()Gets or sets a value indicating whether the descent (depth below baseline) of the base element should be treated as zero.
setZeroDesc(boolean value)Gets or sets a value indicating whether the descent (depth below baseline) of the base element should be treated as zero.
getTransp()Gets or sets a value indicating whether the phantom is transparent for class-based spacing rules.
setTransp(boolean value)Gets or sets a value indicating whether the phantom is transparent for class-based spacing rules.
getControlCharacterProperties()Control Character Properties
getChildren()Get children elements

MathPhantom(IMathElement element)

public MathPhantom(IMathElement element)

Initializes a new instance of the MathPhantom class using the specified base math element.


Example:
 
 IMathElement fraction = new MathFraction(
     new MathematicalText("1"),
     new MathematicalText("2"));

Parameters:

ParameterTypeDescription
elementIMathElementThe base IMathElement whose visibility and layout will be controlled by the phantom. This element defines the content that may be hidden or shown, while still affecting the geometric alignment of the surrounding math.

The phantom element is used to reserve or suppress the visual space of its base expression without necessarily displaying it. It corresponds to the OMML element <m:phant> . |

getBase()

public final IMathElement getBase()

Base argument


Example:
 
 MathPhantom mathBar = new MathPhantom(new MathematicalText("x"));
 IMathElement base = mathBar.getBase();

Returns: IMathElement

getShow()

public final boolean getShow()

Gets or sets a value indicating whether the base element is displayed.


When false, the base element is hidden but may still occupy space depending on other phantom settings. Corresponds to the OMML attribute m:show.

Returns: boolean

setShow(boolean value)

public final void setShow(boolean value)

Gets or sets a value indicating whether the base element is displayed.


When false, the base element is hidden but may still occupy space depending on other phantom settings. Corresponds to the OMML attribute m:show.

Parameters:

ParameterTypeDescription
valueboolean

getZeroWidth()

public final boolean getZeroWidth()

Gets or sets a value indicating whether the width of the base element should be treated as zero.


When true, the phantom does not reserve horizontal space for its base. Corresponds to the OMML attribute m:zeroWid.

Returns: boolean

setZeroWidth(boolean value)

public final void setZeroWidth(boolean value)

Gets or sets a value indicating whether the width of the base element should be treated as zero.


When true, the phantom does not reserve horizontal space for its base. Corresponds to the OMML attribute m:zeroWid.

Parameters:

ParameterTypeDescription
valueboolean

getZeroAsc()

public final boolean getZeroAsc()

Gets or sets a value indicating whether the ascent (height above baseline) of the base element should be treated as zero.


When true, the phantom does not raise the baseline of the surrounding math line. Corresponds to the OMML attribute m:zeroAsc.

Returns: boolean

setZeroAsc(boolean value)

public final void setZeroAsc(boolean value)

Gets or sets a value indicating whether the ascent (height above baseline) of the base element should be treated as zero.


When true, the phantom does not raise the baseline of the surrounding math line. Corresponds to the OMML attribute m:zeroAsc.

Parameters:

ParameterTypeDescription
valueboolean

getZeroDesc()

public final boolean getZeroDesc()

Gets or sets a value indicating whether the descent (depth below baseline) of the base element should be treated as zero.


When true, the phantom does not lower the baseline of the surrounding math line. Corresponds to the OMML attribute m:zeroDesc.

Returns: boolean

setZeroDesc(boolean value)

public final void setZeroDesc(boolean value)

Gets or sets a value indicating whether the descent (depth below baseline) of the base element should be treated as zero.


When true, the phantom does not lower the baseline of the surrounding math line. Corresponds to the OMML attribute m:zeroDesc.

Parameters:

ParameterTypeDescription
valueboolean

getTransp()

public final boolean getTransp()

Gets or sets a value indicating whether the phantom is transparent for class-based spacing rules.


When true, operators and symbols inside the phantom still affect mathematical spacing around the phantom (as if visible). When false, class-based spacing is ignored. Corresponds to the OMML attribute m:transp.

Returns: boolean

setTransp(boolean value)

public final void setTransp(boolean value)

Gets or sets a value indicating whether the phantom is transparent for class-based spacing rules.


When true, operators and symbols inside the phantom still affect mathematical spacing around the phantom (as if visible). When false, class-based spacing is ignored. Corresponds to the OMML attribute m:transp.

Parameters:

ParameterTypeDescription
valueboolean

getControlCharacterProperties()

public final OmmlControlCharacterPPTXUnsupportedProps getControlCharacterProperties()

Control Character Properties

Returns: com.aspose.slides.OmmlControlCharacterPPTXUnsupportedProps

getChildren()

public final IMathElement[] getChildren()

Get children elements

Returns: com.aspose.slides.IMathElement[]