diff options
Diffstat (limited to 'sw/source/core/layout/frmtool.cxx')
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index aa4f6e9921a6..c7315a282b3f 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.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. @@ -305,7 +306,7 @@ SwFrmNotify::~SwFrmNotify() } if ( pPageFrm != pFlyPageFrm ) { - ASSERT( pFlyPageFrm, "~SwFrmNotify: Fly from Nowhere" ); + OSL_ENSURE( pFlyPageFrm, "~SwFrmNotify: Fly from Nowhere" ); if( pFlyPageFrm ) pFlyPageFrm->MoveFly( pFlyFrm, pPageFrm ); else @@ -377,8 +378,7 @@ SwFrmNotify::~SwFrmNotify() } else { - ASSERT( false, - "<SwCntntNotify::~SwCntntNotify()> - unknown anchored object type. Please inform OD." ); + OSL_FAIL( "<SwCntntNotify::~SwCntntNotify()> - unknown anchored object type. Please inform OD." ); } } } @@ -823,7 +823,7 @@ SwCntntNotify::~SwCntntNotify() SwLayoutFrm* pCell = pCnt->GetUpper(); while( !pCell->IsCellFrm() && pCell->GetUpper() ) pCell = pCell->GetUpper(); - ASSERT( pCell->IsCellFrm(), "Where's my cell?" ); + OSL_ENSURE( pCell->IsCellFrm(), "Where's my cell?" ); if ( text::VertOrientation::NONE != pCell->GetFmt()->GetVertOrient().GetVertOrient() ) pCell->InvalidatePrt(); //fuer vertikale Ausrichtung. } @@ -889,7 +889,7 @@ SwCntntNotify::~SwCntntNotify() (pNd->GetOLEObj().IsOleRef() || pNd->IsOLESizeInvalid()) ) { - ASSERT( pCnt->IsInFly(), "OLE not in FlyFrm" ); + OSL_ENSURE( pCnt->IsInFly(), "OLE not in FlyFrm" ); SwFlyFrm *pFly = pCnt->FindFlyFrm(); svt::EmbeddedObjectRef& xObj = pNd->GetOLEObj().GetObject(); SwFEShell *pFESh = 0; @@ -911,7 +911,7 @@ SwCntntNotify::~SwCntntNotify() // The layout is calculated _before_ calling PrtOLENotify, // and the OLE objects are not invalidated during import. // Therefore I added the condition !IsUpdateExpFld, - // have a look at the occurence of CalcLayout in + // have a look at the occurrence of CalcLayout in // uiview/view.cxx. if ( !pNd->IsOLESizeInvalid() && !pSh->GetDoc()->IsUpdateExpFld() ) @@ -972,7 +972,6 @@ SwCntntNotify::~SwCntntNotify() continue; //#60878# nicht etwa zeichengebundene. } - sal_Bool bCheckPos = sal_False; if ( rAnch.GetCntntAnchor() ) { if ( !pIdx ) @@ -981,10 +980,9 @@ SwCntntNotify::~SwCntntNotify() } if ( rAnch.GetCntntAnchor()->nNode == *pIdx ) { - bCheckPos = sal_True; if (FLY_AT_PAGE == rAnch.GetAnchorId()) { - ASSERT( false, "<SwCntntNotify::~SwCntntNotify()> - to page anchored object with content position. Please inform OD." ); + OSL_FAIL( "<SwCntntNotify::~SwCntntNotify()> - to page anchored object with content position. Please inform OD." ); SwFmtAnchor aAnch( rAnch ); aAnch.SetAnchor( 0 ); aAnch.SetPageNum( pPage->GetPhyPageNum() ); @@ -1070,7 +1068,7 @@ void AppendObjs( const SwSpzFrmFmts *pTbl, sal_uLong nIndex, SdrObject* pSdrObj = 0; if ( bSdrObj && 0 == (pSdrObj = pFmt->FindSdrObject()) ) { - ASSERT( !bSdrObj, "DrawObject not found." ); + OSL_ENSURE( !bSdrObj, "DrawObject not found." ); pFmt->GetDoc()->DelFrmFmt( pFmt ); --i; continue; @@ -1304,7 +1302,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, ( !pLay->IsInTab() || pSct->IsInTab() ) ) { pActualSection = new SwActualSection( 0, pSct, 0 ); - ASSERT( !pLay->Lower() || !pLay->Lower()->IsColumnFrm(), + OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrm(), "_InsertCnt: Wrong Call" ); } } @@ -1507,8 +1505,8 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, } else if ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() ) { - ASSERT( pActualSection, "Sectionende ohne Anfang?" ); - ASSERT( pActualSection->GetSectionNode() == pNd->StartOfSectionNode(), + OSL_ENSURE( pActualSection, "Sectionende ohne Anfang?" ); + OSL_ENSURE( pActualSection->GetSectionNode() == pNd->StartOfSectionNode(), "Sectionende mit falschen Start Node?" ); //Section schliessen, ggf. die umgebende Section wieder @@ -1623,11 +1621,9 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, delete pPageMaker; if( pDoc->GetLayoutCache() ) { -#ifdef DBG_UTIL #if OSL_DEBUG_LEVEL > 1 pDoc->GetLayoutCache()->CompareLayout( *pDoc ); #endif -#endif pDoc->GetLayoutCache()->ClearImpl(); } } @@ -1691,14 +1687,14 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, SwFrm *pMove = pFrm; SwFrm *pPrev = pFrm->GetPrev(); SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pMove ); - ASSERT( pTmp, "Missing FlowFrm" ); + OSL_ENSURE( pTmp, "Missing FlowFrm" ); if ( bApres ) { // Wir wollen, dass der Rest der Seite leer ist, d.h. // der naechste muss auf die naechste Seite wandern. // Dieser kann auch in der naechsten Spalte stehen! - ASSERT( !pTmp->HasFollow(), "Follows forbidden" ); + OSL_ENSURE( !pTmp->HasFollow(), "Follows forbidden" ); pPrev = pFrm; // Wenn unser umgebender SectionFrm einen Next besitzt, // so soll dieser ebenfalls gemoved werden! @@ -1753,7 +1749,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, } else { - ASSERT( !pTmp->IsFollow(), "Follows really forbidden" ); + OSL_ENSURE( !pTmp->IsFollow(), "Follows really forbidden" ); // Bei Bereichen muss natuerlich der Inhalt auf die Reise // geschickt werden. if( pMove->IsSctFrm() ) @@ -1924,8 +1920,9 @@ void SwBorderAttrs::_CalcBottom() long SwBorderAttrs::CalcRight( const SwFrm* pCaller ) const { - long nRight; + long nRight=0; + if (!pCaller->IsTxtFrm() || !((SwTxtFrm*)pCaller)->GetTxtNode()->GetDoc()->get(IDocumentSettingAccess::INVERT_BORDER_SPACING)) { // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left // and right border are painted on the right respectively left. if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() ) @@ -1933,33 +1930,34 @@ long SwBorderAttrs::CalcRight( const SwFrm* pCaller ) const else nRight = CalcRightLine(); + } // for paragraphs, "left" is "before text" and "right" is "after text" if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() ) nRight += rLR.GetLeft(); else nRight += rLR.GetRight(); - // --> OD 2008-01-21 #newlistlevelattrs# // correction: retrieve left margin for numbering in R2L-layout if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() ) { nRight += ((SwTxtFrm*)pCaller)->GetTxtNode()->GetLeftMarginWithNum(); } - // <-- return nRight; } long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const { - long nLeft; + long nLeft=0; + if (!pCaller->IsTxtFrm() || !((SwTxtFrm*)pCaller)->GetTxtNode()->GetDoc()->get(IDocumentSettingAccess::INVERT_BORDER_SPACING)) { // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left // and right border are painted on the right respectively left. if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() ) nLeft = CalcRightLine(); else nLeft = CalcLeftLine(); + } // for paragraphs, "left" is "before text" and "right" is "after text" if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() ) @@ -1967,11 +1965,10 @@ long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const else nLeft += rLR.GetLeft(); - // --> OD 2008-01-21 #newlistlevelattrs# + // correction: do not retrieve left margin for numbering in R2L-layout // if ( pCaller->IsTxtFrm() ) if ( pCaller->IsTxtFrm() && !pCaller->IsRightToLeft() ) - // <-- { nLeft += ((SwTxtFrm*)pCaller)->GetTxtNode()->GetLeftMarginWithNum(); } @@ -2261,10 +2258,10 @@ const SdrObject *SwOrderIter::Top() pCurrent = 0; if ( pPage->GetSortedObjs() ) { - sal_uInt32 nTopOrd = 0; const SwSortedObjs *pObjs = pPage->GetSortedObjs(); if ( pObjs->Count() ) { + sal_uInt32 nTopOrd = 0; (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen! for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i ) { @@ -2350,10 +2347,10 @@ const SdrObject *SwOrderIter::Prev() pCurrent = 0; if ( pPage->GetSortedObjs() ) { - sal_uInt32 nOrd = 0; const SwSortedObjs *pObjs = pPage->GetSortedObjs(); if ( pObjs->Count() ) { + sal_uInt32 nOrd = 0; (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen! for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i ) { @@ -2391,7 +2388,7 @@ const SdrObject *SwOrderIter::Prev() // at-fly anchored objects from page void MA_FASTCALL lcl_RemoveObjsFromPage( SwFrm* _pFrm ) { - ASSERT( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_RemoveFlysFromPage." ); + OSL_ENSURE( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_RemoveFlysFromPage." ); SwSortedObjs &rObjs = *_pFrm->GetDrawObjs(); for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i ) { @@ -2511,7 +2508,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart ) } } else { - ASSERT( !pFloat, "Neuer Float-Frame?" ); + OSL_ENSURE( !pFloat, "Neuer Float-Frame?" ); } } if ( pFloat->GetNext() ) @@ -2559,7 +2556,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart ) // anchored objects to page void MA_FASTCALL lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage ) { - ASSERT( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_AddFlysToPage." ); + OSL_ENSURE( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_AddFlysToPage." ); SwSortedObjs &rObjs = *_pFrm->GetDrawObjs(); for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i ) { @@ -2615,7 +2612,7 @@ void MA_FASTCALL lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage ) void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow ) { - ASSERT( pSav && pParent, "Kein Save oder Parent fuer Restore." ); + OSL_ENSURE( pSav && pParent, "Kein Save oder Parent fuer Restore." ); SWRECTFN( pParent ) //Wenn es bereits FlowFrms unterhalb des neuen Parent gibt, so wird die @@ -2740,7 +2737,7 @@ SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, if ( !pFmt ) { pFmt = bOdd ? rDesc.GetLeftFmt() : rDesc.GetRightFmt(); - ASSERT( pFmt, "Descriptor without any format?!" ); + OSL_ENSURE( pFmt, "Descriptor without any format?!" ); bInsertEmpty = !bInsertEmpty; } if( bInsertEmpty ) @@ -3216,7 +3213,7 @@ sal_Bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ) pFrm = ( (SwDrawContact*)GetUserCall(pObj) )->GetAnchorFrm(pObj); aPos = pObj->GetCurrentBoundRect().TopLeft(); } - ASSERT( pFrm, "8-( Fly is lost in Space." ); + OSL_ENSURE( pFrm, "8-( Fly is lost in Space." ); pFrm = GetVirtualUpper( pFrm, aPos ); do { if ( pFrm == pCurrFrm ) @@ -3555,7 +3552,7 @@ void GetSpacingValuesOfFrm( const SwFrm& rFrm, static_cast<const SwTxtFrm&>(rFrm).GetLineSpace( true ) == 0; } - ASSERT( onLowerSpacing >= 0 && onLineSpacing >= 0, + OSL_ENSURE( onLowerSpacing >= 0 && onLineSpacing >= 0, "<GetSpacingValuesOfFrm(..)> - spacing values aren't positive!" ); } } @@ -3604,3 +3601,4 @@ bool SwDeletionChecker::HasBeenDeleted() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |