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 37a99eb4d3489206d9385b9c065c5bb541c17b32
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Fri Mar 7 10:44:35 2025 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Fri Mar 7 23:50:51 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>

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 571d38b5b2b8..4cb0160facee 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1551,7 +1551,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 b197ee530350..364a88471acb 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>
@@ -148,6 +150,21 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf165321)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(6402), xShape->getSize().Width);
 }
 
+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");

Reply via email to