Search in sources :

Example 1 with ExObjList

use of org.apache.poi.hslf.record.ExObjList in project poi by apache.

the class ActiveXShape method getExControl.

/**
     * Document-level container that specifies information about an ActiveX control
     *
     * @return container that specifies information about an ActiveX control
     */
public ExControl getExControl() {
    int idx = getControlIndex();
    Document doc = getSheet().getSlideShow().getDocumentRecord();
    ExObjList lst = (ExObjList) doc.findFirstOfType(RecordTypes.ExObjList.typeID);
    if (lst == null) {
        return null;
    }
    for (Record ch : lst.getChildRecords()) {
        if (ch instanceof ExControl) {
            ExControl c = (ExControl) ch;
            if (c.getExOleObjAtom().getObjID() == idx) {
                return c;
            }
        }
    }
    return null;
}
Also used : ExObjList(org.apache.poi.hslf.record.ExObjList) ExControl(org.apache.poi.hslf.record.ExControl) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) Record(org.apache.poi.hslf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) Document(org.apache.poi.hslf.record.Document)

Example 2 with ExObjList

use of org.apache.poi.hslf.record.ExObjList in project poi by apache.

the class HSLFHyperlink method find.

/**
     * Find hyperlink assigned to the supplied shape
     *
     * @param shape  <code>Shape</code> to lookup hyperlink in
     * @return found hyperlink or <code>null</code>
     */
@SuppressWarnings("resource")
protected static HSLFHyperlink find(HSLFShape shape) {
    HSLFSlideShow ppt = shape.getSheet().getSlideShow();
    //document-level container which stores info about all links in a presentation
    ExObjList exobj = ppt.getDocumentRecord().getExObjList(false);
    HSLFEscherClientDataRecord cldata = shape.getClientData(false);
    if (exobj != null && cldata != null) {
        List<HSLFHyperlink> lst = new ArrayList<HSLFHyperlink>();
        find(cldata.getHSLFChildRecords(), exobj, lst);
        return lst.isEmpty() ? null : (HSLFHyperlink) lst.get(0);
    }
    return null;
}
Also used : ExObjList(org.apache.poi.hslf.record.ExObjList) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) ArrayList(java.util.ArrayList)

Example 3 with ExObjList

use of org.apache.poi.hslf.record.ExObjList in project poi by apache.

the class HSLFHyperlink method find.

/**
     * Find hyperlinks in a text paragraph
     *
     * @param paragraphs  List of <code>TextParagraph</code> to lookup hyperlinks
     * @return found hyperlinks
     */
@SuppressWarnings("resource")
protected static List<HSLFHyperlink> find(List<HSLFTextParagraph> paragraphs) {
    List<HSLFHyperlink> lst = new ArrayList<HSLFHyperlink>();
    if (paragraphs == null || paragraphs.isEmpty())
        return lst;
    HSLFTextParagraph firstPara = paragraphs.get(0);
    HSLFSlideShow ppt = firstPara.getSheet().getSlideShow();
    //document-level container which stores info about all links in a presentation
    ExObjList exobj = ppt.getDocumentRecord().getExObjList(false);
    if (exobj != null) {
        Record[] records = firstPara.getRecords();
        find(Arrays.asList(records), exobj, lst);
    }
    return lst;
}
Also used : ExObjList(org.apache.poi.hslf.record.ExObjList) ArrayList(java.util.ArrayList) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) Record(org.apache.poi.hslf.record.Record)

Example 4 with ExObjList

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

Example 5 with ExObjList

use of org.apache.poi.hslf.record.ExObjList 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

ExObjList (org.apache.poi.hslf.record.ExObjList)5 HSLFEscherClientDataRecord (org.apache.poi.hslf.record.HSLFEscherClientDataRecord)5 Record (org.apache.poi.hslf.record.Record)4 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)3 ArrayList (java.util.ArrayList)2 EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)2 HSLFSlideShow (org.apache.poi.hslf.usermodel.HSLFSlideShow)2 AbstractEscherOptRecord (org.apache.poi.ddf.AbstractEscherOptRecord)1 Document (org.apache.poi.hslf.record.Document)1 ExControl (org.apache.poi.hslf.record.ExControl)1 ExEmbed (org.apache.poi.hslf.record.ExEmbed)1 ExMCIMovie (org.apache.poi.hslf.record.ExMCIMovie)1 ExObjRefAtom (org.apache.poi.hslf.record.ExObjRefAtom)1 ExVideoContainer (org.apache.poi.hslf.record.ExVideoContainer)1