sw/qa/extras/layout/data/tdf104254.docx |binary sw/qa/extras/layout/layout2.cxx | 18 ++++++++++++++++++ sw/source/core/text/txtfly.cxx | 8 +++++--- 3 files changed, 23 insertions(+), 3 deletions(-)
New commits: commit 798b69087119c01a3b51e0bb3240ef35cfededeb Author: Daniel Arato (NISZ) <arato.dan...@nisz.hu> AuthorDate: Wed Mar 24 20:18:16 2021 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri May 21 08:00:33 2021 +0200 tdf#104254 sw DOCX import: fix text wrapping in headers Text wrapping around shapes and images used to be turned off in header and footer frames. This commit simply reenables that feature for headers/footers (to avoid also regressions related to the fix i13832). Change-Id: I46ca112f36e0c0c86342fa34fdb7cb7502745731 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113098 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/layout/data/tdf104254.docx b/sw/qa/extras/layout/data/tdf104254.docx new file mode 100644 index 000000000000..a074db337024 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf104254.docx differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 8846ff6a914e..7e962c9b5976 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -2472,6 +2472,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124770) assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTextWrappingInHeader) +{ + SwDoc* pDoc = createDoc("tdf104254.docx"); + + std::shared_ptr<GDIMetaFile> xMetaFile = pDoc->GetDocShell()->GetPreviewMetaFile(); + MetafileXmlDump dumper; + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray", 2); + + // Make sure the header image does not block any of the header text. + // Without the accompanying fix in place, this test would have failed with: + // - Expected: > 3000 + // - Actual : 2009 + OUString sTextArrayX = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray[1]", "x"); + CPPUNIT_ASSERT(sTextArrayX.toUInt32() > 3000); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testContinuousEndnotesInsertPageAtStart) { // Create a new document with CONTINUOUS_ENDNOTES enabled. diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index a5fb1f6b6731..28ffea4116ab 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -843,7 +843,8 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() const bool bAllowCompatWrap = m_pCurrFrame->IsInTab() && (bFooterHeader || m_pCurrFrame->IsInFootnote()); const bool bWrapAllowed = ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) || bAllowCompatWrap || - (!m_pCurrFrame->IsInFootnote() && !bFooterHeader)); + (!m_pCurrFrame->IsInFootnote() && !bFooterHeader) || + bFooterHeader ); m_bOn = false; @@ -885,12 +886,14 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() // #i20505# Do not consider oversized objects SwAnchoredObject* pAnchoredObj = (*pSorted)[ i ]; assert(pAnchoredObj); + const SwFormatSurround &rFlyFormat = pAnchoredObj->GetFrameFormat().GetSurround(); if ( !pAnchoredObj || !rIDDMA.IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) || !pAnchoredObj->ConsiderForTextWrap() || ( mbIgnoreObjsInHeaderFooter && !bFooterHeader && pAnchoredObj->GetAnchorFrame()->FindFooterOrHeader() ) || - ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() ) + ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() ) || + ( !bAllowCompatWrap && bFooterHeader && com::sun::star::text::WrapTextMode_NONE == rFlyFormat.GetSurround() ) ) { continue; @@ -928,7 +931,6 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() mpAnchoredObjList->insert( aInsPosIter, pAnchoredObj ); } - const SwFormatSurround &rFlyFormat = pAnchoredObj->GetFrameFormat().GetSurround(); // #i68520# if ( rFlyFormat.IsAnchorOnly() && pAnchoredObj->GetAnchorFrame() == GetMaster() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits