use of org.openxmlformats.schemas.drawingml.x2006.main.CTEffectStyleItem in project poi by apache.
the class XSLFSimpleShape method getShadow.
/**
* @return shadow of this shape or null if shadow is disabled
*/
@Override
public XSLFShadow getShadow() {
PropertyFetcher<CTOuterShadowEffect> fetcher = new PropertyFetcher<CTOuterShadowEffect>() {
@Override
public boolean fetch(XSLFShape shape) {
XSLFEffectProperties ep = XSLFPropertiesDelegate.getEffectDelegate(shape.getShapeProperties());
if (ep != null && ep.isSetEffectLst()) {
CTOuterShadowEffect obj = ep.getEffectLst().getOuterShdw();
setValue(obj == null ? NO_SHADOW : obj);
return true;
}
return false;
}
};
fetchShapeProperty(fetcher);
CTOuterShadowEffect obj = fetcher.getValue();
if (obj == null) {
// fill color was not found, check if it is defined in the theme
CTShapeStyle style = getSpStyle();
if (style != null && style.getEffectRef() != null) {
// 1-based index of a shadow style within the style matrix
int idx = (int) style.getEffectRef().getIdx();
if (idx != 0) {
CTStyleMatrix styleMatrix = getSheet().getTheme().getXmlObject().getThemeElements().getFmtScheme();
CTEffectStyleItem ef = styleMatrix.getEffectStyleLst().getEffectStyleArray(idx - 1);
obj = ef.getEffectLst().getOuterShdw();
}
}
}
return (obj == null || obj == NO_SHADOW) ? null : new XSLFShadow(obj, this);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTEffectStyleItem in project poi by apache.
the class TestXSLFSimpleShape method testShadowEffects.
@SuppressWarnings("unused")
@Test
public void testShadowEffects() throws IOException {
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();
CTStyleMatrix styleMatrix = slide.getTheme().getXmlObject().getThemeElements().getFmtScheme();
CTEffectStyleList lst = styleMatrix.getEffectStyleLst();
assertNotNull(lst);
for (CTEffectStyleItem ef : lst.getEffectStyleArray()) {
CTOuterShadowEffect obj = ef.getEffectLst().getOuterShdw();
}
ppt.close();
}
Aggregations