summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-06-15 21:04:56 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-06-16 09:02:50 +0200
commit35bb0594b2d977312ef06fc5262cc7592bc13d0f (patch)
tree7c69b1f944b23e146dcf7b1e1bfecfa06c65d262 /sw/source
parentf1875565431d21789f12b67231fd8dc3f65e8c21 (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. Change-Id: I77841a3a0fb68f054941184ee2a8aca0707d2a9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96395 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-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 1b143e7d7b87..8ddd9747f840 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -750,13 +750,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 );