include/oox/export/drawingml.hxx   |    2 +-
 oox/source/export/drawingml.cxx    |   11 +++++++++--
 sd/qa/unit/data/odp/tdf129430.odp  |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   15 +++++++++++++++
 4 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit 8cb29f4154730713878ddd3c273600411ddaf5fe
Author:     Tibor Nagy <[email protected]>
AuthorDate: Fri Nov 19 12:36:42 2021 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 9 17:12:55 2021 +0100

    tdf#129430 PPTX export: fix workaround for "At least" line spacing
    
    to avoid bad overlapping lines.
    
    PPTX does not have the option "At least", so line spacing
    with this setting is converted to fixed line spacing.
    Improve this workaround to use single line spacing, if the
    "At least" value is lower than the size of the characters,
    like "At least" is handled by Impress.
    
    Change-Id: I29b41225d48fd9a447e7f6ef3a8a7cc7ba9ef354
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125553
    Tested-by: László Németh <[email protected]>
    Reviewed-by: László Németh <[email protected]>
    (cherry picked from commit fc1e5202cbfb36b28b0e597811f39895c19ae6ba)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126588
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 4af628a289f9..af0a84ff8e16 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -260,7 +260,7 @@ public:
     void WriteXGraphicStretch(css::uno::Reference<css::beans::XPropertySet> 
const & rXPropSet,
                               css::uno::Reference<css::graphic::XGraphic> 
const & rxGraphic);
 
-    void WriteLinespacing( const css::style::LineSpacing& rLineSpacing );
+    void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
     OUString WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet> 
const & rXPropSet,
                                css::uno::Reference<css::graphic::XGraphic> 
const & rxGraphic,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 008e6ff9cf12..396288bd9940 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2848,13 +2848,20 @@ const char* DrawingML::GetAlignment( 
style::ParagraphAdjust nAlignment )
     return sAlignment;
 }
 
-void DrawingML::WriteLinespacing( const LineSpacing& rSpacing )
+void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float 
fFirstCharHeight)
 {
     if( rSpacing.Mode == LineSpacingMode::PROP )
     {
         mpFS->singleElementNS( XML_a, XML_spcPct,
                                XML_val, 
OString::number(static_cast<sal_Int32>(rSpacing.Height)*1000));
     }
+    else if (rSpacing.Mode == LineSpacingMode::MINIMUM
+             && fFirstCharHeight > static_cast<float>(rSpacing.Height) * 0.001 
* 72.0 / 2.54)
+    {
+        // 100% proportional line spacing = single line spacing
+        mpFS->singleElementNS(XML_a, XML_spcPct, XML_val,
+                              OString::number(static_cast<sal_Int32>(100000)));
+    }
     else
     {
         mpFS->singleElementNS( XML_a, XML_spcPts,
@@ -2942,7 +2949,7 @@ bool DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
     if( bHasLinespacing )
     {
         mpFS->startElementNS(XML_a, XML_lnSpc);
-        WriteLinespacing( aLineSpacing );
+        WriteLinespacing(aLineSpacing, fFirstCharHeight);
         mpFS->endElementNS( XML_a, XML_lnSpc );
     }
 
diff --git a/sd/qa/unit/data/odp/tdf129430.odp 
b/sd/qa/unit/data/odp/tdf129430.odp
new file mode 100644
index 000000000000..f5304f75cf26
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf129430.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index fbf39e111f71..1650680a2c30 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -51,6 +51,7 @@
 class SdOOXMLExportTest3 : public SdModelTestBaseXML
 {
 public:
+    void testTdf129430();
     void testTdf114848();
     void testTdf68759();
     void testTdf127901();
@@ -126,6 +127,7 @@ public:
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
+    CPPUNIT_TEST(testTdf129430);
     CPPUNIT_TEST(testTdf114848);
     CPPUNIT_TEST(testTdf68759);
     CPPUNIT_TEST(testTdf127901);
@@ -205,6 +207,19 @@ public:
     }
 };
 
+void SdOOXMLExportTest3::testTdf129430()
+{
+    sd::DrawDocShellRef xDocShRef
+        = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf129430.odp"), 
ODP);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xDocShRef->DoClose();
+
+    xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml");
+    assertXPath(pXmlDoc1, 
"/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:lnSpc/a:spcPct",
+                "val", "100000");
+}
+
 void SdOOXMLExportTest3::testTdf114848()
 {
     ::sd::DrawDocShellRef xDocShRef

Reply via email to