oox/source/drawingml/textparagraphproperties.cxx |    3 +++
 oox/source/export/drawingml.cxx                  |    4 +++-
 sd/qa/unit/data/odp/tdf169524.odp                |binary
 sd/qa/unit/data/pptx/tdf169524.pptx              |binary
 sd/qa/unit/export-tests-ooxml3.cxx               |   12 ++++++++++++
 sd/qa/unit/import-tests2.cxx                     |   11 +++++++++++
 6 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 1b4c25a954ca96079439b6a122697e3848c6e694
Author:     Karthik Godha <[email protected]>
AuthorDate: Thu Dec 4 19:59:01 2025 +0530
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Sat Dec 13 08:49:32 2025 +0100

    tdf#169524: Fix left margin import/export in PPTX
    
    Change-Id: I167d2bbe1d4238eb7bd264b74898c232fddb7b1f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195006
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 8c98be05acf61af19d4ff891ab74bce0db3f7476)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195369
    Tested-by: Jenkins
    (cherry picked from commit abe023e3222150f86cf56b1cb63109837511eb2c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195552
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/oox/source/drawingml/textparagraphproperties.cxx 
b/oox/source/drawingml/textparagraphproperties.cxx
index 8394e431e747..1ad2b5b71869 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -497,6 +497,9 @@ void TextParagraphProperties::pushToPropSet( const 
::oox::core::XmlFilterBase* p
     }
     if ( noParaLeftMargin )
         aPropSet.setProperty( PROP_ParaLeftMargin, *noParaLeftMargin);
+    else // Use 0 as default left margin
+        aPropSet.setProperty<sal_Int32>(PROP_ParaLeftMargin, 0);
+
     if ( noFirstLineIndentation )
     {
         aPropSet.setProperty( PROP_ParaFirstLineIndent, 
*noFirstLineIndentation );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 198d8a3145c5..226c2bc1e866 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3632,7 +3632,9 @@ bool DrawingML::WriteParagraphProperties(const 
Reference<XTextContent>& rParagra
     if (nLeftMargin > nMaxMarginVal)
         nLeftMargin = 0;
 
-    if (nParaLeftMargin) // For Paragraph
+    bool bIsListStyle = (nElement >= XML_lvl1pPr && nElement <= XML_lvl9pPr);
+
+    if (nParaLeftMargin || bIsListStyle) // For Paragraph or List-Style 
elements
         mpFS->startElementNS( XML_a, nElement,
                            XML_marL, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nParaLeftMargin)),
 nParaLeftMargin > 0),
                            XML_lvl, 
sax_fastparser::UseIf(OString::number(nOutLevel), nOutLevel > 0),
diff --git a/sd/qa/unit/data/odp/tdf169524.odp 
b/sd/qa/unit/data/odp/tdf169524.odp
new file mode 100644
index 000000000000..06b0a2dc346a
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf169524.odp differ
diff --git a/sd/qa/unit/data/pptx/tdf169524.pptx 
b/sd/qa/unit/data/pptx/tdf169524.pptx
new file mode 100644
index 000000000000..f1e93c55ca3a
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf169524.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 4de5ee355365..ea66d313e482 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -1130,6 +1130,18 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf169781)
                 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf169524)
+{
+    createSdImpressDoc("odp/tdf169524.odp");
+    save(TestFilter::PPTX);
+
+    xmlDocUniquePtr pXmlDoc = 
parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr);
+
+    // Verify that no left margin is exported
+    assertXPathNoAttribute(
+        pXmlDoc, 
"/p:sldMaster/p:cSld/p:spTree/p:sp[2]/p:txBody/a:lstStyle/a:lvl1pPr", "marL");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 75fe572123e2..cdae01a52184 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -2287,6 +2287,17 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, tdf158512)
                          
pPage->GetObj(0)->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND).GetValue());
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf169524)
+{
+    createSdImpressDoc("pptx/tdf169524.pptx");
+    uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
+    uno::Reference<beans::XPropertySet> const 
xParagraph(getParagraphFromShape(8, xShape),
+                                                         uno::UNO_QUERY_THROW);
+    sal_Int32 nLeftMargin;
+    xParagraph->getPropertyValue(u"ParaLeftMargin"_ustr) >>= nLeftMargin;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nLeftMargin);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to