tdf#161348 sw: layout: ignore footnotes when splitting float table row

(regression from commit 534d3818aedfa95ad73935235462f5ec2817f5da)

Change-Id: I169d88375a93c288604a89ef89f7e895830446c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169570
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 68e7413b5f9ce4abd2a4e23bf27cfc335e52f03f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169562
diff --git a/sw/qa/extras/layout/data/fdo48718-1.docx b/sw/qa/extras/layout/data/fdo48718-1.docx
new file mode 100644
index 0000000..373aa35
--- /dev/null
+++ b/sw/qa/extras/layout/data/fdo48718-1.docx
Binary files differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 8cc6216..ed5d44d 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2290,6 +2290,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf138124)
                1);
}

CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf161348)
{
    createSwDoc("fdo48718-1.docx");

    xmlDocUniquePtr pXml = parseLayoutDump();

    // the floating table is on page 1
    // apparently both parts of the split table are on this text frame
    assertXPath(pXml, "/root/page[1]/body/txt[2]/anchored/fly"_ostr, 2);
    assertXPath(pXml, "/root/page[1]/body/txt[2]/anchored/fly/tab"_ostr, 2);
}

CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf154113)
{
    createSwDoc("three_sections.fodt");
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index efc7160..4211667 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -807,7 +807,8 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine,
        bRet = false;

    // apparently checking nFootnoteHeight here does *not* guarantee that it fits into the body
    if (bRet && nDistanceToFootnoteBodyPrtBottom + nFollowFootnotes < 0)
    if (bRet && rTab.IsInDocBody()
        && nDistanceToFootnoteBodyPrtBottom + nFollowFootnotes < 0)
    {
        assert(rTab.GetUpper() != rTab.FindFootnoteBossFrame()->FindBodyCont());
        SAL_INFO("sw.layout", "SwTabFrame Split failed because of footnote growth");