Patch from Stefan from bug #51172 - XWPF .gif images support

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1102668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-05-13 11:06:18 +00:00
parent 7f24c5f652
commit 333af414e0
4 changed files with 12 additions and 2 deletions

View File

@ -34,6 +34,7 @@
<changes> <changes>
<release version="3.8-beta3" date="2011-??-??"> <release version="3.8-beta3" date="2011-??-??">
<action dev="poi-developers" type="add">51172 - Add XWPF support for GIF pictures</action>
<action dev="poi-developers" type="add">NPOIFS Mini Streams now support extending the underlying big block stream to fit more data</action> <action dev="poi-developers" type="add">NPOIFS Mini Streams now support extending the underlying big block stream to fit more data</action>
<action dev="poi-developers" type="fix">51148 - XWPFDocument now properly tracks paragraphs and tables when adding/removing them</action> <action dev="poi-developers" type="fix">51148 - XWPFDocument now properly tracks paragraphs and tables when adding/removing them</action>
<action dev="poi-developers" type="fix">51153 - Correct sizing of LbsDataSubRecord with unused padding fields</action> <action dev="poi-developers" type="fix">51153 - Correct sizing of LbsDataSubRecord with unused padding fields</action>

View File

@ -35,4 +35,7 @@ public interface Document {
/** Device independent bitmap */ /** Device independent bitmap */
public static final int PICTURE_TYPE_DIB = 7; public static final int PICTURE_TYPE_DIB = 7;
/** GIF image format */
public static final int PICTURE_TYPE_GIF = 8;
} }

View File

@ -41,13 +41,14 @@ public class XWPFPictureData extends POIXMLDocumentPart {
*/ */
protected static final POIXMLRelation[] RELATIONS; protected static final POIXMLRelation[] RELATIONS;
static { static {
RELATIONS = new POIXMLRelation[8]; RELATIONS = new POIXMLRelation[9];
RELATIONS[Document.PICTURE_TYPE_EMF] = XWPFRelation.IMAGE_EMF; RELATIONS[Document.PICTURE_TYPE_EMF] = XWPFRelation.IMAGE_EMF;
RELATIONS[Document.PICTURE_TYPE_WMF] = XWPFRelation.IMAGE_WMF; RELATIONS[Document.PICTURE_TYPE_WMF] = XWPFRelation.IMAGE_WMF;
RELATIONS[Document.PICTURE_TYPE_PICT] = XWPFRelation.IMAGE_PICT; RELATIONS[Document.PICTURE_TYPE_PICT] = XWPFRelation.IMAGE_PICT;
RELATIONS[Document.PICTURE_TYPE_JPEG] = XWPFRelation.IMAGE_JPEG; RELATIONS[Document.PICTURE_TYPE_JPEG] = XWPFRelation.IMAGE_JPEG;
RELATIONS[Document.PICTURE_TYPE_PNG] = XWPFRelation.IMAGE_PNG; RELATIONS[Document.PICTURE_TYPE_PNG] = XWPFRelation.IMAGE_PNG;
RELATIONS[Document.PICTURE_TYPE_DIB] = XWPFRelation.IMAGE_DIB; RELATIONS[Document.PICTURE_TYPE_DIB] = XWPFRelation.IMAGE_DIB;
RELATIONS[Document.PICTURE_TYPE_GIF] = XWPFRelation.IMAGE_GIF;
} }
/** /**
* Create a new XWPFGraphicData node * Create a new XWPFGraphicData node

View File

@ -162,7 +162,12 @@ public final class XWPFRelation extends POIXMLRelation {
"/word/media/image#.dib", "/word/media/image#.dib",
XWPFPictureData.class XWPFPictureData.class
); );
public static final XWPFRelation IMAGE_GIF = new XWPFRelation(
"image/gif",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
"/word/media/image#.gif",
XWPFPictureData.class
);
public static final XWPFRelation IMAGES = new XWPFRelation( public static final XWPFRelation IMAGES = new XWPFRelation(
null, null,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",