From c04ee66c7cfeb725d637b0f9ec3e3b1f8776bfe9 Mon Sep 17 00:00:00 2001 From: László Németh Date: Tue, 15 Sep 2020 16:13:34 +0200 Subject: tdf#134784 DOCX import: fix shape paragraph margins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit based on bad style inheritance. Regression from commit dc0300eac3b755bc207cd1fe87217f4ebaeb9f58 (tdf#118521 DOCX import: fix paragraph margin from paragraph style), revealing the problematic m_sCurrentParaStyleName, see also commit 8920d865ee148518bf71f71ce1866b24cc17c07e for more information. Change-Id: Icc7f70452d946d56dc840d39545d850f74f97ebc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102774 Tested-by: László Németh Reviewed-by: László Németh --- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'writerfilter/source') diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 25030cbff4b6..b0facd429e0e 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -780,8 +780,13 @@ uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear() OUString DomainMapper_Impl::GetCurrentParaStyleName() { + OUString sName; // use saved currParaStyleName as a fallback, in case no particular para style name applied. - OUString sName = m_sCurrentParaStyleName; + // tdf#134784 except in the case of first paragraph of shapes to avoid bad fallback. + // TODO fix this "highly inaccurate" m_sCurrentParaStyleName + if ( !m_bIsFirstParaInShape ) + sName = m_sCurrentParaStyleName; + PropertyMapPtr pParaContext = GetTopContextOfType(CONTEXT_PARAGRAPH); if ( pParaContext && pParaContext->isSet(PROP_PARA_STYLE_NAME) ) pParaContext->getProperty(PROP_PARA_STYLE_NAME)->second >>= sName; -- cgit v1.2.3