From b00e43fa5848be0cc7ba81b185021511d94cdc00 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 10 Jun 2020 14:51:04 +0200 Subject: PPTX export, custom shape, bitmap fill: fix source vs fill rect confusion Commit 682ab832522b1349f1714bcb16f6e83468ea2920 (drawingML export\import: cropping of shape's fill texture, 2014-02-12) improved the DOCX filter, so the fill rectangle of a custom shape with bitmap fill is handled. The problem is drawingML has a source rectangle (similar to our crop rect) to limit the usage of the bitmap, and also it has a fill rectangle in case some margin is wanted around a stretched bitmap. We don't have a mapping for the later. Fix the problem by limiting the above work for DOCX, this way PPTX's source rectangle won't be turned into a stretch's fill rectangle. This way no unwanted margins will appear around the image -- those margins can be large enough that the image effectively disappears on export. Change-Id: Ic35063545a56eec9eaf885bbd397a854705d134f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96025 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- oox/source/export/drawingml.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'oox') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index fc5807ee61ba..f14129d0a2e8 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1443,6 +1443,12 @@ void DrawingML::WriteXGraphicBlipFill(uno::Reference const WriteXGraphicBlip(rXPropSet, rxGraphic, bRelPathToMedia); + if (GetDocumentType() != DOCUMENT_DOCX) + { + // Write the crop rectangle of Impress as a source rectangle. + WriteSrcRectXGraphic(rXPropSet, rxGraphic); + } + if (bWriteMode) { WriteXGraphicBlipMode(rXPropSet, rxGraphic); @@ -1538,6 +1544,13 @@ void DrawingML::WriteSrcRectXGraphic(uno::Reference const & void DrawingML::WriteXGraphicStretch(uno::Reference const & rXPropSet, uno::Reference const & rxGraphic) { + if (GetDocumentType() != DOCUMENT_DOCX) + { + // Limiting the area used for stretching is not supported in Impress. + mpFS->singleElementNS(XML_a, XML_stretch); + return; + } + mpFS->startElementNS(XML_a, XML_stretch); bool bCrop = false; -- cgit