summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/ftnfrm.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/layout/ftnfrm.cxx')
-rw-r--r--sw/source/core/layout/ftnfrm.cxx29
1 files changed, 26 insertions, 3 deletions
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 7cc0b077e6eb..1290c125427e 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -474,6 +474,27 @@ void SwFootnoteFrame::InvalidateNxtFootnoteCnts( SwPageFrame const *pPage )
}
}
+bool SwFootnoteFrame::IsDeleteForbidden() const
+{
+ if (SwLayoutFrame::IsDeleteForbidden())
+ return true;
+ // needs to be in sync with the ::Cut logic
+ const SwLayoutFrame *pUp = GetUpper();
+ if (pUp)
+ {
+ if (GetPrev())
+ return false;
+
+ // The last footnote takes its container along if it
+ // is deleted. Cut would put pUp->Lower() to the value
+ // of GetNext(), so if there is no GetNext then
+ // Cut would delete pUp. If that condition is true
+ // here then check if the container is delete-forbidden
+ return !GetNext() && pUp->IsDeleteForbidden();
+ }
+ return false;
+}
+
void SwFootnoteFrame::Cut()
{
if ( GetNext() )
@@ -499,7 +520,7 @@ void SwFootnoteFrame::Cut()
if ( pUp )
{
// The last footnote takes its container along
- if ( !pUp->Lower() )
+ if (!pUp->Lower())
{
SwPageFrame *pPage = pUp->FindPageFrame();
if ( pPage )
@@ -1590,7 +1611,8 @@ void SwFootnoteBossFrame::AppendFootnote( SwContentFrame *pRef, SwTextFootnote *
pNew->Calc(getRootFrame()->GetCurrShell()->GetOut());
// #i57914# - adjust fix #i49383#
if ( !bOldFootnoteFrameLocked && !pNew->GetLower() &&
- !pNew->IsColLocked() && !pNew->IsBackMoveLocked() )
+ !pNew->IsColLocked() && !pNew->IsBackMoveLocked() &&
+ !pNew->IsDeleteForbidden() )
{
pNew->Cut();
SwFrame::DestroyFrame(pNew);
@@ -2199,7 +2221,8 @@ void SwFootnoteBossFrame::RearrangeFootnotes( const SwTwips nDeadLine, const boo
if ( !bLock && bUnlockLastFootnoteFrame &&
!pLastFootnoteFrame->GetLower() &&
!pLastFootnoteFrame->IsColLocked() &&
- !pLastFootnoteFrame->IsBackMoveLocked() )
+ !pLastFootnoteFrame->IsBackMoveLocked() &&
+ !pLastFootnoteFrame->IsDeleteForbidden() )
{
pLastFootnoteFrame->Cut();
SwFrame::DestroyFrame(pLastFootnoteFrame);