Search in sources :

Example 1 with CTTableStyleCellStyle

use of org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyleCellStyle in project poi by apache.

the class XSLFTableCell method getFillPaint.

@SuppressWarnings("resource")
@Override
public PaintStyle getFillPaint() {
    XSLFSheet sheet = getSheet();
    XSLFTheme theme = sheet.getTheme();
    final boolean hasPlaceholder = getPlaceholder() != null;
    XmlObject props = getCellProperties(false);
    XSLFFillProperties fp = XSLFPropertiesDelegate.getFillDelegate(props);
    if (fp != null) {
        PaintStyle paint = selectPaint(fp, null, sheet.getPackagePart(), theme, hasPlaceholder);
        if (paint != null) {
            return paint;
        }
    }
    CTTablePartStyle tps = getTablePartStyle(null);
    if (tps == null || !tps.isSetTcStyle()) {
        tps = getTablePartStyle(TablePartStyle.wholeTbl);
        if (tps == null || !tps.isSetTcStyle()) {
            return null;
        }
    }
    XMLSlideShow slideShow = sheet.getSlideShow();
    CTTableStyleCellStyle tcStyle = tps.getTcStyle();
    if (tcStyle.isSetFill()) {
        props = tcStyle.getFill();
    } else if (tcStyle.isSetFillRef()) {
        props = tcStyle.getFillRef();
    } else {
        return null;
    }
    fp = XSLFPropertiesDelegate.getFillDelegate(props);
    if (fp != null) {
        PaintStyle paint = XSLFShape.selectPaint(fp, null, slideShow.getPackagePart(), theme, hasPlaceholder);
        if (paint != null) {
            return paint;
        }
    }
    return null;
}
Also used : CTTableStyleCellStyle(org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyleCellStyle) CTTablePartStyle(org.openxmlformats.schemas.drawingml.x2006.main.CTTablePartStyle) PaintStyle(org.apache.poi.sl.usermodel.PaintStyle) XmlObject(org.apache.xmlbeans.XmlObject) XSLFFillProperties(org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties)

Aggregations

PaintStyle (org.apache.poi.sl.usermodel.PaintStyle)1 XSLFFillProperties (org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties)1 XmlObject (org.apache.xmlbeans.XmlObject)1 CTTablePartStyle (org.openxmlformats.schemas.drawingml.x2006.main.CTTablePartStyle)1 CTTableStyleCellStyle (org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyleCellStyle)1