/** * Add a control in this presentation * * @param name * name of the control, e.g. "Shockwave Flash Object" * @param progId * OLE Programmatic Identifier, e.g. * "ShockwaveFlash.ShockwaveFlash.9" * @return 0-based index of the control */ @SuppressWarnings("unused") public int addControl(String name, String progId) { ExControl ctrl = new ExControl(); ctrl.setProgId(progId); ctrl.setMenuName(name); ctrl.setClipboardName(name); ExOleObjAtom oleObj = ctrl.getExOleObjAtom(); oleObj.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE); oleObj.setType(ExOleObjAtom.TYPE_CONTROL); oleObj.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT); int objectId = addToObjListAtom(ctrl); oleObj.setObjID(objectId); return objectId; }
public String toString(){ StringBuffer buf = new StringBuffer(); buf.append("ExOleObjAtom\n"); buf.append(" drawAspect: " + getDrawAspect() + "\n"); buf.append(" type: " + getType() + "\n"); buf.append(" objID: " + getObjID() + "\n"); buf.append(" subType: " + getSubType() + "\n"); buf.append(" objStgDataRef: " + getObjStgDataRef() + "\n"); buf.append(" options: " + getOptions() + "\n"); return buf.toString(); } }
/** * Constructs a brand new link related atom record. */ public ExOleObjAtom() { _header = new byte[8]; _data = new byte[24]; LittleEndian.putShort(_header, 0, (short)1); //MUST be 0x1 LittleEndian.putShort(_header, 2, (short)getRecordType()); LittleEndian.putInt(_header, 4, _data.length); }
eeAtom.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE); eeAtom.setType(ExOleObjAtom.TYPE_EMBEDDED); eeAtom.setOptions(1226240); eeAtom.setObjStgDataRef(psrId); eeAtom.setObjID(objectId); return 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; }
/** * Create a new ExEmbed, with blank fields */ public ExEmbed() { _header = new byte[8]; _children = new Record[5]; // Setup our header block _header[0] = 0x0f; // We are a container record LittleEndian.putShort(_header, 2, (short)getRecordType()); // Setup our child records CString cs1 = new CString(); cs1.setOptions(0x1 << 4); CString cs2 = new CString(); cs2.setOptions(0x2 << 4); CString cs3 = new CString(); cs3.setOptions(0x3 << 4); _children[0] = new ExEmbedAtom(); _children[1] = new ExOleObjAtom(); _children[2] = cs1; _children[3] = cs2; _children[4] = cs3; findInterestingChildren(); }
/** * Returns unique identifier for the OLE object. * * @return the unique identifier for the OLE object */ public ObjectData getObjectData(){ SlideShow ppt = getSheet().getSlideShow(); ObjectData[] ole = ppt.getEmbeddedObjects(); //persist reference ExEmbed exEmbed = getExEmbed(); ObjectData 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) { logger.log(POILogger.WARN, "OLE data not found"); } return data; }
eeAtom.setObjID(objectId); eeAtom.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE); eeAtom.setType(ExOleObjAtom.TYPE_EMBEDDED); eeAtom.setOptions(1226240);
/** * 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; }
/** * Create a new ExEmbed, with blank fields */ public ExEmbed() { _header = new byte[8]; _children = new Record[5]; // Setup our header block _header[0] = 0x0f; // We are a container record LittleEndian.putShort(_header, 2, (short)getRecordType()); // Setup our child records final CString cs1 = new CString(); cs1.setOptions(0x1 << 4); final CString cs2 = new CString(); cs2.setOptions(0x2 << 4); final CString cs3 = new CString(); cs3.setOptions(0x3 << 4); _children[0] = new ExEmbedAtom(); _children[1] = new ExOleObjAtom(); _children[2] = cs1; _children[3] = cs2; _children[4] = cs3; findInterestingChildren(); }
/** * Returns unique identifier for the OLE object. * * @return the unique identifier for the OLE object */ 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 (HSLFObjectData hod : ole) { if(hod.getExOleObjStg().getPersistId() == ref) { data=hod; // keep searching to return the last persistent object with that refId } } } if (data==null) { LOG.log(POILogger.WARN, "OLE data not found"); } return data; }
public String toString(){ StringBuffer buf = new StringBuffer(); buf.append("ExOleObjAtom\n"); buf.append(" drawAspect: " + getDrawAspect() + "\n"); buf.append(" type: " + getType() + "\n"); buf.append(" objID: " + getObjID() + "\n"); buf.append(" subType: " + getSubType() + "\n"); buf.append(" objStgDataRef: " + getObjStgDataRef() + "\n"); buf.append(" options: " + getOptions() + "\n"); return buf.toString(); } }
ExControl ctrl = new ExControl(); ExOleObjAtom oleObj = ctrl.getExOleObjAtom(); oleObj.setObjID(objectId); oleObj.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE); oleObj.setType(ExOleObjAtom.TYPE_CONTROL); oleObj.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT);
if(ch[i] instanceof ExEmbed){ ExEmbed embd = (ExEmbed)ch[i]; if( embd.getExOleObjAtom().getObjID() == id) _exEmbed = embd;
/** * Constructs a brand new link related atom record. */ public ExOleObjAtom() { _header = new byte[8]; _data = new byte[24]; LittleEndian.putShort(_header, 0, (short)1); //MUST be 0x1 LittleEndian.putShort(_header, 2, (short)getRecordType()); LittleEndian.putInt(_header, 4, _data.length); }