use of org.apache.poi.hslf.record.ExObjRefAtom in project poi by apache.
the class OLEShape method setObjectID.
/**
* Set the unique identifier for the OLE object and
* register it in the necessary structures
*
* @param objectId the unique identifier for the OLE object
*/
public void setObjectID(int objectId) {
setEscherProperty(EscherProperties.BLIP__PICTUREID, objectId);
EscherContainerRecord ecr = getSpContainer();
EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setFlags(spRecord.getFlags() | EscherSpRecord.FLAG_OLESHAPE);
HSLFEscherClientDataRecord cldata = getClientData(true);
ExObjRefAtom uer = null;
for (Record r : cldata.getHSLFChildRecords()) {
if (r.getRecordType() == RecordTypes.ExObjRefAtom.typeID) {
uer = (ExObjRefAtom) r;
break;
}
}
if (uer == null) {
uer = new ExObjRefAtom();
cldata.addChild(uer);
}
uer.setExObjIdRef(objectId);
}
use of org.apache.poi.hslf.record.ExObjRefAtom in project poi by apache.
the class HSLFShapeFactory method createFrame.
private static HSLFShape createFrame(EscherContainerRecord spContainer, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) {
InteractiveInfo info = getClientDataRecord(spContainer, RecordTypes.InteractiveInfo.typeID);
if (info != null && info.getInteractiveInfoAtom() != null) {
switch(info.getInteractiveInfoAtom().getAction()) {
case InteractiveInfoAtom.ACTION_OLE:
return new OLEShape(spContainer, parent);
case InteractiveInfoAtom.ACTION_MEDIA:
return new MovieShape(spContainer, parent);
default:
break;
}
}
ExObjRefAtom oes = getClientDataRecord(spContainer, RecordTypes.ExObjRefAtom.typeID);
return (oes != null) ? new OLEShape(spContainer, parent) : new HSLFPictureShape(spContainer, parent);
}
use of org.apache.poi.hslf.record.ExObjRefAtom in project poi by apache.
the class MovieShape method getPath.
/**
* @return UNC or local path to a video file
*/
@SuppressWarnings("resource")
public String getPath() {
ExObjRefAtom oe = getClientDataRecord(RecordTypes.ExObjRefAtom.typeID);
int idx = oe.getExObjIdRef();
HSLFSlideShow ppt = getSheet().getSlideShow();
ExObjList lst = (ExObjList) ppt.getDocumentRecord().findFirstOfType(RecordTypes.ExObjList.typeID);
if (lst == null) {
return null;
}
Record[] r = lst.getChildRecords();
for (int i = 0; i < r.length; i++) {
if (r[i] instanceof ExMCIMovie) {
ExMCIMovie mci = (ExMCIMovie) r[i];
ExVideoContainer exVideo = mci.getExVideo();
int objectId = exVideo.getExMediaAtom().getObjectId();
if (objectId == idx) {
return exVideo.getPathAtom().getText();
}
}
}
return null;
}
Aggregations