Search in sources :

Example 11 with CTShape

use of org.openxmlformats.schemas.presentationml.x2006.main.CTShape in project poi by apache.

the class XSLFFreeformShape method prototype.

/**
     * @param shapeId 1-based shapeId
     */
static CTShape prototype(int shapeId) {
    CTShape ct = CTShape.Factory.newInstance();
    CTShapeNonVisual nvSpPr = ct.addNewNvSpPr();
    CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
    cnv.setName("Freeform " + shapeId);
    cnv.setId(shapeId + 1);
    nvSpPr.addNewCNvSpPr();
    nvSpPr.addNewNvPr();
    CTShapeProperties spPr = ct.addNewSpPr();
    CTCustomGeometry2D geom = spPr.addNewCustGeom();
    geom.addNewAvLst();
    geom.addNewGdLst();
    geom.addNewAhLst();
    geom.addNewCxnLst();
    CTGeomRect rect = geom.addNewRect();
    rect.setR("r");
    rect.setB("b");
    rect.setT("t");
    rect.setL("l");
    geom.addNewPathLst();
    return ct;
}
Also used : CTShapeNonVisual(org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual) CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) CTCustomGeometry2D(org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTGeomRect(org.openxmlformats.schemas.drawingml.x2006.main.CTGeomRect) CTShape(org.openxmlformats.schemas.presentationml.x2006.main.CTShape)

Example 12 with CTShape

use of org.openxmlformats.schemas.presentationml.x2006.main.CTShape in project poi by apache.

the class XSLFAutoShape method getTextBody.

protected CTTextBody getTextBody(boolean create) {
    CTShape shape = (CTShape) getXmlObject();
    CTTextBody txBody = shape.getTxBody();
    if (txBody == null && create) {
        txBody = shape.addNewTxBody();
        initTextBody(txBody);
    }
    return txBody;
}
Also used : CTShape(org.openxmlformats.schemas.presentationml.x2006.main.CTShape) CTTextBody(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)

Example 13 with CTShape

use of org.openxmlformats.schemas.presentationml.x2006.main.CTShape in project poi by apache.

the class XSLFGroupShape method removeShape.

/**
     * Remove the specified shape from this group
     */
@Override
public boolean removeShape(XSLFShape xShape) {
    XmlObject obj = xShape.getXmlObject();
    CTGroupShape grpSp = (CTGroupShape) getXmlObject();
    if (obj instanceof CTShape) {
        grpSp.getSpList().remove(obj);
    } else if (obj instanceof CTGroupShape) {
        grpSp.getGrpSpList().remove(obj);
    } else if (obj instanceof CTConnector) {
        grpSp.getCxnSpList().remove(obj);
    } else if (obj instanceof CTGraphicalObjectFrame) {
        grpSp.getGraphicFrameList().remove(obj);
    } else if (obj instanceof CTPicture) {
        XSLFPictureShape ps = (XSLFPictureShape) xShape;
        XSLFSheet sh = getSheet();
        if (sh != null) {
            sh.removePictureRelation(ps);
        }
        grpSp.getPicList().remove(obj);
    } else {
        throw new IllegalArgumentException("Unsupported shape: " + xShape);
    }
    return _shapes.remove(xShape);
}
Also used : CTConnector(org.openxmlformats.schemas.presentationml.x2006.main.CTConnector) CTGraphicalObjectFrame(org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame) CTPicture(org.openxmlformats.schemas.presentationml.x2006.main.CTPicture) XmlObject(org.apache.xmlbeans.XmlObject) CTShape(org.openxmlformats.schemas.presentationml.x2006.main.CTShape) CTGroupShape(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape)

Aggregations

CTShape (org.openxmlformats.schemas.presentationml.x2006.main.CTShape)13 Rectangle2D (java.awt.geom.Rectangle2D)4 XmlObject (org.apache.xmlbeans.XmlObject)4 CTConnector (org.openxmlformats.schemas.presentationml.x2006.main.CTConnector)4 CTGraphicalObjectFrame (org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame)4 CTGroupShape (org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape)4 CTPicture (org.openxmlformats.schemas.presentationml.x2006.main.CTPicture)4 CTShapeNonVisual (org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual)3 CTNonVisualDrawingProps (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps)2 CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)2 CTTextBody (org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 CTCustomGeometry2D (org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D)1 CTGeomRect (org.openxmlformats.schemas.drawingml.x2006.main.CTGeomRect)1 CTOuterShadowEffect (org.openxmlformats.schemas.drawingml.x2006.main.CTOuterShadowEffect)1 CTPresetGeometry2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D)1 CTApplicationNonVisualDrawingProps (org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps)1