oox/source/drawingml/shape.cxx | 7 ++++++- sd/qa/unit/data/pptx/tdf165341.pptx |binary sd/qa/unit/import-tests2.cxx | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-)
New commits: commit 7f6eae5eb75a3993cba47608e7f02f9e4ee24a75 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Fri Mar 7 10:44:35 2025 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Mar 10 10:01:23 2025 +0100 tdf#165341 - FILEOPEN PPTX: fix paragraph alignment for text wrapped shapes In case of word wrapped text objects no need to set TextHorizontalAdjust based on text alignment. regression from: 1d9ce0a67a71e51569cd33c26270eeece587a354 (tdf#162571 - sd: Text box expands or shrinks on left or right or) Change-Id: I9455e30a58cc3853bc2a1c2030ab7cc62314106c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182616 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> (cherry picked from commit 37a99eb4d3489206d9385b9c065c5bb541c17b32) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182659 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 71f402572e2f..20776ea0b4e1 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1550,7 +1550,12 @@ Reference< XShape > const & Shape::createAndInsert( .maPropertyMap.getProperty(PROP_TextAutoGrowHeight) .get<bool>(); - if (bAutoGrowHeight && nShapeRotateInclCamera == 0) + bool bWrap = getTextBody() + ->getTextProperties() + .maPropertyMap.getProperty(PROP_TextWordWrap) + .get<bool>(); + + if (bAutoGrowHeight && !bWrap && nShapeRotateInclCamera == 0) { mpTextBody->getTextProperties().maPropertyMap.setProperty( PROP_TextHorizontalAdjust, lcl_convertTextAdjust( diff --git a/sd/qa/unit/data/pptx/tdf165341.pptx b/sd/qa/unit/data/pptx/tdf165341.pptx new file mode 100644 index 000000000000..6aed8787a6fc Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf165341.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 13a86cf25d77..9c16eebf1c39 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -37,6 +37,8 @@ #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> #include <com/sun/star/drawing/XGluePointsSupplier.hpp> #include <com/sun/star/drawing/GluePoint2.hpp> +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/container/XIdentifierAccess.hpp> #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> #include <com/sun/star/animations/XAnimate.hpp> @@ -125,6 +127,21 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf160490) CPPUNIT_ASSERT_EQUAL(sal_Int32(3367), nHeight2); } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf165341) +{ + createSdImpressDoc("pptx/tdf165341.pptx"); + + uno::Reference<drawing::XShape> xShape(getShapeFromPage(0, 0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xShape.is()); + uno::Reference<beans::XPropertySet> xProp(xShape, uno::UNO_QUERY); + drawing::TextHorizontalAdjust eHori; + CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextHorizontalAdjust"_ustr) >>= eHori); + drawing::TextVerticalAdjust eVert; + CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextVerticalAdjust"_ustr) >>= eVert); + CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER, eHori); + CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust::TextVerticalAdjust_TOP, eVert); +} + CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf157285) { createSdImpressDoc("pptx/tdf157285.pptx");