use of org.apache.poi.hslf.record.ExEmbed in project poi by apache.
the class OLEShape method getObjectData.
/**
* Returns unique identifier for the OLE object.
*
* @return the unique identifier for the OLE object
*/
@SuppressWarnings("resource")
public HSLFObjectData getObjectData() {
HSLFSlideShow ppt = getSheet().getSlideShow();
HSLFObjectData[] ole = ppt.getEmbeddedObjects();
//persist reference
ExEmbed exEmbed = getExEmbed();
HSLFObjectData data = null;
if (exEmbed != null) {
int ref = exEmbed.getExOleObjAtom().getObjStgDataRef();
for (int i = 0; i < ole.length; i++) {
if (ole[i].getExOleObjStg().getPersistId() == ref) {
data = ole[i];
}
}
}
if (data == null) {
LOG.log(POILogger.WARN, "OLE data not found");
}
return data;
}
use of org.apache.poi.hslf.record.ExEmbed in project poi by apache.
the class OLEShape method getExEmbed.
/**
* Return the record container for this embedded object.
*
* <p>
* It contains:
* 1. ExEmbedAtom.(4045)
* 2. ExOleObjAtom (4035)
* 3. CString (4026), Instance MenuName (1) used for menus and the Links dialog box.
* 4. CString (4026), Instance ProgID (2) that stores the OLE Programmatic Identifier.
* A ProgID is a string that uniquely identifies a given object.
* 5. CString (4026), Instance ClipboardName (3) that appears in the paste special dialog.
* 6. MetaFile( 4033), optional
* </p>
*/
@SuppressWarnings("resource")
public ExEmbed getExEmbed() {
if (_exEmbed == null) {
HSLFSlideShow ppt = getSheet().getSlideShow();
ExObjList lst = ppt.getDocumentRecord().getExObjList(false);
if (lst == null) {
LOG.log(POILogger.WARN, "ExObjList not found");
return null;
}
int id = getObjectID();
Record[] ch = lst.getChildRecords();
for (int i = 0; i < ch.length; i++) {
if (ch[i] instanceof ExEmbed) {
ExEmbed embd = (ExEmbed) ch[i];
if (embd.getExOleObjAtom().getObjID() == id)
_exEmbed = embd;
}
}
}
return _exEmbed;
}
Aggregations