diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-05-09 08:20:21 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-10 16:03:56 +0200 |
commit | e747e6df648a7ff076663ab376a4dbbc041b5180 (patch) | |
tree | 5217a9f7e86d102904509e481a096d1c0d8c5026 /sw | |
parent | f6f5038be20bbdafd083bc652b99388529380695 (diff) |
tdf#160984 sw continuous endnotes: add a way to find the endnote section start
Existing code with endnotes on separate page at the end of the document
works by searching for a current or next page that is an endnote page in
SwFootnoteBossFrame::AppendFootnote(), and in case none is found, then
an endnote page is created.
Add similar infrastructure for the inline endnotes case: here we want to
find the first page that has an endnotes section, which also requires
being able to tell if a section is an endnotes one.
The newly introduced SwPageFrame::GetEndNoteSection() is not yet used in
SwFootnoteBossFrame::AppendFootnote(), though.
(cherry picked from commit 8bae684c93bd23bbe98707ba9cf75d1a39427131)
Change-Id: Ib08267f9bf6c7b06576624e3fa8e90e8b8b1b232
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167478
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/pagefrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/inc/sectfrm.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 23 | ||||
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 1 |
4 files changed, 29 insertions, 0 deletions
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 54458032f188..054495eeea80 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -204,6 +204,7 @@ public: bool IsEndNotePage() const { return m_bEndNotePage; } void SetFootnotePage( bool b ) { m_bFootnotePage = b; } void SetEndNotePage( bool b ) { m_bEndNotePage = b; } + SwSectionFrame* GetEndNoteSection(); sal_uInt16 GetPhyPageNum() const { return m_nPhyPageNum;} void SetPhyPageNum( sal_uInt16 nNum ) { m_nPhyPageNum = nNum;} diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx index 3debf367f05a..ac57bd815d5f 100644 --- a/sw/source/core/inc/sectfrm.hxx +++ b/sw/source/core/inc/sectfrm.hxx @@ -52,6 +52,8 @@ class SW_DLLPUBLIC SwSectionFrame final: public SwLayoutFrame, public SwFlowFram SwSection* m_pSection; bool m_bFootnoteAtEnd; // footnotes at the end of section bool m_bEndnAtEnd; // endnotes at the end of section + /// If this is a section for endnotes, then the SwSection is not backed by an SwSectionNode. + bool m_bEndNoteSection = false; bool m_bContentLock; // content locked bool m_bOwnFootnoteNum; // special numbering of footnotes bool m_bFootnoteLock; // ftn, don't leave this section bwd @@ -171,6 +173,8 @@ public: void SetFootnoteLock( bool bNew ) { m_bFootnoteLock = bNew; } bool IsFootnoteLock() const { return m_bFootnoteLock; } + void SetEndNoteSection(bool bEndNoteSection) { m_bEndNoteSection = bEndNoteSection; } + bool IsEndNoteSection() const { return m_bEndNoteSection; } }; inline const SwSectionFrame *SwSectionFrame::GetFollow() const diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 0dd64c6aecff..378e451b9f89 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -65,6 +65,29 @@ SwContentFrame *SwPageFrame::FindLastBodyContent() return pRet; } +SwSectionFrame* SwPageFrame::GetEndNoteSection() +{ + SwLayoutFrame* pBody = FindBodyCont(); + if (!pBody) + { + return nullptr; + } + + SwFrame* pLast = pBody->GetLastLower(); + if (!pLast || !pLast->IsSctFrame()) + { + return nullptr; + } + + auto pLastSection = static_cast<SwSectionFrame*>(pLast); + if (!pLastSection->IsEndNoteSection()) + { + return nullptr; + } + + return pLastSection; +} + /** * Checks if the frame contains one or more ContentFrame's anywhere in his * subsidiary structure; if so the first found ContentFrame is returned. diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 3967a1f56442..78278da9cb38 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -94,6 +94,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) : m_bOwnFootnoteNum( false ), m_bFootnoteLock( false ) { + m_bEndNoteSection = rSect.m_bEndNoteSection; StartListening(rSect.GetFormat()->GetNotifier()); mnFrameType = SwFrameType::Section; |