Search in sources :

Example 11 with CTLineProperties

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

the class XSLFSimpleShape method getLineHeadLength.

/**
     * @return the line end decoration length
     */
public DecorationSize getLineHeadLength() {
    CTLineProperties ln = getLn(this, false);
    DecorationSize ds = DecorationSize.MEDIUM;
    if (ln != null && ln.isSetHeadEnd() && ln.getHeadEnd().isSetLen()) {
        ds = DecorationSize.fromOoxmlId(ln.getHeadEnd().getLen().intValue());
    }
    return ds;
}
Also used : DecorationSize(org.apache.poi.sl.usermodel.LineDecoration.DecorationSize) CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 12 with CTLineProperties

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

the class XSLFSimpleShape method setLineHeadLength.

/**
     * Specifies the line end width in relation to the line width.
     */
public void setLineHeadLength(DecorationSize style) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    CTLineEndProperties lnEnd = ln.isSetHeadEnd() ? ln.getHeadEnd() : ln.addNewHeadEnd();
    if (style == null) {
        if (lnEnd.isSetLen()) {
            lnEnd.unsetLen();
        }
    } else {
        lnEnd.setLen(STLineEndLength.Enum.forInt(style.ooxmlId));
    }
}
Also used : CTLineEndProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties) CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 13 with CTLineProperties

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

the class XSLFSimpleShape method setLineTailWidth.

/**
     * specifies decorations which can be added to the tail of a line.
     */
public void setLineTailWidth(DecorationSize style) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    CTLineEndProperties lnEnd = ln.isSetTailEnd() ? ln.getTailEnd() : ln.addNewTailEnd();
    if (style == null) {
        if (lnEnd.isSetW()) {
            lnEnd.unsetW();
        }
    } else {
        lnEnd.setW(STLineEndWidth.Enum.forInt(style.ooxmlId));
    }
}
Also used : CTLineEndProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties) CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 14 with CTLineProperties

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

the class XSLFSimpleShape method getLineTailDecoration.

/**
     * @return the line end decoration shape
     */
public DecorationShape getLineTailDecoration() {
    CTLineProperties ln = getLn(this, false);
    DecorationShape ds = DecorationShape.NONE;
    if (ln != null && ln.isSetTailEnd() && ln.getTailEnd().isSetType()) {
        ds = DecorationShape.fromOoxmlId(ln.getTailEnd().getType().intValue());
    }
    return ds;
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) DecorationShape(org.apache.poi.sl.usermodel.LineDecoration.DecorationShape)

Example 15 with CTLineProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties 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)

Aggregations

CTLineProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)31 CTLineEndProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties)7 CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)6 PropertyFetcher (org.apache.poi.xslf.model.PropertyFetcher)5 CTSolidColorFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)5 DecorationSize (org.apache.poi.sl.usermodel.LineDecoration.DecorationSize)4 CTStyleMatrixReference (org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference)3 DrawPaint (org.apache.poi.sl.draw.DrawPaint)2 DecorationShape (org.apache.poi.sl.usermodel.LineDecoration.DecorationShape)2 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)2 XmlObject (org.apache.xmlbeans.XmlObject)2 CTPresetLineDashProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTPresetLineDashProperties)2 CTShapeStyle (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle)2 STCompoundLine (org.openxmlformats.schemas.drawingml.x2006.main.STCompoundLine)2 PackagePart (org.apache.poi.openxml4j.opc.PackagePart)1 PaintStyle (org.apache.poi.sl.usermodel.PaintStyle)1 LineCap (org.apache.poi.sl.usermodel.StrokeStyle.LineCap)1 LineDash (org.apache.poi.sl.usermodel.StrokeStyle.LineDash)1 XSLFFillProperties (org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties)1 CTBaseStyles (org.openxmlformats.schemas.drawingml.x2006.main.CTBaseStyles)1