From 8cb29f4154730713878ddd3c273600411ddaf5fe Mon Sep 17 00:00:00 2001 From: Tibor Nagy Date: Fri, 19 Nov 2021 12:36:42 +0100 Subject: tdf#129430 PPTX export: fix workaround for "At least" line spacing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: László Németh (cherry picked from commit fc1e5202cbfb36b28b0e597811f39895c19ae6ba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126588 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- oox/source/export/drawingml.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'oox') 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(rSpacing.Height)*1000)); } + else if (rSpacing.Mode == LineSpacingMode::MINIMUM + && fFirstCharHeight > static_cast(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(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 ); } -- cgit