@Beta public abstract class XSLFShape extends java.lang.Object implements Shape<XSLFShape,XSLFTextParagraph>
Modifier and Type | Class and Description |
---|---|
static interface |
XSLFShape.ReparseFactory<T extends org.apache.xmlbeans.XmlObject> |
Modifier | Constructor and Description |
---|---|
protected |
XSLFShape(org.apache.xmlbeans.XmlObject shape,
XSLFSheet sheet) |
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics2D graphics,
java.awt.geom.Rectangle2D bounds)
Convenience method to draw a single shape
|
protected boolean |
fetchShapeProperty(PropertyFetcher<?> visitor)
Walk up the inheritance tree and fetch shape properties.
|
protected org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties |
getBgPr() |
protected org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference |
getBgRef() |
protected <T extends org.apache.xmlbeans.XmlObject> |
getChild(java.lang.Class<T> childClass,
java.lang.String namespace,
java.lang.String nodename)
Return direct child objects of this shape
|
protected org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps |
getCNvPr() |
protected PaintStyle |
getFillPaint() |
protected org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties |
getGrpSpPr() |
XSLFShapeContainer |
getParent() |
Placeholder |
getPlaceholder() |
XSLFPlaceholderDetails |
getPlaceholderDetails() |
int |
getShapeId()
Returns a unique identifier for this shape within the current slide.
|
java.lang.String |
getShapeName() |
protected org.apache.xmlbeans.XmlObject |
getShapeProperties()
Return the shape specific (visual) properties
|
XSLFSheet |
getSheet() |
protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle |
getSpStyle() |
org.apache.xmlbeans.XmlObject |
getXmlObject() |
boolean |
isPlaceholder() |
protected PaintStyle |
selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties blipFill,
PackagePart parentPart,
org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr,
XSLFTheme theme) |
protected PaintStyle |
selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTGradientFillProperties gradFill,
org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr,
XSLFTheme theme) |
protected PaintStyle |
selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties solidFill,
org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr,
XSLFTheme theme) |
protected PaintStyle |
selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference fillRef,
XSLFTheme theme,
boolean isLineStyle,
boolean hasPlaceholder) |
protected PaintStyle |
selectPaint(XSLFPropertiesDelegate.XSLFFillProperties fp,
org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr,
PackagePart parentPart,
XSLFTheme theme,
boolean hasPlaceholder)
Convert shape fill into java.awt.Paint.
|
protected <T extends org.apache.xmlbeans.XmlObject> |
selectProperty(java.lang.Class<T> resultClass,
java.lang.String xquery)
As there's no xmlbeans hierarchy, but XSLF works with subclassing, not all
child classes work with a
CTShape object, but often contain the same
properties. |
<T extends org.apache.xmlbeans.XmlObject> |
selectProperty(java.lang.Class<T> resultClass,
XSLFShape.ReparseFactory<T> factory,
javax.xml.namespace.QName[]... path)
Internal code - API may change any time!
|
void |
setParent(XSLFShapeContainer parent) |
void |
setPlaceholder(Placeholder placeholder) |
protected XSLFShape(org.apache.xmlbeans.XmlObject shape, XSLFSheet sheet)
public final org.apache.xmlbeans.XmlObject getXmlObject()
public XSLFSheet getSheet()
getSheet
in interface Shape<XSLFShape,XSLFTextParagraph>
public java.lang.String getShapeName()
getShapeName
in interface Shape<XSLFShape,XSLFTextParagraph>
public int getShapeId()
Shape
If multiple objects within the same slide share the same id attribute value, then the document shall be considered non-conformant.
getShapeId
in interface Shape<XSLFShape,XSLFTextParagraph>
public void setParent(XSLFShapeContainer parent)
public XSLFShapeContainer getParent()
getParent
in interface Shape<XSLFShape,XSLFTextParagraph>
protected PaintStyle getFillPaint()
protected org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties getBgPr()
protected org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference getBgRef()
protected org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties getGrpSpPr()
protected org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps getCNvPr()
protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle getSpStyle()
protected <T extends org.apache.xmlbeans.XmlObject> T getChild(java.lang.Class<T> childClass, java.lang.String namespace, java.lang.String nodename)
childClass
- the class to cast the properties tonamespace
- the namespace - usually it is "http://schemas.openxmlformats.org/presentationml/2006/main"
nodename
- the node name, without prefixpublic boolean isPlaceholder()
public Placeholder getPlaceholder()
PlaceholderDetails.getPlaceholder()
public void setPlaceholder(Placeholder placeholder)
public XSLFPlaceholderDetails getPlaceholderDetails()
SimpleShape.getPlaceholderDetails()
protected <T extends org.apache.xmlbeans.XmlObject> T selectProperty(java.lang.Class<T> resultClass, java.lang.String xquery)
CTShape
object, but often contain the same
properties. This method is the generalized form of selecting and casting those
properties.resultClass
- the requested result classxquery
- the simple (xmlbean) xpath expression to the property@Internal public <T extends org.apache.xmlbeans.XmlObject> T selectProperty(java.lang.Class<T> resultClass, XSLFShape.ReparseFactory<T> factory, javax.xml.namespace.QName[]... path) throws org.apache.xmlbeans.XmlException
The selectProperty(Class, String)
xquery method has some performance penalties,
which can be workaround by using XmlCursor
. This method also takes into account
that AlternateContent
tags can occur anywhere on the given path.
It returns the first element found - the search order is:
resultClass
- the requested result classfactory
- a factory parse method reference to allow reparsing of elements
extracted from AlternateContent elements. Usually the enclosing XmlBeans type needs to be used
to parse the streampath
- the elements path, each array must contain at least 1 QName,
but can contain additional alternative tagsorg.apache.xmlbeans.XmlException
- If factory is null, a XmlException is
thrown if the AlternateContent is not allowed by the surrounding element or if the
extracted object is of the generic type XmlAnyTypeImpl.protected boolean fetchShapeProperty(PropertyFetcher<?> visitor)
The following order of inheritance is assumed:
visitor
- the object that collects the desired propertyprotected PaintStyle selectPaint(XSLFPropertiesDelegate.XSLFFillProperties fp, org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr, PackagePart parentPart, XSLFTheme theme, boolean hasPlaceholder)
fp
- a properties handler specific to the underlying shape propertiesphClr
- context colorparentPart
- the parent package part. Any external references (images, etc.) are resolved relative to it.theme
- the theme for the shape/sheetprotected PaintStyle selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties solidFill, org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr, XSLFTheme theme)
protected PaintStyle selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties blipFill, PackagePart parentPart, org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr, XSLFTheme theme)
protected PaintStyle selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTGradientFillProperties gradFill, org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor phClr, XSLFTheme theme)
protected PaintStyle selectPaint(org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference fillRef, XSLFTheme theme, boolean isLineStyle, boolean hasPlaceholder)
public void draw(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D bounds)
Shape
draw
in interface Shape<XSLFShape,XSLFTextParagraph>
graphics
- the graphics contextbounds
- the rectangle to fit the shape to.
if null, the bounds of the shape are used.protected org.apache.xmlbeans.XmlObject getShapeProperties()
Copyright 2020 The Apache Software Foundation or its licensors, as applicable.