Bug 39097

Summary: PATCH: support for pictures in HSLF
Product: POI Reporter: Yegor Kozlov <yegor>
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: All   
Attachments: patch with changes
affected sources

Description Yegor Kozlov 2006-03-24 16:40:59 UTC
Notes:
 - Misc cleanup and refactoring of the code
org.apache.poi.hslf.usermodel.Picture is obsolete and goes away.
Instead two new classes are used:
org.apache.poi.hslf.usermodel.PictureData - holds picture data as read from
Pictures OLE stream
org.apache.poi.hslf.model.Picture extends Shape. - Image frame in a slide
 
 - Added default constructor to SlideShow and HSLFSlideShow to create
an empty ppt file and setup its initial structure from a template file:

    public HSLFSlideShow() throws IOException  {
         
this(HSLFSlideShow.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt"));
    }
empty.ppt is resource file and must be copied to its location by the compile
script. 


 - Support for adding pictures to a slide. Actually Picture is a subclass of Shape
which holds reference to the picture data, position of the picture in the slide,
etc.

 Use case:

        SlideShow ppt = new SlideShow();

        slide = ppt.createSlide();
        
        //picture is global object. It is shared across all slides.
        int idx = ppt.addPicture(new File("hello.jpg"), Picture.JPEG);
        
        Picture pict = new Picture(idx);
        pict.setDefaultSize(ppt); 
        slide.addShape(pict);
 
- Fixed bug with serialization of pictures.
 before this commit HSLFSlideShow.write skipped writing pictures and the data
was lost.
Now everything works right. Pictures are preserved.


Regards, Yegor
Comment 1 Yegor Kozlov 2006-03-24 16:44:25 UTC
Created attachment 17970 [details]
patch with changes
Comment 2 Yegor Kozlov 2006-03-24 16:46:04 UTC
Created attachment 17971 [details]
affected sources
Comment 3 Nick Burch 2006-03-24 16:53:16 UTC
Looks good, thanks for this. I'll try to commit it on the weekend
Comment 4 Nick Burch 2006-03-26 20:09:35 UTC
Thanks, I've committed all of this
Comment 5 Nick Burch 2006-07-02 16:09:11 UTC
Marking as closed (should've done this a while ago)