mirror of https://github.com/apache/poi.git
Don't just assume we'll only have container records for the shape's escher records
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@450057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c41a5148eb
commit
338801b916
|
@ -18,6 +18,7 @@ package org.apache.poi.hslf.model;
|
||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ddf.*;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,15 +51,28 @@ public class ShapeGroup extends Shape{
|
||||||
* @return the shapes contained in this group container
|
* @return the shapes contained in this group container
|
||||||
*/
|
*/
|
||||||
public Shape[] getShapes() {
|
public Shape[] getShapes() {
|
||||||
//several SpContainers, the first of which is the group shape itself
|
// Out escher container record should contain serveral
|
||||||
|
// SpContainers, the first of which is the group shape itself
|
||||||
List lst = _escherContainer.getChildRecords();
|
List lst = _escherContainer.getChildRecords();
|
||||||
|
|
||||||
//don't include the first SpContainer, it is always NotPrimitive
|
ArrayList shapeList = new ArrayList();
|
||||||
Shape[] shapes = new Shape[lst.size() - 1];
|
// Don't include the first SpContainer, it is always NotPrimitive
|
||||||
for (int i = 1; i < lst.size(); i++){
|
for (int i = 1; i < lst.size(); i++){
|
||||||
EscherContainerRecord container = (EscherContainerRecord)lst.get(i);
|
EscherRecord r = (EscherRecord)lst.get(i);
|
||||||
shapes[i-1] = ShapeFactory.createShape(container, this);
|
if(r instanceof EscherContainerRecord) {
|
||||||
|
// Create the Shape for it
|
||||||
|
EscherContainerRecord container = (EscherContainerRecord)r;
|
||||||
|
Shape shape = ShapeFactory.createShape(container, this);
|
||||||
|
shapeList.add( shape );
|
||||||
|
} else {
|
||||||
|
// Should we do anything special with these non
|
||||||
|
// Container records?
|
||||||
|
System.err.println("Shape contained non container escher record, was " + r.getClass().getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put the shapes into an array, and return
|
||||||
|
Shape[] shapes = (Shape[])shapeList.toArray(new Shape[shapeList.size()]);
|
||||||
return shapes;
|
return shapes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue