sw/qa/extras/ooxmlexport/data/tdf112342.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 15 +++++++++++++++ writerfilter/source/dmapper/DomainMapper.cxx | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-)
New commits: commit e520a4f988bf0ff81e75e37588182af92fed7631 Author: Attila Bakos <bakos.attilakar...@nisz.hu> AuthorDate: Thu Jul 30 10:15:09 2020 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Aug 7 11:48:27 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> diff --git a/sw/qa/extras/ooxmlexport/data/tdf112342.docx b/sw/qa/extras/ooxmlexport/data/tdf112342.docx new file mode 100644 index 000000000000..ab4c7ee07d4d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf112342.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 8c2899046a3b..4e0bcad21fc7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -295,6 +295,21 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter, assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "1147"); } +DECLARE_OOXMLIMPORT_TEST(TestTdf112342, "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()); +} + DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx") { uno::Reference<beans::XPropertySet> xOLEProps(getShape(1), uno::UNO_QUERY_THROW); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index cf515ae72669..911f55431cc9 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2287,7 +2287,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