Search in sources :

Example 1 with CTGroupTransform2D

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

the class XSLFGroupShape method setAnchor.

@Override
public void setAnchor(Rectangle2D anchor) {
    CTGroupTransform2D xfrm = getSafeXfrm();
    CTPoint2D off = xfrm.isSetOff() ? xfrm.getOff() : xfrm.addNewOff();
    long x = Units.toEMU(anchor.getX());
    long y = Units.toEMU(anchor.getY());
    off.setX(x);
    off.setY(y);
    CTPositiveSize2D ext = xfrm.isSetExt() ? xfrm.getExt() : xfrm.addNewExt();
    long cx = Units.toEMU(anchor.getWidth());
    long cy = Units.toEMU(anchor.getHeight());
    ext.setCx(cx);
    ext.setCy(cy);
}
Also used : CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGroupTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)

Example 2 with CTGroupTransform2D

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

the class XSLFGroupShape method getInteriorAnchor.

/**
     *
     * @return the coordinates of the child extents rectangle
     * used for calculations of grouping, scaling, and rotation
     * behavior of shapes placed within a group.
     */
@Override
public Rectangle2D getInteriorAnchor() {
    CTGroupTransform2D xfrm = getXfrm();
    CTPoint2D off = xfrm.getChOff();
    double x = Units.toPoints(off.getX());
    double y = Units.toPoints(off.getY());
    CTPositiveSize2D ext = xfrm.getChExt();
    double cx = Units.toPoints(ext.getCx());
    double cy = Units.toPoints(ext.getCy());
    return new Rectangle2D.Double(x, y, cx, cy);
}
Also used : CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGroupTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)

Example 3 with CTGroupTransform2D

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

the class XSLFGroupShape method getAnchor.

@Override
public Rectangle2D getAnchor() {
    CTGroupTransform2D xfrm = 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 : CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGroupTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)

Example 4 with CTGroupTransform2D

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

the class XSLFGroupShape method setInteriorAnchor.

/**
     *
     * @param anchor the coordinates of the child extents rectangle
     * used for calculations of grouping, scaling, and rotation
     * behavior of shapes placed within a group.
     */
@Override
public void setInteriorAnchor(Rectangle2D anchor) {
    CTGroupTransform2D xfrm = getSafeXfrm();
    CTPoint2D off = xfrm.isSetChOff() ? xfrm.getChOff() : xfrm.addNewChOff();
    long x = Units.toEMU(anchor.getX());
    long y = Units.toEMU(anchor.getY());
    off.setX(x);
    off.setY(y);
    CTPositiveSize2D ext = xfrm.isSetChExt() ? xfrm.getChExt() : xfrm.addNewChExt();
    long cx = Units.toEMU(anchor.getWidth());
    long cy = Units.toEMU(anchor.getHeight());
    ext.setCx(cx);
    ext.setCy(cy);
}
Also used : CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGroupTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)

Example 5 with CTGroupTransform2D

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

the class XSSFShapeGroup method prototype.

/**
     * Initialize default structure of a new shape group
     */
protected static CTGroupShape prototype() {
    if (prototype == null) {
        CTGroupShape shape = CTGroupShape.Factory.newInstance();
        CTGroupShapeNonVisual nv = shape.addNewNvGrpSpPr();
        CTNonVisualDrawingProps nvpr = nv.addNewCNvPr();
        nvpr.setId(0);
        nvpr.setName("Group 0");
        nv.addNewCNvGrpSpPr();
        CTGroupShapeProperties sp = shape.addNewGrpSpPr();
        CTGroupTransform2D t2d = sp.addNewXfrm();
        CTPositiveSize2D p1 = t2d.addNewExt();
        p1.setCx(0);
        p1.setCy(0);
        CTPoint2D p2 = t2d.addNewOff();
        p2.setX(0);
        p2.setY(0);
        CTPositiveSize2D p3 = t2d.addNewChExt();
        p3.setCx(0);
        p3.setCy(0);
        CTPoint2D p4 = t2d.addNewChOff();
        p4.setX(0);
        p4.setY(0);
        prototype = shape;
    }
    return prototype;
}
Also used : CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTGroupTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D) CTGroupShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShapeNonVisual) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTGroupShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D) CTGroupShape(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShape)

Aggregations

CTGroupTransform2D (org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D)10 CTPoint2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D)7 CTPositiveSize2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)7 CTGroupShape (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShape)3 CTGroupShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties)2 CTNonVisualDrawingProps (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps)2 CTTransform2D (org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D)2 Test (org.junit.Test)1 CTGroupShapeNonVisual (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGroupShapeNonVisual)1 CTTwoCellAnchor (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTTwoCellAnchor)1 CTCommonSlideData (org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData)1 CTGroupShape (org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape)1 CTGroupShapeNonVisual (org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShapeNonVisual)1 CTSlide (org.openxmlformats.schemas.presentationml.x2006.main.CTSlide)1