sw/qa/extras/layout/data/tdf146704_EndnoteInSection.odt |binary
 sw/qa/extras/layout/layout.cxx                          |    9 +++++++++
 sw/source/core/layout/findfrm.cxx                       |    3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 9a457c24ab2731c99f1a5fa1d28f68788e6977f3
Author:     Attila Szűcs <szucs.atti...@nisz.hu>
AuthorDate: Mon Feb 14 08:43:08 2022 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Feb 15 15:53:24 2022 +0100

    tdf#146704 sw: fix regression of endnote layout in sections
    
    Endnotes collected at the end of sections moved to a new page.
    
    Regression from commit 4c31b4ef2083087a822c3ae648fd09acc67d2f88
    "tdf#139336 sw: fix extra pages of multicolumn sections with footnotes".
    
    Co-authored-by: Tibor Nagy (NISZ)
    
    Change-Id: I36568e33b04ba8024ceef6b3ea84b71fb375e2a4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129896
    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/tdf146704_EndnoteInSection.odt 
b/sw/qa/extras/layout/data/tdf146704_EndnoteInSection.odt
new file mode 100644
index 000000000000..660dcb70df0b
Binary files /dev/null and 
b/sw/qa/extras/layout/data/tdf146704_EndnoteInSection.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 74638e413d59..1618b86a1363 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3728,6 +3728,15 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf135035)
     CPPUNIT_ASSERT_GREATER(nParentWidth, nFly3Width);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf146704_EndnoteInSection)
+{
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, 
"tdf146704_EndnoteInSection.odt");
+    CPPUNIT_ASSERT(pDoc);
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    // Without the fix, the endnote placed to 2. page
+    assertXPath(pXmlDoc, "/root/page", 1);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTdf139336_ColumnsWithFootnoteDoNotOccupyEntirePage)
 {
     SwDoc* pDoc
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 445d3e29dcd6..d100e24526a4 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -458,8 +458,9 @@ SwFootnoteBossFrame* SwFrame::FindFootnoteBossFrame( bool 
bFootnotes )
     //         similar case can be reached with a page break + FootnoteAtEnd 
setting
     SwSectionFrame* pSectframe = pRet->FindSctFrame();
     bool bMoveToPageFrame = false;
+    // tdf146704: only if it is really a footnote, not an endnote.
     // tdf54465: compatibility flag to make old odt files keep these full page 
sections.
-    if (pSectframe
+    if (bFootnotes && pSectframe
         && pSectframe->GetFormat()->getIDocumentSettingAccess().get(
             DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND))
     {

Reply via email to