summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-08-02 14:39:27 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-08-10 19:30:25 +0200
commitc5abee7aefb088a11fc1618bc1512413e9bde682 (patch)
treeda5110cc96af93cd44b234482111a31a40716139
parentc52e48d3d79c41fa3febbbd82f5ae69ff885b1e7 (diff)
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> (cherry picked from commit ff91ddf0a3992b58112f3ffc3e76735b9d66e514) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120144 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/qa/extras/layout/data/tdf104254.docxbin30961 -> 0 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx18
-rw-r--r--sw/qa/extras/odfexport/data/tdf104254_noHeaderWrapping.odtbin0 -> 63167 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx10
-rw-r--r--sw/qa/extras/ww8export/data/tdf64997.docbin62464 -> 0 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf96840.docbin133632 -> 0 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx14
-rw-r--r--sw/source/core/text/txtfly.cxx8
8 files changed, 13 insertions, 37 deletions
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
--- 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 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<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 000000000000..06dde4802b43
--- /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 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<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 d17ef5b84e26..000000000000
--- 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 02cc7559dd55..000000000000
--- 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 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() )