Search in sources :

Example 11 with CTPositiveSize2D

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

the class XSSFPicture method prototype.

/**
     * Returns a prototype that is used to construct new shapes
     *
     * @return a prototype that is used to construct new shapes
     */
protected static CTPicture prototype() {
    if (prototype == null) {
        CTPicture pic = CTPicture.Factory.newInstance();
        CTPictureNonVisual nvpr = pic.addNewNvPicPr();
        CTNonVisualDrawingProps nvProps = nvpr.addNewCNvPr();
        nvProps.setId(1);
        nvProps.setName("Picture 1");
        nvProps.setDescr("Picture");
        CTNonVisualPictureProperties nvPicProps = nvpr.addNewCNvPicPr();
        nvPicProps.addNewPicLocks().setNoChangeAspect(true);
        CTBlipFillProperties blip = pic.addNewBlipFill();
        blip.addNewBlip().setEmbed("");
        blip.addNewStretch().addNewFillRect();
        CTShapeProperties sppr = pic.addNewSpPr();
        CTTransform2D t2d = sppr.addNewXfrm();
        CTPositiveSize2D ext = t2d.addNewExt();
        //should be original picture width and height expressed in EMUs
        ext.setCx(0);
        ext.setCy(0);
        CTPoint2D off = t2d.addNewOff();
        off.setX(0);
        off.setY(0);
        CTPresetGeometry2D prstGeom = sppr.addNewPrstGeom();
        prstGeom.setPrst(STShapeType.RECT);
        prstGeom.addNewAvLst();
        prototype = pic;
    }
    return prototype;
}
Also used : CTNonVisualPictureProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualPictureProperties) CTTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D) CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTBlipFillProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties) CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) CTPresetGeometry2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTPicture(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture) CTPictureNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPictureNonVisual) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)

Example 12 with CTPositiveSize2D

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

the class XSSFGraphicFrame method prototype.

/**
	 * Initialize default structure of a new graphic frame
	 */
protected static CTGraphicalObjectFrame prototype() {
    if (prototype == null) {
        CTGraphicalObjectFrame graphicFrame = CTGraphicalObjectFrame.Factory.newInstance();
        CTGraphicalObjectFrameNonVisual nvGraphic = graphicFrame.addNewNvGraphicFramePr();
        CTNonVisualDrawingProps props = nvGraphic.addNewCNvPr();
        props.setId(0);
        props.setName("Diagramm 1");
        nvGraphic.addNewCNvGraphicFramePr();
        CTTransform2D transform = graphicFrame.addNewXfrm();
        CTPositiveSize2D extPoint = transform.addNewExt();
        CTPoint2D offPoint = transform.addNewOff();
        extPoint.setCx(0);
        extPoint.setCy(0);
        offPoint.setX(0);
        offPoint.setY(0);
        /* CTGraphicalObject graphic = */
        graphicFrame.addNewGraphic();
        prototype = graphicFrame;
    }
    return prototype;
}
Also used : CTTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D) CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGraphicalObjectFrame(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGraphicalObjectFrame) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTGraphicalObjectFrameNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGraphicalObjectFrameNonVisual) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)

Example 13 with CTPositiveSize2D

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

the class XSLFGraphicFrame method getAnchor.

@Override
public Rectangle2D getAnchor() {
    CTTransform2D xfrm = ((CTGraphicalObjectFrame) getXmlObject()).getXfrm();
    CTPoint2D off = xfrm.getOff();
    double x = Units.toPoints(off.getX());
    double y = Units.toPoints(off.getY());
    CTPositiveSize2D ext = xfrm.getExt();
    double cx = Units.toPoints(ext.getCx());
    double cy = Units.toPoints(ext.getCy());
    return new Rectangle2D.Double(x, y, cx, cy);
}
Also used : CTTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D) CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGraphicalObjectFrame(org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)

Example 14 with CTPositiveSize2D

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

the class XSSFSimpleShape method prototype.

/**
     * Prototype with the default structure of a new auto-shape.
     */
protected static CTShape prototype() {
    if (prototype == null) {
        CTShape shape = CTShape.Factory.newInstance();
        CTShapeNonVisual nv = shape.addNewNvSpPr();
        CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
        nvp.setId(1);
        nvp.setName("Shape 1");
        nv.addNewCNvSpPr();
        CTShapeProperties sp = shape.addNewSpPr();
        CTTransform2D t2d = sp.addNewXfrm();
        CTPositiveSize2D p1 = t2d.addNewExt();
        p1.setCx(0);
        p1.setCy(0);
        CTPoint2D p2 = t2d.addNewOff();
        p2.setX(0);
        p2.setY(0);
        CTPresetGeometry2D geom = sp.addNewPrstGeom();
        geom.setPrst(STShapeType.RECT);
        geom.addNewAvLst();
        CTTextBody body = shape.addNewTxBody();
        CTTextBodyProperties bodypr = body.addNewBodyPr();
        bodypr.setAnchor(STTextAnchoringType.T);
        bodypr.setRtlCol(false);
        CTTextParagraph p = body.addNewP();
        p.addNewPPr().setAlgn(STTextAlignType.L);
        CTTextCharacterProperties endPr = p.addNewEndParaRPr();
        endPr.setLang("en-US");
        endPr.setSz(1100);
        CTSolidColorFillProperties scfpr = endPr.addNewSolidFill();
        scfpr.addNewSrgbClr().setVal(new byte[] { 0, 0, 0 });
        body.addNewLstStyle();
        prototype = shape;
    }
    return prototype;
}
Also used : CTShape(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape) CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual)

Example 15 with CTPositiveSize2D

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

the class XSLFSlide method prototype.

private static CTSlide prototype() {
    CTSlide ctSlide = CTSlide.Factory.newInstance();
    CTCommonSlideData cSld = ctSlide.addNewCSld();
    CTGroupShape spTree = cSld.addNewSpTree();
    CTGroupShapeNonVisual nvGrpSpPr = spTree.addNewNvGrpSpPr();
    CTNonVisualDrawingProps cnvPr = nvGrpSpPr.addNewCNvPr();
    cnvPr.setId(1);
    cnvPr.setName("");
    nvGrpSpPr.addNewCNvGrpSpPr();
    nvGrpSpPr.addNewNvPr();
    CTGroupShapeProperties grpSpr = spTree.addNewGrpSpPr();
    CTGroupTransform2D xfrm = grpSpr.addNewXfrm();
    CTPoint2D off = xfrm.addNewOff();
    off.setX(0);
    off.setY(0);
    CTPositiveSize2D ext = xfrm.addNewExt();
    ext.setCx(0);
    ext.setCy(0);
    CTPoint2D choff = xfrm.addNewChOff();
    choff.setX(0);
    choff.setY(0);
    CTPositiveSize2D chExt = xfrm.addNewChExt();
    chExt.setCx(0);
    chExt.setCy(0);
    ctSlide.addNewClrMapOvr().addNewMasterClrMapping();
    return ctSlide;
}
Also used : CTCommonSlideData(org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData) CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGroupTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D) CTGroupShapeNonVisual(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShapeNonVisual) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTGroupShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties) CTSlide(org.openxmlformats.schemas.presentationml.x2006.main.CTSlide) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D) CTGroupShape(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape)

Aggregations

CTPositiveSize2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)21 CTPoint2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D)18 CTTransform2D (org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D)11 CTNonVisualDrawingProps (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps)8 CTGroupTransform2D (org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D)7 CTPresetGeometry2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D)4 CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)4 Dimension (java.awt.Dimension)2 CTBlipFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties)2 CTGroupShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties)2 CTNonVisualPictureProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualPictureProperties)2 CTShape (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape)2 CTShapeNonVisual (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual)2 CTInline (org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline)2 CTGraphicalObjectFrame (org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame)2 Rectangle2D (java.awt.geom.Rectangle2D)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 QName (javax.xml.namespace.QName)1