Search in sources :

Example 1 with ExEmbed

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;
}
Also used : ExEmbed(org.apache.poi.hslf.record.ExEmbed) HSLFObjectData(org.apache.poi.hslf.usermodel.HSLFObjectData) HSLFSlideShow(org.apache.poi.hslf.usermodel.HSLFSlideShow)

Example 2 with ExEmbed

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;
}
Also used : ExObjList(org.apache.poi.hslf.record.ExObjList) ExEmbed(org.apache.poi.hslf.record.ExEmbed) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) Record(org.apache.poi.hslf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) HSLFSlideShow(org.apache.poi.hslf.usermodel.HSLFSlideShow)

Aggregations

ExEmbed (org.apache.poi.hslf.record.ExEmbed)2 HSLFSlideShow (org.apache.poi.hslf.usermodel.HSLFSlideShow)2 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)1 EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)1 ExObjList (org.apache.poi.hslf.record.ExObjList)1 HSLFEscherClientDataRecord (org.apache.poi.hslf.record.HSLFEscherClientDataRecord)1 Record (org.apache.poi.hslf.record.Record)1 HSLFObjectData (org.apache.poi.hslf.usermodel.HSLFObjectData)1