diff options
Diffstat (limited to 'sw/source/core/text')
43 files changed, 409 insertions, 405 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index f745c1a094..3aefbe097d 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -100,7 +100,7 @@ FrmTagIdMap SwEnhancedPDFExportHelper::aFrmTagIdMap; LanguageType SwEnhancedPDFExportHelper::eLanguageDefault = 0; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static std::vector< USHORT > aStructStack; @@ -289,7 +289,7 @@ SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo, if ( mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif @@ -302,7 +302,7 @@ SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo, else BeginTag( vcl::PDFWriter::NonStructElement, aEmptyString ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif @@ -317,13 +317,13 @@ SwTaggedPDFHelper::~SwTaggedPDFHelper() { if ( mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif EndStructureElements(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif @@ -390,9 +390,9 @@ bool SwTaggedPDFHelper::CheckReopenTag() { nRestoreCurrentTag = mpPDFExtOutDevData->GetCurrentStructureElement(); const bool bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( nReopenTag ); - ASSERT( bSuccess, "Failed to reopen tag" ) + OSL_ENSURE( bSuccess, "Failed to reopen tag" ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aStructStack.push_back( 99 ); #endif @@ -413,9 +413,9 @@ bool SwTaggedPDFHelper::CheckRestoreTag() const { const bool bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( nRestoreCurrentTag ); (void)bSuccess; - ASSERT( bSuccess, "Failed to restore reopened tag" ) + OSL_ENSURE( bSuccess, "Failed to restore reopened tag" ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aStructStack.pop_back(); #endif @@ -435,7 +435,7 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const Str const sal_Int32 nId = mpPDFExtOutDevData->BeginStructureElement( eType, rtl::OUString( rString ) ); ++nEndStructureElement; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aStructStack.push_back( static_cast<USHORT>(eType) ); #endif @@ -495,7 +495,7 @@ void SwTaggedPDFHelper::EndTag() { mpPDFExtOutDevData->EndStructureElement(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aStructStack.pop_back(); #endif } @@ -656,7 +656,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bTextIndent ) { - ASSERT( pFrm->IsTxtFrm(), "Frame type <-> tag attribute mismatch" ) + OSL_ENSURE( pFrm->IsTxtFrm(), "Frame type <-> tag attribute mismatch" ); const SvxLRSpaceItem &rSpace = static_cast<const SwTxtFrm*>(pFrm)->GetTxtNode()->GetSwAttrSet().GetLRSpace(); nVal = rSpace.GetTxtFirstLineOfst(); @@ -666,7 +666,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bTextAlign ) { - ASSERT( pFrm->IsTxtFrm(), "Frame type <-> tag attribute mismatch" ) + OSL_ENSURE( pFrm->IsTxtFrm(), "Frame type <-> tag attribute mismatch" ); const SwAttrSet& aSet = static_cast<const SwTxtFrm*>(pFrm)->GetTxtNode()->GetSwAttrSet(); const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust(); if ( SVX_ADJUST_BLOCK == nAdjust || SVX_ADJUST_CENTER == nAdjust || @@ -685,7 +685,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bAlternateText ) { - ASSERT( pFrm->IsFlyFrm(), "Frame type <-> tag attribute mismatch" ) + OSL_ENSURE( pFrm->IsFlyFrm(), "Frame type <-> tag attribute mismatch" ); const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>(pFrm); if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { @@ -741,7 +741,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) const TableColumnsMapEntry::const_iterator aLeftIter = rCols.find( nLeft ); const TableColumnsMapEntry::const_iterator aRightIter = rCols.find( nRight ); - ASSERT( aLeftIter != rCols.end() && aRightIter != rCols.end(), "Colspan trouble" ) + OSL_ENSURE( aLeftIter != rCols.end() && aRightIter != rCols.end(), "Colspan trouble" ); if ( aLeftIter != rCols.end() && aRightIter != rCols.end() ) { nVal = std::distance( aLeftIter, aRightIter ); @@ -863,12 +863,12 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) */ void SwTaggedPDFHelper::BeginNumberedListStructureElements() { - ASSERT( mpNumInfo, "List without mpNumInfo?" ) + OSL_ENSURE( mpNumInfo, "List without mpNumInfo?" ); if ( !mpNumInfo ) return; const SwFrm& rFrm = mpNumInfo->mrFrm; - ASSERT( rFrm.IsTxtFrm(), "numbered only for text frames" ) + OSL_ENSURE( rFrm.IsTxtFrm(), "numbered only for text frames" ); const SwTxtFrm& rTxtFrm = static_cast<const SwTxtFrm&>(rFrm); // @@ -971,7 +971,7 @@ void SwTaggedPDFHelper::BeginNumberedListStructureElements() nRestoreCurrentTag = mpPDFExtOutDevData->GetCurrentStructureElement(); mpPDFExtOutDevData->SetCurrentStructureElement( nReopenTag ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aStructStack.push_back( 99 ); #endif } @@ -1526,7 +1526,7 @@ SwEnhancedPDFExportHelper::SwEnhancedPDFExportHelper( SwEditShell& rSh, aNumListBodyIdMap.clear(); aFrmTagIdMap.clear(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aStructStack.clear(); #endif @@ -1599,7 +1599,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() { const SwTxtNode* pTNd = (SwTxtNode*)((SwFmtFld*)pFirst)->GetTxtFld()->GetpTxtNode(); - ASSERT( 0 != pTNd, "Enhanced pdf export - text node is missing" ) + OSL_ENSURE( 0 != pTNd, "Enhanced pdf export - text node is missing" ); // 1. Check if the whole paragraph is hidden // 2. Move to the field @@ -1655,10 +1655,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() for( sal_uInt16 n = 0; n < nHyperLinkCount; ++n ) { SwGetINetAttr* p = aArr[ n ]; - ASSERT( 0 != p, "Enhanced pdf export - SwGetINetAttr is missing" ) + OSL_ENSURE( 0 != p, "Enhanced pdf export - SwGetINetAttr is missing" ); const SwTxtNode* pTNd = p->rINetAttr.GetpTxtNode(); - ASSERT( 0 != pTNd, "Enhanced pdf export - text node is missing" ) + OSL_ENSURE( 0 != pTNd, "Enhanced pdf export - text node is missing" ); // 1. Check if the whole paragraph is hidden // 2. Move to the hyperlink @@ -1689,7 +1689,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // be deleted again in JumpToSwMark. SwRects aTmp; aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 ); - ASSERT( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" ) + OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" ); // Create the destination for internal links: sal_Int32 nDestId = -1; @@ -1841,7 +1841,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() { const SwTxtNode* pTNd = (SwTxtNode*)((SwFmtFld*)pFirst)->GetTxtFld()->GetpTxtNode(); - ASSERT( 0 != pTNd, "Enhanced pdf export - text node is missing" ) + OSL_ENSURE( 0 != pTNd, "Enhanced pdf export - text node is missing" ); // 1. Check if the whole paragraph is hidden // 2. Move to the field @@ -1857,7 +1857,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // Link Rectangles SwRects aTmp; aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 ); - ASSERT( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" ) + OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" ); mrSh.SwCrsrShell::ClearMark(); @@ -1948,7 +1948,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // Link Rectangle SwRects aTmp; aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 ); - ASSERT( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" ) + OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" ); const SwRect aLinkRect( aTmp[ 0 ] ); mrSh._GetCrsr()->RestoreSavePos(); @@ -2003,7 +2003,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() { // Check if outline is hidden const SwTxtNode* pTNd = mrSh.GetNodes().GetOutLineNds()[ i ]->GetTxtNode(); - ASSERT( 0 != pTNd, "Enhanced pdf export - text node is missing" ) + OSL_ENSURE( 0 != pTNd, "Enhanced pdf export - text node is missing" ); if ( pTNd->IsHidden() || // --> FME 2005-01-10 #i40292# Skip empty outlines: diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx index 1b597f90ed..513ca18f97 100644 --- a/sw/source/core/text/atrhndl.hxx +++ b/sw/source/core/text/atrhndl.hxx @@ -158,16 +158,16 @@ public: inline const SfxPoolItem& SwAttrHandler::GetDefault( const USHORT nAttribID ) const { - ASSERT( nAttribID < RES_TXTATR_END, + OSL_ENSURE( nAttribID < RES_TXTATR_END, "this attrib does not ex." ); - ASSERT( pDefaultArray[ StackPos[ nAttribID ] ], "array not initialized" ); + OSL_ENSURE( pDefaultArray[ StackPos[ nAttribID ] ], "array not initialized" ); return *pDefaultArray[ StackPos[ nAttribID ] ]; } inline void SwAttrHandler::ResetFont( SwFont& rFnt ) const { - ASSERT( pFnt, "ResetFont without a font" ); + OSL_ENSURE( pFnt, "ResetFont without a font" ); if ( pFnt ) rFnt = *pFnt; }; diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 18d6e98055..d212a5356f 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -333,7 +333,7 @@ void SwAttrHandler::SwAttrStack::Insert( const SwTxtAttr& rAttr, const USHORT nP } } - ASSERT( nPos <= nCount, "wrong position for insert operation"); + OSL_ENSURE( nPos <= nCount, "wrong position for insert operation"); if ( nPos < nCount ) memmove( pArray + nPos + 1, pArray + nPos, @@ -521,7 +521,7 @@ void SwAttrHandler::PushAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) { - ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END, + OSL_ENSURE( rItem.Which() < RES_TXTATR_WITHEND_END, "I do not want this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); // robust @@ -542,7 +542,7 @@ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) } USHORT nPos = aAttrStack[ nStack ].Count(); - ASSERT( nPos, "empty stack?" ); + OSL_ENSURE( nPos, "empty stack?" ); aAttrStack[ nStack ].Insert( rAttr, nPos - 1 ); return sal_False; } @@ -599,7 +599,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) void SwAttrHandler::Pop( const SwTxtAttr& rAttr ) { - ASSERT( rAttr.Which() < RES_TXTATR_WITHEND_END, + OSL_ENSURE( rAttr.Which() < RES_TXTATR_WITHEND_END, "I do not have this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); if ( rAttr.Which() < RES_TXTATR_WITHEND_END ) @@ -613,7 +613,7 @@ void SwAttrHandler::Pop( const SwTxtAttr& rAttr ) *************************************************************************/ void SwAttrHandler::ActivateTop( SwFont& rFnt, const USHORT nAttr ) { - ASSERT( nAttr < RES_TXTATR_WITHEND_END, + OSL_ENSURE( nAttr < RES_TXTATR_WITHEND_END, "I cannot activate this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); const USHORT nStackPos = StackPos[ nAttr ]; @@ -945,7 +945,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu void SwAttrHandler::GetDefaultAscentAndHeight( ViewShell* pShell, OutputDevice& rOut, USHORT& nAscent, USHORT& nHeight ) const { - ASSERT( pFnt, "No font available for GetDefaultAscentAndHeight" ) + OSL_ENSURE( pFnt, "No font available for GetDefaultAscentAndHeight" ); if ( pFnt ) { diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 0f7132792e..8c8296fb39 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -114,7 +114,7 @@ SwTxtFrm *GetAdjFrmAtPos( SwTxtFrm *pFrm, const SwPosition &rPos, pFrmAtPos->GetFormatted(); pFrmAtPos = pFrmAtPos->FindMaster(); } - ASSERT( pFrmAtPos, "+GetCharRect: no frame with my rightmargin" ); + OSL_ENSURE( pFrmAtPos, "+GetCharRect: no frame with my rightmargin" ); } return pFrmAtPos ? pFrmAtPos : pFrm; } @@ -122,7 +122,7 @@ SwTxtFrm *GetAdjFrmAtPos( SwTxtFrm *pFrm, const SwPosition &rPos, sal_Bool lcl_ChangeOffset( SwTxtFrm* pFrm, xub_StrLen nNew ) { // In Bereichen und ausserhalb von Flies wird nicht mehr gescrollt. - ASSERT( !pFrm->IsFollow(), "Illegal Scrolling by Follow!" ); + OSL_ENSURE( !pFrm->IsFollow(), "Illegal Scrolling by Follow!" ); if( pFrm->GetOfst() != nNew && !pFrm->IsInSct() ) { SwFlyFrm *pFly = pFrm->FindFlyFrm(); @@ -201,7 +201,7 @@ SwTxtFrm *SwTxtFrm::GetFrmAtPos( const SwPosition &rPos ) sal_Bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos, SwCrsrMoveState *pCMS ) const { - ASSERT( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::GetCharRect with swapped frame" ); + OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::GetCharRect with swapped frame" ); if( IsLocked() || IsHiddenNow() ) return sal_False; @@ -354,7 +354,7 @@ sal_Bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos, if( bRet ) { SwPageFrm *pPage = pFrm->FindPageFrm(); - ASSERT( pPage, "Text esaped from page?" ); + OSL_ENSURE( pPage, "Text esaped from page?" ); const SwTwips nOrigTop = (rOrig.*fnRect->fnGetTop)(); const SwTwips nPageTop = (pPage->Frm().*fnRect->fnGetTop)(); const SwTwips nPageBott = (pPage->Frm().*fnRect->fnGetBottom)(); @@ -885,14 +885,16 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset, aCharBox.Pos().X() = aCharBox.Pos().X() - 150; // siehe Kommentar in SwTxtFrm::GetCrsrOfst() -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const ULONG nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif // Der Node soll nicht gewechselt werden xub_StrLen nTmpOfst = aLine.GetCrsrOfst( pPam->GetPoint(), aCharBox.Pos(), sal_False ); - ASSERT( nOldNode == pPam->GetPoint()->nNode.GetIndex(), - "SwTxtFrm::UnitUp: illegal node change" ) +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( nOldNode == pPam->GetPoint()->nNode.GetIndex(), + "SwTxtFrm::UnitUp: illegal node change" ); +#endif // 7684: Wir stellen sicher, dass wir uns nach oben bewegen. if( nTmpOfst >= nStart && nStart && !bSecondOfDouble ) @@ -1251,7 +1253,7 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset, if( pNextLine || bFirstOfDouble ) { aCharBox.SSize().Width() /= 2; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // siehe Kommentar in SwTxtFrm::GetCrsrOfst() const ULONG nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif @@ -1260,8 +1262,10 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset, xub_StrLen nTmpOfst = aLine.GetCrsrOfst( pPam->GetPoint(), aCharBox.Pos(), sal_False ); - ASSERT( nOldNode == pPam->GetPoint()->nNode.GetIndex(), - "SwTxtFrm::UnitDown: illegal node change" ) +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( nOldNode == pPam->GetPoint()->nNode.GetIndex(), + "SwTxtFrm::UnitDown: illegal node change" ); +#endif // 7684: Wir stellen sicher, dass wir uns nach unten bewegen. if( nTmpOfst <= nStart && ! bFirstOfDouble ) diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 232787abf9..930f80cfd6 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -130,7 +130,7 @@ void SwTxtFrm::ValidateFrm() ValidateTxt( this ); //MA: mindestens das MustFit-Flag muessen wir retten! - ASSERT( HasPara(), "ResetPreps(), missing ParaPortion." ); + OSL_ENSURE( HasPara(), "ResetPreps(), missing ParaPortion." ); SwParaPortion *pPara = GetPara(); const sal_Bool bMustFit = pPara->IsPrepMustFit(); ResetPreps(); @@ -186,7 +186,7 @@ sal_Bool SwTxtFrm::_GetDropRect( SwRect &rRect ) const { SWAP_IF_NOT_SWAPPED( this ) - ASSERT( HasPara(), "SwTxtFrm::_GetDropRect: try again next year." ); + OSL_ENSURE( HasPara(), "SwTxtFrm::_GetDropRect: try again next year." ); SwTxtSizeInfo aInf( (SwTxtFrm*)this ); SwTxtMargin aLine( (SwTxtFrm*)this, &aInf ); if( aLine.GetDropLines() ) @@ -234,7 +234,7 @@ sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst ) { SWAP_IF_SWAPPED( this ) - ASSERT( HasFollow(), "CalcFollow: missing Follow." ); + OSL_ENSURE( HasFollow(), "CalcFollow: missing Follow." ); SwTxtFrm* pMyFollow = GetFollow(); @@ -246,7 +246,7 @@ sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst ) ( pMyFollow->IsVertical() && !pMyFollow->Prt().Width() ) || ( ! pMyFollow->IsVertical() && !pMyFollow->Prt().Height() ) ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const SwFrm *pOldUp = GetUpper(); #endif @@ -333,12 +333,12 @@ sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst ) pMyFollow->Calc(); // Der Follow merkt anhand seiner Frm().Height(), dass was schief // gelaufen ist. - ASSERT( !pMyFollow->GetPrev(), "SwTxtFrm::CalcFollow: cheesy follow" ); + OSL_ENSURE( !pMyFollow->GetPrev(), "SwTxtFrm::CalcFollow: cheesy follow" ); if( pMyFollow->GetPrev() ) { pMyFollow->Prepare( PREP_CLEAR ); pMyFollow->Calc(); - ASSERT( !pMyFollow->GetPrev(), "SwTxtFrm::CalcFollow: very cheesy follow" ); + OSL_ENSURE( !pMyFollow->GetPrev(), "SwTxtFrm::CalcFollow: very cheesy follow" ); } // OD 14.03.2003 #i11760# - reset control flag for follow format. @@ -375,8 +375,8 @@ sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst ) pPage->ValidateCntnt(); } -#ifdef DBG_UTIL - ASSERT( pOldUp == GetUpper(), "SwTxtFrm::CalcFollow: heavy follow" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pOldUp == GetUpper(), "SwTxtFrm::CalcFollow: heavy follow" ); #endif const long nRemaining = @@ -482,7 +482,7 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) SwTwips nRstHeight; if ( IsVertical() ) { - ASSERT( ! IsSwapped(),"Swapped frame while calculating nRstHeight" ); + OSL_ENSURE( ! IsSwapped(),"Swapped frame while calculating nRstHeight" ); nRstHeight = Frm().Left() + Frm().Width() - ( GetUpper()->Frm().Left() + GetUpper()->Prt().Left() ); } @@ -503,7 +503,7 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) { long nAdd = (*fnRect->fnYDiff)( (GetUpper()->Lower()->Frm().*fnRect->fnGetTop)(), (GetUpper()->*fnRect->fnGetPrtTop)() ); - ASSERT( nAdd >= 0, "Ey" ); + OSL_ENSURE( nAdd >= 0, "Ey" ); nRstHeight += nAdd; } @@ -579,7 +579,7 @@ void SwTxtFrm::_AdjustFollow( SwTxtFormatter &rLine, { if( ((SwTxtFrm*)GetFollow())->IsLocked() ) { - ASSERT( sal_False, "+SwTxtFrm::JoinFrm: Follow ist locked." ); + OSL_ENSURE( sal_False, "+SwTxtFrm::JoinFrm: Follow ist locked." ); return; } JoinFrm(); @@ -627,7 +627,7 @@ void SwTxtFrm::_AdjustFollow( SwTxtFormatter &rLine, SwCntntFrm *SwTxtFrm::JoinFrm() { - ASSERT( GetFollow(), "+SwTxtFrm::JoinFrm: no follow" ); + OSL_ENSURE( GetFollow(), "+SwTxtFrm::JoinFrm: no follow" ); SwTxtFrm *pFoll = GetFollow(); SwTxtFrm *pNxt = pFoll->GetFollow(); @@ -665,12 +665,12 @@ SwCntntFrm *SwTxtFrm::JoinFrm() } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else if ( pFoll->GetValidPrtAreaFlag() || pFoll->GetValidSizeFlag() ) { pFoll->CalcFtnFlag(); - ASSERT( !pFoll->HasFtn(), "Missing FtnFlag." ); + OSL_ENSURE( !pFoll->HasFtn(), "Missing FtnFlag." ); } #endif @@ -765,11 +765,11 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos ) } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { CalcFtnFlag( nTxtPos-1 ); - ASSERT( !HasFtn(), "Missing FtnFlag." ); + OSL_ENSURE( !HasFtn(), "Missing FtnFlag." ); } #endif @@ -793,7 +793,7 @@ void SwTxtFrm::_SetOfst( const xub_StrLen nNewOfst ) #ifdef DBGTXT // Es gibt tatsaechlich einen Sonderfall, in dem ein SetOfst(0) // zulaessig ist: bug 3496 - ASSERT( nNewOfst, "!SwTxtFrm::SetOfst: missing JoinFrm()." ); + OSL_ENSURE( nNewOfst, "!SwTxtFrm::SetOfst: missing JoinFrm()." ); #endif // Die Invalidierung unseres Follows ist nicht noetig. @@ -817,7 +817,7 @@ void SwTxtFrm::_SetOfst( const xub_StrLen nNewOfst ) sal_Bool SwTxtFrm::CalcPreps() { - ASSERT( ! IsVertical() || ! IsSwapped(), "SwTxtFrm::CalcPreps with swapped frame" ); + OSL_ENSURE( ! IsVertical() || ! IsSwapped(), "SwTxtFrm::CalcPreps with swapped frame" ); SWRECTFN( this ); SwParaPortion *pPara = GetPara(); @@ -840,7 +840,7 @@ sal_Bool SwTxtFrm::CalcPreps() { if( !GetFollow() ) { - ASSERT( GetFollow(), "+SwTxtFrm::CalcPreps: no credits" ); + OSL_ENSURE( GetFollow(), "+SwTxtFrm::CalcPreps: no credits" ); return sal_False; } @@ -876,7 +876,7 @@ sal_Bool SwTxtFrm::CalcPreps() } else { - ASSERT( nChgHeight < (Prt().*fnRect->fnGetHeight)(), + OSL_ENSURE( nChgHeight < (Prt().*fnRect->fnGetHeight)(), "+SwTxtFrm::CalcPrep: wanna shrink" ); nChgHeight = (Prt().*fnRect->fnGetHeight)() - nChgHeight; @@ -1209,7 +1209,7 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine, sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev ) { - ASSERT( ! IsVertical() || IsSwapped(), + OSL_ENSURE( ! IsVertical() || IsSwapped(), "SwTxtFrm::FormatLine( rLine, bPrev) with unswapped frame" ); SwParaPortion *pPara = rLine.GetInfo().GetParaPortion(); // Nach rLine.FormatLine() haelt nStart den neuen Wert, @@ -1229,9 +1229,9 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev ) const xub_StrLen nNewStart = rLine.FormatLine( rLine.GetStart() ); - ASSERT( Frm().Pos().Y() + Prt().Pos().Y() == rLine.GetFirstPos(), + OSL_ENSURE( Frm().Pos().Y() + Prt().Pos().Y() == rLine.GetFirstPos(), "SwTxtFrm::FormatLine: frame leaves orbit." ); - ASSERT( rLine.GetCurr()->Height(), + OSL_ENSURE( rLine.GetCurr()->Height(), "SwTxtFrm::FormatLine: line height is zero" ); // Das aktuelle Zeilenumbruchobjekt. @@ -1355,7 +1355,7 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev ) void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, const sal_Bool bAdjust ) { - ASSERT( ! IsVertical() || IsSwapped(),"SwTxtFrm::_Format with unswapped frame" ); + OSL_ENSURE( ! IsVertical() || IsSwapped(),"SwTxtFrm::_Format with unswapped frame" ); SwParaPortion *pPara = rLine.GetInfo().GetParaPortion(); rLine.SetUnclipped( sal_False ); @@ -1512,7 +1512,7 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, const SwLineLayout* pLine; { SwTxtFrm *pMaster = FindMaster(); - ASSERT( pMaster, "SwTxtFrm::Format: homeless follow" ); + OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" ); if( !pMaster->HasPara() ) pMaster->GetFormatted(); SwTxtSizeInfo aInf( pMaster ); @@ -1684,7 +1684,7 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, void SwTxtFrm::FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) { - ASSERT( ! IsVertical() || IsSwapped(), + OSL_ENSURE( ! IsVertical() || IsSwapped(), "A frame is not swapped in SwTxtFrm::FormatOnceMore" ); SwParaPortion *pPara = rLine.GetInfo().GetParaPortion(); @@ -1779,7 +1779,7 @@ void SwTxtFrm::_Format( SwParaPortion *pPara ) pPara->SetPrepMustFit( bMustFit ); } - ASSERT( ! IsSwapped(), "A frame is swapped before _Format" ); + OSL_ENSURE( ! IsSwapped(), "A frame is swapped before _Format" ); if ( IsVertical() ) SwapWidthAndHeight(); @@ -1798,7 +1798,7 @@ void SwTxtFrm::_Format( SwParaPortion *pPara ) if ( IsVertical() ) SwapWidthAndHeight(); - ASSERT( ! IsSwapped(), "A frame is swapped after _Format" ); + OSL_ENSURE( ! IsSwapped(), "A frame is swapped after _Format" ); if( 1 < aLine.GetDropLines() ) { @@ -1841,7 +1841,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) const SwFrm *pDbgFtnCont = (const SwFrm*)(FindPageFrm()->FindFtnCont()); (void)pDbgFtnCont; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // nStopAt laesst sich vom CV bearbeiten. static MSHORT nStopAt = 0; if( nStopAt == GetFrmId() ) @@ -1864,7 +1864,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) if( nFtnPageNr > nDbgPageNr ) { SwTxtFrmLocker aLock(this); - ASSERT( nFtnPageNr <= nDbgPageNr, "!Ftn steht vor der Referenz." ); + OSL_ENSURE( nFtnPageNr <= nDbgPageNr, "!Ftn steht vor der Referenz." ); MSHORT i = 0; } } @@ -1966,7 +1966,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) else if( bSetOfst && IsFollow() ) { SwTxtFrm *pMaster = FindMaster(); - ASSERT( pMaster, "SwTxtFrm::Format: homeless follow" ); + OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" ); if( pMaster ) pMaster->Prepare( PREP_FOLLOW_FOLLOWS ); SwTwips nMaxY = (GetUpper()->*fnRect->fnGetPrtBottom)(); @@ -2079,7 +2079,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat ) { - ASSERT( ! IsVertical() || ! IsSwapped(), + OSL_ENSURE( ! IsVertical() || ! IsSwapped(), "SwTxtFrm::FormatQuick with swapped frame" ); DBG_LOOP; @@ -2087,7 +2087,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat ) const XubString aXXX = GetTxtNode()->GetTxt(); const SwTwips nDbgY = Frm().Top(); (void)nDbgY; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // nStopAt laesst sich vom CV bearbeiten. static MSHORT nStopAt = 0; if( nStopAt == GetFrmId() ) @@ -2133,7 +2133,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat ) //DBG_LOOP; shadows declaration above. //resolved into: #if OSL_DEBUG_LEVEL > 1 -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 DbgLoop aDbgLoop2( (const void*) this ); #endif #endif @@ -2151,7 +2151,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat ) if( !bForceQuickFormat && nNewHeight != nOldHeight && !IsUndersized() ) { // Achtung: Durch FormatLevel==12 kann diese Situation auftreten, don't panic! - // ASSERT( nNewHeight == nOldHeight, "!FormatQuick: rosebud" ); + // OSL_ENSURE( nNewHeight == nOldHeight, "!FormatQuick: rosebud" ); const xub_StrLen nStrt = GetOfst(); _InvalidateRange( SwCharRange( nStrt, nEnd - nStrt) ); return sal_False; diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index f256d304c5..f53af9a68e 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -142,7 +142,7 @@ SwExtraPainter::SwExtraPainter( const SwTxtFrm *pFrm, ViewShell *pVwSh, nDivider = rLineInf.GetDivider().Len() ? rLineInf.GetDividerCountBy() : 0; nX = pFrm->Frm().Left(); SwCharFmt* pFmt = rLineInf.GetCharFmt( const_cast<IDocumentStylePoolAccess&>(*pFrm->GetNode()->getIDocumentStylePoolAccess()) ); - ASSERT( pFmt, "PaintExtraData without CharFmt" ); + OSL_ENSURE( pFmt, "PaintExtraData without CharFmt" ); pFnt = new SwFont( &pFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() ); pFnt->Invalidate(); pFnt->ChgPhysFnt( pSh, *pSh->GetOut() ); @@ -438,7 +438,7 @@ SwRect SwTxtFrm::Paint() #endif // finger layout - ASSERT( GetValidPosFlag(), "+SwTxtFrm::Paint: no Calc()" ); + OSL_ENSURE( GetValidPosFlag(), "+SwTxtFrm::Paint: no Calc()" ); SwRect aRet( Prt() ); if ( IsEmpty() || !HasPara() ) @@ -630,7 +630,7 @@ void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) //Informationen entzogen hat. if( !HasPara() ) { - ASSERT( GetValidPosFlag(), "+SwTxtFrm::Paint: no Calc()" ); + OSL_ENSURE( GetValidPosFlag(), "+SwTxtFrm::Paint: no Calc()" ); // --> FME 2004-10-29 #i29062# pass info that we are currently // painting. @@ -643,7 +643,7 @@ void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) } if( !HasPara() ) { - ASSERT( !this, "+SwTxtFrm::Paint: missing format information" ); + OSL_ENSURE( !this, "+SwTxtFrm::Paint: missing format information" ); return; } } @@ -678,7 +678,7 @@ void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) // die Laenge ist immer wieder interessant. // Rectangle - ASSERT( ! IsSwapped(), "A frame is swapped before Paint" ); + OSL_ENSURE( ! IsSwapped(), "A frame is swapped before Paint" ); SwRect aOldRect( rRect ); SWAP_IF_NOT_SWAPPED( this ) @@ -725,7 +725,7 @@ void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) //DBG_LOOP; shadows declaration above. //resolved into: #if OSL_DEBUG_LEVEL > 1 -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 DbgLoop aDbgLoop2( (const void*) this ); #endif #endif @@ -744,7 +744,7 @@ void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) UNDO_SWAP( this ) (SwRect&)rRect = aOldRect; - ASSERT( ! IsSwapped(), "A frame is swapped after Paint" ); + OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Paint" ); } } diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index fae797bc33..952d6912f3 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -33,7 +33,7 @@ #include <ctype.h> #include <editeng/unolingu.hxx> #include <tools/shl.hxx> // needed for SW_MOD() macro -#include <errhdl.hxx> // ASSERTs +#include <errhdl.hxx> //OSL_ENSURE #include <dlelstnr.hxx> #include <swmodule.hxx> #include <IDocumentSettingAccess.hxx> @@ -74,10 +74,10 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, if( !rInf.GetLen() || !rInf.GetTxt().Len() ) return sal_False; - ASSERT( rInf.GetIdx() < rInf.GetTxt().Len(), + OSL_ENSURE( rInf.GetIdx() < rInf.GetTxt().Len(), "+SwTxtGuess::Guess: invalid SwTxtFormatInfo" ); - ASSERT( nPorHeight, "+SwTxtGuess::Guess: no height" ); + OSL_ENSURE( nPorHeight, "+SwTxtGuess::Guess: no height" ); USHORT nMinSize; USHORT nMaxSizeDiff; @@ -174,12 +174,12 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, { nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( STRING_LEN != nCutPos ) { rInf.GetTxtSize( &rSI, rInf.GetIdx(), nCutPos - rInf.GetIdx(), nMaxComp, nMinSize, nMaxSizeDiff ); - ASSERT( nMinSize <= nLineWidth, "What a Guess!!!" ); + OSL_ENSURE( nMinSize <= nLineWidth, "What a Guess!!!" ); } #endif } @@ -330,7 +330,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, { USHORT nScript = pBreakIt->GetRealScriptOfText( rInf.GetTxt(), nLangIndex ); - ASSERT( nScript, "Script is not between 1 and 4" ); + OSL_ENSURE( nScript, "Script is not between 1 and 4" ); // compare current script with script from last "real" character if ( nScript - 1 != rInf.GetFont()->GetActual() ) @@ -423,7 +423,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, } else if ( !bHyph && nBreakPos >= rInf.GetLineStart() ) { - ASSERT( nBreakPos != STRING_LEN, "we should have found a break pos" ); + OSL_ENSURE( nBreakPos != STRING_LEN, "we should have found a break pos" ); // found break position within line xHyphWord = NULL; @@ -452,7 +452,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // no line break found, setting nBreakPos to STRING_LEN // causes a break cut nBreakPos = STRING_LEN; - ASSERT( nCutPos >= rInf.GetIdx(), "Deep cut" ); + OSL_ENSURE( nCutPos >= rInf.GetIdx(), "Deep cut" ); nPorLen = nCutPos - rInf.GetIdx(); } @@ -461,7 +461,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, const xub_StrLen nHangingLen = nBreakPos - nCutPos; SwPosSize aTmpSize = rInf.GetTxtSize( &rSI, nCutPos, nHangingLen, 0 ); - ASSERT( !pHanging, "A hanging portion is hanging around" ); + OSL_ENSURE( !pHanging, "A hanging portion is hanging around" ); pHanging = new SwHangingPortion( aTmpSize ); pHanging->SetLen( nHangingLen ); nPorLen = nCutPos - rInf.GetIdx(); @@ -478,11 +478,11 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, nBreakPos = nOldIdx - 1; else if ( STRING_LEN != nBreakPos ) { - ASSERT( nBreakPos >= nFieldDiff, "I've got field trouble!" ); + OSL_ENSURE( nBreakPos >= nFieldDiff, "I've got field trouble!" ); nBreakPos = nBreakPos - nFieldDiff; } - ASSERT( nCutPos >= rInf.GetIdx() && nCutPos >= nFieldDiff, + OSL_ENSURE( nCutPos >= rInf.GetIdx() && nCutPos >= nFieldDiff, "I've got field trouble, part2!" ); nCutPos = nCutPos - nFieldDiff; @@ -492,7 +492,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, rInf.SetIdx( nOldIdx ); #if OSL_DEBUG_LEVEL > 1 - ASSERT( aDebugString == rInf.GetTxt(), + OSL_ENSURE( aDebugString == rInf.GetTxt(), "Somebody, somebody, somebody put something in my string" ); #endif } @@ -545,7 +545,7 @@ sal_Bool SwTxtGuess::AlternativeSpelling( const SwTxtFormatInfo &rInf, // check, if word has alternative spelling Reference< XHyphenator > xHyph( ::GetHyphenator() ); - ASSERT( xHyph.is(), "Hyphenator is missing"); + OSL_ENSURE( xHyph.is(), "Hyphenator is missing"); //! subtract 1 since the UNO-interface is 0 based xHyphWord = xHyph->queryAlternativeSpelling( OUString(aTxt), pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ), diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index ec518d0857..cda5370827 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -222,7 +222,7 @@ void SwTxtInfo::CtorInitTxtInfo( SwTxtFrm *pFrm ) nTxtStart = pFrm->GetOfst(); if( !pPara ) { - ASSERT( pPara, "+SwTxtInfo::CTOR: missing paragraph information" ); + OSL_ENSURE( pPara, "+SwTxtInfo::CTOR: missing paragraph information" ); pFrm->Format(); pPara = pFrm->GetPara(); } @@ -234,7 +234,7 @@ SwTxtInfo::SwTxtInfo( const SwTxtInfo &rInf ) { } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 /************************************************************************* * ChkOutDev() *************************************************************************/ @@ -246,7 +246,7 @@ void ChkOutDev( const SwTxtSizeInfo &rInf ) const OutputDevice* pOut = rInf.GetOut(); const OutputDevice* pRef = rInf.GetRefDev(); - ASSERT( pOut && pRef, "ChkOutDev: invalid output devices" ) + OSL_ENSURE( pOut && pRef, "ChkOutDev: invalid output devices" ); } #endif // PRODUCT @@ -287,7 +287,7 @@ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew ) bSnapToGrid( rNew.SnapToGrid() ), nDirection( rNew.GetDirection() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ChkOutDev( *this ); #endif } @@ -324,7 +324,7 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt, pRef = pOut; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ChkOutDev( *this ); #endif @@ -412,7 +412,7 @@ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const XubString &rTxt, bSnapToGrid( rNew.SnapToGrid() ), nDirection( rNew.GetDirection() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ChkOutDev( *this ); #endif SetLen( GetMinLen( *this ) ); @@ -441,8 +441,8 @@ void SwTxtSizeInfo::NoteAnimation() const if( OnWin() ) SwRootFrm::FlushVout(); - ASSERT( pOut == pVsh->GetOut(), - "SwTxtSizeInfo::NoteAnimation() changed pOut" ) + OSL_ENSURE( pOut == pVsh->GetOut(), + "SwTxtSizeInfo::NoteAnimation() changed pOut" ); } /************************************************************************* @@ -519,7 +519,7 @@ xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth, const SwScriptInfo& rScriptInfo = ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo(); - ASSERT( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" ) + OSL_ENSURE( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" ); SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo, *pTxt, GetIdx(), nMaxLen ); aDrawInf.SetFrm( pFrm ); @@ -543,7 +543,7 @@ xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth, const SwScriptInfo& rScriptInfo = ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo(); - ASSERT( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" ) + OSL_ENSURE( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" ); SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo, *pTxt, GetIdx(), nMaxLen ); aDrawInf.SetFrm( pFrm ); @@ -570,10 +570,10 @@ void SwTxtPaintInfo::CtorInitTxtPaintInfo( SwTxtFrm *pFrame, const SwRect &rPain pGrammarCheckList = NULL; pSmartTags = NULL; // SMARTTAGS -#ifndef DBG_UTIL - pBrushItem = 0; -#else +#if OSL_DEBUG_LEVEL > 1 pBrushItem = ((SvxBrushItem*)-1); +#else + pBrushItem = 0; #endif } @@ -710,7 +710,7 @@ void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPo const sal_Bool bTmpGrammarCheck = bGrammarCheck && OnWin() && bCfgIsAutoGrammar && GetOpt().IsOnlineSpell(); const sal_Bool bTmpSmart = bSmartTag && OnWin() && !GetOpt().IsPagePreview() && SwSmartTagMgr::Get().IsSmartTagsEnabled(); // SMARTTAGS - ASSERT( GetParaPortion(), "No paragraph!"); + OSL_ENSURE( GetParaPortion(), "No paragraph!"); SwDrawTextInfo aDrawInf( pFrm->GetShell(), *pOut, pSI, rText, nStart, nLength, rPor.Width(), bBullet ); @@ -917,7 +917,7 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP nMaxWidth = rRect.Height(); break; default: - ASSERT( sal_False, "Unknown direction set at font" ) + OSL_ENSURE( sal_False, "Unknown direction set at font" ); break; } @@ -995,7 +995,7 @@ void SwTxtPaintInfo::DrawRect( const SwRect &rRect, sal_Bool bNoGraphic, pOut->DrawRect( rRect.SVRect() ); else { - ASSERT( ((SvxBrushItem*)-1) != pBrushItem, "DrawRect: Uninitialized BrushItem!" ); + OSL_ENSURE( ((SvxBrushItem*)-1) != pBrushItem, "DrawRect: Uninitialized BrushItem!" ); ::DrawGraphic( pBrushItem, pOut, aItemRect, rRect ); } } @@ -1174,7 +1174,7 @@ void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) *************************************************************************/ void SwTxtPaintInfo::DrawBackground( const SwLinePortion &rPor ) const { - ASSERT( OnWin(), "SwTxtPaintInfo::DrawBackground: printer polution ?" ); + OSL_ENSURE( OnWin(), "SwTxtPaintInfo::DrawBackground: printer polution ?" ); SwRect aIntersect; CalcRect( rPor, 0, &aIntersect ); @@ -1243,7 +1243,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const } if( !pFnt->GetBackColor() ) return; - ASSERT( pFnt->GetBackColor(), "DrawBackBrush: Lost Color" ); + OSL_ENSURE( pFnt->GetBackColor(), "DrawBackBrush: Lost Color" ); SwRect aIntersect; CalcRect( rPor, 0, &aIntersect ); @@ -1301,7 +1301,7 @@ void SwTxtPaintInfo::DrawViewOpt( const SwLinePortion &rPor, case POR_BLANK: if ( GetOpt().IsHardBlank())bDraw = sal_True; break; default: { - ASSERT( !this, "SwTxtPaintInfo::DrawViewOpt: don't know how to draw this" ); + OSL_ENSURE( !this, "SwTxtPaintInfo::DrawViewOpt: don't know how to draw this" ); break; } } @@ -1316,7 +1316,7 @@ void SwTxtPaintInfo::DrawViewOpt( const SwLinePortion &rPor, void SwTxtPaintInfo::_NotifyURL( const SwLinePortion &rPor ) const { - ASSERT( pNoteURL, "NotifyURL: pNoteURL gone with the wind!" ); + OSL_ENSURE( pNoteURL, "NotifyURL: pNoteURL gone with the wind!" ); SwRect aIntersect; CalcRect( rPor, 0, &aIntersect ); @@ -1671,7 +1671,7 @@ xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart, { if( cTabDec == cPos ) { - ASSERT( cPos, "Unexpected end of string" ); + OSL_ENSURE( cPos, "Unexpected end of string" ); if( cPos ) // robust { cHookChar = cPos; diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index b11c6c3554..073b9bfffd 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -423,11 +423,11 @@ class SwTxtPaintInfo : public SwTxtSizeInfo void _DrawBackBrush( const SwLinePortion &rPor ) const; protected: -#ifndef DBG_UTIL - SwTxtPaintInfo() { pFrm = 0; pWrongList = 0; pGrammarCheckList = 0; pWrongList = 0; pSmartTags = 0; pSpaceAdd = 0; pBrushItem = 0;} -#else +#if OSL_DEBUG_LEVEL > 1 SwTxtPaintInfo() { pFrm = 0; pWrongList = 0; pGrammarCheckList = 0; pSmartTags = 0; pSpaceAdd = 0; pBrushItem = ((SvxBrushItem*)-1);} +#else + SwTxtPaintInfo() { pFrm = 0; pWrongList = 0; pGrammarCheckList = 0; pWrongList = 0; pSmartTags = 0; pSpaceAdd = 0; pBrushItem = 0;} #endif public: SwTxtPaintInfo( const SwTxtPaintInfo &rInf ); @@ -812,13 +812,13 @@ public: inline KSHORT SwTxtSizeInfo::GetAscent() const { - ASSERT( GetOut(), "SwTxtSizeInfo::GetAscent() without pOut" ) + OSL_ENSURE( GetOut(), "SwTxtSizeInfo::GetAscent() without pOut" ); return ((SwFont*)GetFont())->GetAscent( pVsh, *GetOut() ); } inline KSHORT SwTxtSizeInfo::GetTxtHeight() const { - ASSERT( GetOut(), "SwTxtSizeInfo::GetTxtHeight() without pOut" ) + OSL_ENSURE( GetOut(), "SwTxtSizeInfo::GetTxtHeight() without pOut" ); return ((SwFont*)GetFont())->GetHeight( pVsh, *GetOut() ); } diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index e47f814482..a0c3e3d3c2 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -270,9 +270,9 @@ bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTxtIter& void SwTxtAdjuster::CalcNewBlock( SwLineLayout *pCurrent, const SwLinePortion *pStopAt, SwTwips nReal, bool bSkipKashida ) { - ASSERT( GetInfo().IsMulti() || SVX_ADJUST_BLOCK == GetAdjust(), + OSL_ENSURE( GetInfo().IsMulti() || SVX_ADJUST_BLOCK == GetAdjust(), "CalcNewBlock: Why?" ); - ASSERT( pCurrent->Height(), "SwTxtAdjuster::CalcBlockAdjust: missing CalcLine()" ); + OSL_ENSURE( pCurrent->Height(), "SwTxtAdjuster::CalcBlockAdjust: missing CalcLine()" ); pCurrent->InitSpaceAdd(); xub_StrLen nGluePortion = 0; @@ -422,8 +422,8 @@ void SwTxtAdjuster::CalcNewBlock( SwLineLayout *pCurrent, SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) { - ASSERT( pCurrent->Height(), "SwTxtAdjuster::CalcBlockAdjust: missing CalcLine()" ); - ASSERT( !pCurrent->GetpKanaComp(), "pKanaComp already exists!!" ); + OSL_ENSURE( pCurrent->Height(), "SwTxtAdjuster::CalcBlockAdjust: missing CalcLine()" ); + OSL_ENSURE( !pCurrent->GetpKanaComp(), "pKanaComp already exists!!" ); SvUShorts *pNewKana = new SvUShorts; pCurrent->SetKanaComp( pNewKana ); @@ -713,7 +713,7 @@ void SwTxtAdjuster::CalcFlyAdjust( SwLineLayout *pCurrent ) void SwTxtAdjuster::CalcAdjLine( SwLineLayout *pCurrent ) { - ASSERT( pCurrent->IsFormatAdj(), "CalcAdjLine: Why?" ); + OSL_ENSURE( pCurrent->IsFormatAdj(), "CalcAdjLine: Why?" ); pCurrent->SetFormatAdj(sal_False); @@ -814,8 +814,8 @@ SwFlyPortion *SwTxtAdjuster::CalcFlyPortion( const long nRealWidth, void SwTxtAdjuster::CalcDropAdjust() { - ASSERT( 1<GetDropLines() && SVX_ADJUST_LEFT!=GetAdjust() && SVX_ADJUST_BLOCK!=GetAdjust(), - "CalcDropAdjust: No reason for DropAdjustment." ) + OSL_ENSURE( 1<GetDropLines() && SVX_ADJUST_LEFT!=GetAdjust() && SVX_ADJUST_BLOCK!=GetAdjust(), + "CalcDropAdjust: No reason for DropAdjustment." ); const MSHORT nLineNumber = GetLineNr(); diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index c0746595d8..c2212c44e2 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -73,7 +73,7 @@ using namespace ::com::sun::star; void SwAttrIter::Chg( SwTxtAttr *pHt ) { - ASSERT( pHt && pFnt, "No attribute of font available for change"); + OSL_ENSURE( pHt && pFnt, "No attribute of font available for change"); if( pRedln && pRedln->IsOn() ) pRedln->ChangeTxtAttr( pFnt, *pHt, sal_True ); else @@ -87,7 +87,7 @@ void SwAttrIter::Chg( SwTxtAttr *pHt ) void SwAttrIter::Rst( SwTxtAttr *pHt ) { - ASSERT( pHt && pFnt, "No attribute of font available for reset"); + OSL_ENSURE( pHt && pFnt, "No attribute of font available for reset"); // get top from stack after removing pHt if( pRedln && pRedln->IsOn() ) pRedln->ChangeTxtAttr( pFnt, *pHt, sal_False ); @@ -469,7 +469,7 @@ sal_Bool lcl_MinMaxNode( const SwFrmFmtPtr& rpNd, void* pArgs ) { const SwMinMaxNodeArgs *pIn = (const SwMinMaxNodeArgs*)pArgs; const SwPosition *pPos = rFmtA.GetCntntAnchor(); - ASSERT(pPos && pIn, "Unexpected NULL arguments"); + OSL_ENSURE(pPos && pIn, "Unexpected NULL arguments"); if (!pPos || !pIn || pIn->nIndx != pPos->nNode.GetIndex()) bCalculate = false; } @@ -846,7 +846,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) pOut = getIDocumentDeviceAccess()->getReferenceDevice( true ); } - ASSERT( pOut, "GetScalingOfSelectedText without outdev" ) + OSL_ENSURE( pOut, "GetScalingOfSelectedText without outdev" ); MapMode aOldMap( pOut->GetMapMode() ); pOut->SetMapMode( MapMode( MAP_TWIP ) ); diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 3c00183a57..07f2bdbb29 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -78,7 +78,7 @@ void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, const SwCrsrMoveState& rCMS, const SwLinePortion& rPor ) { - ASSERT( rCMS.pSpecialPos, "Information about special pos missing" ) + OSL_ENSURE( rCMS.pSpecialPos, "Information about special pos missing" ); if ( rPor.InFldGrp() && ((SwFldPortion&)rPor).GetExp().Len() ) { @@ -110,7 +110,7 @@ void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, } while ( TRUE ); - ASSERT( nCharOfst >= nFldIdx, "Request of position inside field failed" ) + OSL_ENSURE( nCharOfst >= nFldIdx, "Request of position inside field failed" ); USHORT nLen = nCharOfst - nFldIdx + 1; if ( pString ) @@ -288,7 +288,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) case SVX_LINE_SPACE_FIX: nFirstLineOfs = pSpace->GetLineHeight(); break; - default: ASSERT( sal_False, ": unknown LineSpaceRule" ); + default: OSL_ENSURE( sal_False, ": unknown LineSpaceRule" ); } switch( pSpace->GetInterLineSpaceRule() ) { @@ -314,7 +314,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nFirstLineOfs += pSpace->GetInterLineSpace(); break; } - default: ASSERT( sal_False, ": unknown InterLineSpaceRule" ); + default: OSL_ENSURE( sal_False, ": unknown InterLineSpaceRule" ); } } } @@ -499,7 +499,7 @@ sal_Bool SwTxtCursor::GetEndCharRect( SwRect* pOrig, const xub_StrLen nOfst, pCMS->aRealHeight.X() = nTmpAscent - nPorAscent; else pCMS->aRealHeight.X() = 0; - ASSERT( nPorHeight, "GetCharRect: Missing Portion-Height" ); + OSL_ENSURE( nPorHeight, "GetCharRect: Missing Portion-Height" ); pCMS->aRealHeight.Y() = nPorHeight; } @@ -964,7 +964,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, if( pPor ) { - ASSERT( !pPor->InNumberGrp() || bInsideFirstField, "Number surprise" ); + OSL_ENSURE( !pPor->InNumberGrp() || bInsideFirstField, "Number surprise" ); sal_Bool bEmptyFld = sal_False; if( pPor->InFldGrp() && pPor->GetLen() ) { @@ -975,7 +975,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, SwLinePortion *pNext = pTmp->GetPortion(); while( pNext && !pNext->InFldGrp() ) { - ASSERT( !pNext->GetLen(), "Where's my field follow?" ); + OSL_ENSURE( !pNext->GetLen(), "Where's my field follow?" ); nAddX = nAddX + pNext->Width(); pNext = pNext->GetPortion(); } @@ -1152,8 +1152,8 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, const SwLinePortion *pLast = rLineLayout.FindLastPortion(); if ( pLast->IsMultiPortion() ) { - ASSERT( ((SwMultiPortion*)pLast)->IsBidi(), - "Non-BidiPortion inside BidiPortion" ) + OSL_ENSURE( ((SwMultiPortion*)pLast)->IsBidi(), + "Non-BidiPortion inside BidiPortion" ); pOrig->Pos().X() += pLast->Width() + pLast->CalcSpacing( nSpaceAdd, aInf ); } @@ -1182,7 +1182,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, pCMS->aRealHeight.X() = nTmpAscent - nPorAscent; else pCMS->aRealHeight.X() = 0; - ASSERT( nPorHeight, "GetCharRect: Missing Portion-Height" ); + OSL_ENSURE( nPorHeight, "GetCharRect: Missing Portion-Height" ); if ( nTmpHeight > nPorHeight ) pCMS->aRealHeight.Y() = nPorHeight; else @@ -1209,8 +1209,8 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, { const BYTE nExtendRange = pCMS->pSpecialPos->nExtendRange; - ASSERT( ! pCMS->pSpecialPos->nLineOfst || SP_EXTEND_RANGE_BEFORE != nExtendRange, - "LineOffset AND Number Portion?" ) + OSL_ENSURE( ! pCMS->pSpecialPos->nLineOfst || SP_EXTEND_RANGE_BEFORE != nExtendRange, + "LineOffset AND Number Portion?" ); // portions which are behind the string if ( SP_EXTEND_RANGE_BEHIND == nExtendRange ) @@ -1629,7 +1629,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, ((SwDropPortion*)pPor)->GetFnt() : NULL ); SwParaPortion* pPara = (SwParaPortion*)GetInfo().GetParaPortion(); - ASSERT( pPara, "No paragraph!" ); + OSL_ENSURE( pPara, "No paragraph!" ); SwDrawTextInfo aDrawInf( aSizeInf.GetVsh(), *aSizeInf.GetOut(), diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 06e69c3577..2c2efa5bf4 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -108,7 +108,7 @@ void SwTxtFormatter::CtorInitTxtFormatter( SwTxtFrm *pNewFrm, SwTxtFormatInfo *p if( nStart > GetInfo().GetTxt().Len() ) { - ASSERT( !this, "+SwTxtFormatter::CTOR: bad offset" ); + OSL_ENSURE( !this, "+SwTxtFormatter::CTOR: bad offset" ); nStart = GetInfo().GetTxt().Len(); } @@ -218,7 +218,7 @@ SwLinePortion *SwTxtFormatter::UnderFlow( SwTxtFormatInfo &rInf ) pTmpPrev->Move( rInf ); rInf.SetLast( pTmpPrev ); pTmpPrev = pTmpPrev->GetPortion(); - ASSERT( pTmpPrev, "UnderFlow: Loosing control!" ); + OSL_ENSURE( pTmpPrev, "UnderFlow: Loosing control!" ); }; } pPor = pPor->GetPortion(); @@ -236,7 +236,7 @@ SwLinePortion *SwTxtFormatter::UnderFlow( SwTxtFormatInfo &rInf ) } // Was? Die Unterlaufsituation ist nicht in der Portion-Kette ? - ASSERT( pPor, "SwTxtFormatter::UnderFlow: overflow but underflow" ); + OSL_ENSURE( pPor, "SwTxtFormatter::UnderFlow: overflow but underflow" ); // OD 2004-05-26 #i29529# - correction: no delete of footnotes // if( rInf.IsFtnInside() && pPor && !rInf.IsQuick() ) @@ -380,7 +380,7 @@ void SwTxtFormatter::InsertPortion( SwTxtFormatInfo &rInf, void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) { - ASSERT( rInf.GetTxt().Len() < STRING_LEN, + OSL_ENSURE( rInf.GetTxt().Len() < STRING_LEN, "SwTxtFormatter::BuildPortions: bad text length in info" ); rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() ); @@ -391,7 +391,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) rInf.SetLast( pCurr ); rInf.ForcedLeftMargin( 0 ); - ASSERT( pCurr->FindLastPortion() == pCurr, "pLast supposed to equal pCurr" ); + OSL_ENSURE( pCurr->FindLastPortion() == pCurr, "pLast supposed to equal pCurr" ); if( !pCurr->GetAscent() && !pCurr->Height() ) CalcAscent( rInf, pCurr ); @@ -399,7 +399,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) SeekAndChg( rInf ); // In CalcFlyWidth wird Width() verkuerzt, wenn eine FlyPortion vorliegt. - ASSERT( !rInf.X() || pMulti, "SwTxtFormatter::BuildPortion X=0?" ); + OSL_ENSURE( !rInf.X() || pMulti, "SwTxtFormatter::BuildPortion X=0?" ); CalcFlyWidth( rInf ); SwFlyPortion *pFly = rInf.GetFly(); if( pFly ) @@ -432,7 +432,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) while( pPor && !rInf.IsStop() ) { - ASSERT( rInf.GetLen() < STRING_LEN && + OSL_ENSURE( rInf.GetLen() < STRING_LEN && rInf.GetIdx() <= rInf.GetTxt().Len(), "SwTxtFormatter::BuildPortions: bad length in info" ); DBG_LOOP; @@ -668,7 +668,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) if ( nRestWidth > 0 && SW_CJK != nCurrScript && ! rInf.IsUnderFlow() && ( bFull || SW_CJK == nNextScript ) ) { - ASSERT( pGridKernPortion, "No GridKernPortion available" ) + OSL_ENSURE( pGridKernPortion, "No GridKernPortion available" ); // calculate size SwLinePortion* pTmpPor = pGridKernPortion->GetPortion(); @@ -687,8 +687,8 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) nRestWidth ); const USHORT nKernWidth_1 = (USHORT)(nKernWidth / 2); - ASSERT( nKernWidth <= nRestWidth, - "Not enough space left for adjusting non-asian text in grid mode" ) + OSL_ENSURE( nKernWidth <= nRestWidth, + "Not enough space left for adjusting non-asian text in grid mode" ); pGridKernPortion->Width( pGridKernPortion->Width() + nKernWidth_1 ); rInf.X( rInf.X() + nKernWidth_1 ); @@ -1062,8 +1062,8 @@ SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf) // 5) Die Fussnotenzahlen if( !rInf.IsFtnDone() ) { - ASSERT( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(), - "Rotated number portion trouble" ) + OSL_ENSURE( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(), + "Rotated number portion trouble" ); sal_Bool bFtnNum = pFrm->IsFtnNumFrm(); rInf.GetParaPortion()->SetFtnNum( bFtnNum ); @@ -1084,8 +1084,8 @@ SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf) // 7) Die Numerierungen if( !rInf.IsNumDone() && !pPor ) { - ASSERT( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(), - "Rotated number portion trouble" ) + OSL_ENSURE( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(), + "Rotated number portion trouble" ); // Wenn wir im Follow stehen, dann natuerlich nicht. if( GetTxtFrm()->GetTxtNode()->GetNumRule() ) @@ -1161,7 +1161,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) rInf.SetStopUnderFlow( sal_False ); if( rInf.GetUnderFlow() ) { - ASSERT( rInf.IsFull(), "SwTxtFormatter::NewPortion: underflow but not full" ); + OSL_ENSURE( rInf.IsFull(), "SwTxtFormatter::NewPortion: underflow but not full" ); return UnderFlow( rInf ); } @@ -1348,7 +1348,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) if ( GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT) /*rInf.GetVsh()->IsTabCompat();*/ && POR_TABDECIMAL == pLastTabPortion->GetWhichPor() ) { - ASSERT( rInf.X() >= pLastTabPortion->Fix(), "Decimal tab stop position cannot be calculated" ) + OSL_ENSURE( rInf.X() >= pLastTabPortion->Fix(), "Decimal tab stop position cannot be calculated" ); const USHORT nWidthOfPortionsUpToDecimalPosition = (USHORT)(rInf.X() - pLastTabPortion->Fix() ); static_cast<SwTabDecimalPortion*>(pLastTabPortion)->SetWidthOfPortionsUpToDecimalPosition( nWidthOfPortionsUpToDecimalPosition ); rInf.SetTabDecimal( 0 ); @@ -1461,12 +1461,12 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) // Werte bereithalten muss: if( !pCurr->Height() ) { - ASSERT( pCurr->Height(), "SwTxtFormatter::NewPortion: limbo dance" ); + OSL_ENSURE( pCurr->Height(), "SwTxtFormatter::NewPortion: limbo dance" ); pCurr->Height( pPor->Height() ); pCurr->SetAscent( pPor->GetAscent() ); } - ASSERT( !pPor || pPor->Height(), + OSL_ENSURE( !pPor || pPor->Height(), "SwTxtFormatter::NewPortion: something went wrong"); if( pPor->IsPostItsPortion() && rInf.X() >= rInf.Width() && rInf.GetFly() ) { @@ -1482,7 +1482,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos ) { - ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(), + OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(), "SwTxtFormatter::FormatLine( nStartPos ) with unswapped frame" ); // For the formatting routines, we set pOut to the reference device. @@ -1786,7 +1786,7 @@ pCurr->GetAscent() ) pInf->GetParaPortion()->SetFixLineHeight(); } break; - default: ASSERT( sal_False, ": unknown LineSpaceRule" ); + default: OSL_ENSURE( sal_False, ": unknown LineSpaceRule" ); } if( !IsParaLine() ) switch( pSpace->GetInterLineSpaceRule() ) @@ -1813,7 +1813,7 @@ pCurr->GetAscent() ) nLineHeight = nLineHeight + pSpace->GetInterLineSpace(); break; } - default: ASSERT( sal_False, ": unknown InterLineSpaceRule" ); + default: OSL_ENSURE( sal_False, ": unknown InterLineSpaceRule" ); } } #if OSL_DEBUG_LEVEL > 1 @@ -2081,7 +2081,7 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd, CH_BLANK == GetInfo().GetChar( nReformat ) ) --nReformat; - ASSERT( nReformat < GetInfo().GetIdx(), "Reformat too small for me!" ); + OSL_ENSURE( nReformat < GetInfo().GetIdx(), "Reformat too small for me!" ); SwRect aRect; // Note: GetChareRect is not const. It definitely changes the diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index b0e7890637..d32534e7ee 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -101,10 +101,10 @@ void SwTxtPainter::CtorInitTxtPainter( SwTxtFrm *pNewFrm, SwTxtPaintInfo *pNewIn pInf = pNewInf; SwFont *pMyFnt = GetFnt(); GetInfo().SetFont( pMyFnt ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( ALIGN_BASELINE != pMyFnt->GetAlign() ) { - ASSERT( ALIGN_BASELINE == pMyFnt->GetAlign(), + OSL_ENSURE( ALIGN_BASELINE == pMyFnt->GetAlign(), "+SwTxtPainter::CTOR: font alignment revolution" ); pMyFnt->SetAlign( ALIGN_BASELINE ); } @@ -538,8 +538,8 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, Range aRange( 0, GetInfo().GetTxt().Len() ); MultiSelection aUnderMulti( aRange ); - ASSERT( GetFnt() && UNDERLINE_NONE != GetFnt()->GetUnderline(), - "CheckSpecialUnderline without underlined font" ) + OSL_ENSURE( GetFnt() && UNDERLINE_NONE != GetFnt()->GetUnderline(), + "CheckSpecialUnderline without underlined font" ); const SwFont* pParaFnt = GetAttrHandler().GetFont(); if( pParaFnt && pParaFnt->GetUnderline() == GetFnt()->GetUnderline() ) aUnderMulti.SelectAll(); diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index 51a5dc7bf0..4b33e4053e 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -69,7 +69,7 @@ void SwTxtIter::CtorInitTxtIter( SwTxtFrm *pNewFrm, SwTxtInfo *pNewInf ) SwTxtNode *pNode = pNewFrm->GetTxtNode(); - ASSERT( pNewFrm->GetPara(), "No paragraph" ); + OSL_ENSURE( pNewFrm->GetPara(), "No paragraph" ); CtorInitAttrIter( *pNode, pNewFrm->GetPara()->GetScriptInfo(), pNewFrm ); @@ -359,7 +359,7 @@ USHORT SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine, nOfst = nOfst + nPorAscent; break; case SvxParaVertAlignItem::CENTER : - ASSERT( rLine.Height() >= nPorHeight, "Portion height > Line height"); + OSL_ENSURE( rLine.Height() >= nPorHeight, "Portion height > Line height"); nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent; break; case SvxParaVertAlignItem::BOTTOM : @@ -510,7 +510,7 @@ SwHookOut::SwHookOut( SwTxtSizeInfo& rInfo ) : pOut( rInfo.GetOut() ), bOnWin( rInfo.OnWin() ) { - ASSERT( rInfo.GetRefDev(), "No reference device for text formatting" ) + OSL_ENSURE( rInfo.GetRefDev(), "No reference device for text formatting" ); // set new values rInfo.SetOut( rInfo.GetRefDev() ); diff --git a/sw/source/core/text/makefile.mk b/sw/source/core/text/makefile.mk index 0076a17487..f7786a5a6b 100644 --- a/sw/source/core/text/makefile.mk +++ b/sw/source/core/text/makefile.mk @@ -89,7 +89,7 @@ SLOFILES = \ $(SLO)$/SwGrammarMarkUp.obj \ $(SLO)$/wrong.obj -.IF "$(dbgutil)"!="" +.IF "$(DBG_LEVEL)">="2" SLOFILES += \ $(SLO)$/txtio.obj .ENDIF diff --git a/sw/source/core/text/noteurl.cxx b/sw/source/core/text/noteurl.cxx index 16ace54ca3..1761bc1257 100644 --- a/sw/source/core/text/noteurl.cxx +++ b/sw/source/core/text/noteurl.cxx @@ -64,7 +64,7 @@ void SwNoteURL::InsertURLNote( const XubString& rURL, const XubString& rTarget, void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos, const MapMode& rMap ) { - ASSERT( pMap, "FillImageMap: No ImageMap, no cookies!" ); + OSL_ENSURE( pMap, "FillImageMap: No ImageMap, no cookies!" ); MSHORT nCount = Count(); if( nCount ) { diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index b0741ac46f..6b7636c05a 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -84,7 +84,7 @@ SwFldPortion *SwFldPortion::Clone( const XubString &rExpand ) const void SwFldPortion::TakeNextOffset( const SwFldPortion* pFld ) { - ASSERT( pFld, "TakeNextOffset: Missing Source" ); + OSL_ENSURE( pFld, "TakeNextOffset: Missing Source" ); nNextOffset = pFld->GetNextOffset(); aExpand.Erase( 0, nNextOffset ); bFollow = sal_True; @@ -455,7 +455,7 @@ void SwFldPortion::Paint( const SwTxtPaintInfo &rInf ) const { SwFontSave aSave( rInf, pFnt ); - ASSERT( GetLen() <= 1, "SwFldPortion::Paint: rest-portion polution?" ); + OSL_ENSURE( GetLen() <= 1, "SwFldPortion::Paint: rest-portion polution?" ); if( Width() && ( !bPlaceHolder || rInf.GetOpt().IsShowPlaceHolderFields() ) ) { // Dies ist eine freizuegige Auslegung der Hintergrundbelegung ... @@ -595,7 +595,7 @@ sal_Bool SwNumberPortion::Format( SwTxtFormatInfo &rInf ) if( rInf.IsNumDone() ) { // SetAscent( rInf.GetAscent() ); - ASSERT( Height() && nAscent, "NumberPortions without Height | Ascent" ); + OSL_ENSURE( Height() && nAscent, "NumberPortions without Height | Ascent" ); long nDiff( 0 ); // --> OD 2008-01-23 #newlistlevelattrs# @@ -1093,7 +1093,7 @@ void SwGrfNumPortion::SetBase( long nLnAscent, long nLnDescent, void SwTxtFrm::StopAnimation( OutputDevice* pOut ) { - ASSERT( HasAnimation(), "SwTxtFrm::StopAnimation: Which Animation?" ); + OSL_ENSURE( HasAnimation(), "SwTxtFrm::StopAnimation: Which Animation?" ); if( HasPara() ) { SwLineLayout *pLine = GetPara(); @@ -1156,7 +1156,7 @@ SwCombinedPortion::SwCombinedPortion( const XubString &rTxt ) void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const { - ASSERT( GetLen() <= 1, "SwFldPortion::Paint: rest-portion polution?" ); + OSL_ENSURE( GetLen() <= 1, "SwFldPortion::Paint: rest-portion polution?" ); if( Width() ) { rInf.DrawBackBrush( *this ); @@ -1169,7 +1169,7 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const USHORT nCount = aExpand.Len(); if( !nCount ) return; - ASSERT( nCount < 7, "Too much combined characters" ); + OSL_ENSURE( nCount < 7, "Too much combined characters" ); // the first character of the second row USHORT nTop = ( nCount + 1 ) / 2; @@ -1221,7 +1221,7 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) return sal_False; } - ASSERT( nCount < 7, "Too much combined characters" ); + OSL_ENSURE( nCount < 7, "Too much combined characters" ); // If there are leading "weak"-scripttyped characters in this portion, // they get the actual scripttype. USHORT i = 0; @@ -1233,7 +1233,7 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) i = 0; while( i < aExpand.Len() ) { - ASSERT( aScrType[i] < SW_SCRIPTS, "Combined: Script fault" ); + OSL_ENSURE( aScrType[i] < SW_SCRIPTS, "Combined: Script fault" ); if( !aWidth[ aScrType[i] ] ) { rInf.GetOut()->SetFont( rInf.GetFont()->GetFnt( aScrType[i] ) ); diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index 9b71a21328..f38233799b 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -69,7 +69,7 @@ void SwFlyPortion::Paint( const SwTxtPaintInfo& ) const *************************************************************************/ sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf ) { - ASSERT( Fix() >= rInf.X(), "SwFlyPortion::Format: rush hour" ); + OSL_ENSURE( Fix() >= rInf.X(), "SwFlyPortion::Format: rush hour" ); // 8537: Tabs muessen expandiert werden. if( rInf.GetLastTab() ) ((SwLinePortion*)rInf.GetLastTab())->FormatEOL( rInf ); @@ -79,7 +79,7 @@ sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf ) PrtWidth( static_cast<USHORT>(Fix() - rInf.X() + PrtWidth()) ); if( !Width() ) { - ASSERT( Width(), "+SwFlyPortion::Format: a fly is a fly is a fly" ); + OSL_ENSURE( Width(), "+SwFlyPortion::Format: a fly is a fly is a fly" ); Width(1); } @@ -205,7 +205,7 @@ void SwTxtFrm::MoveFlyInCnt( SwTxtFrm *pNew, xub_StrLen nStart, xub_StrLen nEnd xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch ) { SwpHints* pHints = GetTxtNode()->GetpSwpHints(); - ASSERT( pHints, "CalcFlyPos: Why me?" ); + OSL_ENSURE( pHints, "CalcFlyPos: Why me?" ); if( !pHints ) return STRING_LEN; SwTxtAttr* pFound = NULL; @@ -219,7 +219,7 @@ xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch ) pFound = pHt; } } - ASSERT( pHints, "CalcFlyPos: Not Found!" ); + OSL_ENSURE( pHints, "CalcFlyPos: Not Found!" ); if( !pFound ) return STRING_LEN; return *pFound->GetStart(); @@ -277,8 +277,8 @@ void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const ((SwTxtPaintInfo&)rInf).SelectFont(); // I want to know if this can really happen. So here comes a new - ASSERT( ! rInf.GetVsh() || rInf.GetVsh()->GetOut() == rInf.GetOut(), - "SwFlyCntPortion::Paint: Outdev has changed" ) + OSL_ENSURE( ! rInf.GetVsh() || rInf.GetVsh()->GetOut() == rInf.GetOut(), + "SwFlyCntPortion::Paint: Outdev has changed" ); if( rInf.GetVsh() ) ((SwTxtPaintInfo&)rInf).SetOut( rInf.GetVsh()->GetOut() ); } @@ -302,7 +302,7 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm, bMax( sal_False ), nAlign( 0 ) { - ASSERT( pFly, "SwFlyCntPortion::SwFlyCntPortion: no SwFlyInCntFrm!" ); + OSL_ENSURE( pFly, "SwFlyCntPortion::SwFlyCntPortion: no SwFlyInCntFrm!" ); nLineLength = 1; nFlags |= AS_CHAR_ULSPACE | AS_CHAR_INIT; SetBase( rFrm, rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags ); @@ -320,7 +320,7 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm, bMax( sal_False ), nAlign( 0 ) { - ASSERT( pDrawContact, "SwFlyCntPortion::SwFlyCntPortion: no SwDrawContact!" ); + OSL_ENSURE( pDrawContact, "SwFlyCntPortion::SwFlyCntPortion: no SwDrawContact!" ); if( !pDrawContact->GetAnchorFrm() ) { // OD 2004-04-01 #i26791# - no direct positioning needed any more @@ -365,7 +365,7 @@ void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase, pSdrObj = GetDrawContact()->GetDrawObjectByAnchorFrm( rFrm ); if ( !pSdrObj ) { - ASSERT( false, "SwFlyCntPortion::SetBase(..) - No drawing object found by <GetDrawContact()->GetDrawObjectByAnchorFrm( rFrm )>" ); + OSL_ENSURE( false, "SwFlyCntPortion::SetBase(..) - No drawing object found by <GetDrawContact()->GetDrawObjectByAnchorFrm( rFrm )>" ); pSdrObj = GetDrawContact()->GetMaster(); } // --> OD 2007-11-29 #i65798# @@ -449,7 +449,7 @@ xub_StrLen SwFlyCntPortion::GetFlyCrsrOfst( const KSHORT nOfst, xub_StrLen SwFlyCntPortion::GetCrsrOfst( const KSHORT nOfst ) const { - // ASSERT( !this, "SwFlyCntPortion::GetCrsrOfst: use GetFlyCrsrOfst()" ); + // OSL_ENSURE( !this, "SwFlyCntPortion::GetCrsrOfst: use GetFlyCrsrOfst()" ); return SwLinePortion::GetCrsrOfst( nOfst ); } diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index d230edf2a6..6bc3e8c8ea 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -112,9 +112,9 @@ void SwGluePortion::Paint( const SwTxtPaintInfo &rInf ) const if( rInf.OnWin() && rInf.GetOpt().IsBlank() && rInf.IsNoSymbol() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const xub_Unicode cChar = rInf.GetChar( rInf.GetIdx() ); - ASSERT( CH_BLANK == cChar || CH_BULLET == cChar, + OSL_ENSURE( CH_BLANK == cChar || CH_BULLET == cChar, "SwGluePortion::Paint: blank expected" ); #endif if( 1 == GetLen() ) diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 7e3fe67715..9c68d1140f 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -453,7 +453,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) while( pPos ) { DBG_LOOP; - ASSERT( POR_LIN != pPos->GetWhichPor(), + OSL_ENSURE( POR_LIN != pPos->GetWhichPor(), "SwLineLayout::CalcLine: don't use SwLinePortions !" ); // Null-Portions werden eliminiert. Sie koennen entstehen, @@ -501,7 +501,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) KSHORT nPosHeight = pPos->Height(); KSHORT nPosAscent = pPos->GetAscent(); - ASSERT( nPosHeight >= nPosAscent, + OSL_ENSURE( nPosHeight >= nPosAscent, "SwLineLayout::CalcLine: bad ascent or height" ); if( pPos->IsHangingPortion() ) @@ -655,7 +655,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) // Robust: if( nLineWidth < Width() ) Width( nLineWidth ); - ASSERT( nLineWidth >= Width(), "SwLineLayout::CalcLine: line is bursting" ); + OSL_ENSURE( nLineWidth >= Width(), "SwLineLayout::CalcLine: line is bursting" ); SetDummy( bTmpDummy ); SetRedline( rLine.GetRedln() && rLine.GetRedln()->CheckLine( rLine.GetStart(), rLine.GetEnd() ) ); @@ -760,7 +760,7 @@ SwScriptInfo::~SwScriptInfo() *************************************************************************/ BYTE SwScriptInfo::WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI ) { - ASSERT( pTxt || pSI,"How should I determine the script type?" ); + OSL_ENSURE( pTxt || pSI,"How should I determine the script type?" ); USHORT nScript; // First we try to use our SwScriptInfo @@ -776,7 +776,7 @@ BYTE SwScriptInfo::WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScrip case i18n::ScriptType::COMPLEX : return SW_CTL; } - ASSERT( sal_False, "Somebody tells lies about the script type!" ); + OSL_ENSURE( sal_False, "Somebody tells lies about the script type!" ); return SW_LATIN; } @@ -855,7 +855,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) // if change position = 0 we do not use any data from the arrays // because by deleting all characters of the first group at the beginning // of a paragraph nScript is set to a wrong value - ASSERT( CountScriptChg(), "Where're my changes of script?" ); + OSL_ENSURE( CountScriptChg(), "Where're my changes of script?" ); while( nCnt < CountScriptChg() ) { if ( nChg > GetScriptChg( nCnt ) ) @@ -968,7 +968,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) nScript = (BYTE)GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ); - ASSERT( i18n::ScriptType::LATIN == nScript || + OSL_ENSURE( i18n::ScriptType::LATIN == nScript || i18n::ScriptType::ASIAN == nScript || i18n::ScriptType::COMPLEX == nScript, "Wrong default language" ); @@ -993,9 +993,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) while ( nChg < rTxt.Len() || ( !aScriptChg.Count() && !rTxt.Len() ) ) { - ASSERT( i18n::ScriptType::WEAK != nScript, + OSL_ENSURE( i18n::ScriptType::WEAK != nScript, "Inserting WEAK into SwScriptInfo structure" ); - ASSERT( STRING_LEN != nChg, "65K? Strange length of script section" ); + OSL_ENSURE( STRING_LEN != nChg, "65K? Strange length of script section" ); xub_StrLen nSearchStt = nChg; nChg = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( rTxt, nSearchStt, nScript ); @@ -1175,7 +1175,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) ( isHahChar ( cCh ) && nIdx == nWordLen - 1)) // Hah (dual joining) only at end of word { - ASSERT( 0 != cPrevCh, "No previous character" ) + OSL_ENSURE( 0 != cPrevCh, "No previous character" ); // check if character is connectable to previous character, if ( lcl_ConnectToPrev( cCh, cPrevCh ) ) { @@ -1195,7 +1195,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) isGafChar ( cCh ) ) && nIdx == nWordLen - 1)) // only at end of word { - ASSERT( 0 != cPrevCh, "No previous character" ) + OSL_ENSURE( 0 != cPrevCh, "No previous character" ); // check if character is connectable to previous character, if ( lcl_ConnectToPrev( cCh, cPrevCh ) ) { @@ -1215,7 +1215,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) xub_Unicode cNextCh = rWord.GetChar( nIdx + 1 ); if ( isRehChar ( cNextCh ) || isYehChar ( cNextCh )) { - ASSERT( 0 != cPrevCh, "No previous character" ) + OSL_ENSURE( 0 != cPrevCh, "No previous character" ); // check if character is connectable to previous character, if ( lcl_ConnectToPrev( cCh, cPrevCh ) ) { @@ -1237,7 +1237,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) isFeChar ( cCh ) ) // Feh (dual joining) && nIdx == nWordLen - 1)) // only at end of word { - ASSERT( 0 != cPrevCh, "No previous character" ) + OSL_ENSURE( 0 != cPrevCh, "No previous character" ); // check if character is connectable to previous character, if ( lcl_ConnectToPrev( cCh, cPrevCh ) ) { @@ -1257,7 +1257,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) ( 0x60C <= cCh && 0x6FE >= cCh // all others && nIdx == nWordLen - 1)) // only at end of word { - ASSERT( 0 != cPrevCh, "No previous character" ) + OSL_ENSURE( 0 != cPrevCh, "No previous character" ); // check if character is connectable to previous character, if ( lcl_ConnectToPrev( cCh, cPrevCh ) ) { @@ -1288,7 +1288,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) nLastKashida = nChg; }; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // check kashida data long nTmpKashidaPos = -1; sal_Bool bWrongKash = sal_False; @@ -1302,7 +1302,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) } nTmpKashidaPos = nCurrKashidaPos; } - ASSERT( ! bWrongKash, "Kashida array contains wrong data" ) + OSL_ENSURE( ! bWrongKash, "Kashida array contains wrong data" ); #endif // remove invalid entries from direction information arrays @@ -1352,8 +1352,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) const xub_StrLen nStartPosOfGroup = nScriptIdx ? GetScriptChg( nScriptIdx - 1 ) : 0; const BYTE nScriptTypeOfGroup = GetScriptType( nScriptIdx ); - ASSERT( nStartPosOfGroup <= nStart && GetScriptChg( nScriptIdx ) > nStart, - "Script override with CTL font trouble" ) + OSL_ENSURE( nStartPosOfGroup <= nStart && GetScriptChg( nScriptIdx ) > nStart, + "Script override with CTL font trouble" ); // Check if we have to insert a new script change at // position nStart. If nStartPosOfGroup < nStart, @@ -1388,9 +1388,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) { nScriptChg = GetScriptChg( i2 ); nScriptType = GetScriptType( i2 ); - ASSERT( nLastScriptType != nScriptType && + OSL_ENSURE( nLastScriptType != nScriptType && nLastScriptChg < nScriptChg, - "Heavy InitScriptType() confusion" ) + "Heavy InitScriptType() confusion" ); } #endif } @@ -1511,7 +1511,7 @@ USHORT SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, XubString& rText, const xub_StrLen nStt, const xub_StrLen nEnd, const xub_Unicode cChar ) { - ASSERT( rNode.GetTxt().Len() == rText.Len(), "MaskHiddenRanges, string len mismatch" ) + OSL_ENSURE( rNode.GetTxt().Len() == rText.Len(), "MaskHiddenRanges, string len mismatch" ); PositionList aList; xub_StrLen nHiddenStart; @@ -1762,8 +1762,8 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen const USHORT nCompress, const USHORT nFontHeight, Point* pPoint ) const { - ASSERT( nCompress, "Compression without compression?!" ); - ASSERT( nLen, "Compression without text?!" ); + OSL_ENSURE( nCompress, "Compression without compression?!" ); + OSL_ENSURE( nLen, "Compression without text?!" ); USHORT nCompCount = CountCompChg(); // In asian typography, there are full width and half width characters. @@ -1798,7 +1798,7 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen { USHORT nType = GetCompType( nCompIdx ); #if OSL_DEBUG_LEVEL > 1 - ASSERT( nType == CompType( nIdx ), "Gimme the right type!" ); + OSL_ENSURE( nType == CompType( nIdx ), "Gimme the right type!" ); #endif nCompLen = nCompLen + nIdx; if( nCompLen > nLen ) @@ -1813,7 +1813,7 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen { while( nIdx < nCompLen ) { - ASSERT( SwScriptInfo::NONE != nType, "None compression?!" ); + OSL_ENSURE( SwScriptInfo::NONE != nType, "None compression?!" ); // nLast is width of current character nLast -= pKernArray[ nI ]; @@ -1885,7 +1885,7 @@ USHORT SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, xub_StrLen nLen, long nSpaceAdd ) const { - ASSERT( nLen, "Kashida justification without text?!" ) + OSL_ENSURE( nLen, "Kashida justification without text?!" ); if( !IsKashidaLine(nStt)) return STRING_LEN; @@ -2165,7 +2165,7 @@ void SwScriptInfo::ClearNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen ) // mark the given character indices as invalid kashida positions bool SwScriptInfo::MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen* pKashidaPositions ) { - ASSERT( pKashidaPositions && nCnt > 0, "Where are kashidas?" ) + OSL_ENSURE( pKashidaPositions && nCnt > 0, "Where are kashidas?" ); USHORT nCntKash = 0; xub_StrLen nKashidaPosIdx = 0; @@ -2198,7 +2198,7 @@ USHORT SwScriptInfo::ThaiJustify( const XubString& rTxt, sal_Int32* pKernArray, xub_StrLen nLen, xub_StrLen nNumberOfBlanks, long nSpaceAdd ) { - ASSERT( nStt + nLen <= rTxt.Len(), "String in ThaiJustify too small" ) + OSL_ENSURE( nStt + nLen <= rTxt.Len(), "String in ThaiJustify too small" ); SwTwips nNumOfTwipsToDistribute = nSpaceAdd * nNumberOfBlanks / SPACING_PRECISION_FACTOR; @@ -2361,7 +2361,7 @@ SwTwips SwLineLayout::_GetHangingMargin() const SwTwips SwTxtFrm::HangingMargin() const { - ASSERT( HasPara(), "Don't call me without a paraportion" ); + OSL_ENSURE( HasPara(), "Don't call me without a paraportion" ); if( !GetPara()->IsMargin() ) return 0; const SwLineLayout* pLine = GetPara(); diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx index 38294374eb..c66852273c 100644 --- a/sw/source/core/text/porlay.hxx +++ b/sw/source/core/text/porlay.hxx @@ -256,7 +256,7 @@ public: const SwLinePortion* _pDontConsiderPortion = NULL, const bool _bNoFlyCntPorAndLinePor = false ) const; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void DebugPortions( SvStream &rOs, const XubString &rTxt, const xub_StrLen nStart ); //$ ostream #endif diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index 9e42618f1f..f2537a92fa 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -43,7 +43,7 @@ #include "porglue.hxx" #include "inftxt.hxx" #include "blink.hxx" -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool ChkChain( SwLinePortion *pStart ) { @@ -52,7 +52,7 @@ sal_Bool ChkChain( SwLinePortion *pStart ) while( pPor ) { ++nCount; - ASSERT( nCount < 200 && pPor != pStart, + OSL_ENSURE( nCount < 200 && pPor != pStart, "ChkChain(): lost in chains" ); if( nCount >= 200 || pPor == pStart ) { @@ -107,8 +107,8 @@ SwLinePortion::SwLinePortion( ) : void SwLinePortion::PrePaint( const SwTxtPaintInfo& rInf, const SwLinePortion* pLast ) const { - ASSERT( rInf.OnWin(), "SwLinePortion::PrePaint: don't prepaint on a printer"); - ASSERT( !Width(), "SwLinePortion::PrePaint: For Width()==0 only!"); + OSL_ENSURE( rInf.OnWin(), "SwLinePortion::PrePaint: don't prepaint on a printer"); + OSL_ENSURE( !Width(), "SwLinePortion::PrePaint: For Width()==0 only!"); const KSHORT nViewWidth = GetViewWidth( rInf ); @@ -191,7 +191,7 @@ void SwLinePortion::_Truncate() { SwLinePortion *pPos = pPortion; do - { ASSERT( pPos != this, "SwLinePortion::Truncate: loop" ); + { OSL_ENSURE( pPos != this, "SwLinePortion::Truncate: loop" ); SwLinePortion *pLast = pPos; pPos = pPos->GetPortion(); pLast->SetPortion( 0 ); @@ -212,7 +212,7 @@ SwLinePortion *SwLinePortion::Insert( SwLinePortion *pIns ) { pIns->FindLastPortion()->SetPortion( pPortion ); SetPortion( pIns ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ChkChain( this ); #endif return pIns; @@ -243,7 +243,7 @@ SwLinePortion *SwLinePortion::Append( SwLinePortion *pIns ) SwLinePortion *pPos = FindLastPortion(); pPos->SetPortion( pIns ); pIns->SetPortion( 0 ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ChkChain( this ); #endif return pIns; @@ -256,7 +256,7 @@ SwLinePortion *SwLinePortion::Append( SwLinePortion *pIns ) SwLinePortion *SwLinePortion::Cut( SwLinePortion *pVictim ) { SwLinePortion *pPrev = pVictim->FindPrevPortion( this ); - ASSERT( pPrev, "SwLinePortion::Cut(): can't cut" ); + OSL_ENSURE( pPrev, "SwLinePortion::Cut(): can't cut" ); pPrev->SetPortion( pVictim->GetPortion() ); pVictim->SetPortion(0); return pVictim; @@ -268,14 +268,14 @@ SwLinePortion *SwLinePortion::Cut( SwLinePortion *pVictim ) SwLinePortion *SwLinePortion::FindPrevPortion( const SwLinePortion *pRoot ) { - ASSERT( pRoot != this, "SwLinePortion::FindPrevPortion(): invalid root" ); + OSL_ENSURE( pRoot != this, "SwLinePortion::FindPrevPortion(): invalid root" ); SwLinePortion *pPos = (SwLinePortion*)pRoot; while( pPos->GetPortion() && pPos->GetPortion() != this ) { DBG_LOOP; pPos = pPos->GetPortion(); } - ASSERT( pPos->GetPortion(), + OSL_ENSURE( pPos->GetPortion(), "SwLinePortion::FindPrevPortion: blowing in the wind"); return pPos; } @@ -298,12 +298,12 @@ xub_StrLen SwLinePortion::GetCrsrOfst( const KSHORT nOfst ) const SwPosSize SwLinePortion::GetTxtSize( const SwTxtSizeInfo & ) const { - ASSERT( !this, "SwLinePortion::GetTxtSize: don't ask me about sizes, " + OSL_ENSURE( !this, "SwLinePortion::GetTxtSize: don't ask me about sizes, " "I'm only a stupid SwLinePortion" ); return SwPosSize(); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 /************************************************************************* * virtual SwLinePortion::Check() diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index ca056ee851..489ea594f2 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -40,7 +40,7 @@ class SwPortionHandler; // Das CLASSIO-Makro implementiert die 'freischwebende' Funktion. // Auf diese Weise erhaelt man beide Vorteile: virtuelle Ausgabeoperatoren // und allgemeine Verwendbarkeit. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #define OUTPUT_OPERATOR virtual SvStream &operator<<( SvStream & aOs ) const; #else #define OUTPUT_OPERATOR @@ -175,7 +175,7 @@ public: virtual void Paint( const SwTxtPaintInfo &rInf ) const = 0; void PrePaint( const SwTxtPaintInfo &rInf, const SwLinePortion *pLast ) const; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 virtual sal_Bool Check( SvStream &rOs, SwTxtSizeInfo &rInfo ); //$ ostream #endif diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 821e994a79..3d1ea042cf 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -80,7 +80,7 @@ SwMultiPortion::~SwMultiPortion() void SwMultiPortion::Paint( const SwTxtPaintInfo & ) const { - ASSERT( FALSE, + OSL_ENSURE( FALSE, "Don't try SwMultiPortion::Paint, try SwTxtPainter::PaintMultiPortion" ); } @@ -624,8 +624,8 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt, : SwMultiPortion( nEnd ) { SetRuby(); - ASSERT( SW_MC_RUBY == rCreate.nId, "Ruby expected" ); - ASSERT( RES_TXTATR_CJK_RUBY == rCreate.pAttr->Which(), "Wrong attribute" ); + OSL_ENSURE( SW_MC_RUBY == rCreate.nId, "Ruby expected" ); + OSL_ENSURE( RES_TXTATR_CJK_RUBY == rCreate.pAttr->Which(), "Wrong attribute" ); const SwFmtRuby& rRuby = rCreate.pAttr->GetRuby(); nAdjustment = rRuby.GetAdjustment(); nRubyOffset = nOffs; @@ -749,7 +749,7 @@ void SwRubyPortion::_Adjust( SwTxtFormatInfo &rInf ) } break; } - default: ASSERT( sal_False, "New ruby adjustment" ); + default: OSL_ENSURE( sal_False, "New ruby adjustment" ); } if( nLeft || nRight ) { @@ -888,7 +888,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, BYTE nCurrLevel; if ( pMulti ) { - ASSERT( pMulti->IsBidi(), "Nested MultiPortion is not BidiPortion" ) + OSL_ENSURE( pMulti->IsBidi(), "Nested MultiPortion is not BidiPortion" ); // level associated with bidi-portion; nCurrLevel = ((SwBidiPortion*)pMulti)->GetLevel(); } @@ -1398,8 +1398,8 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint, { // these values are needed for the calculation of the x coordinate // and the layout mode - ASSERT( ! pEnvPor || pEnvPor->IsBidi(), - "Oh no, I expected a BidiPortion" ) + OSL_ENSURE( ! pEnvPor || pEnvPor->IsBidi(), + "Oh no, I expected a BidiPortion" ); nFrmDir = GetInfo().GetTxtFrm()->IsRightToLeft() ? 1 : 0; nEnvDir = pEnvPor ? ((SwBidiPortion*)pEnvPor)->GetLevel() % 2 : nFrmDir; nThisDir = ((SwBidiPortion&)rMulti).GetLevel() % 2; @@ -1503,8 +1503,8 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint, sal_Bool bRest = pLay->IsRest(); sal_Bool bFirst = sal_True; - ASSERT( 0 == GetInfo().GetUnderFnt() || rMulti.IsBidi(), - " Only BiDi portions are allowed to use the common underlining font" ) + OSL_ENSURE( 0 == GetInfo().GetUnderFnt() || rMulti.IsBidi(), + " Only BiDi portions are allowed to use the common underlining font" ); do { @@ -1596,7 +1596,7 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint, if( pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->IsBidi() ) { // but we do allow nested bidi portions - ASSERT( rMulti.IsBidi(), "Only nesting of bidi portions is allowed" ) + OSL_ENSURE( rMulti.IsBidi(), "Only nesting of bidi portions is allowed" ); PaintMultiPortion( rPaint, (SwMultiPortion&)*pPor, &rMulti ); } else @@ -1795,7 +1795,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, // We set nTmpX (which is used for portion calculating) to the // current Y value const SwPageFrm* pPage = pFrm->FindPageFrm(); - ASSERT( pPage, "No page in frame!"); + OSL_ENSURE( pPage, "No page in frame!"); const SwLayoutFrm* pUpperFrm = pPage; if ( pFrm->IsInTab() ) @@ -1803,7 +1803,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, pUpperFrm = pFrm->GetUpper(); while ( pUpperFrm && !pUpperFrm->IsCellFrm() ) pUpperFrm = pUpperFrm->GetUpper(); - ASSERT( pUpperFrm, "pFrm is in table but does not have an upper cell frame" ) + OSL_ENSURE( pUpperFrm, "pFrm is in table but does not have an upper cell frame" ); const SwTableLine* pLine = ((SwRowFrm*)pUpperFrm->GetUpper())->GetTabLine(); const SwFmtFrmSize& rFrmFmtSize = pLine->GetFrmFmt()->GetFrmSize(); if ( ATT_VAR_SIZE == rFrmFmtSize.GetHeightSizeType() ) @@ -1900,7 +1900,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, if( pFirstRest ) { - ASSERT( pFirstRest->InFldGrp(), "BuildMulti: Fieldrest expected"); + OSL_ENSURE( pFirstRest->InFldGrp(), "BuildMulti: Fieldrest expected"); SwFldPortion *pFld = ((SwFldPortion*)pFirstRest)->Clone( ((SwFldPortion*)pFirstRest)->GetExp() ); @@ -1947,7 +1947,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, pNextFirst = aInf.GetRest(); if( pSecondRest ) { - ASSERT( pSecondRest->InFldGrp(), "Fieldrest expected"); + OSL_ENSURE( pSecondRest->InFldGrp(), "Fieldrest expected"); SwFldPortion *pFld = ((SwFldPortion*)pSecondRest)->Clone( ((SwFldPortion*)pSecondRest)->GetExp() ); pFld->SetFollow( sal_True ); @@ -2085,7 +2085,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, // line break has to be performed! if( bRet ) { - ASSERT( !pNextFirst || pNextFirst->InFldGrp(), + OSL_ENSURE( !pNextFirst || pNextFirst->InFldGrp(), "BuildMultiPortion: Surprising restportion, field expected" ); SwMultiPortion *pTmp; if( rMulti.IsDouble() ) @@ -2093,7 +2093,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, nMultiLen + rInf.GetIdx() ); else if( rMulti.IsRuby() ) { - ASSERT( !pNextSecond || pNextSecond->InFldGrp(), + OSL_ENSURE( !pNextSecond || pNextSecond->InFldGrp(), "BuildMultiPortion: Surprising restportion, field expected" ); if ( rInf.GetIdx() == rInf.GetLineStart() ) @@ -2230,7 +2230,7 @@ SwLinePortion* SwTxtFormatter::MakeRestPortion( const SwLineLayout* pLine, } else if( pPor->IsMultiPortion() ) { - ASSERT( !pHelpMulti || pHelpMulti->IsBidi(), + OSL_ENSURE( !pHelpMulti || pHelpMulti->IsBidi(), "Nested multiportions are forbidden." ); pFld = NULL; @@ -2290,7 +2290,7 @@ SwLinePortion* SwTxtFormatter::MakeRestPortion( const SwLineLayout* pLine, if ( !pCreate ) { - ASSERT( !pHelpMulti->GetLen(), "Multiportion without attribut?" ); + OSL_ENSURE( !pHelpMulti->GetLen(), "Multiportion without attribut?" ); if ( nMultiPos ) --nMultiPos; pCreate = GetInfo().GetMultiCreator( --nMultiPos, 0 ); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 247f5ac766..30941f351c 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -245,7 +245,7 @@ SwTwips SwTxtFrm::EmptyHeight() const return 1; } } - ASSERT( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::EmptyHeight with swapped frame" ); + OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::EmptyHeight with swapped frame" ); SwFont *pFnt; const SwTxtNode& rTxtNode = *GetTxtNode(); @@ -308,7 +308,7 @@ SwTwips SwTxtFrm::EmptyHeight() const sal_Bool SwTxtFrm::FormatEmpty() { - ASSERT( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::FormatEmpty with swapped frame" ); + OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::FormatEmpty with swapped frame" ); if ( HasFollow() || GetTxtNode()->GetpSwpHints() || 0 != GetTxtNode()->GetNumRule() || @@ -442,8 +442,8 @@ sal_Bool SwTxtFrm::FillRegister( SwTwips& rRegStart, KSHORT& rRegDiff ) rRegDiff = rSpace.GetLineHeight(); break; } - default: ASSERT( - sal_False, ": unknown LineSpaceRule" ); + default: + OSL_ENSURE( sal_False, ": unknown LineSpaceRule" ); } switch( rSpace.GetInterLineSpaceRule() ) { @@ -468,7 +468,7 @@ sal_Bool SwTxtFrm::FillRegister( SwTwips& rRegStart, KSHORT& rRegDiff ) nNettoHeight = rRegDiff; break; } - default: ASSERT( sal_False, ": unknown InterLineSpaceRule" ); + default: OSL_ENSURE( sal_False, ": unknown InterLineSpaceRule" ); } pDesc->SetRegHeight( rRegDiff ); pDesc->SetRegAscent( rRegDiff - nNettoHeight + diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 732613e4e7..cd80a7086d 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -327,7 +327,7 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf ) // this should usually be true but aGuess.AlternativeSpelling( rInf, rInf.GetSoftHyphPos() - 1 ); bFull = CreateHyphen( rInf, aGuess ); - ASSERT( bFull, "Problem with hyphenation!!!" ); + OSL_ENSURE( bFull, "Problem with hyphenation!!!" ); } rInf.ChgHyph( bHyph ); rInf.SetSoftHyphPos( 0 ); @@ -435,7 +435,7 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf ) SetLen( aGuess.BreakPos() - rInf.GetIdx() ); - ASSERT( aGuess.BreakStart() >= aGuess.FieldDiff(), + OSL_ENSURE( aGuess.BreakStart() >= aGuess.FieldDiff(), "Trouble with expanded field portions during line break" ); const xub_StrLen nRealStart = aGuess.BreakStart() - aGuess.FieldDiff(); if( aGuess.BreakPos() < nRealStart && !InExpGrp() ) @@ -491,9 +491,9 @@ sal_Bool SwTxtPortion::Format( SwTxtFormatInfo &rInf ) return sal_True; } - ASSERT( rInf.RealWidth() || (rInf.X() == rInf.Width()), + OSL_ENSURE( rInf.RealWidth() || (rInf.X() == rInf.Width()), "SwTxtPortion::Format: missing real width" ); - ASSERT( Height(), "SwTxtPortion::Format: missing height" ); + OSL_ENSURE( Height(), "SwTxtPortion::Format: missing height" ); return _Format( rInf ); } @@ -551,7 +551,7 @@ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf ) xub_StrLen SwTxtPortion::GetCrsrOfst( const KSHORT nOfst ) const { - ASSERT( !this, "SwTxtPortion::GetCrsrOfst: don't use this method!" ); + OSL_ENSURE( !this, "SwTxtPortion::GetCrsrOfst: don't use this method!" ); return SwLinePortion::GetCrsrOfst( nOfst ); } @@ -851,7 +851,7 @@ sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo & rInf ) SwIndex aIndex( pNd, rInf.GetIdx( ) ); SwPosition aPosition( *pNd, aIndex ); IFieldmark *pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition ); - ASSERT( pBM != NULL, "Where is my form field bookmark???" ); + OSL_ENSURE( pBM != NULL, "Where is my form field bookmark???" ); if ( pBM != NULL ) { if ( pBM->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index cbef155330..343acded1e 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -100,7 +100,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = NULL; // determine script changes if not already done for current paragraph - ASSERT( pScriptInfo, "No script info available"); + OSL_ENSURE( pScriptInfo, "No script info available"); if ( pScriptInfo->GetInvalidity() != STRING_LEN ) pScriptInfo->InitScriptInfo( rTxtNode, bRTL ); @@ -318,7 +318,7 @@ void SwRedlineItr::FillHints( MSHORT nAuthor, RedlineType_t eType ) void SwRedlineItr::ChangeTxtAttr( SwFont* pFnt, SwTxtAttr &rHt, sal_Bool bChg ) { - ASSERT( IsOn(), "SwRedlineItr::ChangeTxtAttr: Off?" ); + OSL_ENSURE( IsOn(), "SwRedlineItr::ChangeTxtAttr: Off?" ); if( !bShow && !pExt ) return; @@ -332,14 +332,14 @@ void SwRedlineItr::ChangeTxtAttr( SwFont* pFnt, SwTxtAttr &rHt, sal_Bool bChg ) } else { - ASSERT( ! pExt || ! pExt->IsOn(), "Pop of attribute during opened extension" ) + OSL_ENSURE( ! pExt || ! pExt->IsOn(), "Pop of attribute during opened extension" ); rAttrHandler.PopAndChg( rHt, *pFnt ); } } void SwRedlineItr::_Clear( SwFont* pFnt ) { - ASSERT( bOn, "SwRedlineItr::Clear: Off?" ); + OSL_ENSURE( bOn, "SwRedlineItr::Clear: Off?" ); bOn = sal_False; while( aHints.Count() ) { @@ -445,8 +445,8 @@ void SwExtend::ActualizeFont( SwFont &rFnt, MSHORT nAttr ) short SwExtend::Enter( SwFont& rFnt, xub_StrLen nNew ) { - ASSERT( !Inside(), "SwExtend: Enter without Leave" ); - ASSERT( !pFnt, "SwExtend: Enter with Font" ); + OSL_ENSURE( !Inside(), "SwExtend: Enter without Leave" ); + OSL_ENSURE( !pFnt, "SwExtend: Enter with Font" ); nPos = nNew; if( Inside() ) { @@ -459,7 +459,7 @@ short SwExtend::Enter( SwFont& rFnt, xub_StrLen nNew ) sal_Bool SwExtend::_Leave( SwFont& rFnt, xub_StrLen nNew ) { - ASSERT( Inside(), "SwExtend: Leave without Enter" ); + OSL_ENSURE( Inside(), "SwExtend: Leave without Enter" ); MSHORT nOldAttr = rArr[ nPos - nStart ]; nPos = nNew; if( Inside() ) diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx index 14e64a32c6..a807cbe484 100644 --- a/sw/source/core/text/redlnitr.hxx +++ b/sw/source/core/text/redlnitr.hxx @@ -113,7 +113,7 @@ public: { return pExt->Leave(rFnt, nNew ); } inline sal_Bool ExtOn() { if( pExt ) return pExt->IsOn(); return sal_False; } inline void UpdateExtFont( SwFont &rFnt ) { - ASSERT( ExtOn(), "UpdateExtFont without ExtOn" ) + OSL_ENSURE( ExtOn(), "UpdateExtFont without ExtOn" ); pExt->UpdateFont( rFnt ); } }; diff --git a/sw/source/core/text/txtcache.cxx b/sw/source/core/text/txtcache.cxx index bb7dcd6c47..61b17479c8 100644 --- a/sw/source/core/text/txtcache.cxx +++ b/sw/source/core/text/txtcache.cxx @@ -184,7 +184,7 @@ SwParaPortion *SwTxtFrm::GetPara() void SwTxtFrm::ClearPara() { - ASSERT( !IsLocked(), "+SwTxtFrm::ClearPara: this is locked." ); + OSL_ENSURE( !IsLocked(), "+SwTxtFrm::ClearPara: this is locked." ); if ( !IsLocked() && GetCacheIdx() != MSHRT_MAX ) { SwTxtLine *pTxtLine = (SwTxtLine*)SwTxtFrm::GetTxtCache()-> @@ -223,7 +223,7 @@ void SwTxtFrm::SetPara( SwParaPortion *pNew, sal_Bool bDelete ) } else { - ASSERT( !pNew, "+SetPara: Losing SwParaPortion" ); + OSL_ENSURE( !pNew, "+SetPara: Losing SwParaPortion" ); nCacheIdx = MSHRT_MAX; } } @@ -234,7 +234,7 @@ void SwTxtFrm::SetPara( SwParaPortion *pNew, sal_Bool bDelete ) nCacheIdx = pTxtLine->GetCachePos(); else { - ASSERT( sal_False, "+SetPara: InsertCache failed." ); + OSL_ENSURE( sal_False, "+SetPara: InsertCache failed." ); } } } diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 427e1350f2..283f1ae70b 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -242,7 +242,7 @@ bool SwTxtNode::GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescen if ( !((SwTxtFrm*)pLastFrm)->IsEmpty() ) { const SwParaPortion* pPara = ((SwTxtFrm*)pLastFrm)->GetPara(); - ASSERT( pPara, "GetDropSize could not find the ParaPortion, I'll guess the drop cap size" ) + OSL_ENSURE( pPara, "GetDropSize could not find the ParaPortion, I'll guess the drop cap size" ); if ( pPara ) { @@ -293,7 +293,7 @@ void SwDropPortion::PaintTxt( const SwTxtPaintInfo &rInf ) const !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() ) rInf.DrawBackground( *this ); - ASSERT( nDropHeight && pPart && nLines != 1, "Drop Portion painted twice" ); + OSL_ENSURE( nDropHeight && pPart && nLines != 1, "Drop Portion painted twice" ); const SwDropPortionPart* pCurrPart = GetPart(); const xub_StrLen nOldLen = GetLen(); @@ -527,7 +527,7 @@ void SwTxtFormatter::CalcDropHeight( const MSHORT nLines ) { if( !Next() ) { - ASSERT( !this, "SwTxtFormatter::_CalcDropHeight: left Toulouse" ); + OSL_ENSURE( !this, "SwTxtFormatter::_CalcDropHeight: left Toulouse" ); break; } } @@ -545,7 +545,7 @@ void SwTxtFormatter::CalcDropHeight( const MSHORT nLines ) void SwTxtFormatter::GuessDropHeight( const MSHORT nLines ) { - ASSERT( nLines, "GuessDropHeight: Give me more Lines!" ); + OSL_ENSURE( nLines, "GuessDropHeight: Give me more Lines!" ); KSHORT nAscent = 0; KSHORT nHeight = 0; SetDropLines( nLines ); @@ -606,7 +606,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf ) } // build DropPortionParts: - ASSERT( ! rInf.GetIdx(), "Drop Portion not at 0 position!" ); + OSL_ENSURE( ! rInf.GetIdx(), "Drop Portion not at 0 position!" ); xub_StrLen nNextChg = 0; const SwCharFmt* pFmt = pDropFmt->GetCharFmt(); SwDropPortionPart* pCurrPart = 0; @@ -660,7 +660,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf ) void SwTxtPainter::PaintDropPortion() { const SwDropPortion *pDrop = GetInfo().GetParaPortion()->FindDropPortion(); - ASSERT( pDrop, "DrapCop-Portion not available." ); + OSL_ENSURE( pDrop, "DrapCop-Portion not available." ); if( !pDrop ) return; @@ -758,7 +758,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) const void* pFntNo = 0; MSHORT nTmpIdx = 0; - ASSERT( pDrop->GetPart(),"DropPortion without part during font calculation"); + OSL_ENSURE( pDrop->GetPart(),"DropPortion without part during font calculation"); SwDropPortionPart* pCurrPart = pDrop->GetPart(); const sal_Bool bUseCache = ! pCurrPart->GetFollow(); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index a2c23600ef..c151a6136a 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -129,8 +129,8 @@ using namespace ::com::sun::star; void SwTxtFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom ) { - ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(), - "SwTxtFormatter::CalcUnclipped with unswapped frame" ) + OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(), + "SwTxtFormatter::CalcUnclipped with unswapped frame" ); long nFlyAsc, nFlyDesc; // OD 08.01.2004 #i11859# - use new method <SwLineLayout::MaxAscentDescent(..)> @@ -150,8 +150,8 @@ void SwTxtFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom ) void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, xub_StrLen nStartIdx, sal_Bool bAllWays ) const { - ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(), - "SwTxtFormatter::UpdatePos with unswapped frame" ) + OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(), + "SwTxtFormatter::UpdatePos with unswapped frame" ); if( GetInfo().IsTest() ) return; @@ -237,14 +237,14 @@ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, } if( pPos->IsMultiPortion() && ((SwMultiPortion*)pPos)->HasFlyInCntnt() ) { - ASSERT( !GetMulti(), "Too much multi" ); + OSL_ENSURE( !GetMulti(), "Too much multi" ); ((SwTxtFormatter*)this)->pMulti = (SwMultiPortion*)pPos; SwLineLayout *pLay = &GetMulti()->GetRoot(); Point aSt( aTmpInf.X(), aStart.Y() ); if ( GetMulti()->HasBrackets() ) { - ASSERT( GetMulti()->IsDouble(), "Brackets only for doubles"); + OSL_ENSURE( GetMulti()->IsDouble(), "Brackets only for doubles"); aSt.X() += ((SwDoubleLinePortion*)GetMulti())->PreWidth(); } else if( GetMulti()->HasRotation() ) @@ -281,8 +281,8 @@ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, void SwTxtFormatter::AlignFlyInCntBase( long nBaseLine ) const { - ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(), - "SwTxtFormatter::AlignFlyInCntBase with unswapped frame" ) + OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(), + "SwTxtFormatter::AlignFlyInCntBase with unswapped frame" ); if( GetInfo().IsTest() ) return; @@ -340,7 +340,7 @@ void SwTxtFormatter::AlignFlyInCntBase( long nBaseLine ) const sal_Bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const { - ASSERT( rInf.GetTxtFly()->IsOn(), "SwTxtFormatter::ChkFlyUnderflow: why?" ); + OSL_ENSURE( rInf.GetTxtFly()->IsOn(), "SwTxtFormatter::ChkFlyUnderflow: why?" ); if( GetCurr() ) { // Erst pruefen wir, ob ueberhaupt ein Fly mit der Zeile ueberlappt. @@ -848,7 +848,7 @@ sal_Bool SwTxtFly::IsAnyFrm() const { SWAP_IF_SWAPPED( pCurrFrm ) - ASSERT( bOn, "IsAnyFrm: Why?" ); + OSL_ENSURE( bOn, "IsAnyFrm: Why?" ); SwRect aRect( pCurrFrm->Frm().Pos() + pCurrFrm->Prt().Pos(), pCurrFrm->Prt().SSize() ); @@ -869,7 +869,7 @@ sal_Bool SwTxtFly::IsAnyFrm() const sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const { - ASSERT ( bOn, "SwTxtFly::IsAnyObj: Who's knocking?" ); + OSL_ENSURE( bOn, "SwTxtFly::IsAnyObj: Who's knocking?" ); SwRect aRect( rRect ); if ( aRect.IsEmpty() ) @@ -956,7 +956,7 @@ sal_Bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf ) ? mpCurrAnchoredObj->GetDrawObj()->GetOrdNum() : SAL_MAX_UINT32; // <-- - ASSERT( !bTopRule, "DrawTextOpaque: Wrong TopRule" ); + OSL_ENSURE( !bTopRule, "DrawTextOpaque: Wrong TopRule" ); // --> OD 2006-08-15 #i68520# SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); @@ -1062,7 +1062,7 @@ void SwTxtFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect, const SwTxtPaintInfo &rInf, sal_Bool bNoGraphic ) { SwRegionRects aRegion( rRect ); - ASSERT( !bTopRule, "DrawFlyRect: Wrong TopRule" ); + OSL_ENSURE( !bTopRule, "DrawFlyRect: Wrong TopRule" ); // --> OD 2006-08-15 #i68520# SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); if ( bOn && nCount > 0 ) @@ -1121,7 +1121,7 @@ void SwTxtFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect, pOut->DrawRect( aRegion[i].SVRect() ); else { - ASSERT( ((SvxBrushItem*)-1) != rInf.GetBrushItem(), + OSL_ENSURE( ((SvxBrushItem*)-1) != rInf.GetBrushItem(), "DrawRect: Uninitialized BrushItem!" ); ::DrawGraphic( rInf.GetBrushItem(), pOut, rInf.GetBrushRect(), aRegion[i] ); @@ -1271,7 +1271,7 @@ sal_Bool SwTxtFly::GetTop( const SwAnchoredObject* _pAnchoredObj, // --> OD 2004-10-06 #i26945# const SwFmtAnchor& rNewA = _pAnchoredObj->GetFrmFmt().GetAnchor(); // <-- - ASSERT( FLY_AS_CHAR != rNewA.GetAnchorId(), + OSL_ENSURE( FLY_AS_CHAR != rNewA.GetAnchorId(), "Don't call GetTop with a FlyInCntFrm" ); if (FLY_AT_PAGE == rNewA.GetAnchorId()) return sal_True; // Seitengebundenen wird immer ausgewichen. @@ -1413,9 +1413,9 @@ struct AnchoredObjOrder // --> OD 2006-08-15 #i68520# SwAnchoredObjList* SwTxtFly::InitAnchoredObjList() { - ASSERT( pCurrFrm, "InitFlyList: No Frame, no FlyList" ); + OSL_ENSURE( pCurrFrm, "InitFlyList: No Frame, no FlyList" ); // --> OD 2006-08-15 #i68520# - ASSERT( !mpAnchoredObjList, "InitFlyList: FlyList already initialized" ); + OSL_ENSURE( !mpAnchoredObjList, "InitFlyList: FlyList already initialized" ); // <-- SWAP_IF_SWAPPED( pCurrFrm ) @@ -1674,7 +1674,7 @@ SwContourCache::~SwContourCache() void SwContourCache::ClrObject( MSHORT nPos ) { - ASSERT( pTextRanger[ nPos ], "ClrObject: Allready cleared. Good Bye!" ); + OSL_ENSURE( pTextRanger[ nPos ], "ClrObject: Allready cleared. Good Bye!" ); nPntCnt -= pTextRanger[ nPos ]->GetPointCount(); delete pTextRanger[ nPos ]; --nObjCnt; @@ -1877,7 +1877,7 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt, * SwContourCache::ShowContour() * zeichnet die PolyPolygone des Caches zu Debugzwecken. *************************************************************************/ -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void SwContourCache::ShowContour( OutputDevice* pOut, const SdrObject* pObj, const Color& rClosedColor, const Color& rOpenColor ) @@ -1928,7 +1928,7 @@ void SwContourCache::ShowContour( OutputDevice* pOut, const SdrObject* pObj, * SwTxtFly::ShowContour() * zeichnet die PolyPolygone des Caches zu Debugzwecken. *************************************************************************/ -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void SwTxtFly::ShowContour( OutputDevice* pOut ) { @@ -2084,8 +2084,8 @@ void SwTxtFly::CalcRightMargin( SwRect &rFly, const SwRect &rLine ) const { // Normalerweise ist der rechte Rand der rechte Rand der Printarea. - ASSERT( ! pCurrFrm->IsVertical() || ! pCurrFrm->IsSwapped(), - "SwTxtFly::CalcRightMargin with swapped frame" ) + OSL_ENSURE( ! pCurrFrm->IsVertical() || ! pCurrFrm->IsSwapped(), + "SwTxtFly::CalcRightMargin with swapped frame" ); SWRECTFN( pCurrFrm ) // --> OD 2004-12-14 #118796# - correct determination of right of printing area SwTwips nRight = (pCurrFrm->*fnRect->fnGetPrtRight)(); @@ -2188,8 +2188,8 @@ void SwTxtFly::CalcLeftMargin( SwRect &rFly, SwAnchoredObjList::size_type nFlyPos, const SwRect &rLine ) const { - ASSERT( ! pCurrFrm->IsVertical() || ! pCurrFrm->IsSwapped(), - "SwTxtFly::CalcLeftMargin with swapped frame" ) + OSL_ENSURE( ! pCurrFrm->IsVertical() || ! pCurrFrm->IsSwapped(), + "SwTxtFly::CalcLeftMargin with swapped frame" ); SWRECTFN( pCurrFrm ) // --> OD 2004-12-14 #118796# - correct determination of left of printing area SwTwips nLeft = (pCurrFrm->*fnRect->fnGetPrtLeft)(); @@ -2423,7 +2423,7 @@ sal_Bool SwTxtFly::IsAnyFrm( const SwRect &rLine ) const SWAP_IF_SWAPPED( pCurrFrm ) - ASSERT( bOn, "IsAnyFrm: Why?" ); + OSL_ENSURE( bOn, "IsAnyFrm: Why?" ); const sal_Bool bRet = ForEach( rLine, NULL, sal_False ); UNDO_SWAP( pCurrFrm ) diff --git a/sw/source/core/text/txtfly.hxx b/sw/source/core/text/txtfly.hxx index cf31d96436..d5b6c6eb53 100644 --- a/sw/source/core/text/txtfly.hxx +++ b/sw/source/core/text/txtfly.hxx @@ -100,7 +100,7 @@ public: const long nXPos, const sal_Bool bRight ); // <-- -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void ShowContour( OutputDevice* pOut, const SdrObject* pObj, const Color& rClosedColor, const Color& rOpenColor ); #endif @@ -233,7 +233,7 @@ public: } // <-- -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void ShowContour( OutputDevice* pOut ); #endif }; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 5c4217c613..1a3242c4a7 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -312,7 +312,7 @@ SwDigitModeModifier::~SwDigitModeModifier() void SwTxtFrm::Init() { - ASSERT( !IsLocked(), "+SwTxtFrm::Init: this ist locked." ); + OSL_ENSURE( !IsLocked(), "+SwTxtFrm::Init: this ist locked." ); if( !IsLocked() ) { ClearPara(); @@ -394,7 +394,7 @@ sal_Bool SwTxtFrm::IsHiddenNow() const if( !Frm().Width() && IsValid() && GetUpper()->IsValid() ) //bei Stackueberlauf (StackHack) invalid! { -// ASSERT( false, "SwTxtFrm::IsHiddenNow: thin frame" ); +// OSL_ENSURE( false, "SwTxtFrm::IsHiddenNow: thin frame" ); return sal_True; } @@ -426,7 +426,7 @@ sal_Bool SwTxtFrm::IsHiddenNow() const void SwTxtFrm::HideHidden() { - ASSERT( !GetFollow() && IsHiddenNow(), + OSL_ENSURE( !GetFollow() && IsHiddenNow(), "HideHidden on visible frame of hidden frame has follow" ); const xub_StrLen nEnd = STRING_LEN; @@ -606,7 +606,7 @@ void SwTxtFrm::HideAndShowObjects() } else { - ASSERT( false, + OSL_ENSURE( false, "<SwTxtFrm::HideAndShowObjects()> - object not anchored at/inside paragraph!?" ); } } @@ -739,8 +739,8 @@ void SwTxtFrm::_InvalidateRange( const SwCharRange &aRange, const long nD) void SwTxtFrm::CalcLineSpace() { - ASSERT( ! IsVertical() || ! IsSwapped(), - "SwTxtFrm::CalcLineSpace with swapped frame!" ) + OSL_ENSURE( ! IsVertical() || ! IsSwapped(), + "SwTxtFrm::CalcLineSpace with swapped frame!" ); if( IsLocked() || !HasPara() ) return; @@ -1381,7 +1381,7 @@ sal_Bool SwTxtFrm::GetInfo( SfxPoolItem &rHnt ) const void SwTxtFrm::PrepWidows( const MSHORT nNeed, sal_Bool bNotify ) { - ASSERT(GetFollow() && nNeed, "+SwTxtFrm::Prepare: lost all friends"); + OSL_ENSURE(GetFollow() && nNeed, "+SwTxtFrm::Prepare: lost all friends"); SwParaPortion *pPara = GetPara(); if ( !pPara ) @@ -1535,7 +1535,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, if( !HasPara() && PREP_MUST_FIT != ePrep ) { SetInvalidVert( TRUE ); // Test - ASSERT( !IsLocked(), "SwTxtFrm::Prepare: three of a perfect pair" ); + OSL_ENSURE( !IsLocked(), "SwTxtFrm::Prepare: three of a perfect pair" ); if ( bNotify ) InvalidateSize(); else @@ -1778,7 +1778,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, // letzte Zeile formatiert werden, damit ggf. die erste Zeile des Follows // hochrutschen kann, die extra auf die naechste Seite gerutscht war, um mit // der Fussnote zusammen zu sein, insbesondere bei spaltigen Bereichen. - ASSERT( GetFollow(), "PREP_FTN_GONE darf nur vom Follow gerufen werden" ); + OSL_ENSURE( GetFollow(), "PREP_FTN_GONE darf nur vom Follow gerufen werden" ); xub_StrLen nPos = GetFollow()->GetOfst(); if( IsFollow() && GetOfst() == nPos ) // falls wir gar keine Textmasse besitzen, FindMaster()->Prepare( PREP_FTN_GONE ); // rufen wir das Prepare unseres Masters @@ -1800,7 +1800,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, if( pVoid ) { xub_StrLen nWhere = CalcFlyPos( (SwFrmFmt*)pVoid ); - ASSERT( STRING_LEN != nWhere, "Prepare: Why me?" ); + OSL_ENSURE( STRING_LEN != nWhere, "Prepare: Why me?" ); InvalidateRange( SwCharRange( nWhere, 1 ) ); return; } @@ -1894,7 +1894,7 @@ SwTestFormat::SwTestFormat( SwTxtFrm* pTxtFrm, const SwFrm* pPre, SwTwips nMaxHe pOldPara = pFrm->HasPara() ? pFrm->GetPara() : NULL; pFrm->SetPara( new SwParaPortion(), sal_False ); - ASSERT( ! pFrm->IsSwapped(), "A frame is swapped before _Format" ); + OSL_ENSURE( ! pFrm->IsSwapped(), "A frame is swapped before _Format" ); if ( pFrm->IsVertical() ) pFrm->SwapWidthAndHeight(); @@ -1907,7 +1907,7 @@ SwTestFormat::SwTestFormat( SwTxtFrm* pTxtFrm, const SwFrm* pPre, SwTwips nMaxHe if ( pFrm->IsVertical() ) pFrm->SwapWidthAndHeight(); - ASSERT( ! pFrm->IsSwapped(), "A frame is swapped after _Format" ); + OSL_ENSURE( ! pFrm->IsSwapped(), "A frame is swapped after _Format" ); } SwTestFormat::~SwTestFormat() @@ -1947,7 +1947,7 @@ sal_Bool SwTxtFrm::TestFormat( const SwFrm* pPrv, SwTwips &rMaxHeight, sal_Bool sal_Bool SwTxtFrm::WouldFit( SwTwips &rMaxHeight, sal_Bool &bSplit, sal_Bool bTst ) { - ASSERT( ! IsVertical() || ! IsSwapped(), + OSL_ENSURE( ! IsVertical() || ! IsSwapped(), "SwTxtFrm::WouldFit with swapped frame" ); SWRECTFN( this ); @@ -1979,7 +1979,7 @@ sal_Bool SwTxtFrm::WouldFit( SwTwips &rMaxHeight, sal_Bool &bSplit, sal_Bool bTs // In sehr unguenstigen Faellen kann GetPara immer noch 0 sein. // Dann returnen wir sal_True, um auf der neuen Seite noch einmal // anformatiert zu werden. - ASSERT( HasPara() || IsHiddenNow(), "WouldFit: GetFormatted() and then !HasPara()" ); + OSL_ENSURE( HasPara() || IsHiddenNow(), "WouldFit: GetFormatted() and then !HasPara()" ); if( !HasPara() || ( !(Frm().*fnRect->fnGetHeight)() && IsHiddenNow() ) ) return sal_True; @@ -2053,8 +2053,8 @@ sal_Bool SwTxtFrm::WouldFit( SwTwips &rMaxHeight, sal_Bool &bSplit, sal_Bool bTs KSHORT SwTxtFrm::GetParHeight() const { - ASSERT( ! IsVertical() || ! IsSwapped(), - "SwTxtFrm::GetParHeight with swapped frame" ) + OSL_ENSURE( ! IsVertical() || ! IsSwapped(), + "SwTxtFrm::GetParHeight with swapped frame" ); if( !HasPara() ) { // Fuer nichtleere Absaetze ist dies ein Sonderfall, da koennen wir @@ -2271,7 +2271,7 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont ) // <-- // determine output device ViewShell* pVsh = GetShell(); - ASSERT( pVsh, "<SwTxtFrm::_GetHeightOfLastLineForPropLineSpacing()> - no ViewShell" ); + OSL_ENSURE( pVsh, "<SwTxtFrm::_GetHeightOfLastLineForPropLineSpacing()> - no ViewShell" ); // --> OD 2007-07-02 #i78921# - make code robust, according to provided patch // There could be no <ViewShell> instance in the case of loading a binary // StarOffice file format containing an embedded Writer document. @@ -2286,7 +2286,7 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont ) { pOut = GetTxtNode()->getIDocumentDeviceAccess()->getReferenceDevice( true ); } - ASSERT( pOut, "<SwTxtFrm::_GetHeightOfLastLineForPropLineSpacing()> - no OutputDevice" ); + OSL_ENSURE( pOut, "<SwTxtFrm::_GetHeightOfLastLineForPropLineSpacing()> - no OutputDevice" ); // --> OD 2007-07-02 #i78921# - make code robust, according to provided patch if ( !pOut ) { @@ -2349,7 +2349,7 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont ) if ( bCalcHeightOfLastLine ) { - ASSERT( HasPara(), + OSL_ENSURE( HasPara(), "<SwTxtFrm::_CalcHeightOfLastLine()> - missing paragraph portions." ); const SwLineLayout* pLineLayout = GetPara(); while ( pLineLayout && pLineLayout->GetNext() ) @@ -2703,8 +2703,8 @@ SwTwips lcl_CalcFlyBasePos( const SwTxtFrm& rFrm, SwRect aFlyRect, void SwTxtFrm::CalcBaseOfstForFly() { - ASSERT( !IsVertical() || !IsSwapped(), - "SwTxtFrm::CalcBasePosForFly with swapped frame!" ) + OSL_ENSURE( !IsVertical() || !IsSwapped(), + "SwTxtFrm::CalcBasePosForFly with swapped frame!" ); const SwNode* pNode = GetTxtNode(); if ( !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::ADD_FLY_OFFSETS) ) diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 038cda828b..a0070cfd55 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -102,10 +102,10 @@ SwTxtFrm *SwTxtFrm::FindFtnRef( const SwTxtFtn *pFtn ) * CalcFtnFlag() *************************************************************************/ -#ifndef DBG_UTIL -void SwTxtFrm::CalcFtnFlag() +#if OSL_DEBUG_LEVEL > 1 +void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//For testing the SplitFrm #else -void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm +void SwTxtFrm::CalcFtnFlag() #endif { bFtn = sal_False; @@ -116,11 +116,11 @@ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm const USHORT nSize = pHints->Count(); -#ifndef DBG_UTIL - const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; -#else +#if OSL_DEBUG_LEVEL > 1 const xub_StrLen nEnd = nStop != STRING_LEN ? nStop : GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; +#else + const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; #endif for ( USHORT i = 0; i < nSize; ++i ) @@ -146,7 +146,7 @@ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm sal_Bool SwTxtFrm::CalcPrepFtnAdjust() { - ASSERT( HasFtn(), "Wer ruft mich da?" ); + OSL_ENSURE( HasFtn(), "Wer ruft mich da?" ); SwFtnBossFrm *pBoss = FindFtnBossFrm( sal_True ); const SwFtnFrm *pFtn = pBoss->FindFirstFtn( this ); if( pFtn && FTNPOS_CHAPTER != GetNode()->GetDoc()->GetFtnInfo().ePos && @@ -195,7 +195,7 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) // containing the footnote. SWRECTFN( pFrm ) - ASSERT( !pFrm->IsVertical() || !pFrm->IsSwapped(), + OSL_ENSURE( !pFrm->IsVertical() || !pFrm->IsSwapped(), "lcl_GetFtnLower with swapped frame" ); SwTwips nAdd; @@ -221,8 +221,8 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) pRow = pRow->GetUpper(); const SwTabFrm* pTabFrm = (SwTabFrm*)pRow->GetUpper(); - ASSERT( pTabFrm && pRow && - pRow->GetUpper()->IsTabFrm(), "Upper of row should be tab" ) + OSL_ENSURE( pTabFrm && pRow && + pRow->GetUpper()->IsTabFrm(), "Upper of row should be tab" ); const BOOL bDontSplit = !pTabFrm->IsFollow() && !pTabFrm->IsLayoutSplitAllowed(); @@ -252,11 +252,11 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) // #i10770#: If there are fly frames anchored at previous paragraphs, // the deadline should consider their lower borders. const SwFrm* pStartFrm = pFrm->GetUpper()->GetLower(); - ASSERT( pStartFrm, "Upper has no lower" ) + OSL_ENSURE( pStartFrm, "Upper has no lower" ); SwTwips nFlyLower = bVert ? LONG_MAX : 0; while ( pStartFrm != pFrm ) { - ASSERT( pStartFrm, "Frame chain is broken" ) + OSL_ENSURE( pStartFrm, "Frame chain is broken" ); if ( pStartFrm->GetDrawObjs() ) { const SwSortedObjs &rObjs = *pStartFrm->GetDrawObjs(); @@ -293,8 +293,8 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) SwTwips SwTxtFrm::GetFtnLine( const SwTxtFtn *pFtn ) const { - ASSERT( ! IsVertical() || ! IsSwapped(), - "SwTxtFrm::GetFtnLine with swapped frame" ) + OSL_ENSURE( ! IsVertical() || ! IsSwapped(), + "SwTxtFrm::GetFtnLine with swapped frame" ); SwTxtFrm *pThis = (SwTxtFrm*)this; @@ -336,7 +336,7 @@ SwTwips SwTxtFrm::GetFtnLine( const SwTxtFtn *pFtn ) const SwTwips SwTxtFrm::_GetFtnFrmHeight() const { - ASSERT( !IsFollow() && IsInFtn(), "SwTxtFrm::SetFtnLine: moon walk" ); + OSL_ENSURE( !IsFollow() && IsInFtn(), "SwTxtFrm::SetFtnLine: moon walk" ); const SwFtnFrm *pFtnFrm = FindFtnFrm(); const SwTxtFrm *pRef = (const SwTxtFrm *)pFtnFrm->GetRef(); @@ -360,7 +360,7 @@ SwTwips SwTxtFrm::_GetFtnFrmHeight() const SwTwips nTmp = (*fnRect->fnYDiff)( (pCont->*fnRect->fnGetPrtBottom)(), (Frm().*fnRect->fnGetTop)() ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( nTmp < 0 ) { sal_Bool bInvalidPos = sal_False; @@ -373,7 +373,7 @@ SwTwips SwTxtFrm::_GetFtnFrmHeight() const break; pTmp = pTmp->GetUpper(); } - ASSERT( bInvalidPos, "Hanging below FtnCont" ); + OSL_ENSURE( bInvalidPos, "Hanging below FtnCont" ); } #endif @@ -510,7 +510,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) // Wir loeschen nicht, sondern wollen die Ftn verschieben. // Drei Faelle koennen auftreten: // 1) Es gibt weder Follow noch PrevFollow - // -> RemoveFtn() (vielleicht sogar ein ASSERT wert) + // -> RemoveFtn() (vielleicht sogar ein OSL_ENSURE(wert) // 2) nStart > GetOfst, ich habe einen Follow // -> Ftn wandert in den Follow // 3) nStart < GetOfst, ich bin ein Follow @@ -538,7 +538,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) while( pDest->GetFollow() && ((SwTxtFrm*)pDest-> GetFollow())->GetOfst() <= nIdx ) pDest = pDest->GetFollow(); - ASSERT( !pDest->FindFtnBossFrm( !bEndn )->FindFtn( + OSL_ENSURE( !pDest->FindFtnBossFrm( !bEndn )->FindFtn( pDest,pFtn),"SwTxtFrm::RemoveFtn: footnote exists"); //Nicht ummelden sondern immer Moven. @@ -567,7 +567,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) } ((SwTxtFrm*)pDest)->SetFtn( sal_True ); - ASSERT( pDest->FindFtnBossFrm( !bEndn )->FindFtn( pDest, + OSL_ENSURE( pDest->FindFtnBossFrm( !bEndn )->FindFtn( pDest, pFtn),"SwTxtFrm::RemoveFtn: footnote ChgRef failed"); } else @@ -581,7 +581,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) else pFtnBoss->RemoveFtn( this, pFtn ); bRemove = bRemove || !bEndDoc; - ASSERT( bEndn ? !pEndBoss->FindFtn( this, pFtn ) : + OSL_ENSURE( bEndn ? !pEndBoss->FindFtn( this, pFtn ) : !pFtnBoss->FindFtn( this, pFtn ), "SwTxtFrm::RemoveFtn: can't get off that footnote" ); } @@ -631,7 +631,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) void SwTxtFrm::ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine ) { - ASSERT( !IsVertical() || !IsSwapped(), + OSL_ENSURE( !IsVertical() || !IsSwapped(), "SwTxtFrm::ConnectFtn with swapped frame" ); bFtn = sal_True; @@ -849,7 +849,7 @@ void SwTxtFrm::ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine ) SwFtnPortion *SwTxtFormatter::NewFtnPortion( SwTxtFormatInfo &rInf, SwTxtAttr *pHint ) { - ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(), + OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(), "NewFtnPortion with unswapped frame" ); if( !pFrm->IsFtnAllowed() ) @@ -996,7 +996,7 @@ SwFtnPortion *SwTxtFormatter::NewFtnPortion( SwTxtFormatInfo &rInf, SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const { - ASSERT( pFrm->IsInFtn() && !pFrm->GetIndPrev() && !rInf.IsFtnDone(), + OSL_ENSURE( pFrm->IsInFtn() && !pFrm->GetIndPrev() && !rInf.IsFtnDone(), "This is the wrong place for a ftnnumber" ); if( rInf.GetTxtStart() != nStart || rInf.GetTxtStart() != rInf.GetIdx() ) @@ -1052,7 +1052,7 @@ SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const XubString lcl_GetPageNumber( const SwPageFrm* pPage ) { - ASSERT( pPage, "GetPageNumber: Homeless TxtFrm" ); + OSL_ENSURE( pPage, "GetPageNumber: Homeless TxtFrm" ); MSHORT nVirtNum = pPage->GetVirtPageNum(); const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType(); return rNum.GetNumStr( nVirtNum ); @@ -1093,7 +1093,7 @@ SwErgoSumPortion *SwTxtFormatter::NewErgoSumPortion( SwTxtFormatInfo &rInf ) con xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset ) { - ASSERT( ! pFrm->IsVertical() || ! pFrm->IsSwapped(), + OSL_ENSURE( ! pFrm->IsVertical() || ! pFrm->IsSwapped(), "SwTxtFormatter::FormatQuoVadis with swapped frame" ); if( !pFrm->IsInFtn() || pFrm->ImplFindFtnFrm()->GetAttr()->GetFtn().IsEndNote() ) @@ -1167,8 +1167,8 @@ xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset ) rInf.SetRest( 0 ); pCurrPor->Move( rInf ); - ASSERT( pFollow->IsQuoVadisPortion(), - "Quo Vadis, rest of QuoVadisPortion" ) + OSL_ENSURE( pFollow->IsQuoVadisPortion(), + "Quo Vadis, rest of QuoVadisPortion" ); // format the rest and append it to the other QuoVadis parts pFollow->Format( rInf ); diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index 5e28600cf4..2612cc67a7 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -45,7 +45,7 @@ #include <guess.hxx> // #include <splargs.hxx> // SwInterHyphInfo -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 extern const sal_Char *GetLangName( const MSHORT nLang ); #endif @@ -65,7 +65,7 @@ Reference< XHyphenatedWord > SwTxtFormatInfo::HyphWord( { if( rTxt.Len() < 4 || pFnt->IsSymbol(pVsh) ) return 0; -// ASSERT( IsHyphenate(), "SwTxtFormatter::HyphWord: why?" ); +// OSL_ENSURE( IsHyphenate(), "SwTxtFormatter::HyphWord: why?" ); Reference< XHyphenator > xHyph = ::GetHyphenator(); Reference< XHyphenatedWord > xHyphWord; @@ -85,12 +85,12 @@ Reference< XHyphenatedWord > SwTxtFormatInfo::HyphWord( sal_Bool SwTxtFrm::Hyphenate( SwInterHyphInfo &rHyphInf ) { - ASSERT( ! IsVertical() || ! IsSwapped(),"swapped frame at SwTxtFrm::Hyphenate" ); + OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"swapped frame at SwTxtFrm::Hyphenate" ); if( !pBreakIt->GetBreakIter().is() ) return sal_False;; // Wir machen den Laden erstmal dicht: - ASSERT( !IsLocked(), "SwTxtFrm::Hyphenate: this is locked" ); + OSL_ENSURE( !IsLocked(), "SwTxtFrm::Hyphenate: this is locked" ); // 4935: Der frame::Frame muss eine gueltige SSize haben! Calc(); GetFormatted(); @@ -149,7 +149,7 @@ sal_Bool SwTxtFrm::Hyphenate( SwInterHyphInfo &rHyphInf ) void SetParaPortion( SwTxtInfo *pInf, SwParaPortion *pRoot ) { - ASSERT( pRoot, "SetParaPortion: no root anymore" ); + OSL_ENSURE( pRoot, "SetParaPortion: no root anymore" ); pInf->pPara = pRoot; } @@ -182,7 +182,7 @@ sal_Bool SwTxtFormatter::Hyphenate( SwInterHyphInfo &rHyphInf ) SwParaPortion *pPara = new SwParaPortion(); SetParaPortion( &rInf, pPara ); pCurr = pPara; - ASSERT( IsParaLine(), "SwTxtFormatter::Hyphenate: not the first" ); + OSL_ENSURE( IsParaLine(), "SwTxtFormatter::Hyphenate: not the first" ); } else pCurr = new SwLineLayout(); @@ -235,7 +235,7 @@ sal_Bool SwTxtFormatter::Hyphenate( SwInterHyphInfo &rHyphInf ) if( pOldCurr->IsParaPortion() ) { SetParaPortion( &rInf, (SwParaPortion*)pOldCurr ); - ASSERT( IsParaLine(), "SwTxtFormatter::Hyphenate: even not the first" ); + OSL_ENSURE( IsParaLine(), "SwTxtFormatter::Hyphenate: even not the first" ); } if( nWrdStart ) @@ -300,11 +300,11 @@ sal_Bool SwTxtFormatter::Hyphenate( SwInterHyphInfo &rHyphInf ) #ifdef DEBUGGY if( OPTDBG( rInf ) ) { - ASSERT( aSelTxt == aHyphWord, + OSL_ENSURE( aSelTxt == aHyphWord, "!SwTxtFormatter::Hyphenate: different words, different planets" ); aDbstream << "Diff: \"" << aSelTxt.GetStr() << "\" != \"" << aHyphWord.GetStr() << "\"" << endl; - ASSERT( bRet, "!SwTxtFormatter::Hyphenate: three of a perfect pair" ); + OSL_ENSURE( bRet, "!SwTxtFormatter::Hyphenate: three of a perfect pair" ); aDbstream << "Hyphenate: "; } #endif @@ -321,8 +321,8 @@ sal_Bool SwTxtPortion::CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ) { Reference< XHyphenatedWord > xHyphWord = rGuess.HyphWord(); - ASSERT( !pPortion, "SwTxtPortion::CreateHyphen(): another portion, another planet..." ) - ASSERT( xHyphWord.is(), "SwTxtPortion::CreateHyphen(): You are lucky! The code is robust here." ) + OSL_ENSURE( !pPortion, "SwTxtPortion::CreateHyphen(): another portion, another planet..." ); + OSL_ENSURE( xHyphWord.is(), "SwTxtPortion::CreateHyphen(): You are lucky! The code is robust here." ); if( rInf.IsHyphForbud() || pPortion || // robust @@ -340,7 +340,7 @@ sal_Bool SwTxtPortion::CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ) { SvxAlternativeSpelling aAltSpell; aAltSpell = SvxGetAltSpelling( xHyphWord ); - ASSERT( aAltSpell.bIsAltSpelling, "no alternatve spelling" ); + OSL_ENSURE( aAltSpell.bIsAltSpelling, "no alternatve spelling" ); XubString aAltTxt = aAltSpell.aReplacement; nPorEnd = aAltSpell.nChangedPos + rGuess.BreakStart() - rGuess.FieldDiff(); diff --git a/sw/source/core/text/txtinit.cxx b/sw/source/core/text/txtinit.cxx index 32ae8563be..74468830a8 100644 --- a/sw/source/core/text/txtinit.cxx +++ b/sw/source/core/text/txtinit.cxx @@ -77,7 +77,7 @@ void _TextInit() pFntCache = new SwFntCache; // Cache for SwSubFont -> SwFntObj = { Font aFont, Font* pScrFont, Font* pPrtFont, OutputDevice* pPrinter, ... } pSwFontCache = new SwFontCache; // Cache for SwTxtFmtColl -> SwFontObj = { SwFont aSwFont, SfxPoolItem* pDefaultArray } SwCache *pTxtCache = new SwCache( 250, 100 // Cache for SwTxtFrm -> SwTxtLine = { SwParaPortion* pLine } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 , "static SwTxtFrm::pTxtCache" #endif ); diff --git a/sw/source/core/text/txtio.cxx b/sw/source/core/text/txtio.cxx index ec7eb6f288..d93d8d13f7 100644 --- a/sw/source/core/text/txtio.cxx +++ b/sw/source/core/text/txtio.cxx @@ -30,8 +30,8 @@ #include "precompiled_sw.hxx" -#ifndef DBG_UTIL -#error Wer fummelt denn an den makefiles? +#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 +#error Who broke the makefiles? #endif #include "viewsh.hxx" // IsDbg() @@ -294,7 +294,7 @@ sal_Bool IsDbg( const SwTxtFrm *pFrm ) if( pFrm && pFrm->GetShell() ) return pFrm->GetShell()->GetViewOptions()->IsTest4(); else -#else +#endif return sal_False; } @@ -304,7 +304,7 @@ static void Error() { // wegen PM und BCC sal_Bool bFalse = sal_False; - ASSERT( bFalse, "txtio: No debug version" ); + OSL_ENSURE( bFalse, "txtio: No debug version" ); } #define IMPL_OUTOP(class) \ @@ -465,7 +465,7 @@ const char *GetPrepName( const PrepareHint ePrep ) pPREP_UL_SPACE, pPREP_MUST_FIT, pPREP_WIDOWS, pPREP_QUOVADIS, pPREP_PAGE }; - ASSERT( ePrep < PREP_END, "GetPrepName: unknown PrepareHint" ); + OSL_ENSURE( ePrep < PREP_END, "GetPrepName: unknown PrepareHint" ); return( ppNameArr[ePrep] ); } diff --git a/sw/source/core/text/txtpaint.cxx b/sw/source/core/text/txtpaint.cxx index b37e445ead..915a03b2f7 100644 --- a/sw/source/core/text/txtpaint.cxx +++ b/sw/source/core/text/txtpaint.cxx @@ -120,7 +120,7 @@ void SwSaveClip::_ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm, #endif } #if OSL_DEBUG_LEVEL > 1 -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static sal_Bool bDbg = sal_False; if( bDbg ) { diff --git a/sw/source/core/text/txtpaint.hxx b/sw/source/core/text/txtpaint.hxx index b9c438edbc..735236b962 100644 --- a/sw/source/core/text/txtpaint.hxx +++ b/sw/source/core/text/txtpaint.hxx @@ -69,7 +69,7 @@ inline SwSaveClip::~SwSaveClip() Reset(); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 /************************************************************************* * class SwDbgOut diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 0f98a7fea0..a53f8ada8a 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -268,7 +268,7 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto ) nNextPos = nForced; } nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos; - ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" ); + OSL_ENSURE( nNextPos >= 0, "GetTabStop: Don't go back!" ); nNewTabPos = KSHORT(nNextPos); } @@ -301,7 +301,7 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto ) } default: { - ASSERT( SVX_TAB_ADJUST_LEFT == eAdj || SVX_TAB_ADJUST_DEFAULT == eAdj, + OSL_ENSURE( SVX_TAB_ADJUST_LEFT == eAdj || SVX_TAB_ADJUST_DEFAULT == eAdj, "+SwTxtFormatter::NewTabPortion: unknown adjustment" ); pTabPor = new SwTabLeftPortion( nNewTabPos, cFill ); break; @@ -328,10 +328,10 @@ SwTabPortion::SwTabPortion( const KSHORT nTabPosition, const xub_Unicode cFillCh : SwFixPortion( 0, 0 ), nTabPos(nTabPosition), cFill(cFillChar) { nLineLength = 1; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( IsFilled() ) { - ASSERT( ' ' != cFill, "SwTabPortion::CTOR: blanks ?!" ); + OSL_ENSURE( ' ' != cFill, "SwTabPortion::CTOR: blanks ?!" ); } #endif SetWhichPor( POR_TAB ); @@ -373,7 +373,7 @@ void SwTabPortion::FormatEOL( SwTxtFormatInfo &rInf ) sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) { - ASSERT( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" ); + OSL_ENSURE( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" ); // Hier lassen wir uns nieder... Fix( static_cast<USHORT>(rInf.X()) ); @@ -445,7 +445,7 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) break; } - default: ASSERT( !this, "SwTabPortion::PreFormat: unknown adjustment" ); + default: OSL_ENSURE( !this, "SwTabPortion::PreFormat: unknown adjustment" ); } } @@ -501,7 +501,7 @@ sal_Bool SwTabPortion::PostFormat( SwTxtFormatInfo &rInf ) } const MSHORT nWhich = GetWhichPor(); - ASSERT( POR_TABLEFT != nWhich, "SwTabPortion::PostFormat: already formatted" ); + OSL_ENSURE( POR_TABLEFT != nWhich, "SwTabPortion::PostFormat: already formatted" ); const bool bTabCompat = rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT); // --> FME 2005-12-19 #127428# Abandon dec. tab position if line is full: @@ -563,7 +563,7 @@ sal_Bool SwTabPortion::PostFormat( SwTxtFormatInfo &rInf ) void SwTabPortion::Paint( const SwTxtPaintInfo &rInf ) const { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // Wir wollen uns die Fixbreite anzeigen if( rInf.OnWin() && OPTDBG( rInf ) && !rInf.GetOpt().IsPagePreview() && \ @@ -633,7 +633,7 @@ void SwTabPortion::Paint( const SwTxtPaintInfo &rInf ) const XubString aTxt( cFill ); const KSHORT nCharWidth = rInf.GetTxtSize( aTxt ).Width(); #if OSL_DEBUG_LEVEL > 1 - ASSERT( nCharWidth, "!SwTabPortion::Paint: sophisticated tabchar" ); + OSL_ENSURE( nCharWidth, "!SwTabPortion::Paint: sophisticated tabchar" ); #endif // robust: if( nCharWidth ) diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index 0b66f2fa5b..e561356161 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -61,7 +61,7 @@ // Ein Follow, der auf der selben Seite steht, wie sein Master ist nasty. inline sal_Bool IsNastyFollow( const SwTxtFrm *pFrm ) { - ASSERT( !pFrm->IsFollow() || !pFrm->GetPrev() || + OSL_ENSURE( !pFrm->IsFollow() || !pFrm->GetPrev() || ((const SwTxtFrm*)pFrm->GetPrev())->GetFollow() == pFrm, "IsNastyFollow: Was ist denn hier los?" ); return pFrm->IsFollow() && pFrm->GetPrev(); @@ -323,7 +323,7 @@ sal_Bool WidowsAndOrphans::FindBreak( SwTxtFrm *pFrame, SwTxtMargin &rLine, { // OD 2004-02-25 #i16128# - Why member <pFrm> _*and*_ parameter <pFrame>?? // Thus, assertion on situation, that these are different to figure out why. - ASSERT( pFrm == pFrame, "<WidowsAndOrphans::FindBreak> - pFrm != pFrame" ); + OSL_ENSURE( pFrm == pFrame, "<WidowsAndOrphans::FindBreak> - pFrm != pFrame" ); SWAP_IF_SWAPPED( pFrm ) @@ -378,8 +378,8 @@ sal_Bool WidowsAndOrphans::FindBreak( SwTxtFrm *pFrame, SwTxtMargin &rLine, sal_Bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrame, SwTxtMargin &rLine ) { - ASSERT( ! pFrame->IsVertical() || ! pFrame->IsSwapped(), - "WidowsAndOrphans::FindWidows with swapped frame" ) + OSL_ENSURE( ! pFrame->IsVertical() || ! pFrame->IsSwapped(), + "WidowsAndOrphans::FindWidows with swapped frame" ); if( !nWidLines || !pFrame->IsFollow() ) return sal_False; @@ -388,7 +388,7 @@ sal_Bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrame, SwTxtMargin &rLine ) // Wir koennen noch was abzwacken SwTxtFrm *pMaster = pFrame->FindMaster(); - ASSERT(pMaster, "+WidowsAndOrphans::FindWidows: Widows in a master?"); + OSL_ENSURE(pMaster, "+WidowsAndOrphans::FindWidows: Widows in a master?"); if( !pMaster ) return sal_False; @@ -512,7 +512,7 @@ sal_Bool WidowsAndOrphans::WouldFit( SwTxtMargin &rLine, SwTwips &rMaxHeight, sa // IsInside() takes care for itself // Wir erwarten, dass rLine auf der letzten Zeile steht!! - ASSERT( !rLine.GetNext(), "WouldFit: aLine::Bottom missed!" ); + OSL_ENSURE( !rLine.GetNext(), "WouldFit: aLine::Bottom missed!" ); MSHORT nLineCnt = rLine.GetLineNr(); // Erstmal die Orphansregel und den Initialenwunsch erfuellen ... diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx index 14322a2c95..f77d9635a7 100644 --- a/sw/source/core/text/wrong.cxx +++ b/sw/source/core/text/wrong.cxx @@ -561,7 +561,7 @@ void SwWrongList::Remove(USHORT nIdx, USHORT nLen ) maList.erase(i1, i2); #if OSL_DEBUG_LEVEL > 1 - ASSERT( Count() + nLen == nOldSize, "SwWrongList::Remove() trouble" ) + OSL_ENSURE( Count() + nLen == nOldSize, "SwWrongList::Remove() trouble" ); #endif } |