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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations