From 223dd0c15e383144bdeea040f86efb7a06f89450 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Sat, 17 Dec 2016 16:55:07 +0300 Subject: tdf#104714 bRemove paragraph: ignore frames in Headers/Footers Empty paragraphs are removed in certain cases. If the previous paragraph was in a frame, then this one shouldn't be removed (unless that previous paragraph was in a header/footer). Most of this patch is renaming the function to clarify that it refers to the latest paragraph, not the very last one. As noted in original tdf#75573, there may be other paragraph containers that should also ignore their framed status - so I've tried to set this up to make it easier to add those cases when proof documents are found. Change-Id: Icd09793f652616622ab266942f4b81eeb39c0ccc Reviewed-on: https://gerrit.libreoffice.org/32121 Tested-by: Jenkins Reviewed-by: Justin Luth --- writerfilter/source/dmapper/DomainMapper.cxx | 2 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 +++++--------- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 6 +++--- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 929671ac3df5..8d47e9801103 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3280,7 +3280,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) && !bSingleParagraph && !( pContext && pContext->isSet(PROP_BREAK_TYPE) ) && !m_pImpl->GetIsDummyParaAddedForTableInSection() - && !m_pImpl->GetIsLastParagraphFramed(); + && !m_pImpl->GetIsPreviousParagraphFramed(); PropertyMapPtr xContext = bRemove ? m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr(); if (xContext) { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index fec064cbc826..15ec945bf0dd 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -216,7 +216,7 @@ DomainMapper_Impl::DomainMapper_Impl( m_bIsFirstParaInSection( true ), m_bDummyParaAddedForTableInSection( false ), m_bTextFrameInserted(false), - m_bIsLastParagraphFramed( false ), + m_bIsPreviousParagraphFramed( false ), m_bIsLastParaInSection( false ), m_bIsLastSectionGroup( false ), m_bIsInComments( false ), @@ -1203,15 +1203,11 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) } } - if( (pParaContext && pParaContext->IsFrameMode()) - || (IsInHeaderFooter() && GetIsLastParagraphFramed()) ) - { - SetIsLastParagraphFramed(true); - } + bool bIgnoreFrameState = IsInHeaderFooter(); + if( (!bIgnoreFrameState && pParaContext && pParaContext->IsFrameMode()) || (bIgnoreFrameState && GetIsPreviousParagraphFramed()) ) + SetIsPreviousParagraphFramed(true); else - { - SetIsLastParagraphFramed(false); - } + SetIsPreviousParagraphFramed(false); m_bParaChanged = false; if (!pParaContext || !pParaContext->IsFrameMode()) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index ae503660dae7..d3cc079df9db 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -436,7 +436,7 @@ private: bool m_bIsFirstParaInSection; bool m_bDummyParaAddedForTableInSection; bool m_bTextFrameInserted; - bool m_bIsLastParagraphFramed; + bool m_bIsPreviousParagraphFramed; bool m_bIsLastParaInSection; bool m_bIsLastSectionGroup; bool m_bIsInComments; @@ -525,8 +525,8 @@ public: bool GetIsDummyParaAddedForTableInSection() { return m_bDummyParaAddedForTableInSection;} void SetIsTextFrameInserted( bool bIsInserted ); bool GetIsTextFrameInserted() { return m_bTextFrameInserted;} - void SetIsLastParagraphFramed( bool bIsFramed ) { m_bIsLastParagraphFramed = bIsFramed; } - bool GetIsLastParagraphFramed() { return m_bIsLastParagraphFramed; } + void SetIsPreviousParagraphFramed( bool bIsFramed ) { m_bIsPreviousParagraphFramed = bIsFramed; } + bool GetIsPreviousParagraphFramed() { return m_bIsPreviousParagraphFramed; } void SetParaSectpr(bool bParaSectpr); bool GetParaSectpr() { return m_bParaSectpr;} -- cgit