summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-12-17 16:55:07 +0300
committerJustin Luth <justin_luth@sil.org>2016-12-20 06:20:52 +0000
commitce758326191d66520ecba94c8a62a98dcfa3846b (patch)
tree2b715acd45a8275f4f78d76797aa1e15793ca28b
parent899ea62194d59a69e04823962a3170f762a02e9b (diff)
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 <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> (cherry picked from commit 223dd0c15e383144bdeea040f86efb7a06f89450) Reviewed-on: https://gerrit.libreoffice.org/32125 Tested-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx14
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx6
3 files changed, 9 insertions, 13 deletions
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 983b27c8cb55..12686345d9c2 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 c69e114a69ff..9e4ca9a1e9f2 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;}