From: Andreas Beeker Date: Sun, 16 Dec 2018 18:17:21 +0000 (+0000) Subject: #60656 - EMF image support in slideshows X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a5b67054b0337fb65ea45dde5819302581e5ff67;p=poi.git #60656 - EMF image support in slideshows git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849040 13f79535-47bb-0310-9956-ffa450edef68 --- a5b67054b0337fb65ea45dde5819302581e5ff67 diff --cc build.gradle index 63e1d34e8d,63e1d34e8d..9c4afa814b --- a/build.gradle +++ b/build.gradle @@@ -91,7 -91,7 +91,7 @@@ subprojects // See https://github.com/melix/japicmp-gradle-plugin apply plugin: 'me.champeau.gradle.japicmp' -- version = '4.0.2-SNAPSHOT' ++ version = '4.1.0-SNAPSHOT' ext { japicmpversion = '4.0.0' } diff --cc build.xml index d7032dc1c2,d7032dc1c2..e512230ac7 --- a/build.xml +++ b/build.xml @@@ -42,7 -42,7 +42,7 @@@ under the License The Apache POI project Ant build. -- ++ diff --cc sonar/examples/pom.xml index 22c576a20d,22c576a20d..b6854c9f7b --- a/sonar/examples/pom.xml +++ b/sonar/examples/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT poi-examples jar diff --cc sonar/excelant/pom.xml index 220d4eb1e9,220d4eb1e9..2953351f8e --- a/sonar/excelant/pom.xml +++ b/sonar/excelant/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT poi-excelant jar diff --cc sonar/main/pom.xml index 9bd0af96a2,9bd0af96a2..2c4eed2720 --- a/sonar/main/pom.xml +++ b/sonar/main/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT poi-main jar diff --cc sonar/ooxml-schema-encryption/pom.xml index d768a5f4b3,d768a5f4b3..9a0b19d190 --- a/sonar/ooxml-schema-encryption/pom.xml +++ b/sonar/ooxml-schema-encryption/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT .. poi-ooxml-schema-encryption diff --cc sonar/ooxml-schema-security/pom.xml index 06318b2be9,06318b2be9..a9d7418bbf --- a/sonar/ooxml-schema-security/pom.xml +++ b/sonar/ooxml-schema-security/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT .. poi-ooxml-schema-security diff --cc sonar/ooxml-schema/pom.xml index 7bb69433da,7bb69433da..3b5f5c28f4 --- a/sonar/ooxml-schema/pom.xml +++ b/sonar/ooxml-schema/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT .. poi-ooxml-schema diff --cc sonar/ooxml/pom.xml index 6a6232acaa,6a6232acaa..7de88404cc --- a/sonar/ooxml/pom.xml +++ b/sonar/ooxml/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT poi-ooxml jar diff --cc sonar/pom.xml index c008c3a1c4,c008c3a1c4..5fce9d97c5 --- a/sonar/pom.xml +++ b/sonar/pom.xml @@@ -4,7 -4,7 +4,7 @@@ org.apache.poi poi-parent pom -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT Apache POI - the Java API for Microsoft Documents Maven build of Apache POI for Sonar checks http://poi.apache.org/ diff --cc sonar/scratchpad/pom.xml index a980e15568,a980e15568..5af72fdee3 --- a/sonar/scratchpad/pom.xml +++ b/sonar/scratchpad/pom.xml @@@ -6,7 -6,7 +6,7 @@@ org.apache.poi poi-parent -- 4.0.2-SNAPSHOT ++ 4.1.0-SNAPSHOT poi-scratchpad jar diff --cc src/java/org/apache/poi/sl/draw/DrawPictureShape.java index fcca6d07a7,3ccbc9f219..70194bdcd7 --- a/src/java/org/apache/poi/sl/draw/DrawPictureShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawPictureShape.java @@@ -22,19 -22,22 +22,22 @@@ import java.awt.Graphics2D import java.awt.Insets; import java.awt.geom.Rectangle2D; import java.io.IOException; -import java.util.ServiceLoader; import org.apache.poi.sl.usermodel.PictureData; - import org.apache.poi.sl.usermodel.PictureData.PictureType; - import org.apache.poi.util.POILogFactory; - import org.apache.poi.util.POILogger; import org.apache.poi.sl.usermodel.PictureShape; import org.apache.poi.sl.usermodel.RectAlign; + import org.apache.poi.util.POILogFactory; + import org.apache.poi.util.POILogger; public class DrawPictureShape extends DrawSimpleShape { private static final POILogger LOG = POILogFactory.getLogger(DrawPictureShape.class); - private static final String WMF_IMAGE_RENDERER = "org.apache.poi.hwmf.draw.HwmfSLImageRenderer"; - + private static final String[] KNOWN_RENDERER = { + "org.apache.poi.hwmf.draw.HwmfImageRenderer", - "org.apache.poi.hemf.draw.HemfImageRenderer" ++ "org.apache.poi.hemf.draw.HemfImageRenderer", ++ "org.apache.poi.xslf.draw.SVGImageRenderer" + }; + public DrawPictureShape(PictureShape shape) { super(shape); } diff --cc src/java/org/apache/poi/util/Dimension2DDouble.java index 0000000000,d08906433c..227c0cddd5 mode 000000,100644..100644 --- a/src/java/org/apache/poi/util/Dimension2DDouble.java +++ b/src/java/org/apache/poi/util/Dimension2DDouble.java @@@ -1,0 -1,73 +1,76 @@@ + /* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ==================================================================== */ + + package org.apache.poi.util; + + import java.awt.geom.Dimension2D; + ++/** ++ * @since 4.1.0 ++ */ + public class Dimension2DDouble extends Dimension2D { + + double width; + double height; + + public Dimension2DDouble() { + width = 0d; + height = 0d; + } + + public Dimension2DDouble(double width, double height) { + this.width = width; + this.height = height; + } + + @Override + public double getWidth() { + return width; + } + + @Override + public double getHeight() { + return height; + } + + @Override + public void setSize(double width, double height) { + this.width = width; + this.height = height; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Dimension2DDouble) { + Dimension2DDouble other = (Dimension2DDouble) obj; + return width == other.width && height == other.height; + } + + return false; + } + + @Override + public int hashCode() { + double sum = width + height; + return (int) Math.ceil(sum * (sum + 1) / 2 + width); + } + + @Override + public String toString() { + return "Dimension2DDouble[" + width + ", " + height + "]"; + } + } diff --cc src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java index 71a42ef9e1,71a42ef9e1..0977a403a1 --- a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java +++ b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java @@@ -177,7 -177,7 +177,7 @@@ public class SignatureConfig /** * if true, the signature is added to the existing signatures * -- * @since POI 4.0.2 ++ * @since POI 4.1.0 */ private boolean allowMultipleSignatures = false; @@@ -1019,7 -1019,7 +1019,7 @@@ /** * @return true, if multiple signatures can be attached * -- * @since POI 4.0.2 ++ * @since POI 4.1.0 */ public boolean isAllowMultipleSignatures() { return allowMultipleSignatures; @@@ -1031,7 -1031,7 +1031,7 @@@ * @param allowMultipleSignatures if true, the signature will be added, * otherwise all existing signatures will be replaced by the current * -- * @since POI 4.0.2 ++ * @since POI 4.1.0 */ public void setAllowMultipleSignatures(boolean allowMultipleSignatures) { this.allowMultipleSignatures = allowMultipleSignatures; diff --cc src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java index 94b887e04e,0000000000..2363abb939 mode 100644,000000..100644 --- a/src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java +++ b/src/ooxml/java/org/apache/poi/xdgf/geom/Dimension2dDouble.java @@@ -1,73 -1,0 +1,28 @@@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.xdgf.geom; + - import java.awt.geom.Dimension2D; - - public class Dimension2dDouble extends Dimension2D { - - double width; - double height; - - public Dimension2dDouble() { - width = 0d; - height = 0d; - } - - public Dimension2dDouble(double width, double height) { - this.width = width; - this.height = height; - } - - @Override - public double getWidth() { - return width; - } - - @Override - public double getHeight() { - return height; - } - - @Override - public void setSize(double width, double height) { - this.width = width; - this.height = height; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof Dimension2dDouble) { - Dimension2dDouble other = (Dimension2dDouble) obj; - return width == other.width && height == other.height; - } - - return false; - } - - @Override - public int hashCode() { - double sum = width + height; - return (int) Math.ceil(sum * (sum + 1) / 2 + width); - } - - @Override - public String toString() { - return "Dimension2dDouble[" + width + ", " + height + "]"; - } ++import org.apache.poi.util.Removal; ++ ++/** ++ * @deprecated in 4.1.0 - use org.apache.poi.util.Dimension2DDouble ++ */ ++@Deprecated ++@Removal(version = "5.0.0") ++public class Dimension2dDouble extends org.apache.poi.util.Dimension2DDouble { +} diff --cc src/ooxml/java/org/apache/poi/xslf/draw/SVGImageRenderer.java index 2a03dda691,2a03dda691..a40c169516 --- a/src/ooxml/java/org/apache/poi/xslf/draw/SVGImageRenderer.java +++ b/src/ooxml/java/org/apache/poi/xslf/draw/SVGImageRenderer.java @@@ -39,6 -39,6 +39,7 @@@ import org.apache.batik.ext.awt.image.r import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.util.XMLResourceDescriptor; import org.apache.poi.sl.draw.ImageRenderer; ++import org.apache.poi.sl.usermodel.PictureData; import org.w3c.dom.Document; public class SVGImageRenderer implements ImageRenderer { @@@ -133,4 -133,4 +134,9 @@@ return true; } ++ ++ @Override ++ public boolean canRender(String contentType) { ++ return PictureData.PictureType.SVG.contentType.equalsIgnoreCase(contentType); ++ } } diff --cc src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java index b0cbc59dd1,b0cbc59dd1..c5e47415df --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java @@@ -310,7 -310,7 +310,7 @@@ public class XMLSlideShow extends POIXM /** * This method is used to create template for chart XML. * @return Xslf chart object -- * @since POI 4.0.2 ++ * @since POI 4.1.0 */ public XSLFChart createChart() { int chartIdx = findNextAvailableFileNameIndex(XSLFRelation.CHART, _charts.size() + 1); diff --cc src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java index 5e8d73cd06,5e8d73cd06..97f3ec23ee --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java @@@ -112,7 -112,7 +112,7 @@@ public final class XSLFChart extends XD * @param rID relation id * @param anchor size and location of chart * @return graphic frame object -- * @since POI 4.0.2 ++ * @since POI 4.1.0 */ static CTGraphicalObjectFrame prototype(int shapeId, String rID, Rectangle2D anchor) { CTGraphicalObjectFrame frame = CTGraphicalObjectFrame.Factory.newInstance(); diff --cc src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFDrawing.java index ba93988d0b,ba93988d0b..dca6fed131 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFDrawing.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFDrawing.java @@@ -112,7 -112,7 +112,7 @@@ public class XSLFDrawing * * @param rID relation id of chart * @param rect2D Chart Bounding values -- * @since POI 4.0.2 ++ * @since POI 4.1.0 */ public void addChart(String rID, Rectangle2D rect2D) { CTGraphicalObjectFrame sp = _spTree.addNewGraphicFrame(); diff --cc src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java index 2bcf063990,2bcf063990..d76142a4c4 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java @@@ -724,7 -724,7 +724,7 @@@ implements XSLFShapeContainer, Sheet