use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFFill method getEscherBSERecord.
@SuppressWarnings("resource")
protected EscherBSERecord getEscherBSERecord(int idx) {
HSLFSheet sheet = shape.getSheet();
if (sheet == null) {
LOG.log(POILogger.DEBUG, "Fill has not yet been assigned to a sheet");
return null;
}
HSLFSlideShow ppt = sheet.getSlideShow();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
EscherContainerRecord bstore = HSLFShape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
if (bstore == null) {
LOG.log(POILogger.DEBUG, "EscherContainerRecord.BSTORE_CONTAINER was not found ");
return null;
}
List<EscherRecord> lst = bstore.getChildRecords();
return (EscherBSERecord) lst.get(idx - 1);
}
use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFShapeFactory method createShapeGroup.
public static HSLFGroupShape createShapeGroup(EscherContainerRecord spContainer, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) {
boolean isTable = false;
EscherContainerRecord ecr = (EscherContainerRecord) spContainer.getChild(0);
EscherRecord opt = HSLFShape.getEscherChild(ecr, RecordTypes.EscherUserDefined);
if (opt != null) {
EscherPropertyFactory f = new EscherPropertyFactory();
List<EscherProperty> props = f.createProperties(opt.serialize(), 8, opt.getInstance());
for (EscherProperty ep : props) {
if (ep.getPropertyNumber() == EscherProperties.GROUPSHAPE__TABLEPROPERTIES && ep instanceof EscherSimpleProperty && (((EscherSimpleProperty) ep).getPropertyValue() & 1) == 1) {
isTable = true;
break;
}
}
}
HSLFGroupShape group;
if (isTable) {
group = new HSLFTable(spContainer, parent);
} else {
group = new HSLFGroupShape(spContainer, parent);
}
return group;
}
use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFSheet method addShape.
/**
* Add a new Shape to this Slide
*
* @param shape - the Shape to add
*/
@Override
public void addShape(HSLFShape shape) {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dgContainer = ppdrawing.getDgContainer();
EscherContainerRecord spgr = (EscherContainerRecord) HSLFShape.getEscherChild(dgContainer, EscherContainerRecord.SPGR_CONTAINER);
spgr.addChildRecord(shape.getSpContainer());
shape.setSheet(this);
shape.setShapeId(allocateShapeId());
shape.afterInsert(this);
}
use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFSheet method getShapes.
/**
* Returns all shapes contained in this Sheet
*
* @return all shapes contained in this Sheet (Slide or Notes)
*/
@Override
public List<HSLFShape> getShapes() {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dg = ppdrawing.getDgContainer();
EscherContainerRecord spgr = null;
for (EscherRecord rec : dg) {
if (rec.getRecordId() == EscherContainerRecord.SPGR_CONTAINER) {
spgr = (EscherContainerRecord) rec;
break;
}
}
if (spgr == null) {
throw new IllegalStateException("spgr not found");
}
List<HSLFShape> shapeList = new ArrayList<HSLFShape>();
boolean isFirst = true;
for (EscherRecord r : spgr) {
if (isFirst) {
// skip first item
isFirst = false;
continue;
}
EscherContainerRecord sp = (EscherContainerRecord) r;
HSLFShape sh = HSLFShapeFactory.createShape(sp, null);
sh.setSheet(this);
if (sh instanceof HSLFSimpleShape) {
HSLFHyperlink link = HSLFHyperlink.find(sh);
if (link != null) {
((HSLFSimpleShape) sh).setHyperlink(link);
}
}
shapeList.add(sh);
}
return shapeList;
}
use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.
the class HSLFShape method createSpContainer.
/**
* Create and assign the lower level escher record to this shape
*/
protected EscherContainerRecord createSpContainer(boolean isChild) {
if (_escherContainer == null) {
_escherContainer = new EscherContainerRecord();
_escherContainer.setOptions((short) 15);
}
return _escherContainer;
}
Aggregations