oox/source/drawingml/shape.cxx | 10 +++++++--- sd/qa/unit/data/pptx/tdf157529.pptx |binary sd/qa/unit/import-tests2.cxx | 25 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-)
New commits: commit 6f989266ca9880290832196cd115468d1a645b4b Author: Tibor Nagy <tibor.nagy.ext...@allotropia.de> AuthorDate: Sat Jun 22 11:17:33 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jun 27 10:48:02 2024 +0200 tdf#157529 PPTX import: fix transparency value if the paragraph, which uses transformation (Arch, Circle, etc.), contains multiple texts and the first text is only a space character, then we use the transparency value of the following text. Change-Id: Ia87242e34b495802cbecf5dc0dd13d490312f435 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169351 Reviewed-by: Nagy Tibor <tibor.nagy.ext...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 513c2bdbb1e7c0ad669d03043db61c94d6524aba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169443 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 2fcca550608c..9727688b25fe 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -646,9 +646,13 @@ static void lcl_copyCharPropsToShape(const uno::Reference<drawing::XShape>& xSha { std::shared_ptr<TextParagraph> pParagraph = *aParaIt; const TextRunVector& rRuns = pParagraph->getRuns(); - auto aRunIt = std::find_if_not( - rRuns.cbegin(), rRuns.cend(), - [](const std::shared_ptr<TextRun> pRun) { return pRun->getText().isEmpty(); }); + auto aRunIt = std::find_if_not(rRuns.cbegin(), rRuns.cend(), + [](const std::shared_ptr<TextRun> pRun) + { + return pRun->getText().isEmpty() + || pRun->getText() == " " + || pRun->getText().toChar() == 0xA0; // NBSP + }); if (aRunIt != rRuns.cend()) { std::shared_ptr<TextRun> pRun = *aRunIt; diff --git a/sd/qa/unit/data/pptx/tdf157529.pptx b/sd/qa/unit/data/pptx/tdf157529.pptx new file mode 100644 index 000000000000..625777809711 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf157529.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index ecae9a10c2d0..03ec35f9cb80 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -77,6 +77,31 @@ protected: bool checkPattern(int nShapeNumber, std::vector<sal_uInt8>& rExpected); }; +CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf157529) +{ + createSdImpressDoc("pptx/tdf157529.pptx"); + + uno::Reference<beans::XPropertySet> xShape1(getShapeFromPage(0, 0)); + CPPUNIT_ASSERT(xShape1.is()); + sal_Int16 nTransparence1; + xShape1->getPropertyValue(u"FillTransparence"_ustr) >>= nTransparence1; + + // Without the fix in place, this test would have failed with + // Expected: transparence value: 100% + // Actual : transparence value: 0% + CPPUNIT_ASSERT_EQUAL(sal_Int16(100), nTransparence1); + + uno::Reference<beans::XPropertySet> xShape2(getShapeFromPage(1, 0)); + CPPUNIT_ASSERT(xShape2.is()); + sal_Int16 nTransparence2; + xShape2->getPropertyValue(u"FillTransparence"_ustr) >>= nTransparence2; + + // Without the fix in place, this test would have failed with + // Expected: transparence value: 100% + // Actual : transparence value: 0% + CPPUNIT_ASSERT_EQUAL(sal_Int16(100), nTransparence2); +} + CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf160490) { createSdImpressDoc("pptx/tdf160490.pptx");