Revert "tdf#104254 sw DOCX import: fix text wrapping in headers"
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 <nemeth@numbertext.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit d03aaef3dcb5d142955457ae9b8ca4469cfafa38)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119973
Tested-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/qa/extras/layout/data/tdf104254.docx b/sw/qa/extras/layout/data/tdf104254.docx
deleted file mode 100644
index a074db3..0000000
--- a/sw/qa/extras/layout/data/tdf104254.docx
+++ /dev/null
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 4940a37..12fb7c4 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<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(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 0000000..06dde48
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf104254_noHeaderWrapping.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index bbe5d7f..68571cd 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<OUString>(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 d17ef5b..0000000
--- a/sw/qa/extras/ww8export/data/tdf64997.doc
+++ /dev/null
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf96840.doc b/sw/qa/extras/ww8export/data/tdf96840.doc
deleted file mode 100644
index 02cc755..0000000
--- a/sw/qa/extras/ww8export/data/tdf96840.doc
+++ /dev/null
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index b153f8a..0332e02 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 d91d41a..2daaf4a 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() )