use of org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D in project poi by apache.
the class XSLFSimpleShape method getAnchor.
@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);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D in project poi by apache.
the class XSLFGraphicFrame method setAnchor.
@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);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D in project poi by apache.
the class XSSFConnector method prototype.
/**
* Initialize default structure of a new auto-shape
*
*/
protected static CTConnector prototype() {
if (prototype == null) {
CTConnector shape = CTConnector.Factory.newInstance();
CTConnectorNonVisual nv = shape.addNewNvCxnSpPr();
CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
nvp.setId(1);
nvp.setName("Shape 1");
nv.addNewCNvCxnSpPr();
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.LINE);
geom.addNewAvLst();
CTShapeStyle style = shape.addNewStyle();
CTSchemeColor scheme = style.addNewLnRef().addNewSchemeClr();
scheme.setVal(STSchemeColorVal.ACCENT_1);
style.getLnRef().setIdx(1);
CTStyleMatrixReference fillref = style.addNewFillRef();
fillref.setIdx(0);
fillref.addNewSchemeClr().setVal(STSchemeColorVal.ACCENT_1);
CTStyleMatrixReference effectRef = style.addNewEffectRef();
effectRef.setIdx(0);
effectRef.addNewSchemeClr().setVal(STSchemeColorVal.ACCENT_1);
CTFontReference fontRef = style.addNewFontRef();
fontRef.setIdx(STFontCollectionIndex.MINOR);
fontRef.addNewSchemeClr().setVal(STSchemeColorVal.TX_1);
prototype = shape;
}
return prototype;
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D in project poi by apache.
the class XSSFObjectData method prototype.
/**
* Prototype with the default structure of a new auto-shape.
*/
/**
* Prototype with the default structure of a new auto-shape.
*/
protected static CTShape prototype() {
final String drawNS = "http://schemas.microsoft.com/office/drawing/2010/main";
if (prototype == null) {
CTShape shape = CTShape.Factory.newInstance();
CTShapeNonVisual nv = shape.addNewNvSpPr();
CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
nvp.setId(1);
nvp.setName("Shape 1");
// nvp.setHidden(true);
CTOfficeArtExtensionList extLst = nvp.addNewExtLst();
// https://msdn.microsoft.com/en-us/library/dd911027(v=office.12).aspx
CTOfficeArtExtension ext = extLst.addNewExt();
ext.setUri("{63B3BB69-23CF-44E3-9099-C40C66FF867C}");
XmlCursor cur = ext.newCursor();
cur.toEndToken();
cur.beginElement(new QName(drawNS, "compatExt", "a14"));
cur.insertNamespace("a14", drawNS);
cur.insertAttributeWithValue("spid", "_x0000_s1");
cur.dispose();
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();
prototype = shape;
}
return prototype;
}
Aggregations