Bug 39097 - PATCH: support for pictures in HSLF
Summary: PATCH: support for pictures in HSLF
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: unspecified
Hardware: Other All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-24 16:40 UTC by Yegor Kozlov
Modified: 2006-07-02 09:09 UTC (History)
0 users



Attachments
patch with changes (25.61 KB, patch)
2006-03-24 16:44 UTC, Yegor Kozlov
Details | Diff
affected sources (54.41 KB, application/zip)
2006-03-24 16:46 UTC, Yegor Kozlov
Details

Note You need to log in before you can comment on or make changes to this bug.
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)