diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-06-16 12:16:33 +0300 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-18 12:08:18 +0200 |
commit | 00d26e055d97706961032416b2a3de4d518d987b (patch) | |
tree | 800d80bda2f51220d36dcaef6197dd1d313aa422 /writerfilter | |
parent | 070552010d27fab9e224ad5289cc26a99440fecf (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>
(cherry picked from commit a4ab155ae15e9e6d4deb157634f8b86c87fcbde4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136985
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.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 224f8c2aa902..cc05d84cef4a 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()); |