sw/qa/extras/uiwriter/data3/tdf112342.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 17 +++++++++++++++++ writerfilter/source/dmapper/DomainMapper.cxx | 8 +++++++- 3 files changed, 24 insertions(+), 1 deletion(-)
New commits: commit 75f291ff075c4e4106a1f652e8bab629e4edcff7 Author: Attila Bakos <bakos.attilakar...@nisz.hu> AuthorDate: Thu Jul 30 10:15:09 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Sep 8 18:36:40 2020 +0200 tdf#112342 DOCX import: fix page break before image-only paragraphs Picture anchored to an empty paragraphs was moved to the previous page, because the deferred page wasn't handled here. Change-Id: I4a694dd443ca8b67c4addbcba3523bffecd21418 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99763 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit e520a4f988bf0ff81e75e37588182af92fed7631) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100945 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/data3/tdf112342.docx b/sw/qa/extras/uiwriter/data3/tdf112342.docx new file mode 100644 index 000000000000..ab4c7ee07d4d Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf112342.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 34db982e195b..fe637456f517 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -55,6 +55,23 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) CPPUNIT_ASSERT_EQUAL(8, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf112342) +{ + load(DATA_DIRECTORY, "tdf112342.docx"); + + //Get the last para + uno::Reference<text::XTextRange> xPara = getParagraph(3); + auto xCur = xPara->getText()->createTextCursor(); + //Go to the end of it + xCur->gotoEnd(false); + //And let's remove the last 2 chars (the last para with its char). + xCur->goLeft(2, true); + xCur->setString(""); + + //If the second paragraph on the second page, this will be passed. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Page break does not match", 2, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626) { load(DATA_DIRECTORY, "tdf126626.docx"); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index beccdfdafc76..b9adb976c73b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2284,7 +2284,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) { if ( m_pImpl->IsDiscardHeaderFooter() ) break; - + //tdf112342: Break before images as well, if there are page break + if (m_pImpl->isBreakDeferred(BreakType::PAGE_BREAK)) + { + m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) + ->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); + m_pImpl->clearDeferredBreak(PAGE_BREAK); + } writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits