From e37563c304e52f1d2385868c9b33e0145493d2bd Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Tue, 20 Dec 2016 15:54:18 +0300 Subject: tdf#104710 bRemove: only prevent w/BREAK_TYPE for defined Sections fixes regression from fix for bug 103975 which prevented removal of empty paragraphs if there was a page/column break. This patch adds the requirement that there is also a defined SectionBreak. I did a bad thing with unit test rhbz988516 (which was re-used as the unit test for bug 103975). I didn't first check in MSWord to see how many pages it really ought to have, and when it started round-tripping with 3 pages I was happy. Well, the proper page count according to MSO is 2 (a hard page/break and Section/newPage combine to form a single pagebreak). Undoing the regression fixes that too. The regression was commit 7b250d56981f78e77454a2a3fd670731b2358e75 Change-Id: I15e9df2d260954f02a9e183d9f48c1d267494b49 Reviewed-on: https://gerrit.libreoffice.org/32236 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-by: Justin Luth --- writerfilter/source/dmapper/DomainMapper.cxx | 3 ++- writerfilter/source/dmapper/PropertyMap.hxx | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index f79ad82402f6..0a4041cfd495 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3276,10 +3276,11 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) // If the paragraph contains only the section properties and it has // no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section. + SectionPropertyMap* pSectionContext = m_pImpl->GetSectionContext(); bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph - && !( pContext && pContext->isSet(PROP_BREAK_TYPE) ) && !m_pImpl->GetIsDummyParaAddedForTableInSection() + && !( pSectionContext && pSectionContext->GetBreakType() != -1 && pContext && pContext->isSet(PROP_BREAK_TYPE) ) && !m_pImpl->GetIsPreviousParagraphFramed(); const bool bNoNumbering = bRemove || (!m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && bSingleParagraph); diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index efee54294c4f..9fe090273150 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -312,6 +312,8 @@ public: void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; } void SetPageNumberType(sal_Int32 nSet) { m_nPageNumberType = nSet; } void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; } + // GetBreakType returns -1 if the breakType has not yet been identified for the section + sal_Int32 GetBreakType() { return m_nBreakType; } void SetLeftMargin( sal_Int32 nSet ) { m_nLeftMargin = nSet; } sal_Int32 GetLeftMargin() { return m_nLeftMargin; } -- cgit