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 fc1e5202cbfb36b28b0e597811f39895c19ae6ba Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Fri Nov 19 12:36:42 2021 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Dec 3 15:52:50 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 516287293580..b71490752708 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -262,7 +262,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 7217efe0e5c9..0c8235a3a1da 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2894,13 +2894,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, @@ -2988,7 +2995,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 900716e20093..375922511661 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(); @@ -125,6 +126,7 @@ public: CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); + CPPUNIT_TEST(testTdf129430); CPPUNIT_TEST(testTdf114848); CPPUNIT_TEST(testTdf68759); CPPUNIT_TEST(testTdf127901); @@ -203,6 +205,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