Search in sources :

Example 1 with CTBaseStyles

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

the class XSLFSimpleShape method getDefaultLineProperties.

/**
     * Get default line properties defined in the theme (if any).
     * Used internally to resolve shape properties.
     *
     * @return line properties from the theme of null
     */
CTLineProperties getDefaultLineProperties() {
    CTShapeStyle style = getSpStyle();
    if (style == null) {
        return null;
    }
    CTStyleMatrixReference lnRef = style.getLnRef();
    if (lnRef == null) {
        return null;
    }
    // 1-based index of a line style within the style matrix
    int idx = (int) lnRef.getIdx();
    XSLFTheme theme = getSheet().getTheme();
    if (theme == null) {
        return null;
    }
    CTBaseStyles styles = theme.getXmlObject().getThemeElements();
    if (styles == null) {
        return null;
    }
    CTStyleMatrix styleMatrix = styles.getFmtScheme();
    if (styleMatrix == null) {
        return null;
    }
    CTLineStyleList lineStyles = styleMatrix.getLnStyleLst();
    if (lineStyles == null || lineStyles.sizeOfLnArray() < idx) {
        return null;
    }
    return lineStyles.getLnArray(idx - 1);
}
Also used : CTStyleMatrix(org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrix) CTShapeStyle(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle) CTBaseStyles(org.openxmlformats.schemas.drawingml.x2006.main.CTBaseStyles) CTLineStyleList(org.openxmlformats.schemas.drawingml.x2006.main.CTLineStyleList) CTStyleMatrixReference(org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference) DrawPaint(org.apache.poi.sl.draw.DrawPaint) SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)

Example 2 with CTBaseStyles

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

the class XSLFTheme method initialize.

private void initialize() {
    CTBaseStyles elems = _theme.getThemeElements();
    CTColorScheme scheme = elems.getClrScheme();
    // The color scheme is responsible for defining a list of twelve colors. 
    _schemeColors = new HashMap<String, CTColor>(12);
    for (XmlObject o : scheme.selectPath("*")) {
        CTColor c = (CTColor) o;
        String name = c.getDomNode().getLocalName();
        _schemeColors.put(name, c);
    }
}
Also used : CTColorScheme(org.openxmlformats.schemas.drawingml.x2006.main.CTColorScheme) CTBaseStyles(org.openxmlformats.schemas.drawingml.x2006.main.CTBaseStyles) XmlObject(org.apache.xmlbeans.XmlObject) CTColor(org.openxmlformats.schemas.drawingml.x2006.main.CTColor)

Aggregations

CTBaseStyles (org.openxmlformats.schemas.drawingml.x2006.main.CTBaseStyles)2 DrawPaint (org.apache.poi.sl.draw.DrawPaint)1 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)1 XmlObject (org.apache.xmlbeans.XmlObject)1 CTColor (org.openxmlformats.schemas.drawingml.x2006.main.CTColor)1 CTColorScheme (org.openxmlformats.schemas.drawingml.x2006.main.CTColorScheme)1 CTLineStyleList (org.openxmlformats.schemas.drawingml.x2006.main.CTLineStyleList)1 CTShapeStyle (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle)1 CTStyleMatrix (org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrix)1 CTStyleMatrixReference (org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference)1