git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892653 13f79535-47bb-0310-9956-ffa450edef68tags/REL_5_1_0
@@ -101,6 +101,11 @@ public interface PackageRelationshipTypes { | |||
*/ | |||
String IMAGE_PART = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; | |||
/** | |||
* hdphoto type. | |||
*/ | |||
String HDPHOTO_PART = "http://schemas.microsoft.com/office/2007/relationships/hdphoto"; | |||
/** | |||
* Hyperlink type. | |||
*/ |
@@ -16,6 +16,7 @@ | |||
==================================================================== */ | |||
package org.apache.poi.xslf.usermodel; | |||
import static org.apache.poi.openxml4j.opc.PackageRelationshipTypes.HDPHOTO_PART; | |||
import static org.apache.poi.openxml4j.opc.PackageRelationshipTypes.IMAGE_PART; | |||
import java.util.HashMap; | |||
@@ -221,7 +222,12 @@ public final class XSLFRelation extends POIXMLRelation { | |||
"/ppt/media/image#.wdp", | |||
XSLFPictureData::new, XSLFPictureData::new | |||
); | |||
public static final XSLFRelation HDPHOTO_WDP = new XSLFRelation( | |||
PictureType.WDP.contentType, | |||
HDPHOTO_PART, | |||
"/ppt/media/hdphoto#.wdp", | |||
XSLFPictureData::new, XSLFPictureData::new | |||
); | |||
public static final XSLFRelation IMAGE_SVG = new XSLFRelation( | |||
PictureType.SVG.contentType, | |||
IMAGE_PART, |
@@ -648,7 +648,13 @@ implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> { | |||
* @return ID of the created relationship | |||
*/ | |||
String importBlip(String blipId, POIXMLDocumentPart parent) { | |||
final XSLFPictureData parData = parent.getRelationPartById(blipId).getDocumentPart(); | |||
final POIXMLDocumentPart docPart = parent.getRelationPartById(blipId).getDocumentPart(); | |||
XSLFPictureData parData; | |||
if (docPart instanceof XSLFPictureData) { | |||
parData = (XSLFPictureData)docPart; | |||
} else { | |||
throw new RuntimeException("cannot import blip " + blipId + " - document part is not XSLFPictureData type"); | |||
} | |||
final XSLFPictureData pictureData; | |||
if (getPackagePart().getPackage() == parent.getPackagePart().getPackage()) { | |||
// handle ref counter correct, if the parent document is the same as this |
@@ -32,9 +32,7 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse; | |||
import java.awt.Color; | |||
import java.awt.geom.Rectangle2D; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.net.URI; | |||
import java.text.AttributedCharacterIterator; | |||
import java.text.AttributedCharacterIterator.Attribute; | |||
@@ -49,6 +47,7 @@ import java.util.function.Function; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; | |||
import org.apache.poi.POIDataSamples; | |||
import org.apache.poi.common.usermodel.HyperlinkType; | |||
import org.apache.poi.ooxml.POIXMLDocumentPart; | |||
@@ -75,7 +74,6 @@ import org.apache.poi.sl.usermodel.SlideShowFactory; | |||
import org.apache.poi.sl.usermodel.TextRun; | |||
import org.apache.poi.sl.usermodel.TextShape; | |||
import org.apache.poi.sl.usermodel.VerticalAlignment; | |||
import org.apache.poi.util.IOUtils; | |||
import org.apache.commons.io.output.NullPrintStream; | |||
import org.apache.poi.xslf.usermodel.*; | |||
import org.apache.poi.xslf.util.DummyGraphics2d; | |||
@@ -1044,4 +1042,21 @@ class TestXSLFBugs { | |||
assertEquals(TextRun.TextCap.ALL, act); | |||
} | |||
} | |||
@Test | |||
public void bug65523() throws IOException { | |||
try (XMLSlideShow sourcePresentation = openSampleDocument("bug65523.pptx")) { | |||
XMLSlideShow targetPresentation = new XMLSlideShow(); | |||
XSLFSlide targetPresentationSlide = targetPresentation.createSlide(); | |||
XSLFSlide sourceSlide = sourcePresentation.getSlides().get(0); | |||
targetPresentationSlide.getSlideMaster().importContent(sourceSlide.getSlideMaster()); | |||
targetPresentationSlide.getSlideLayout().importContent(sourceSlide.getSlideLayout()); | |||
targetPresentationSlide.importContent(sourceSlide); | |||
targetPresentation.write(new UnsynchronizedByteArrayOutputStream()); | |||
} | |||
} | |||
} |