summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-06-15 21:04:56 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2020-06-17 14:00:15 +0200
commit7caa0003b0dc71ed676cc8fa84585c49f8ac5031 (patch)
tree047d09bdbf349dae84824ff84c5d8d929e2b4505 /sw/source/core/layout
parent81580e8850a1f256262edeaea990fb40c0dd637f (diff)
tdf#133145 sw ContinuousEndnotes: fix moving endnotes to a previous page
Regression from commit 4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (tdf#124601 sw: add ContinuousEndnotes layout compat option, 2019-09-30), the problem was that SwFrame::GetPrevFootnoteLeaf() did not take the new compat flag into account when determining the previous footnote page for endnotes. Do the same pattern here as the cases already handled in the above commit, just try to get the "last but one" and not the "last" page, since we try to move these endnotes to a previous page. (cherry picked from commit 35bb0594b2d977312ef06fc5262cc7592bc13d0f) Conflicts: sw/qa/core/layout/layout.cxx Change-Id: I77841a3a0fb68f054941184ee2a8aca0707d2a9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96467 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/ftnfrm.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 767ead4c6ef1..9573944b71d1 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -718,13 +718,31 @@ SwLayoutFrame *SwFrame::GetPrevFootnoteLeaf( MakePageType eMakeFootnote )
{
bool bEndn = pFootnote->GetAttr()->GetFootnote().IsEndNote();
SwFrame* pTmpRef = nullptr;
+ const IDocumentSettingAccess& rSettings
+ = pFootnote->GetAttrSet()->GetDoc()->getIDocumentSettingAccess();
if( bEndn && pFootnote->IsInSct() )
{
SwSectionFrame* pSect = pFootnote->FindSctFrame();
if( pSect->IsEndnAtEnd() )
+ // Endnotes at the end of the section.
pTmpRef = pSect->FindLastContent( SwFindMode::LastCnt );
}
+ else if (bEndn && rSettings.get(DocumentSettingId::CONTINUOUS_ENDNOTES))
+ {
+ // Endnotes at the end of the document.
+ SwPageFrame* pPage = getRootFrame()->GetLastPage();
+ assert(pPage);
+ SwFrame* pPrevPage = pPage->GetPrev();
+ if (pPrevPage)
+ {
+ // Have a last but one page, use that since we try to get a preceding frame.
+ assert(pPrevPage->IsPageFrame());
+ pPage = static_cast<SwPageFrame*>(pPrevPage);
+ }
+ pTmpRef = pPage->FindLastBodyContent();
+ }
if( !pTmpRef )
+ // Endnotes on a separate page.
pTmpRef = pFootnote->GetRef();
SwFootnoteBossFrame* pStop = pTmpRef->FindFootnoteBossFrame( !bEndn );