public XDDFPositiveSize2D getExtension() { if (transform.isSetExt()) { return new XDDFPositiveSize2D(transform.getExt()); } else { return null; } }
public void setDx2(int dx2) { t2d.getExt().setCx(dx2 - getDx1()); } }
public int getDy2() { return (int)(getDy1() + t2d.getExt().getCy()); }
public void setDy2(int dy2) { t2d.getExt().setCy(dy2 - getDy1()); }
public int getDx2() { return (int)(getDx1() + t2d.getExt().getCx()); }
/** * Calculate the preferred size for this picture. * * @param scaleX the amount by which image width is multiplied relative to the original width. * @param scaleY the amount by which image height is multiplied relative to the original height. * @return XSSFClientAnchor with the preferred size for this image */ public XSSFClientAnchor getPreferredSize(double scaleX, double scaleY){ Dimension dim = ImageUtils.setPreferredSize(this, scaleX, scaleY); CTPositiveSize2D size2d = ctPicture.getSpPr().getXfrm().getExt(); size2d.setCx((int)dim.getWidth()); size2d.setCy((int)dim.getHeight()); return getClientAnchor(); }
@Override public void setAnchor(Rectangle2D anchor){ CTTransform2D xfrm = ((CTGraphicalObjectFrame)getXmlObject()).getXfrm(); 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); }
@Override public void setAnchor(Rectangle2D anchor) { CTTransform2D xfrm = getXfrm(true); if (xfrm == null) { return; } 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); }
@Override public Rectangle2D getAnchor() { CTTransform2D xfrm = getXfrm(false); if (xfrm == null) { return null; } 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); }
@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); }
/** * Creates a simple shape. This includes such shapes as lines, rectangles, * and ovals. * * @param anchor * the client anchor describes how this group is attached to the * sheet. * @return the newly created shape. */ public XSSFShapeGroup createGroup(XSSFClientAnchor anchor) { CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTGroupShape ctGroup = ctAnchor.addNewGrpSp(); ctGroup.set(XSSFShapeGroup.prototype()); CTTransform2D xfrm = createXfrm(anchor); CTGroupTransform2D grpXfrm = ctGroup.getGrpSpPr().getXfrm(); grpXfrm.setOff(xfrm.getOff()); grpXfrm.setExt(xfrm.getExt()); grpXfrm.setChExt(xfrm.getExt()); XSSFShapeGroup shape = new XSSFShapeGroup(this, ctGroup); shape.anchor = anchor; return shape; }
public void setExtension(XDDFPositiveSize2D extension) { CTPositiveSize2D xformExt; if (extension == null) { if (transform.isSetExt()) { transform.unsetExt(); } return; } else if (transform.isSetExt()) { xformExt = transform.getExt(); } else { xformExt = transform.addNewExt(); } xformExt.setCx(extension.getX()); xformExt.setCy(extension.getY()); }
/** * Creates a group shape. * * @param anchor the client anchor describes how this group is attached to the group. * @return the newly created group shape. */ public XSSFShapeGroup createGroup(XSSFChildAnchor anchor) { CTGroupShape ctShape = ctGroup.addNewGrpSp(); ctShape.set(prototype()); XSSFShapeGroup shape = new XSSFShapeGroup(getDrawing(), ctShape); shape.parent = this; shape.anchor = anchor; // TODO: calculate bounding rectangle on anchor and set off/ext correctly CTGroupTransform2D xfrm = shape.getCTGroupShape().getGrpSpPr().getXfrm(); CTTransform2D t2 = anchor.getCTTransform2D(); xfrm.setOff(t2.getOff()); xfrm.setExt(t2.getExt()); // child offset is left to 0,0 xfrm.setChExt(t2.getExt()); xfrm.setFlipH(t2.getFlipH()); xfrm.setFlipV(t2.getFlipV()); return shape; }
anchor.setDy2(dy2); CTPositiveSize2D size2d = getCTPicture().getSpPr().getXfrm().getExt(); size2d.setCx((long)(scaledWidth * Units.EMU_PER_PIXEL)); size2d.setCy((long)(scaledHeight * Units.EMU_PER_PIXEL));
public XDDFPositiveSize2D getExtension() { if (transform.isSetExt()) { return new XDDFPositiveSize2D(transform.getExt()); } else { return null; } }
public int getDy2() { return (int)(getDy1() + t2d.getExt().getCy()); }
public void setDy2(int dy2) { t2d.getExt().setCy(dy2 - getDy1()); }
public Rectangle2D getAnchor(){ CTTransform2D xfrm = _shape.getXfrm(); CTPoint2D off = xfrm.getOff(); long x = off.getX(); long y = off.getY(); CTPositiveSize2D ext = xfrm.getExt(); long cx = ext.getCx(); long cy = ext.getCy(); return new Rectangle2D.Double( Units.toPoints(x), Units.toPoints(y), Units.toPoints(cx), Units.toPoints(cy)); }
@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); }