From c5abee7aefb088a11fc1618bc1512413e9bde682 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Mon, 2 Aug 2021 14:39:27 +0200 Subject: Revert "tdf#104254 sw DOCX import: fix text wrapping in headers" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts 7.2 commit 798b69087119c01a3b51e0bb3240ef35cfededeb. The change affected not only DOCX compatibilityMode 15, but also DOC and ODT and older versions of DOCX and everything else which should not have been affected. This reverted change of course affected layout. Some bug documents didn't loop after this layout breakage. That doesn't mean that those bugs were fixed. So just revert the tests: Revert "tdf#96840: sw_ww8export3: Add unittest" This reverts commit 975488594fc88aaba7298448e0ff727ebca7fe85. Revert "tdf#64997: sw_ww8export3: Add unittest" This reverts commit 02af9b8ef1f87bb6bc5fee22ad184681b20f201a. Change-Id: I54f7b801199bba45d8ca6f82f77e7060c7b3fcf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119887 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: Justin Luth Reviewed-by: László Németh (cherry picked from commit d03aaef3dcb5d142955457ae9b8ca4469cfafa38) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119973 Tested-by: Justin Luth Reviewed-by: Xisco Fauli (cherry picked from commit ff91ddf0a3992b58112f3ffc3e76735b9d66e514) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120144 Reviewed-by: Christian Lohmaier Reviewed-by: Michael Stahl Tested-by: Michael Stahl --- sw/qa/extras/layout/data/tdf104254.docx | Bin 30961 -> 0 bytes sw/qa/extras/layout/layout.cxx | 18 ------------------ .../odfexport/data/tdf104254_noHeaderWrapping.odt | Bin 0 -> 63167 bytes sw/qa/extras/odfexport/odfexport2.cxx | 10 ++++++++++ sw/qa/extras/ww8export/data/tdf64997.doc | Bin 62464 -> 0 bytes sw/qa/extras/ww8export/data/tdf96840.doc | Bin 133632 -> 0 bytes sw/qa/extras/ww8export/ww8export3.cxx | 14 -------------- sw/source/core/text/txtfly.cxx | 8 +++----- 8 files changed, 13 insertions(+), 37 deletions(-) delete mode 100644 sw/qa/extras/layout/data/tdf104254.docx create mode 100644 sw/qa/extras/odfexport/data/tdf104254_noHeaderWrapping.odt delete mode 100644 sw/qa/extras/ww8export/data/tdf64997.doc delete mode 100644 sw/qa/extras/ww8export/data/tdf96840.doc diff --git a/sw/qa/extras/layout/data/tdf104254.docx b/sw/qa/extras/layout/data/tdf104254.docx deleted file mode 100644 index a074db337024..000000000000 Binary files a/sw/qa/extras/layout/data/tdf104254.docx and /dev/null differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 4940a37e41c4..12fb7c421967 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3253,24 +3253,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124770) assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 1); } -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTextWrappingInHeader) -{ - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf104254.docx"); - - std::shared_ptr 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(SwLayoutWriter, testContinuousEndnotesInsertPageAtStart) { // Create a new document with CONTINUOUS_ENDNOTES enabled. diff --git a/sw/qa/extras/odfexport/data/tdf104254_noHeaderWrapping.odt b/sw/qa/extras/odfexport/data/tdf104254_noHeaderWrapping.odt new file mode 100644 index 000000000000..06dde4802b43 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf104254_noHeaderWrapping.odt differ diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index bbe5d7f193e7..68571cd8b863 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -39,6 +39,16 @@ DECLARE_ODFEXPORT_TEST(testTdf52065_centerTabs, "testTdf52065_centerTabs.odt") CPPUNIT_ASSERT_EQUAL(OUString(u"Pečiatka zamestnávateľa"), parseDump("//body/txt[4]/Text[4]", "Portion")); } +DECLARE_ODFEXPORT_TEST(testTdf104254_noHeaderWrapping, "tdf104254_noHeaderWrapping.odt") +{ + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + sal_Int32 nParaHeight = getXPath(pXmlDoc, "//header/txt[1]/infos/bounds", "height").toInt32(); + // The wrapping on header images is supposed to be ignored (since OOo for MS compat reasons), + // thus making the text run underneath the image. Before, height was 1104. Now it is 552. + CPPUNIT_ASSERT_MESSAGE("Paragraph should fit on a single line", nParaHeight < 600); +} + DECLARE_ODFEXPORT_TEST(testTdf137199, "tdf137199.docx") { CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty(getParagraph(1), "ListLabelString")); diff --git a/sw/qa/extras/ww8export/data/tdf64997.doc b/sw/qa/extras/ww8export/data/tdf64997.doc deleted file mode 100644 index d17ef5b84e26..000000000000 Binary files a/sw/qa/extras/ww8export/data/tdf64997.doc and /dev/null differ diff --git a/sw/qa/extras/ww8export/data/tdf96840.doc b/sw/qa/extras/ww8export/data/tdf96840.doc deleted file mode 100644 index 02cc7559dd55..000000000000 Binary files a/sw/qa/extras/ww8export/data/tdf96840.doc and /dev/null differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index b153f8abee5d..0332e023c3ed 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -291,20 +291,6 @@ DECLARE_WW8EXPORT_TEST(testTdf122460_header, "tdf122460_header.odt") CPPUNIT_ASSERT(headerIsOn); } -DECLARE_WW8EXPORT_TEST(testTdf96840, "tdf96840.doc") -{ - // Without the fix in place, this test would have hung at import time - CPPUNIT_ASSERT_EQUAL(3, getPages()); - CPPUNIT_ASSERT_EQUAL(4, getShapes()); -} - -DECLARE_WW8EXPORT_TEST(testTdf64997, "tdf64997.doc") -{ - // Without the fix in place, this test would have hung at import time - CPPUNIT_ASSERT_EQUAL(1, getPages()); - CPPUNIT_ASSERT_EQUAL(4, getShapes()); -} - DECLARE_WW8EXPORT_TEST(testTdf139495_tinyHeader, "tdf139495_tinyHeader.doc") { // In Word 2003, this is one page, but definitely not six pages. diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index d91d41ae4a01..2daaf4ac6d6c 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -843,8 +843,7 @@ 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) || - bFooterHeader ); + (!m_pCurrFrame->IsInFootnote() && !bFooterHeader)); m_bOn = false; @@ -886,14 +885,12 @@ 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 && bFooterHeader && com::sun::star::text::WrapTextMode_NONE == rFlyFormat.GetSurround() ) + ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() ) ) { continue; @@ -931,6 +928,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() mpAnchoredObjList->insert( aInsPosIter, pAnchoredObj ); } + const SwFormatSurround &rFlyFormat = pAnchoredObj->GetFrameFormat().GetSurround(); // #i68520# if ( rFlyFormat.IsAnchorOnly() && pAnchoredObj->GetAnchorFrame() == GetMaster() ) -- cgit v1.2.3