Search in sources :

Example 6 with CTLineProperties

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

the class XSLFTableCell method setBorderCap.

public void setBorderCap(BorderEdge edge, LineCap cap) {
    if (cap == null) {
        throw new IllegalArgumentException("LineCap need to be specified.");
    }
    CTLineProperties ln = setBorderDefaults(edge);
    ln.setCap(STLineCap.Enum.forInt(cap.ooxmlId));
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 7 with CTLineProperties

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

the class XSLFTableCell method getBorderColor.

public Color getBorderColor(BorderEdge edge) {
    CTLineProperties ln = getCTLine(edge, false);
    if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill()) {
        return null;
    }
    CTSolidColorFillProperties fill = ln.getSolidFill();
    XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
    return c.getColor();
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)

Example 8 with CTLineProperties

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

the class XSLFSimpleShape method getLineCap.

/**
     *
     * @return the line end cap style
     */
public LineCap getLineCap() {
    PropertyFetcher<LineCap> fetcher = new PropertyFetcher<LineCap>() {

        @Override
        public boolean fetch(XSLFShape shape) {
            CTLineProperties ln = getLn(shape, false);
            if (ln != null && ln.isSetCap()) {
                setValue(LineCap.fromOoxmlId(ln.getCap().intValue()));
                return true;
            }
            return false;
        }
    };
    fetchShapeProperty(fetcher);
    LineCap cap = fetcher.getValue();
    if (cap == null) {
        CTLineProperties defaultLn = getDefaultLineProperties();
        if (defaultLn != null && defaultLn.isSetCap()) {
            cap = LineCap.fromOoxmlId(defaultLn.getCap().intValue());
        }
    }
    return cap;
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) PropertyFetcher(org.apache.poi.xslf.model.PropertyFetcher) LineCap(org.apache.poi.sl.usermodel.StrokeStyle.LineCap) STLineCap(org.openxmlformats.schemas.drawingml.x2006.main.STLineCap)

Example 9 with CTLineProperties

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

the class XSLFSimpleShape method getLineDash.

/**
     * @return  a preset line dashing scheme to stroke the shape outline
     */
public LineDash getLineDash() {
    PropertyFetcher<LineDash> fetcher = new PropertyFetcher<LineDash>() {

        @Override
        public boolean fetch(XSLFShape shape) {
            CTLineProperties ln = getLn(shape, false);
            if (ln == null || !ln.isSetPrstDash()) {
                return false;
            }
            setValue(LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue()));
            return true;
        }
    };
    fetchShapeProperty(fetcher);
    LineDash dash = fetcher.getValue();
    if (dash == null) {
        CTLineProperties defaultLn = getDefaultLineProperties();
        if (defaultLn != null && defaultLn.isSetPrstDash()) {
            dash = LineDash.fromOoxmlId(defaultLn.getPrstDash().getVal().intValue());
        }
    }
    return dash;
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) PropertyFetcher(org.apache.poi.xslf.model.PropertyFetcher) LineDash(org.apache.poi.sl.usermodel.StrokeStyle.LineDash)

Example 10 with CTLineProperties

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

the class XSLFSimpleShape method setLineTailDecoration.

/**
     * Specifies the line end decoration, such as a triangle or arrowhead.
     */
public void setLineTailDecoration(DecorationShape style) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    CTLineEndProperties lnEnd = ln.isSetTailEnd() ? ln.getTailEnd() : ln.addNewTailEnd();
    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)

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