--- src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (revision 421811) +++ src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (working copy) @@ -671,6 +671,7 @@ pict.setUID(uid); pict.setData(data); pict.setType(format); + pict.setOffset(offset); _hslfSlideShow.addPicture(pict); --- src/scratchpad/src/org/apache/poi/hslf/usermodel/PictureData.java (revision 421811) +++ src/scratchpad/src/org/apache/poi/hslf/usermodel/PictureData.java (working copy) @@ -49,6 +49,8 @@ */ protected byte[] header; + protected int offset; + public PictureData(){ header = new byte[PictureData.HEADER_SIZE]; } @@ -76,6 +78,7 @@ // Save the picture data pictdata = new byte[size]; + this.offset = offset; System.arraycopy(pictstream, startPos, pictdata, 0, pictdata.length); } @@ -164,6 +167,25 @@ } /** + * File offset in the 'Pictures' stream + * + * @return offset in the 'Pictures' stream + */ + public int getOffset(){ + return offset; + } + + /** + * Set offset of this picture in the 'Pictures' stream. + * We need to set it when a new picture is created. + * + * @param offset in the 'Pictures' stream + */ + public void setOffset(int offset){ + this.offset = offset; + } + + /** * Compute 16-byte checksum of this picture */ public static byte[] getChecksum(byte[] data) { --- src/scratchpad/src/org/apache/poi/hslf/model/Picture.java (revision 421811) +++ src/scratchpad/src/org/apache/poi/hslf/model/Picture.java (working copy) @@ -153,7 +153,7 @@ int idx = getPictureIndex()-1; EscherBSERecord bse = (EscherBSERecord)lst.get(idx); for ( int i = 0; i < pict.length; i++ ) { - if (Arrays.equals(bse.getUid(), pict[i].getUID())){ + if (pict[i].getOffset() == bse.getOffset()){ return pict[i]; } }