Search in sources :

Example 21 with CTLineProperties

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

the class XSLFSimpleShape method setLineCompound.

/**
     * @param compound set the line compound style
     */
public void setLineCompound(LineCompound compound) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    if (compound == null) {
        if (ln.isSetCmpd()) {
            ln.unsetCmpd();
        }
    } else {
        STCompoundLine.Enum xCmpd;
        switch(compound) {
            default:
            case SINGLE:
                xCmpd = STCompoundLine.SNG;
                break;
            case DOUBLE:
                xCmpd = STCompoundLine.DBL;
                break;
            case THICK_THIN:
                xCmpd = STCompoundLine.THICK_THIN;
                break;
            case THIN_THICK:
                xCmpd = STCompoundLine.THIN_THICK;
                break;
            case TRIPLE:
                xCmpd = STCompoundLine.TRI;
                break;
        }
        ln.setCmpd(xCmpd);
    }
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) STCompoundLine(org.openxmlformats.schemas.drawingml.x2006.main.STCompoundLine)

Example 22 with CTLineProperties

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

the class XSLFSimpleShape method getLineHeadDecoration.

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

Example 23 with CTLineProperties

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

the class XSLFSimpleShape method setLineHeadDecoration.

/**
     * Specifies the line end decoration, such as a triangle or arrowhead.
     * 
     * @param style the line end docoration style
     */
public void setLineHeadDecoration(DecorationShape style) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    CTLineEndProperties lnEnd = ln.isSetHeadEnd() ? ln.getHeadEnd() : ln.addNewHeadEnd();
    if (style == null) {
        if (lnEnd.isSetType()) {
            lnEnd.unsetType();
        }
    } else {
        lnEnd.setType(STLineEndType.Enum.forInt(style.ooxmlId));
    }
}
Also used : CTLineEndProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties) CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 24 with CTLineProperties

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

the class XSLFSimpleShape method setLineHeadWidth.

/**
     * specifies decoration width of the head of a line.
     * 
     * @param style the decoration width 
     */
public void setLineHeadWidth(DecorationSize style) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    CTLineEndProperties lnEnd = ln.isSetHeadEnd() ? ln.getHeadEnd() : ln.addNewHeadEnd();
    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 25 with CTLineProperties

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

the class XSLFSimpleShape method setLineColor.

/**
    * @param color  the color to paint the shape outline.
     * A <code>null</code> value turns off the shape outline.
     */
public void setLineColor(Color color) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    if (ln.isSetSolidFill()) {
        ln.unsetSolidFill();
    }
    if (ln.isSetGradFill()) {
        ln.unsetGradFill();
    }
    if (ln.isSetPattFill()) {
        ln.unsetPattFill();
    }
    if (ln.isSetNoFill()) {
        ln.unsetNoFill();
    }
    if (color == null) {
        ln.addNewNoFill();
    } else {
        CTSolidColorFillProperties fill = ln.addNewSolidFill();
        XSLFColor col = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
        col.setColor(color);
    }
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)

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