summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/layout/fly.cxx7
-rw-r--r--sw/source/core/layout/pagechg.cxx12
-rw-r--r--sw/source/core/layout/ssfrm.cxx1
3 files changed, 19 insertions, 1 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index a52f82f564e7..ecd4251881aa 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1463,8 +1463,15 @@ void CalcContent( SwLayoutFrm *pLay,
if ( bNoCalcFollow && pFrm->IsTextFrm() )
static_cast<SwTextFrm*>(pFrm)->ForbidFollowFormat();
+ const bool bDeleteForbidden(pSect && pSect->IsDeleteForbidden());
+ if (pSect)
+ pSect->ForbidDelete();
+
pFrm->Calc(pRenderContext);
+ if (!bDeleteForbidden)
+ pSect->AllowDelete();
+
// OD 14.03.2003 #i11760# - reset control flag for follow format.
if ( pFrm->IsTextFrm() )
{
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index a91cef35d2a1..2976db7804b9 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1151,6 +1151,16 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
#endif
}
+namespace
+{
+ bool isDeleteForbidden(const SwPageFrm *pDel)
+ {
+ const SwLayoutFrm* pBody = pDel->FindBodyCont();
+ const SwFrm* pBodyContent = pBody ? pBody->Lower() : NULL;
+ return pBodyContent && pBodyContent->IsDeleteForbidden();
+ }
+}
+
SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, bool bFootnote )
{
SwRootFrm *pRoot = static_cast<SwRootFrm*>(pPrevPage->GetUpper());
@@ -1216,7 +1226,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, bool bFootnote )
pPage->PreparePage( bFootnote );
// If the sibling has no body text, destroy it as long as it is no footnote page.
if ( pSibling && !pSibling->IsFootnotePage() &&
- !pSibling->FindFirstBodyContent() )
+ !pSibling->FindFirstBodyContent() && !isDeleteForbidden(pSibling) )
{
SwPageFrm *pDel = pSibling;
pSibling = static_cast<SwPageFrm*>(pSibling->GetNext());
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index a29b09ea844d..4d21ba2edf04 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -374,6 +374,7 @@ void SwFrm::DestroyImpl()
SwFrm::~SwFrm()
{
assert(m_isInDestroy); // check that only DestroySwFrm does "delete"
+ assert(!IsDeleteForbidden()); // check that its not deleted while deletes are forbidden
#if OSL_DEBUG_LEVEL > 0
// JP 15.10.2001: for detection of access to deleted frames
mpDrawObjs = reinterpret_cast<SwSortedObjs*>(0x33333333);