Lines 50-55
import org.apache.poi.sl.usermodel.PictureData.PictureType;
Link Here
|
50 |
import org.apache.poi.sl.usermodel.Resources; |
50 |
import org.apache.poi.sl.usermodel.Resources; |
51 |
import org.apache.poi.sl.usermodel.Shape; |
51 |
import org.apache.poi.sl.usermodel.Shape; |
52 |
import org.apache.poi.sl.usermodel.SlideShow; |
52 |
import org.apache.poi.sl.usermodel.SlideShow; |
|
|
53 |
import org.apache.poi.util.IOUtils; |
53 |
import org.apache.poi.util.POILogFactory; |
54 |
import org.apache.poi.util.POILogFactory; |
54 |
import org.apache.poi.util.POILogger; |
55 |
import org.apache.poi.util.POILogger; |
55 |
import org.apache.poi.util.Units; |
56 |
import org.apache.poi.util.Units; |
Lines 797-812
public final class HSLFSlideShow implements SlideShow {
Link Here
|
797 |
} |
798 |
} |
798 |
|
799 |
|
799 |
/** |
800 |
/** |
800 |
* Adds a picture to this presentation and returns the associated index. |
801 |
* Adds a picture to the presentation. |
|
|
802 |
* |
803 |
* @param is The stream to read the image from |
804 |
* @param format The format of the picture. |
805 |
* |
806 |
* @return the picture data. |
807 |
*/ |
808 |
@Override |
809 |
public HSLFPictureData addPicture(InputStream is, PictureType format) throws IOException { |
810 |
if (format == null || format.nativeId == -1) { // fail early |
811 |
throw new IllegalArgumentException("Unsupported picture format: " + format); |
812 |
} |
813 |
return addPicture(IOUtils.toByteArray(is), format); |
814 |
} |
815 |
|
816 |
/** |
817 |
* Adds a picture to the presentation. |
801 |
* |
818 |
* |
802 |
* @param pict |
819 |
* @param pict |
803 |
* the file containing the image to add |
820 |
* the file containing the image to add |
804 |
* @param format |
821 |
* @param format |
805 |
* the format of the picture. One of constans defined in the |
822 |
* The format of the picture. |
806 |
* <code>Picture</code> class. |
823 |
* |
807 |
* @return the index to this picture (1 based). |
824 |
* @return the picture data. |
808 |
*/ |
825 |
*/ |
|
|
826 |
@Override |
809 |
public HSLFPictureData addPicture(File pict, PictureType format) throws IOException { |
827 |
public HSLFPictureData addPicture(File pict, PictureType format) throws IOException { |
|
|
828 |
if (format == null || format.nativeId == -1) { // fail early |
829 |
throw new IllegalArgumentException("Unsupported picture format: " + format); |
830 |
} |
810 |
int length = (int) pict.length(); |
831 |
int length = (int) pict.length(); |
811 |
byte[] data = new byte[length]; |
832 |
byte[] data = new byte[length]; |
812 |
FileInputStream is = null; |
833 |
FileInputStream is = null; |
813 |
- |
|
|