Search in sources :

Example 1 with CTLineProperties

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

the class XSLFConnectorShape method prototype.

/**
     * @param shapeId 1-based shapeId
     */
static CTConnector prototype(int shapeId) {
    CTConnector ct = CTConnector.Factory.newInstance();
    CTConnectorNonVisual nvSpPr = ct.addNewNvCxnSpPr();
    CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
    cnv.setName("Connector " + shapeId);
    cnv.setId(shapeId + 1);
    nvSpPr.addNewCNvCxnSpPr();
    nvSpPr.addNewNvPr();
    CTShapeProperties spPr = ct.addNewSpPr();
    CTPresetGeometry2D prst = spPr.addNewPrstGeom();
    prst.setPrst(STShapeType.LINE);
    prst.addNewAvLst();
    /* CTLineProperties ln = */
    spPr.addNewLn();
    return ct;
}
Also used : CTConnector(org.openxmlformats.schemas.presentationml.x2006.main.CTConnector) CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) CTPresetGeometry2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTConnectorNonVisual(org.openxmlformats.schemas.presentationml.x2006.main.CTConnectorNonVisual)

Example 2 with CTLineProperties

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

the class XSLFSimpleShape method getLn.

private static CTLineProperties getLn(XSLFShape shape, boolean create) {
    XmlObject pr = shape.getShapeProperties();
    if (!(pr instanceof CTShapeProperties)) {
        LOG.log(POILogger.WARN, shape.getClass() + " doesn't have line properties");
        return null;
    }
    CTShapeProperties spr = (CTShapeProperties) pr;
    return (spr.isSetLn() || !create) ? spr.getLn() : spr.addNewLn();
}
Also used : CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) XmlObject(org.apache.xmlbeans.XmlObject)

Example 3 with CTLineProperties

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

the class XSLFTableCell method setBorderDash.

@Override
public void setBorderDash(BorderEdge edge, LineDash dash) {
    if (dash == null) {
        throw new IllegalArgumentException("LineDash need to be specified.");
    }
    CTLineProperties ln = setBorderDefaults(edge);
    ln.getPrstDash().setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId));
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 4 with CTLineProperties

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

the class XSLFTableCell method setBorderColor.

@Override
public void setBorderColor(BorderEdge edge, Color color) {
    if (color == null) {
        throw new IllegalArgumentException("Colors need to be specified.");
    }
    CTLineProperties ln = setBorderDefaults(edge);
    CTSolidColorFillProperties fill = ln.addNewSolidFill();
    XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
    c.setColor(color);
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) CTSolidColorFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)

Example 5 with CTLineProperties

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

the class XSLFTableCell method setBorderDefaults.

private CTLineProperties setBorderDefaults(BorderEdge edge) {
    CTLineProperties ln = getCTLine(edge, true);
    if (ln.isSetNoFill()) {
        ln.unsetNoFill();
    }
    if (!ln.isSetPrstDash()) {
        ln.addNewPrstDash().setVal(STPresetLineDashVal.SOLID);
    }
    if (!ln.isSetCmpd()) {
        ln.setCmpd(STCompoundLine.SNG);
    }
    if (!ln.isSetAlgn()) {
        ln.setAlgn(STPenAlignment.CTR);
    }
    if (!ln.isSetCap()) {
        ln.setCap(STLineCap.FLAT);
    }
    if (!ln.isSetRound()) {
        ln.addNewRound();
    }
    if (!ln.isSetHeadEnd()) {
        CTLineEndProperties hd = ln.addNewHeadEnd();
        hd.setType(STLineEndType.NONE);
        hd.setW(STLineEndWidth.MED);
        hd.setLen(STLineEndLength.MED);
    }
    if (!ln.isSetTailEnd()) {
        CTLineEndProperties tl = ln.addNewTailEnd();
        tl.setType(STLineEndType.NONE);
        tl.setW(STLineEndWidth.MED);
        tl.setLen(STLineEndLength.MED);
    }
    return ln;
}
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