public XDDFTransform2D getTransform2D() { if (props.isSetXfrm()) { return new XDDFTransform2D(props.getXfrm()); } else { return null; } }
@Override public boolean fetch(XSLFShape shape) { XmlObject xo = shape.getShapeProperties(); if (xo instanceof CTShapeProperties && ((CTShapeProperties)xo).isSetXfrm()) { setValue(((CTShapeProperties)xo).getXfrm()); return true; } return false; } };
/** * 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(); }
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 XDDFTransform2D getTransform2D() { if (props.isSetXfrm()) { return new XDDFTransform2D(props.getXfrm()); } else { return null; } }
@Override public boolean fetch(XSLFShape shape) { XmlObject xo = shape.getShapeProperties(); if (xo instanceof CTShapeProperties && ((CTShapeProperties)xo).isSetXfrm()) { setValue(((CTShapeProperties)xo).getXfrm()); return true; } return false; } };
public boolean fetch(XSLFSimpleShape shape) { CTShapeProperties pr = shape.getSpPr(); if (pr.isSetXfrm()) { setValue(pr.getXfrm()); return true; } return false; } };
/** * 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 setFlipVertical(boolean flip) { CTShapeProperties spPr = getSpPr(); CTTransform2D xfrm = spPr.isSetXfrm() ? spPr.getXfrm() : spPr.addNewXfrm(); xfrm.setFlipV(flip); }
@Override public void setRotation(double theta) { CTShapeProperties spPr = getSpPr(); CTTransform2D xfrm = spPr.isSetXfrm() ? spPr.getXfrm() : spPr.addNewXfrm(); xfrm.setRot((int) (theta * 60000)); }
@Override public void setFlipHorizontal(boolean flip) { CTShapeProperties spPr = getSpPr(); CTTransform2D xfrm = spPr.isSetXfrm() ? spPr.getXfrm() : spPr.addNewXfrm(); xfrm.setFlipH(flip); }
public static StringBuilder getStyle( XWPFPicture picture ) { StringBuilder htmlStyle = new StringBuilder(); // Position CTPositiveSize2D ext = picture.getCTPicture().getSpPr().getXfrm().getExt(); long x = ext.getCx(); long y = ext.getCy(); float width = dxa2points( x ) / 635; float height = dxa2points( y ) / 635; XHTMLUtil.addHTMLStyle( htmlStyle, WIDTH, width + "pt" ); XHTMLUtil.addHTMLStyle( htmlStyle, HEIGHT, height + "pt" ); return htmlStyle; }
@Override public void setAnchor(Rectangle2D anchor) { CTShapeProperties spPr = getSpPr(); CTTransform2D xfrm = spPr.isSetXfrm() ? spPr.getXfrm() : spPr.addNewXfrm(); 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); }
CTPositiveSize2D ext = picture.getSpPr().getXfrm().getExt(); long x = ext.getCx(); long y = ext.getCy();
CTPositiveSize2D ext = picture.getSpPr().getXfrm().getExt(); long x = ext.getCx(); long y = ext.getCy();
throws Exception CTPositiveSize2D ext = picture.getCTPicture().getSpPr().getXfrm().getExt(); long x = ext.getCx(); long y = ext.getCy();
anchor.setDy2(dy2); CTPositiveSize2D size2d = ctPicture.getSpPr().getXfrm().getExt(); size2d.setCx((long)(scaledWidth*EMU_PER_PIXEL)); size2d.setCy((long)(scaledHeight*EMU_PER_PIXEL));
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));