/** * Return list of pictures contained in this presentation * * @return list with the read pictures or an empty list if the * presentation doesn't contain pictures. */ public List<HSLFPictureData> getPictureData() { if (_pictures == null) { try { readPictures(); } catch (IOException e) { throw new CorruptPowerPointFileException(e.getMessage()); } } return Collections.unmodifiableList(_pictures); }
/** * Add a new picture to this presentation. * * @return offset of this picture in the Pictures stream */ public int addPicture(HSLFPictureData img) { // Process any existing pictures if we haven't yet if (_pictures == null) { try { readPictures(); } catch (IOException e) { throw new CorruptPowerPointFileException(e.getMessage()); } } // Add the new picture in int offset = 0; if (_pictures.size() > 0) { HSLFPictureData prev = _pictures.get(_pictures.size() - 1); offset = prev.getOffset() + prev.getRawData().length + 8; } img.setOffset(offset); img.setIndex(_pictures.size() + 1); _pictures.add(img); return offset; }
private void write(POIFSFileSystem outFS, boolean copyAllOtherNodes) throws IOException { readPictures();