[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - oox/source sd/qa
GülÅah Köse (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 23 10:30:03 UTC 2021
oox/source/drawingml/shape.cxx | 6 ++++--
sd/qa/unit/data/pptx/tdf140714.pptx |binary
sd/qa/unit/export-tests.cxx | 16 ++++++++++++++++
3 files changed, 20 insertions(+), 2 deletions(-)
New commits:
commit ff751d42a4f672e25188ba90958e91d7869f395a
Author: Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Mon Mar 22 23:39:17 2021 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Mar 23 11:29:21 2021 +0100
tdf#140714 Import graphics cropped into custom geometry as custom shapes.
Change-Id: I2054d24ce41c9f0d6cc1675f461274067c3b2898
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112943
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
(cherry picked from commit db39b68c3c85531744ddeb8105b3ddb9b2dab099)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112811
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 5f3204bf64f2..ffa7fb017aca 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -722,8 +722,10 @@ Reference< XShape > const & Shape::createAndInsert(
}
// Use custom shape instead of GraphicObjectShape if the image is cropped to
// shape. Except rectangle, which does not require further cropping
- bool bIsCroppedGraphic = (aServiceName == "com.sun.star.drawing.GraphicObjectShape" && mpCustomShapePropertiesPtr->getShapePresetType() >= 0
- && mpCustomShapePropertiesPtr->getShapePresetType() != XML_Rect && mpCustomShapePropertiesPtr->getShapePresetType() != XML_rect);
+ bool bIsCroppedGraphic = (aServiceName == "com.sun.star.drawing.GraphicObjectShape" &&
+ (mpCustomShapePropertiesPtr->getShapePresetType() >= 0 || mpCustomShapePropertiesPtr->getPath2DList().size() > 0) &&
+ mpCustomShapePropertiesPtr->getShapePresetType() != XML_Rect &&
+ mpCustomShapePropertiesPtr->getShapePresetType() != XML_rect);
bool bIsCustomShape = ( aServiceName == "com.sun.star.drawing.CustomShape" ||
aServiceName == "com.sun.star.drawing.ConnectorShape" ||
bIsCroppedGraphic);
diff --git a/sd/qa/unit/data/pptx/tdf140714.pptx b/sd/qa/unit/data/pptx/tdf140714.pptx
new file mode 100644
index 000000000000..6f5e98ec66f1
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf140714.pptx differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 96022e2fc118..d8a214804643 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -79,6 +79,7 @@ public:
void testShadowBlur();
void testRhbz1870501();
void testTdf128550();
+ void testTdf140714();
CPPUNIT_TEST_SUITE(SdExportTest);
@@ -118,6 +119,7 @@ public:
CPPUNIT_TEST(testShadowBlur);
CPPUNIT_TEST(testRhbz1870501);
CPPUNIT_TEST(testTdf128550);
+ CPPUNIT_TEST(testTdf140714);
CPPUNIT_TEST_SUITE_END();
@@ -1355,6 +1357,20 @@ void SdExportTest::testTdf128550()
}
+void SdExportTest::testTdf140714()
+{
+ //Without the fix in place, shape will be imported as GraphicObjectShape instead of CustomShape.
+
+ auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf140714.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+ uno::Reference<drawing::XShape> xShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString{"com.sun.star.drawing.CustomShape"}, xShape->getShapeType());
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list