sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 3 + writerfilter/source/dmapper/DomainMapper.cxx | 16 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit f6f53f76e15f5eecc5b6ce56e471c53cebfea8ad Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Wed Apr 24 22:20:51 2019 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Apr 30 15:16:19 2019 +0200 tdf#123636 writerfilter: handle deferred breaks on frames ...similar to handling breaks before shapes in lcl_startShape. Three different examples found to create/split a paragraph. Which one to use? (addDummy, m_bIsSplitPara, and lcl_startCharacterGroup). SplitPara is not good because the paragraph properties probably should not be copied to the dummy paragraph (like numbering for example). Slightly modified the lcl_startChar example to ensure that the dummy paragraph doesn't steal a part of the properties, but is only default properties plus page-break. This doesn't export very well, so roundtripping is very poor. Research Note: There exists a compat flag showBreaksInFrames (Display Page/Column Breaks Present in Frames) "This element specifies whether applications should honor the presence of page and/or column breaks which are present within the contents of paragraphs which have been defined as frames using the framePr element." --Currently, LO does nothing with this flag. Probably too exotic and irrelevant (word 2003 era?). No existing unit tests found that have isSet(pg_brk) frames. Change-Id: I29f815355401c7af8b347a3ed9d0298bc9b27b93 Reviewed-on: https://gerrit.libreoffice.org/71255 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx index 30698c4675cf..a876bea84e02 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 4448275021bf..dfde7c2f399a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -97,7 +97,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak2, "tdf123636_newlinePage { //WITHOUT SplitPgBreakAndParaMark: a following anchored shape should force a page break //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 2, getParagraphs() ); - //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); + CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(2, ""), "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); } DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak3, "tdf123636_newlinePageBreak3.docx") diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 1a9be316b85d..cc7b7c720e05 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1965,6 +1965,22 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); if( pContext.get() ) { + // If there is a deferred page break applied to this framed paragraph, + // create a dummy paragraph without extra properties, + // so that the anchored frame will be on the correct page (similar to shapes). + if (pContext->isSet(PROP_BREAK_TYPE)) + { + pContext->Erase(PROP_BREAK_TYPE); + + lcl_startParagraphGroup(); + m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); + lcl_startCharacterGroup(); + sal_uInt8 const sBreak[] = { 0xd }; + lcl_text(sBreak, 1); + lcl_endCharacterGroup(); + lcl_endParagraphGroup(); + } + ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() ); if (pParaContext) pParaContext->SetFrameMode(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits