use of org.apache.poi.ddf.DefaultEscherRecordFactory in project poi by apache.
the class OfficeDrawingsImpl method getBitmapRecord.
private EscherBlipRecord getBitmapRecord(int bitmapIndex) {
List<? extends EscherContainerRecord> bContainers = _escherRecordHolder.getBStoreContainers();
if (bContainers == null || bContainers.size() != 1)
return null;
EscherContainerRecord bContainer = bContainers.get(0);
final List<EscherRecord> bitmapRecords = bContainer.getChildRecords();
if (bitmapRecords.size() < bitmapIndex)
return null;
EscherRecord imageRecord = bitmapRecords.get(bitmapIndex - 1);
if (imageRecord instanceof EscherBlipRecord) {
return (EscherBlipRecord) imageRecord;
}
if (imageRecord instanceof EscherBSERecord) {
EscherBSERecord bseRecord = (EscherBSERecord) imageRecord;
EscherBlipRecord blip = bseRecord.getBlipRecord();
if (blip != null) {
return blip;
}
if (bseRecord.getOffset() > 0) {
/*
* Blip stored in delay stream, which in a word doc, is the main
* stream
*/
EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
EscherRecord record = recordFactory.createRecord(_mainStream, bseRecord.getOffset());
if (record instanceof EscherBlipRecord) {
record.fillFields(_mainStream, bseRecord.getOffset(), recordFactory);
return (EscherBlipRecord) record;
}
}
}
return null;
}
use of org.apache.poi.ddf.DefaultEscherRecordFactory in project poi by apache.
the class HSSFSimpleShape method cloneShape.
@Override
protected HSSFShape cloneShape() {
TextObjectRecord txo = null;
EscherContainerRecord spContainer = new EscherContainerRecord();
byte[] inSp = getEscherContainer().serialize();
spContainer.fillFields(inSp, 0, new DefaultEscherRecordFactory());
ObjRecord obj = (ObjRecord) getObjRecord().cloneViaReserialise();
if (getTextObjectRecord() != null && getString() != null && null != getString().getString()) {
txo = (TextObjectRecord) getTextObjectRecord().cloneViaReserialise();
}
return new HSSFSimpleShape(spContainer, obj, txo);
}
Aggregations