diff options
Diffstat (limited to 'sw/source/core/layout/ftnfrm.cxx')
-rw-r--r-- | sw/source/core/layout/ftnfrm.cxx | 172 |
1 files changed, 69 insertions, 103 deletions
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index ccdf4035d569..608ecb57ddd5 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <txtftn.hxx> #include <fmtftn.hxx> #include <ftnidx.hxx> @@ -67,29 +67,6 @@ sal_uLong MA_FASTCALL lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr ) { const SwFtnIdxs &rFtnIdxs = pDoc->GetFtnIdxs(); -#ifdef MA_DEBUG - //Wenn das Array nicht stimmt haben wir ein Problem, denn viele - //Ftn-Functions bauen auf dem Array auf. - for ( sal_uInt16 k = 0; k+1 < rFtnIdxs.Count(); ++k ) - { - SwIndex aIdx1(&pDoc->GetNodes()); - SwIndex aIdx2(&pDoc->GetNodes()); - rFtnIdxs[k]->pFtn-> GetTxtNode().GetIndex(aIdx1); - rFtnIdxs[k+1]->pFtn->GetTxtNode().GetIndex(aIdx2); - if ( aIdx1.GetIndex() > aIdx2.GetIndex() ) - { - ASSERT( !rFtnIdxs.Count(), "FtnIdxs not up to date" ); - } - else if ( aIdx1.GetIndex() == aIdx2.GetIndex() ) - { - SwTxtFtn *p1 = rFtnIdxs[k]; - SwTxtFtn *p2 = rFtnIdxs[k+1]; - ASSERT( *p1->GetStart() < *p2->GetStart(), - "FtnIdxs not up to date" ); - } - } -#endif - sal_uInt16 nRet; SwTxtFtnPtr pBla = (SwTxtFtn*)pAttr; if ( rFtnIdxs.Seek_Entry( pBla, &nRet ) ) @@ -98,14 +75,14 @@ sal_uLong MA_FASTCALL lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr ) return sal_uLong(nRet) + ENDNOTE; return nRet; } - ASSERT( !pDoc, "FtnPos not found." ); + OSL_ENSURE( !pDoc, "FtnPos not found." ); return 0; } sal_Bool SwFtnFrm::operator<( const SwTxtFtn* pTxtFtn ) const { const SwDoc* pDoc = GetFmt()->GetDoc(); - ASSERT( pDoc, "SwFtnFrm: Missing doc!" ); + OSL_ENSURE( pDoc, "SwFtnFrm: Missing doc!" ); return lcl_FindFtnPos( pDoc, GetAttr() ) < lcl_FindFtnPos( pDoc, pTxtFtn ); } @@ -134,7 +111,7 @@ sal_Bool lcl_NextFtnBoss( SwFtnBossFrm* &rpBoss, SwPageFrm* &rpPage, SwSectionFrm* pSct = rpBoss->FindSctFrm()->GetFollow(); if( pSct ) { - ASSERT( pSct->Lower() && pSct->Lower()->IsColumnFrm(), + OSL_ENSURE( pSct->Lower() && pSct->Lower()->IsColumnFrm(), "Where's the column?" ); rpBoss = (SwColumnFrm*)pSct->Lower(); SwPageFrm* pOld = rpPage; @@ -344,9 +321,9 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool ) //moeglich. //Wenn die Seite eine spezielle Fussnotenseite ist, so nehmen wir uns auch //soviel Platz wie eben moeglich. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( !GetUpper() || !GetUpper()->IsFtnBossFrm() ) - { ASSERT( !this, "Keine FtnBoss." ); + { OSL_ENSURE( !this, "Keine FtnBoss." ); return 0; } #endif @@ -360,7 +337,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool ) if( IsInSct() ) { SwSectionFrm* pSect = FindSctFrm(); - ASSERT( pSect, "GrowFrm: Missing SectFrm" ); + OSL_ENSURE( pSect, "GrowFrm: Missing SectFrm" ); // In a section, which has to maximize, a footnotecontainer is allowed // to grow, when the section can't grow anymore. if( !bTst && !pSect->IsColLocked() && @@ -557,11 +534,10 @@ void SwFtnFrm::InvalidateNxtFtnCnts( SwPageFrm *pPage ) } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) { -#if OSL_DEBUG_LEVEL > 1 static sal_uInt16 nNum = USHRT_MAX; SwTxtFtn* pTxtFtn = GetAttr(); if ( pTxtFtn->GetFtn().GetNumber() == nNum ) @@ -570,14 +546,12 @@ SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) (void)bla; } -#endif return SwLayoutFrm::GrowFrm( nDist, bTst, bInfo ); } SwTwips SwFtnFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) { -#if OSL_DEBUG_LEVEL > 1 static sal_uInt16 nNum = USHRT_MAX; if( nNum != USHRT_MAX ) { @@ -588,7 +562,6 @@ SwTwips SwFtnFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo ) (void)bla; } } -#endif return SwLayoutFrm::ShrinkFrm( nDist, bTst, bInfo ); } #endif @@ -660,11 +633,11 @@ void SwFtnFrm::Cut() void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) { - ASSERT( pParent, "Kein Parent fuer Paste." ); - ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); - ASSERT( pParent != this, "Bin selbst der Parent." ); - ASSERT( pSibling != this, "Bin mein eigener Nachbar." ); - ASSERT( !GetPrev() && !GetNext() && !GetUpper(), + OSL_ENSURE( pParent, "Kein Parent fuer Paste." ); + OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); + OSL_ENSURE( pParent != this, "Bin selbst der Parent." ); + OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." ); + OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(), "Bin noch irgendwo angemeldet." ); //In den Baum einhaengen. @@ -684,7 +657,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) //Wenn mein Vorgaenger mein Master ist und/oder wenn mein Nachfolger mein //Follow ist so kann ich deren Inhalt uebernehmen und sie vernichten. if ( GetPrev() && GetPrev() == GetMaster() ) - { ASSERT( SwFlowFrm::CastFlowFrm( GetPrev()->GetLower() ), + { OSL_ENSURE( SwFlowFrm::CastFlowFrm( GetPrev()->GetLower() ), "Fussnote ohne Inhalt?" ); (SwFlowFrm::CastFlowFrm( GetPrev()->GetLower()))-> MoveSubTree( this, GetLower() ); @@ -693,23 +666,23 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) delete pDel; } if ( GetNext() && GetNext() == GetFollow() ) - { ASSERT( SwFlowFrm::CastFlowFrm( GetNext()->GetLower() ), + { OSL_ENSURE( SwFlowFrm::CastFlowFrm( GetNext()->GetLower() ), "Fussnote ohne Inhalt?" ); (SwFlowFrm::CastFlowFrm( GetNext()->GetLower()))->MoveSubTree( this ); SwFrm *pDel = GetNext(); pDel->Cut(); delete pDel; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwDoc *pDoc = GetFmt()->GetDoc(); if ( GetPrev() ) { - ASSERT( lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetPrev())->GetAttr() ) <= + OSL_ENSURE( lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetPrev())->GetAttr() ) <= lcl_FindFtnPos( pDoc, GetAttr() ), "Prev ist not FtnPrev" ); } if ( GetNext() ) { - ASSERT( lcl_FindFtnPos( pDoc, GetAttr() ) <= + OSL_ENSURE( lcl_FindFtnPos( pDoc, GetAttr() ) <= lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetNext())->GetAttr() ), "Next is not FtnNext" ); } @@ -744,7 +717,7 @@ SwLayoutFrm *SwFrm::GetNextFtnLeaf( MakePageType eMakePage ) SwLayoutFrm* pNxt = pOldBoss->GetNextSctLeaf( eMakePage ); if( pNxt ) { - ASSERT( pNxt->IsColBodyFrm(), "GetNextFtnLeaf: Funny Leaf" ); + OSL_ENSURE( pNxt->IsColBodyFrm(), "GetNextFtnLeaf: Funny Leaf" ); pBoss = (SwFtnBossFrm*)pNxt->GetUpper(); pPage = pBoss->FindPageFrm(); } @@ -880,7 +853,7 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn ) pSect = (SwSectionFrm*)pSect->FindMaster(); if( !pSect || !pSect->Lower() ) return 0; - ASSERT( pSect->Lower()->IsColumnFrm(), + OSL_ENSURE( pSect->Lower()->IsColumnFrm(), "GetPrevFtnLeaf: Where's the column?" ); pNxtBoss = (SwFtnBossFrm*)pSect->Lower(); pBody = pSect; @@ -1002,7 +975,7 @@ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes if ( pCont ) { SwFtnFrm *pFtn = (SwFtnFrm*)pCont->Lower(); - ASSERT( pFtn, "FtnCont ohne Ftn." ); + OSL_ENSURE( pFtn, "FtnCont ohne Ftn." ); if ( bPageOnly ) while ( pFtn->GetMaster() ) pFtn = pFtn->GetMaster(); @@ -1112,9 +1085,9 @@ SwFtnContFrm *SwFtnBossFrm::MakeFtnCont() //immer direkt hinter dem Bodytext. //Sein FrmFmt ist immer das DefaultFrmFmt. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( FindFtnCont() ) - { ASSERT( !this, "Fussnotencontainer bereits vorhanden." ); + { OSL_ENSURE( !this, "Fussnotencontainer bereits vorhanden." ); return 0; } #endif @@ -1138,14 +1111,14 @@ SwFtnContFrm *SwFtnBossFrm::FindFtnCont() while( pFrm && !pFrm->IsFtnContFrm() ) pFrm = pFrm->GetNext(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( pFrm ) { SwFrm *pFtn = pFrm->GetLower(); - ASSERT( pFtn, "Cont ohne Fussnote." ); + OSL_ENSURE( pFtn, "Cont ohne Fussnote." ); while ( pFtn ) { - ASSERT( pFtn->IsFtnFrm(), "Nachbar von Fussnote keine Fussnote." ); + OSL_ENSURE( pFtn->IsFtnFrm(), "Nachbar von Fussnote keine Fussnote." ); pFtn = pFtn->GetNext(); } } @@ -1213,7 +1186,7 @@ SwFtnFrm *SwFtnBossFrm::FindFirstFtn() if( pRet ) { pBoss = pRet->GetRef()->FindFtnBossFrm(); - ASSERT( pBoss, "FindFirstFtn: No boss found" ); + OSL_ENSURE( pBoss, "FindFirstFtn: No boss found" ); if( !pBoss ) return sal_False; // ?There must be a bug, but no GPF pPage = pBoss->FindPageFrm(); @@ -1325,7 +1298,7 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) { //Vernichten der Inkarnationen von Fussnoten zum Attribut, wenn sie nicht //zu pAssumed gehoeren. - ASSERT( !pCheck->GetMaster(), "Master not an Master." ); + OSL_ENSURE( !pCheck->GetMaster(), "Master not an Master." ); SwNodeIndex aIdx( *pCheck->GetAttr()->GetStartNode(), 1 ); SwCntntNode *pNd = aIdx.GetNode().GetCntntNode(); @@ -1370,14 +1343,6 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) { -#if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL) - static sal_uInt16 nStop = 0; - if ( nStop == pNew->GetFrmId() ) - { - int bla = 5; - (void)bla; - } -#endif //Die Fussnote haben wir, sie muss jetzt nur noch irgendwo //hin und zwar vor die Fussnote, deren Attribut vor das //der neuen zeigt (Position wird ueber das Doc ermittelt) @@ -1483,7 +1448,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) //werden. pSibling = (SwFtnFrm*)pParent->Lower(); if ( !pSibling ) - { ASSERT( !this, "Keinen Platz fuer Fussnote gefunden."); + { OSL_ENSURE( !this, "Keinen Platz fuer Fussnote gefunden."); return; } nCmpPos = ::lcl_FindFtnPos( pDoc, pSibling->GetAttr() ); @@ -1502,7 +1467,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) if ( pSibling->GetNext() ) { pSibling = (SwFtnFrm*)pSibling->GetNext(); - ASSERT( !pSibling->GetMaster() || ( ENDNOTE > nStPos && + OSL_ENSURE( !pSibling->GetMaster() || ( ENDNOTE > nStPos && pSibling->GetAttr()->GetFtn().IsEndNote() ), "InsertFtn: Master expected I" ); } @@ -1524,7 +1489,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) if ( pSibling ) { nCmpPos = ::lcl_FindFtnPos( pDoc, pSibling->GetAttr() ); - ASSERT( nCmpPos > nLastPos, "InsertFtn: Order of FtnFrm's buggy" ); + OSL_ENSURE( nCmpPos > nLastPos, "InsertFtn: Order of FtnFrm's buggy" ); } } // pLastSib ist jetzt die letzte Fussnote vor uns, @@ -1544,7 +1509,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) pSibling = pLastSib; while( pSibling->GetFollow() ) pSibling = pSibling->GetFollow(); - ASSERT( !pSibling->GetNext(), "InsertFtn: Who's that guy?" ); + OSL_ENSURE( !pSibling->GetNext(), "InsertFtn: Who's that guy?" ); } } } @@ -1623,7 +1588,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) { if( ENDNOTE > nCmpPos || nStPos >= ENDNOTE ) { - ASSERT( sal_False, "InsertFtn: Master expected II" ); + OSL_FAIL( "InsertFtn: Master expected II" ); do pSibling = pSibling->GetMaster(); while ( pSibling->GetMaster() ); @@ -1632,7 +1597,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) pParent = (SwFtnContFrm*)pSibling->GetUpper(); } } - ASSERT( pParent, "paste in space?" ); + OSL_ENSURE( pParent, "paste in space?" ); pNew->Paste( pParent, pSibling ); } @@ -1701,7 +1666,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) SwFtnContFrm *pCont = pNxt->FindFtnCont(); if ( pCont && pCont->Lower() ) { - ASSERT( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); + OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); if ( nStPos > ::lcl_FindFtnPos( pDoc, ((SwFtnFrm*)pCont->Lower())->GetAttr())) { @@ -1744,7 +1709,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) SwFtnContFrm *pCont = pNxt->FindFtnCont(); if ( pCont && pCont->Lower() ) { - ASSERT( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); + OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); if ( nStPos > ::lcl_FindFtnPos( pDoc, ((SwFtnFrm*)pCont->Lower())->GetAttr())) { @@ -1760,7 +1725,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) //Erstmal eine Fussnote und die benoetigten CntntFrms anlegen. if ( !pAttr->GetStartNode() ) - { ASSERT( !this, "Kein Fussnoteninhalt." ); + { OSL_ENSURE( !this, "Kein Fussnoteninhalt." ); return; } @@ -1794,7 +1759,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) if( bChgPage ) { SwLayoutFrm* pBody = pPage->FindBodyCont(); - ASSERT( pBody, "AppendFtn: NoPageBody?" ); + OSL_ENSURE( pBody, "AppendFtn: NoPageBody?" ); if( pBody->Lower() && pBody->Lower()->IsColumnFrm() ) pBoss = (SwFtnBossFrm*)pBody->Lower(); else @@ -1878,7 +1843,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr ) { //Der einfachste und sicherste Weg geht ueber das Attribut. - ASSERT( pAttr->GetStartNode(), "FtnAtr ohne StartNode." ); + OSL_ENSURE( pAttr->GetStartNode(), "FtnAtr ohne StartNode." ); SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 ); SwCntntNode *pNd = aIdx.GetNode().GetCntntNode(); if ( !pNd ) @@ -1936,7 +1901,7 @@ void SwFtnBossFrm::RemoveFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr, } while ( pFtn ); if( bPrep && pRef->IsFollow() ) { - ASSERT( pRef->IsTxtFrm(), "NoTxtFrm has Footnote?" ); + OSL_ENSURE( pRef->IsTxtFrm(), "NoTxtFrm has Footnote?" ); SwTxtFrm* pMaster = (SwTxtFrm*)pRef->FindMaster(); if( !pMaster->IsLocked() ) pMaster->Prepare( PREP_FTN_GONE ); @@ -2054,7 +2019,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, // OD 03.04.2003 #108446# - assert, that no reference footnote boss frame // is set, in spite of the order, that only previous footnotes has to be // collected. - ASSERT( !_bCollectOnlyPreviousFtns || _pRefFtnBossFrm, + OSL_ENSURE( !_bCollectOnlyPreviousFtns || _pRefFtnBossFrm, "<SwFtnBossFrm::_CollectFtns(..)> - No reference footnote boss frame for collecting only previous footnotes set.\nCrash will be caused!" ); //Alle Fussnoten die von pRef referenziert werden nacheinander @@ -2073,7 +2038,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, //Hier sollte keiner mit einer Follow-Ftn ankommen, es sei denn er hat //ernste Absichten (:-)); spricht er kommt mit einer Ftn an die vor der //ersten der Referenz liegt. - ASSERT( !_pFtn->GetMaster() || _pFtn->GetRef() != _pRef, "FollowFtn moven?" ); + OSL_ENSURE( !_pFtn->GetMaster() || _pFtn->GetRef() != _pRef, "FollowFtn moven?" ); while ( _pFtn->GetMaster() ) _pFtn = _pFtn->GetMaster(); @@ -2113,13 +2078,13 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, } while( !pNxtFtn && pBoss ); } else if( !pNxtFtn->GetAttr()->GetFtn().IsEndNote() ) - { ASSERT( !pNxtFtn->GetMaster(), "_CollectFtn: Master exspected" ); + { OSL_ENSURE( !pNxtFtn->GetMaster(), "_CollectFtn: Master exspected" ); while ( pNxtFtn->GetMaster() ) pNxtFtn = pNxtFtn->GetMaster(); } if ( pNxtFtn == _pFtn ) { - ASSERT( sal_False, "_CollectFtn: Devil's circle" ); + OSL_FAIL( "_CollectFtn: Devil's circle" ); pNxtFtn = 0; } @@ -2130,7 +2095,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, if ( _bCollectOnlyPreviousFtns ) { SwFtnBossFrm* pBossOfFoundFtn = _pFtn->FindFtnBossFrm( sal_True ); - ASSERT( pBossOfFoundFtn, + OSL_ENSURE( pBossOfFoundFtn, "<SwFtnBossFrm::_CollectFtns(..)> - footnote boss frame of found footnote frame missing.\nWrong layout!" ); if ( !pBossOfFoundFtn || // don't crash, if no footnote boss is found. pBossOfFoundFtn->IsBefore( _pRefFtnBossFrm ) @@ -2147,7 +2112,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, if ( bCollectFoundFtn ) { - ASSERT( !_pFtn->GetMaster(), "FollowFtn moven?" ); + OSL_ENSURE( !_pFtn->GetMaster(), "FollowFtn moven?" ); SwFtnFrm *pNxt = _pFtn->GetFollow(); while ( pNxt ) { @@ -2162,7 +2127,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, } while ( pCnt ); } else - { ASSERT( !pNxt, "Fussnote ohne Inhalt?" ); + { OSL_ENSURE( !pNxt, "Fussnote ohne Inhalt?" ); pNxt->Cut(); delete pNxt; } @@ -2325,7 +2290,7 @@ void SwFtnBossFrm::_MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc ) } } else - { ASSERT( !pFtn->GetMaster() && !pFtn->GetFollow(), + { OSL_ENSURE( !pFtn->GetMaster() && !pFtn->GetFollow(), "DelFtn und Master/Follow?" ); delete pFtn; // --> OD 2004-06-10 #i21478# @@ -2417,7 +2382,7 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest, || pAttr->GetFtn().IsEndNote() ) return; - ASSERT( this == pSrc->FindFtnBossFrm( sal_True ), + OSL_ENSURE( this == pSrc->FindFtnBossFrm( sal_True ), "SwPageFrm::MoveFtns: source frame isn't on that FtnBoss" ); SwFtnFrm *pFtn = FindFirstFtn(); @@ -2425,7 +2390,7 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest, { ChangeFtnRef( pSrc, pAttr, pDest ); SwFtnBossFrm *pDestBoss = pDest->FindFtnBossFrm( sal_True ); - ASSERT( pDestBoss, "+SwPageFrm::MoveFtns: no destination boss" ); + OSL_ENSURE( pDestBoss, "+SwPageFrm::MoveFtns: no destination boss" ); if( pDestBoss ) // robust { SvPtrarr aFtnArr( 5, 5 ); @@ -2588,7 +2553,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock, !pFtnFrm->IsColLocked() ) { // --> OD 2005-08-10 #i49383# - ASSERT( pLastFtnFrm == pFtnFrm, + OSL_ENSURE( pLastFtnFrm == pFtnFrm, "<SwFtnBossFrm::RearrangeFtns(..)> - <pLastFtnFrm> != <pFtnFrm>" ); pLastFtnFrm = 0L; // --> OD 2006-02-02 #i57914# - adjust fix #i49383# @@ -2731,11 +2696,11 @@ void SwPageFrm::UpdateFtnNum() else { SwFtnBossFrm* pTmpBoss = pFtn->FindFtnBossFrm( sal_True ); - SwPageFrm* pPage = pTmpBoss->FindPageFrm(); - pFtn = NULL; - lcl_NextFtnBoss( pTmpBoss, pPage, sal_False ); if( pTmpBoss ) { + SwPageFrm* pPage = pTmpBoss->FindPageFrm(); + pFtn = NULL; + lcl_NextFtnBoss( pTmpBoss, pPage, sal_False ); SwFtnContFrm *pCont = pTmpBoss->FindNearestFtnCont(); if ( pCont ) pFtn = (SwFtnFrm*)pCont->Lower(); @@ -2798,7 +2763,7 @@ SwTwips SwFtnBossFrm::GetVarSpace() const // die ganze Seite/Spalte ein. const SwPageFrm* pPg = FindPageFrm(); - ASSERT( pPg || IsInSct(), "Footnote lost page" ); + OSL_ENSURE( pPg || IsInSct(), "Footnote lost page" ); const SwFrm *pBody = FindBodyCont(); SwTwips nRet; @@ -2815,7 +2780,7 @@ SwTwips SwFtnBossFrm::GetVarSpace() const // the bottom of the last contentfrm if( pSect->IsEndnAtEnd() ) // endnotes allowed? { - ASSERT( !Lower() || !Lower()->GetNext() || Lower()->GetNext()-> + OSL_ENSURE( !Lower() || !Lower()->GetNext() || Lower()->GetNext()-> IsFtnContFrm(), "FtnContainer exspected" ); const SwFtnContFrm* pCont = Lower() ? (SwFtnContFrm*)Lower()->GetNext() : 0; @@ -2885,18 +2850,18 @@ sal_uInt8 SwFtnBossFrm::_NeighbourhoodAdjustment( const SwFrm* ) const nRet = NA_GROW_SHRINK; else { - ASSERT( GetUpper()->IsSctFrm(), "NeighbourhoodAdjustment: Unexspected Upper" ); + OSL_ENSURE( GetUpper()->IsSctFrm(), "NeighbourhoodAdjustment: Unexspected Upper" ); if( !GetNext() && !GetPrev() ) nRet = NA_GROW_ADJUST; // section with a single column (FtnAtEnd) else { const SwFrm* pTmp = Lower(); - ASSERT( pTmp, "NeighbourhoodAdjustment: Missing Lower()" ); + OSL_ENSURE( pTmp, "NeighbourhoodAdjustment: Missing Lower()" ); if( !pTmp->GetNext() ) nRet = NA_GROW_SHRINK; else if( !GetUpper()->IsColLocked() ) nRet = NA_ADJUST_GROW; - ASSERT( !pTmp->GetNext() || pTmp->GetNext()->IsFtnContFrm(), + OSL_ENSURE( !pTmp->GetNext() || pTmp->GetNext()->IsFtnContFrm(), "NeighbourhoodAdjustment: Who's that guy?" ); } } @@ -2965,7 +2930,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, pStart = pStart->GetNextCntntFrm(); } - ASSERT( pOldBoss->IsInSct() == pNewBoss->IsInSct(), + OSL_ENSURE( pOldBoss->IsInSct() == pNewBoss->IsInSct(), "MoveLowerFtns: Section confusion" ); SvPtrarr *pFtnArr; SwLayoutFrm* pNewChief = 0; @@ -3027,7 +2992,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss ) { - ASSERT( IsInFtn(), "Keine Ftn." ); + OSL_ENSURE( IsInFtn(), "Keine Ftn." ); SwLayoutFrm *pFtn = FindFtnFrm(); // The first paragraph in the first footnote in the first column in the @@ -3086,7 +3051,7 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss ) SwFtnFrm* pTmpFtn = pNewUpper->IsFtnFrm() ? ((SwFtnFrm*)pNewUpper) : 0; if( !pTmpFtn ) { - ASSERT( pNewUpper->IsFtnContFrm(), "Neuer Upper kein FtnCont."); + OSL_ENSURE( pNewUpper->IsFtnContFrm(), "Neuer Upper kein FtnCont."); SwFtnContFrm *pCont = (SwFtnContFrm*)pNewUpper; //Fussnote erzeugen. @@ -3108,7 +3073,7 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss ) pTmpFtn->Paste( pCont, pNx ); pTmpFtn->Calc(); } - ASSERT( pTmpFtn->GetAttr() == FindFtnFrm()->GetAttr(), "Wrong Footnote!" ); + OSL_ENSURE( pTmpFtn->GetAttr() == FindFtnFrm()->GetAttr(), "Wrong Footnote!" ); // Bereiche in Fussnoten beduerfen besonderer Behandlung SwLayoutFrm *pNewUp = pTmpFtn; if( IsInSct() ) @@ -3140,7 +3105,7 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss ) pTmpNxt = (SwSectionFrm*)pTmp; else { - ASSERT( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" ); + OSL_ENSURE( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" ); pTmpNxt = (SwTabFrm*)pTmp; } pTmpNxt->MoveSubTree( pTmpFtn, pNewUp->GetNext() ); @@ -3183,7 +3148,7 @@ SwSaveFtnHeight::~SwSaveFtnHeight() } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //JP 15.10.2001: in a non pro version test if the attribute has the same // meaning which his reference is @@ -3195,7 +3160,7 @@ SwSaveFtnHeight::~SwSaveFtnHeight() const SwCntntFrm* SwFtnFrm::GetRef() const { const SwCntntFrm* pRefAttr = GetRefFromAttr(); - ASSERT( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) + OSL_ENSURE( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) || pRefAttr->IsAnFollow( pRef ), "access to deleted Frame? pRef != pAttr->GetRef()" ); return pRef; @@ -3204,7 +3169,7 @@ const SwCntntFrm* SwFtnFrm::GetRef() const SwCntntFrm* SwFtnFrm::GetRef() { const SwCntntFrm* pRefAttr = GetRefFromAttr(); - ASSERT( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) + OSL_ENSURE( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) || pRefAttr->IsAnFollow( pRef ), "access to deleted Frame? pRef != pAttr->GetRef()" ); return pRef; @@ -3220,7 +3185,7 @@ const SwCntntFrm* SwFtnFrm::GetRefFromAttr() const SwCntntFrm* SwFtnFrm::GetRefFromAttr() { - ASSERT( pAttr, "invalid Attribute" ); + OSL_ENSURE( pAttr, "invalid Attribute" ); SwTxtNode& rTNd = (SwTxtNode&)pAttr->GetTxtNode(); SwPosition aPos( rTNd, SwIndex( &rTNd, *pAttr->GetStart() )); SwCntntFrm* pCFrm = rTNd.getLayoutFrm( getRootFrm(), 0, &aPos, sal_False ); @@ -3273,3 +3238,4 @@ SwCntntFrm* SwFtnFrm::FindLastCntnt() return pLastCntntFrm; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |