diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-06-16 12:16:33 +0300 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-07-12 21:16:48 +0200 |
commit | a4ab155ae15e9e6d4deb157634f8b86c87fcbde4 (patch) | |
tree | 70274f5a3bff02ac73725f2a149fe8a092610fba /writerfilter | |
parent | a73daa562c82a5c058a217ba80035da08d40451d (diff) |
tdf#149313: DOCX import: improved conditions for removeparagraph
Quite complex conditions to define if current paragraph can be
removed for document were forcing to keep paragraphs after page
break with only section definition. Usually these pars are removed,
but since tdf#103975 fix they were kept.
It looks like to resolve that problem will be enough to ensure
current break is a column break: they are bit different and
processed in a different way unlike other break types.
So this condition part instead of "do not remove par with section
info after any break" it is right now "do not remove par after
column break".
Change-Id: Ib6290dc6254430883a598bef3ecd1f7ab7063922
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135969
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 713412ccfa94..d940d09ffd34 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3892,13 +3892,23 @@ 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(); + // Also do not remove here column breaks: they are treated in a different way and place. + bool bIsColumnBreak = false; + if (pContext->isSet(PROP_BREAK_TYPE)) + { + const uno::Any aBreakType = pContext->getProperty(PROP_BREAK_TYPE)->second; + bIsColumnBreak = + aBreakType == style::BreakType_COLUMN_BEFORE || + aBreakType == style::BreakType_COLUMN_AFTER || + aBreakType == style::BreakType_COLUMN_BOTH; + } + bool bRemove = (!m_pImpl->GetParaChanged() && m_pImpl->GetRemoveThisPara()) || (!m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraphAfterRedline + && !bIsColumnBreak && !m_pImpl->GetParaHadField() && (!m_pImpl->GetIsDummyParaAddedForTableInSectionPage()) - && !( pSectionContext && pSectionContext->GetBreakType() != -1 && pContext && pContext->isSet(PROP_BREAK_TYPE) ) && !m_pImpl->GetIsPreviousParagraphFramed() && !m_pImpl->HasTopAnchoredObjects() && !m_pImpl->IsParaWithInlineObject()); |