}
}
+ /**
+ * Returns the anchor (the bounding box rectangle) of this shape group.
+ * All coordinates are expressed in points (72 dpi).
+ *
+ * @return the anchor of this shape group
+ */
+ public java.awt.Rectangle getAnchor(){
+ EscherContainerRecord groupInfoContainer = (EscherContainerRecord)_escherContainer.getChild(0);
+ EscherSpgrRecord spgr = (EscherSpgrRecord)getEscherChild(groupInfoContainer, EscherSpgrRecord.RECORD_ID);
+ java.awt.Rectangle anchor=null;
+
+ anchor = new java.awt.Rectangle();
+ anchor.x = spgr.getRectX1()*POINT_DPI/MASTER_DPI;
+ anchor.y = spgr.getRectY1()*POINT_DPI/MASTER_DPI;
+ anchor.width = (spgr.getRectX2() - spgr.getRectX1())*POINT_DPI/MASTER_DPI;
+ anchor.height = (spgr.getRectY2() - spgr.getRectY1())*POINT_DPI/MASTER_DPI;
+ return anchor;
+ }
}
}\r
}\r
\r
+ /**\r
+ * Bug 42484: NullPointerException from ShapeGroup.getAnchor()\r
+ */\r
+ public void test42484 () throws Exception {\r
+ FileInputStream is = new FileInputStream(new File(cwd, "42485.ppt")); //test file is the same as for bug 42485\r
+ HSLFSlideShow hslf = new HSLFSlideShow(is);\r
+ is.close();\r
+\r
+ SlideShow ppt = new SlideShow(hslf);\r
+ Shape[] shape = ppt.getSlides()[0].getShapes();\r
+ for (int i = 0; i < shape.length; i++) {\r
+ if(shape[i] instanceof ShapeGroup){\r
+ ShapeGroup group = (ShapeGroup)shape[i];\r
+ assertNotNull(group.getAnchor());\r
+ Shape[] sh = group.getShapes();\r
+ for (int j = 0; j < sh.length; j++) {\r
+ assertNotNull(sh[j].getAnchor());\r
+ }\r
+ }\r
+ }\r
+ assertTrue("No Exceptions while reading file", true);\r
+ }\r
+\r
}\r