/** * Returns the ExObjList, which holds the references to * external objects used in the slides. This may be null, if * there are no external references. * * @param create if true, create an ExObjList if it doesn't exist */ public ExObjList getExObjList(boolean create) { if (exObjList == null && create) { exObjList = new ExObjList(); addChildAfter(exObjList, getDocumentAtom()); } return exObjList; }
int addToObjListAtom(RecordContainer exObj) { ExObjList lst = getDocumentRecord().getExObjList(true); ExObjListAtom objAtom = lst.getExObjListAtom(); // increment the object ID seed int objectId = (int) objAtom.getObjectIDSeed() + 1; objAtom.setObjectIDSeed(objectId); lst.addChildAfter(exObj, objAtom); return objectId; }
/** * Set things up, and find our more interesting children */ protected ExObjList(byte[] source, int start, int len) { // Grab the header _header = new byte[8]; System.arraycopy(source,start,_header,0,8); // Find our children _children = Record.findChildRecords(source,start+8,len-8); findInterestingChildren(); }
/** * Add a hyperlink to this presentation * * @return 0-based index of the hyperlink */ public int addHyperlink(Hyperlink link) { ExObjList lst = (ExObjList) _documentRecord.findFirstOfType(RecordTypes.ExObjList.typeID); if (lst == null) { lst = new ExObjList(); _documentRecord.addChildAfter(lst, _documentRecord.getDocumentAtom()); } ExObjListAtom objAtom = lst.getExObjListAtom(); // increment the object ID seed int objectId = (int) objAtom.getObjectIDSeed() + 1; objAtom.setObjectIDSeed(objectId); ExHyperlink ctrl = new ExHyperlink(); ExHyperlinkAtom obj = ctrl.getExHyperlinkAtom(); obj.setNumber(objectId); ctrl.setLinkURL(link.getAddress()); ctrl.setLinkTitle(link.getTitle()); lst.addChildAfter(ctrl, objAtom); link.setId(objectId); return objectId; } }
ExObjList lst = (ExObjList) _documentRecord.findFirstOfType(RecordTypes.ExObjList.typeID); if (lst == null) { lst = new ExObjList(); _documentRecord.addChildAfter(lst, _documentRecord.getDocumentAtom()); ExObjListAtom objAtom = lst.getExObjListAtom(); lst.appendChildRecord(mci); ExVideoContainer exVideo = mci.getExVideo(); exVideo.getExMediaAtom().setObjectId(objectId);
private ExEmbed getExEmbed(boolean create) { if (_exEmbed == null) { HSLFSlideShow ppt = getSheet().getSlideShow(); ExObjList lst = ppt.getDocumentRecord().getExObjList(create); if(lst == null){ LOG.log(POILogger.WARN, "ExObjList not found"); return null; } int id = getObjectID(); for (Record ch : lst.getChildRecords()) { if(ch instanceof ExEmbed){ ExEmbed embd = (ExEmbed)ch; if( embd.getExOleObjAtom().getObjID() == id) { _exEmbed = embd; } } } if (_exEmbed == null && create) { _exEmbed = new ExEmbed(); _exEmbed.getExOleObjAtom().setObjID(id); lst.appendChildRecord(_exEmbed); } } return _exEmbed; }
/** * 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; }
/** * Write the contents of the record back, so it can be written * to disk */ public void writeOut(OutputStream out) throws IOException { writeOut(_header[0],_header[1],_type,_children,out); }
ExHyperlink exHyper = exobj.get(id); if (exHyper == null) { continue;
ExObjList lst = (ExObjList) _documentRecord.findFirstOfType(RecordTypes.ExObjList.typeID); if (lst == null) { lst = new ExObjList(); _documentRecord.addChildAfter(lst, _documentRecord.getDocumentAtom()); ExObjListAtom objAtom = lst.getExObjListAtom(); ctrl.setMenuName(name); ctrl.setClipboardName(name); lst.addChildAfter(ctrl, objAtom);
/** * 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(); ExControl ctrl = null; Document doc = getSheet().getSlideShow().getDocumentRecord(); ExObjList lst = (ExObjList)doc.findFirstOfType(RecordTypes.ExObjList.typeID); if(lst != null){ Record[] ch = lst.getChildRecords(); for (int i = 0; i < ch.length; i++) { if(ch[i] instanceof ExControl){ ExControl c = (ExControl)ch[i]; if(c.getExOleObjAtom().getObjID() == idx){ ctrl = c; break; } } } } return ctrl; }
/** * Write the contents of the record back, so it can be written * to disk */ public void writeOut(OutputStream out) throws IOException { writeOut(_header[0],_header[1],_type,_children,out); }
private static void find(Record[] records, ExObjList exobj, List out){ for (int i = 0; i < records.length; i++) { //see if we have InteractiveInfo in the textrun's records if( records[i] instanceof InteractiveInfo){ InteractiveInfo hldr = (InteractiveInfo)records[i]; InteractiveInfoAtom info = hldr.getInteractiveInfoAtom(); int id = info.getHyperlinkID(); ExHyperlink linkRecord = exobj.get(id); if (linkRecord != null){ Hyperlink link = new Hyperlink(); link.title = linkRecord.getLinkTitle(); link.address = linkRecord.getLinkURL(); link.type = info.getAction(); if (++i < records.length && records[i] instanceof TxInteractiveInfoAtom){ TxInteractiveInfoAtom txinfo = (TxInteractiveInfoAtom)records[i]; link.startIndex = txinfo.getStartIndex(); link.endIndex = txinfo.getEndIndex(); } out.add(link); } } } } }
ExObjList lst = _documentRecord.getExObjList(); if (lst == null) { lst = new ExObjList(); _documentRecord.addChildAfter(lst, _documentRecord.getDocumentAtom()); try { ExObjListAtom objAtom = lst.getExObjListAtom(); lst.addChildAfter(exEmbed, objAtom);
Record[] ch = lst.getChildRecords(); for (int i = 0; i < ch.length; i++) { if(ch[i] instanceof ExEmbed){
/** * Set things up, and find our more interesting children */ protected ExObjList(byte[] source, int start, int len) { // Grab the header _header = new byte[8]; System.arraycopy(source,start,_header,0,8); // Find our children _children = Record.findChildRecords(source,start+8,len-8); findInterestingChildren(); }
/** * @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; } }
/** * Create a new ExObjList, with blank fields */ public ExObjList() { _header = new byte[8]; _children = new Record[1]; // Setup our header block _header[0] = 0x0f; // We are a container record LittleEndian.putShort(_header, 2, (short)_type); // Setup our child records _children[0] = new ExObjListAtom(); findInterestingChildren(); }
/** * @return UNC or local path to a video file */ public String getPath(){ OEShapeAtom oe = (OEShapeAtom)getClientDataRecord(RecordTypes.OEShapeAtom.typeID); int idx = oe.getOptions(); SlideShow 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; } }
/** * Create a new ExObjList, with blank fields */ public ExObjList() { _header = new byte[8]; _children = new Record[1]; // Setup our header block _header[0] = 0x0f; // We are a container record LittleEndian.putShort(_header, 2, (short)_type); // Setup our child records _children[0] = new ExObjListAtom(); findInterestingChildren(); }