From 22bac58465b5187609a58a9eec0b5e7f537a1485 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 23 Oct 2021 09:46:13 +0000 Subject: [PATCH] use content types from constants git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894506 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/XSSFRelation.java | 104 ++++++++++-------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java index 545b575357..a720ba43c6 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java @@ -22,6 +22,7 @@ import java.util.Map; import org.apache.poi.ooxml.POIXMLDocument; import org.apache.poi.ooxml.POIXMLRelation; import org.apache.poi.openxml4j.opc.PackageRelationshipTypes; +import org.apache.poi.sl.usermodel.PictureData; import org.apache.poi.xssf.model.CalculationChain; import org.apache.poi.xssf.model.CommentsTable; import org.apache.poi.xssf.model.ExternalLinksTable; @@ -150,87 +151,94 @@ public final class XSSFRelation extends POIXMLRelation { ); public static final XSSFRelation IMAGES = new XSSFRelation( - null, - PackageRelationshipTypes.IMAGE_PART, - null, - XSSFPictureData::new, XSSFPictureData::new + null, + PackageRelationshipTypes.IMAGE_PART, + null, + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_EMF = new XSSFRelation( - "image/x-emf", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.emf", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.EMF.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.emf", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_WMF = new XSSFRelation( - "image/x-wmf", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.wmf", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.WMF.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.wmf", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_PICT = new XSSFRelation( - "image/pict", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.pict", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.PICT.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.pict", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_JPEG = new XSSFRelation( - "image/jpeg", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.jpeg", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.JPEG.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.jpeg", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_PNG = new XSSFRelation( - "image/png", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.png", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.PNG.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.png", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_DIB = new XSSFRelation( - "image/dib", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.dib", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.DIB.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.dib", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_GIF = new XSSFRelation( - "image/gif", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.gif", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.GIF.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.gif", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_TIFF = new XSSFRelation( - "image/tiff", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.tiff", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.TIFF.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.tiff", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_EPS = new XSSFRelation( - "image/x-eps", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.eps", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.EPS.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.eps", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_BMP = new XSSFRelation( - "image/x-ms-bmp", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.bmp", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.BMP.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.bmp", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation IMAGE_WPG = new XSSFRelation( - "image/x-wpg", - PackageRelationshipTypes.IMAGE_PART, - "/xl/media/image#.wpg", - XSSFPictureData::new, XSSFPictureData::new + PictureData.PictureType.WPG.contentType, + PackageRelationshipTypes.IMAGE_PART, + "/xl/media/image#.wpg", + XSSFPictureData::new, XSSFPictureData::new + ); + + public static final XSSFRelation HDPHOTO_WDP = new XSSFRelation( + PictureData.PictureType.WDP.contentType, + PackageRelationshipTypes.HDPHOTO_PART, + "/xl/media/hdphoto#.wdp", + XSSFPictureData::new, XSSFPictureData::new ); public static final XSSFRelation SHEET_COMMENTS = new XSSFRelation(