From: Nick Burch Date: Fri, 13 May 2011 11:06:18 +0000 (+0000) Subject: Patch from Stefan from bug #51172 - XWPF .gif images support X-Git-Tag: REL_3_8_BETA3~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e44a0f8d40655eaf3ac40f0a90739b6da69245f4;p=poi.git 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 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index db3adb4e1b..ad97b96946 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51172 - Add XWPF support for GIF pictures NPOIFS Mini Streams now support extending the underlying big block stream to fit more data 51148 - XWPFDocument now properly tracks paragraphs and tables when adding/removing them 51153 - Correct sizing of LbsDataSubRecord with unused padding fields diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java index 2c3d4f732a..cf051e4516 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java @@ -34,5 +34,8 @@ public interface Document { /** Device independent bitmap */ public static final int PICTURE_TYPE_DIB = 7; + + /** GIF image format */ + public static final int PICTURE_TYPE_GIF = 8; } diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java index ecae82b3fa..aee464e0e3 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java @@ -41,13 +41,14 @@ public class XWPFPictureData extends POIXMLDocumentPart { */ protected static final POIXMLRelation[] RELATIONS; static { - RELATIONS = new POIXMLRelation[8]; + RELATIONS = new POIXMLRelation[9]; RELATIONS[Document.PICTURE_TYPE_EMF] = XWPFRelation.IMAGE_EMF; RELATIONS[Document.PICTURE_TYPE_WMF] = XWPFRelation.IMAGE_WMF; RELATIONS[Document.PICTURE_TYPE_PICT] = XWPFRelation.IMAGE_PICT; RELATIONS[Document.PICTURE_TYPE_JPEG] = XWPFRelation.IMAGE_JPEG; RELATIONS[Document.PICTURE_TYPE_PNG] = XWPFRelation.IMAGE_PNG; RELATIONS[Document.PICTURE_TYPE_DIB] = XWPFRelation.IMAGE_DIB; + RELATIONS[Document.PICTURE_TYPE_GIF] = XWPFRelation.IMAGE_GIF; } /** * Create a new XWPFGraphicData node diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java index 83d2282099..14783d62f7 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java @@ -162,7 +162,12 @@ public final class XWPFRelation extends POIXMLRelation { "/word/media/image#.dib", 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( null, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",