use of org.apache.poi.ddf.EscherRecord in project poi by apache.
the class HSLFPictureShape method getEscherBSERecord.
@SuppressWarnings("resource")
protected EscherBSERecord getEscherBSERecord() {
HSLFSlideShow ppt = getSheet().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();
int idx = getPictureIndex();
if (idx == 0) {
LOG.log(POILogger.DEBUG, "picture index was not found, returning ");
return null;
}
return (EscherBSERecord) lst.get(idx - 1);
}
use of org.apache.poi.ddf.EscherRecord in project poi by apache.
the class HSLFGroupShape method getShapes.
@Override
public List<HSLFShape> getShapes() {
// Our escher container record should contain several
// SpContainers, the first of which is the group shape itself
List<HSLFShape> shapeList = new ArrayList<HSLFShape>();
boolean isFirst = true;
for (EscherRecord r : getSpContainer()) {
if (isFirst) {
// Don't include the first SpContainer, it is always NotPrimitive
isFirst = false;
continue;
}
if (r instanceof EscherContainerRecord) {
// Create the Shape for it
EscherContainerRecord container = (EscherContainerRecord) r;
HSLFShape shape = HSLFShapeFactory.createShape(container, this);
shape.setSheet(getSheet());
shapeList.add(shape);
} else {
// Should we do anything special with these non
// Container records?
LOG.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName());
}
}
return shapeList;
}
use of org.apache.poi.ddf.EscherRecord in project poi by apache.
the class HSLFFill method getPictureData.
/**
* <code>PictureData</code> object used in a texture, pattern of picture fill.
*/
@SuppressWarnings("resource")
public HSLFPictureData getPictureData() {
AbstractEscherOptRecord opt = shape.getEscherOptRecord();
EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
if (p == null) {
return null;
}
HSLFSlideShow ppt = shape.getSheet().getSlideShow();
List<HSLFPictureData> pict = ppt.getPictureData();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
EscherContainerRecord bstore = HSLFShape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
java.util.List<EscherRecord> lst = bstore.getChildRecords();
int idx = p.getPropertyValue();
if (idx == 0) {
LOG.log(POILogger.WARN, "no reference to picture data found ");
} else {
EscherBSERecord bse = (EscherBSERecord) lst.get(idx - 1);
for (HSLFPictureData pd : pict) {
if (pd.getOffset() == bse.getOffset()) {
return pd;
}
}
}
return null;
}
use of org.apache.poi.ddf.EscherRecord in project poi by apache.
the class HSLFSheet method removeShape.
/**
* Removes the specified shape from this sheet.
*
* @param shape shape to be removed from this sheet, if present.
* @return <tt>true</tt> if the shape was deleted.
*/
@Override
public boolean removeShape(HSLFShape shape) {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dg = ppdrawing.getDgContainer();
EscherContainerRecord spgr = dg.getChildById(EscherContainerRecord.SPGR_CONTAINER);
if (spgr == null) {
return false;
}
List<EscherRecord> lst = spgr.getChildRecords();
boolean result = lst.remove(shape.getSpContainer());
spgr.setChildRecords(lst);
return result;
}
use of org.apache.poi.ddf.EscherRecord in project poi by apache.
the class EscherAggregate method toString.
/**
* Calculates the string representation of this record. This is
* simply a dump of all the records.
*/
public String toString() {
String nl = System.getProperty("line.separtor");
StringBuilder result = new StringBuilder();
result.append('[').append(getRecordName()).append(']').append(nl);
for (EscherRecord escherRecord : getEscherRecords()) {
result.append(escherRecord);
}
result.append("[/").append(getRecordName()).append(']').append(nl);
return result.toString();
}
Aggregations