diff options
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r-- | sw/source/core/txtnode/atrfld.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrflyin.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrftn.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrref.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/fmtatr2.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 62 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcap.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndhints.cxx | 30 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 90 | ||||
-rw-r--r-- | sw/source/core/txtnode/swfont.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 98 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtatr2.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 20 |
13 files changed, 199 insertions, 197 deletions
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index bedc79b1db86..843705204a21 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -139,7 +139,7 @@ void SwFmtFld::SetFld(SwField * _pField) int SwFmtFld::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); // OD 2004-05-14 #i29146# - correction: check, if <pField> and // <((SwFmtFld&)rAttr).GetFld()> are set. // OD 2004-05-14 #i29146# - items are equal, if both fields aren't set. @@ -164,7 +164,7 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) return; SwTxtNode* pTxtNd = (SwTxtNode*)&pTxtAttr->GetTxtNode(); - ASSERT( pTxtNd, "wo ist denn mein Node?" ); + OSL_ENSURE( pTxtNd, "wo ist denn mein Node?" ); if( pNew ) { switch( pNew->Which() ) @@ -292,7 +292,7 @@ SwTxtFld::~SwTxtFld( ) void SwTxtFld::Expand() const { // Wenn das expandierte Feld sich nicht veraendert hat, wird returnt - ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtFld: where is my TxtNode?" ); const SwField* pFld = GetFld().GetFld(); XubString aNewExpand( @@ -334,8 +334,8 @@ void SwTxtFld::Expand() const void SwTxtFld::CopyFld( SwTxtFld *pDest ) const { - ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" ); - ASSERT( pDest->m_pTxtNode, "SwTxtFld: where is pDest's TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtFld: where is my TxtNode?" ); + OSL_ENSURE( pDest->m_pTxtNode, "SwTxtFld: where is pDest's TxtNode?" ); IDocumentFieldsAccess* pIDFA = m_pTxtNode->getIDocumentFieldsAccess(); IDocumentFieldsAccess* pDestIDFA = pDest->m_pTxtNode->getIDocumentFieldsAccess(); @@ -364,7 +364,7 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest ) const ((SwDDEFieldType*)pFldType)->IncRefCnt(); } - ASSERT( pFldType, "unbekannter FieldType" ); + OSL_ENSURE( pFldType, "unbekannter FieldType" ); pFldType->Add( &rFmtFld ); // ummelden rFmtFld.GetFld()->ChgTyp( pFldType ); } diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index fb997f83d066..bd765b43e937 100644 --- a/sw/source/core/txtnode/atrflyin.cxx +++ b/sw/source/core/txtnode/atrflyin.cxx @@ -57,7 +57,7 @@ SwFmtFlyCnt::SwFmtFlyCnt( SwFrmFmt *pFrmFmt ) int __EXPORT SwFmtFlyCnt::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return( pTxtAttr && ((SwFmtFlyCnt&)rAttr).pTxtAttr && *pTxtAttr->GetStart() == *((SwFmtFlyCnt&)rAttr).pTxtAttr->GetStart() && pFmt == ((SwFmtFlyCnt&)rAttr).GetFrmFmt() ); @@ -113,7 +113,7 @@ SwTxtFlyCnt::SwTxtFlyCnt( SwFmtFlyCnt& rAttr, xub_StrLen nStartPos ) void SwTxtFlyCnt::CopyFlyFmt( SwDoc* pDoc ) { SwFrmFmt* pFmt = GetFlyCnt().GetFrmFmt(); - ASSERT( pFmt, "von welchem Format soll ich eine Kopie erzeugen?" ) + OSL_ENSURE( pFmt, "von welchem Format soll ich eine Kopie erzeugen?" ); // Das FlyFrmFmt muss dupliziert werden. // In CopyLayoutFmt (siehe doclay.cxx) wird das FlyFrmFmt erzeugt // und der Inhalt dupliziert. @@ -142,7 +142,7 @@ void SwTxtFlyCnt::CopyFlyFmt( SwDoc* pDoc ) else { pPos->nContent.Assign( 0, 0 ); - ASSERT( !this, "CopyFlyFmt: Was fuer ein Anker?" ); + OSL_ENSURE( !this, "CopyFlyFmt: Was fuer ein Anker?" ); } } @@ -235,12 +235,12 @@ SwFlyInCntFrm *SwTxtFlyCnt::_GetFlyFrm( const SwFrm *pCurrFrm ) SwFrmFmt* pFrmFmt = GetFlyCnt().GetFrmFmt(); if( RES_DRAWFRMFMT == pFrmFmt->Which() ) { - ASSERT( !this, "SwTxtFlyCnt::_GetFlyFrm: DrawInCnt-Baustelle!" ); + OSL_ENSURE( !this, "SwTxtFlyCnt::_GetFlyFrm: DrawInCnt-Baustelle!" ); return NULL; } SwClientIter aIter( *GetFlyCnt().pFmt ); - ASSERT( pCurrFrm->IsTxtFrm(), "SwTxtFlyCnt::_GetFlyFrm for TxtFrms only." ); + OSL_ENSURE( pCurrFrm->IsTxtFrm(), "SwTxtFlyCnt::_GetFlyFrm for TxtFrms only." ); if( aIter.GoStart() ) { diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 56d866911d7a..d9be255d1d02 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -35,7 +35,7 @@ #define _SVSTDARR_USHORTSSORT #include <svl/svstdarr.hxx> #include <doc.hxx> -#include <cntfrm.hxx> // ASSERT in ~SwTxtFtn() +#include <cntfrm.hxx> // OSL_ENSURE(in ~SwTxtFtn() #include <pagefrm.hxx> // RemoveFtn() #include <fmtftn.hxx> #include <txtftn.hxx> @@ -71,7 +71,7 @@ SwFmtFtn::SwFmtFtn( bool bEndNote ) int SwFmtFtn::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return nNumber == ((SwFmtFtn&)rAttr).nNumber && aNumber == ((SwFmtFtn&)rAttr).aNumber && m_bEndNote == ((SwFmtFtn&)rAttr).m_bEndNote; @@ -271,7 +271,7 @@ void SwTxtFtn::SetNumber( const USHORT nNewNum, const XubString* pStr ) rFtn.aNumber = aEmptyStr; } - ASSERT( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" ); SwNodes &rNodes = m_pTxtNode->GetDoc()->GetNodes(); m_pTxtNode->Modify( 0, &rFtn ); if ( m_pStartNode ) @@ -366,7 +366,7 @@ void SwTxtFtn::MakeNewTextSection( SwNodes& rNodes ) void SwTxtFtn::DelFrms() { // delete the FtnFrames from the pages - ASSERT( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" ); if ( !m_pTxtNode ) return; @@ -405,7 +405,7 @@ void SwTxtFtn::DelFrms() SwFtnFrm *pFtn = (SwFtnFrm*)pFrm; while ( pFtn && pFtn->GetMaster() ) pFtn = pFtn->GetMaster(); - ASSERT( pFtn->GetAttr() == this, "Ftn mismatch error." ); + OSL_ENSURE( pFtn->GetAttr() == this, "Ftn mismatch error." ); while ( pFtn ) { diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx index 65cfac27bdb6..b9c66e4b782f 100644 --- a/sw/source/core/txtnode/atrref.cxx +++ b/sw/source/core/txtnode/atrref.cxx @@ -62,7 +62,7 @@ SwFmtRefMark::SwFmtRefMark( const SwFmtRefMark& rAttr ) int SwFmtRefMark::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return aRefName == ((SwFmtRefMark&)rAttr).aRefName; } diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index faa408065dcb..2d27ec119286 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -101,7 +101,7 @@ SwFmtCharFmt::~SwFmtCharFmt() {} int SwFmtCharFmt::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return GetCharFmt() == ((SwFmtCharFmt&)rAttr).GetCharFmt(); } @@ -167,7 +167,7 @@ SwFmtAutoFmt::~SwFmtAutoFmt() int SwFmtAutoFmt::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "different attributes" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "different attributes" ); return mpHandle == ((SwFmtAutoFmt&)rAttr).mpHandle; } @@ -242,7 +242,7 @@ SwFmtINetFmt::~SwFmtINetFmt() int SwFmtINetFmt::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); BOOL bRet = SfxPoolItem::operator==( (SfxPoolItem&) rAttr ) && aURL == ((SwFmtINetFmt&)rAttr).aURL && aName == ((SwFmtINetFmt&)rAttr).aName @@ -491,7 +491,7 @@ SwFmtRuby& SwFmtRuby::operator=( const SwFmtRuby& rAttr ) int SwFmtRuby::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return sRubyTxt == ((SwFmtRuby&)rAttr).sRubyTxt && sCharFmtName == ((SwFmtRuby&)rAttr).sCharFmtName && nCharFmtId == ((SwFmtRuby&)rAttr).nCharFmtId && @@ -594,7 +594,7 @@ SwFmtMeta::SwFmtMeta(const USHORT i_nWhich) , m_pMeta() , m_pTxtAttr( 0 ) { - ASSERT((RES_TXTATR_META == i_nWhich) || (RES_TXTATR_METAFIELD == i_nWhich), + OSL_ENSURE((RES_TXTATR_META == i_nWhich) || (RES_TXTATR_METAFIELD == i_nWhich), "ERROR: SwFmtMeta: invalid which id!"); } @@ -604,9 +604,9 @@ SwFmtMeta::SwFmtMeta( ::boost::shared_ptr< ::sw::Meta > const & i_pMeta, , m_pMeta( i_pMeta ) , m_pTxtAttr( 0 ) { - ASSERT((RES_TXTATR_META == i_nWhich) || (RES_TXTATR_METAFIELD == i_nWhich), + OSL_ENSURE((RES_TXTATR_META == i_nWhich) || (RES_TXTATR_METAFIELD == i_nWhich), "ERROR: SwFmtMeta: invalid which id!"); - ASSERT(m_pMeta, "SwFmtMeta: no Meta ?"); + OSL_ENSURE(m_pMeta, "SwFmtMeta: no Meta ?"); // DO NOT call m_pMeta->SetFmtMeta(this) here; only from SetTxtAttr! } @@ -620,7 +620,7 @@ SwFmtMeta::~SwFmtMeta() int SwFmtMeta::operator==( const SfxPoolItem & i_rOther ) const { - ASSERT( SfxPoolItem::operator==( i_rOther ), "i just copied this assert" ); + OSL_ENSURE( SfxPoolItem::operator==( i_rOther ), "i just copied this assert" ); return SfxPoolItem::operator==( i_rOther ) && (m_pMeta == static_cast<SwFmtMeta const &>( i_rOther ).m_pMeta); } @@ -634,12 +634,12 @@ SfxPoolItem * SwFmtMeta::Clone( SfxItemPool * /*pPool*/ ) const void SwFmtMeta::SetTxtAttr(SwTxtMeta * const i_pTxtAttr) { - ASSERT(!(m_pTxtAttr && i_pTxtAttr), + OSL_ENSURE(!(m_pTxtAttr && i_pTxtAttr), "SwFmtMeta::SetTxtAttr: already has text attribute?"); - ASSERT( m_pTxtAttr || i_pTxtAttr , + OSL_ENSURE( m_pTxtAttr || i_pTxtAttr , "SwFmtMeta::SetTxtAttr: no attribute to remove?"); m_pTxtAttr = i_pTxtAttr; - ASSERT(m_pMeta, "inserted SwFmtMeta has no sw::Meta?"); + OSL_ENSURE(m_pMeta, "inserted SwFmtMeta has no sw::Meta?"); // the sw::Meta must be able to find the current text attribute! if (i_pTxtAttr && m_pMeta) { @@ -651,7 +651,7 @@ void SwFmtMeta::NotifyChangeTxtNode(SwTxtNode *const pTxtNode) { // N.B.: do not reset m_pTxtAttr here: see call in nodes.cxx, // where the hint is not deleted! - ASSERT(m_pMeta, "NotifyRemoval: no meta ?"); + OSL_ENSURE(m_pMeta, "NotifyRemoval: no meta ?"); if (m_pMeta) { if (!pTxtNode) @@ -671,7 +671,7 @@ void SwFmtMeta::NotifyChangeTxtNode(SwTxtNode *const pTxtNode) // and if it is not called when copying, total chaos will undoubtedly ensue void SwFmtMeta::DoCopy(SwFmtMeta & rOriginalMeta) { - ASSERT(m_pMeta, "DoCopy called for SwFmtMeta with no sw::Meta?"); + OSL_ENSURE(m_pMeta, "DoCopy called for SwFmtMeta with no sw::Meta?"); if (m_pMeta) { const ::boost::shared_ptr< ::sw::Meta> pOriginal( m_pMeta ); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 78713022f247..8296d7c7822d 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -308,7 +308,7 @@ USHORT SwFntObj::GetFontAscent( const ViewShell *pSh, const OutputDevice& rOut ) if ( pSh && lcl_IsFontAdjustNecessary( rOut, rRefDev ) ) { CreateScrFont( *pSh, rOut ); - ASSERT( USHRT_MAX != nScrAscent, "nScrAscent is going berzerk" ) + OSL_ENSURE( USHRT_MAX != nScrAscent, "nScrAscent is going berzerk" ); nRet = nScrAscent; } else @@ -331,7 +331,7 @@ USHORT SwFntObj::GetFontAscent( const ViewShell *pSh, const OutputDevice& rOut ) nRet += GetFontLeading( pSh, rRefDev ); #endif - ASSERT( USHRT_MAX != nRet, "GetFontAscent returned USHRT_MAX" ) + OSL_ENSURE( USHRT_MAX != nRet, "GetFontAscent returned USHRT_MAX" ); return nRet; } @@ -355,7 +355,7 @@ USHORT SwFntObj::GetFontHeight( const ViewShell* pSh, const OutputDevice& rOut ) if ( pSh && lcl_IsFontAdjustNecessary( rOut, rRefDev ) ) { CreateScrFont( *pSh, rOut ); - ASSERT( USHRT_MAX != nScrHeight, "nScrHeight is going berzerk" ) + OSL_ENSURE( USHRT_MAX != nScrHeight, "nScrHeight is going berzerk" ); nRet = nScrHeight + GetFontLeading( pSh, rRefDev ); } else @@ -373,7 +373,7 @@ USHORT SwFntObj::GetFontHeight( const ViewShell* pSh, const OutputDevice& rOut ) long nTmpPrtHeight = (USHORT)aOutMet.GetAscent() + aOutMet.GetDescent(); (void) nTmpPrtHeight; // #i106098#: do not compare with == here due to rounding error - ASSERT( abs(nTmpPrtHeight - nPrtHeight) < 3, + OSL_ENSURE( abs(nTmpPrtHeight - nPrtHeight) < 3, "GetTextHeight != Ascent + Descent" ); #endif @@ -383,7 +383,7 @@ USHORT SwFntObj::GetFontHeight( const ViewShell* pSh, const OutputDevice& rOut ) nRet = nPrtHeight + GetFontLeading( pSh, rRefDev ); } - ASSERT( USHRT_MAX != nRet, "GetFontHeight returned USHRT_MAX" ) + OSL_ENSURE( USHRT_MAX != nRet, "GetFontHeight returned USHRT_MAX" ); return nRet; } @@ -415,7 +415,7 @@ USHORT SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& rOut nRet = nGuessedLeading; } - ASSERT( USHRT_MAX != nRet, "GetFontLeading returned USHRT_MAX" ) + OSL_ENSURE( USHRT_MAX != nRet, "GetFontLeading returned USHRT_MAX" ); return nRet; } @@ -579,7 +579,7 @@ void SwFntObj::GuessLeading( const ViewShell& aWinMet.GetAscent() - rMet.GetAscent() - nTmpLeading ); if( nDiff > 0 ) { - ASSERT( nPrtAscent < USHRT_MAX, "GuessLeading: PrtAscent-Fault" ); + OSL_ENSURE( nPrtAscent < USHRT_MAX, "GuessLeading: PrtAscent-Fault" ); if ( nPrtAscent < USHRT_MAX ) nPrtAscent = nPrtAscent + (USHORT)(( 2 * nDiff ) / 5); } @@ -817,7 +817,7 @@ static void lcl_DrawLineForWrongListData( void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { - ASSERT( rInf.GetShell(), "SwFntObj::DrawText without shell" ) + OSL_ENSURE( rInf.GetShell(), "SwFntObj::DrawText without shell" ); OutputDevice& rRefDev = rInf.GetShell()->GetRefDev(); OutputDevice* pWin = rInf.GetShell()->GetWin(); @@ -861,7 +861,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // a window. Therefore bUseSrcFont is always 0 in this case. // -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const BOOL bNoAdjust = bPrt || ( pWin && @@ -873,15 +873,15 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Printer output if ( OUTDEV_PRINTER == rRefDev.GetOutDevType() ) { - ASSERT( bNoAdjust == 1 && bUseScrFont == 0, "Outdev Check failed" ) + OSL_ENSURE( bNoAdjust == 1 && bUseScrFont == 0, "Outdev Check failed" ); } else if ( OUTDEV_VIRDEV == rRefDev.GetOutDevType() ) { - ASSERT( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ) + OSL_ENSURE( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ); } else { - ASSERT( sal_False, "Outdev Check failed" ) + OSL_ENSURE( sal_False, "Outdev Check failed" ); } } else if ( OUTDEV_VIRDEV == rInf.GetOut().GetOutDevType() && ! pWin ) @@ -889,15 +889,15 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // PDF export if ( OUTDEV_PRINTER == rRefDev.GetOutDevType() ) { - ASSERT( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ) + OSL_ENSURE( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ); } else if ( OUTDEV_VIRDEV == rRefDev.GetOutDevType() ) { - ASSERT( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ) + OSL_ENSURE( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ); } else { - ASSERT( sal_False, "Outdev Check failed" ) + OSL_ENSURE( sal_False, "Outdev Check failed" ); } } else if ( OUTDEV_WINDOW == rInf.GetOut().GetOutDevType() || @@ -906,30 +906,30 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Window or virtual window if ( OUTDEV_PRINTER == rRefDev.GetOutDevType() ) { - ASSERT( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ) + OSL_ENSURE( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ); } else if ( OUTDEV_VIRDEV == rRefDev.GetOutDevType() ) { - ASSERT( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ) + OSL_ENSURE( bNoAdjust == 0 && bUseScrFont == 1, "Outdev Check failed" ); } else if ( OUTDEV_WINDOW == rRefDev.GetOutDevType() ) { - ASSERT( bNoAdjust == 1 && bUseScrFont == 0, "Outdev Check failed" ) + OSL_ENSURE( bNoAdjust == 1 && bUseScrFont == 0, "Outdev Check failed" ); } else { - ASSERT( sal_False, "Outdev Check failed" ) + OSL_ENSURE( sal_False, "Outdev Check failed" ); } } else { - ASSERT( sal_False, "Outdev Check failed" ) + OSL_ENSURE( sal_False, "Outdev Check failed" ); } #endif // robust: better use the printer font instead of using no font at all - ASSERT( pTmpFont, "No screen or printer font?" ); + OSL_ENSURE( pTmpFont, "No screen or printer font?" ); if ( ! pTmpFont ) pTmpFont = pPrtFont; @@ -1457,7 +1457,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) rInf.GetIdx(), rInf.GetLen() ); // OLE: no printer available - // ASSERT( pPrinter, "DrawText needs pPrinter" ) + // OSL_ENSURE( pPrinter, "DrawText needs pPrinter" ) if ( pPrinter ) { // pTmpFont has already been set as current font for rInf.GetOut() @@ -1648,7 +1648,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { nCh = rInf.GetText().GetChar( rInf.GetIdx() + i ); - ASSERT( pScrArray, "Where is the screen array?" ) + OSL_ENSURE( pScrArray, "Where is the screen array?" ); long nScr; nScr = pScrArray[ i ] - pScrArray[ i - 1 ]; @@ -1912,9 +1912,9 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) aTxtSize.Width() = pOutDev->GetTextWidth( rInf.GetText(), rInf.GetIdx(), nLn ); - ASSERT( !rInf.GetShell() || + OSL_ENSURE( !rInf.GetShell() || ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExtLeading() ), - "Leading values should be already calculated" ) + "Leading values should be already calculated" ); aTxtSize.Height() = pOutDev->GetTextHeight() + GetFontLeading( rInf.GetShell(), rInf.GetOut() ); @@ -1973,7 +1973,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) rInf.GetScriptInfo()->CountCompChg() && lcl_IsMonoSpaceFont( rInf.GetOut() ); - ASSERT( !bCompress || ( rInf.GetScriptInfo() && rInf.GetScriptInfo()-> + OSL_ENSURE( !bCompress || ( rInf.GetScriptInfo() && rInf.GetScriptInfo()-> CountCompChg()), "Compression without info" ); // This is the part used e.g., for cursor travelling @@ -2076,9 +2076,9 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) if ( rInf.GetKern() && nLn ) aTxtSize.Width() += ( nLn - 1 ) * long( rInf.GetKern() ); - ASSERT( !rInf.GetShell() || + OSL_ENSURE( !rInf.GetShell() || ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != GetExtLeading() ), - "Leading values should be already calculated" ) + "Leading values should be already calculated" ); aTxtSize.Height() += GetFontLeading( rInf.GetShell(), rInf.GetOut() ); return aTxtSize; } @@ -2378,14 +2378,14 @@ SwFntAccess::SwFntAccess( const void* &rMagic, // SwFont sein, spaeter wird als Owner die "MagicNumber" gehalten. SwCacheAccess::pOwner = pOwn; pFntObj = Get(); // hier wird via NewObj() angelegt und gelockt. - ASSERT(pFntObj, "No Font, no Fun."); + OSL_ENSURE(pFntObj, "No Font, no Fun."); } else // Font has been found, so we lock it. { pFntObj->Lock(); if( pFntObj->pPrinter != pOut ) // Falls bis dato kein Drucker bekannt { - ASSERT( !pFntObj->pPrinter, "SwFntAccess: Printer Changed" ); + OSL_ENSURE( !pFntObj->pPrinter, "SwFntAccess: Printer Changed" ); pFntObj->CreatePrtFont( *pOut ); pFntObj->pPrinter = pOut; pFntObj->pScrFont = NULL; @@ -2428,7 +2428,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth ) rInf.GetScriptInfo()->CountCompChg() && lcl_IsMonoSpaceFont( rInf.GetOut() ); - ASSERT( !bCompress || ( rInf.GetScriptInfo() && rInf.GetScriptInfo()-> + OSL_ENSURE( !bCompress || ( rInf.GetScriptInfo() && rInf.GetScriptInfo()-> CountCompChg()), "Compression without info" ); USHORT nTxtBreak = 0; diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index f8efc733165a..38d69deb2c63 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -88,7 +88,7 @@ xub_StrLen lcl_CalcCaseMap( const SwFont& rFnt, { int j = 0; const xub_StrLen nEnd = nOfst + nLen; - ASSERT( nEnd <= rOrigString.Len(), "lcl_CalcCaseMap: Wrong parameters" ) + OSL_ENSURE( nEnd <= rOrigString.Len(), "lcl_CalcCaseMap: Wrong parameters" ); // special case for title case: const bool bTitle = SVX_CASEMAP_TITEL == rFnt.GetCaseMap() && @@ -319,7 +319,7 @@ void SwDoDrawCapital::Do() rInf.SetBullet( bOldBullet ); } - ASSERT( pUpperFnt, "No upper font, dying soon!"); + OSL_ENSURE( pUpperFnt, "No upper font, dying soon!"); rInf.Shift( pUpperFnt->GetFont()->GetOrientation() ); rInf.SetWidth( nOrgWidth ); } @@ -557,7 +557,7 @@ void SwSubFont::DrawStretchCapital( SwDrawTextInfo &rInf ) void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) { - ASSERT( pLastFont, "SwFont::DoOnCapitals: No LastFont?!" ); + OSL_ENSURE( pLastFont, "SwFont::DoOnCapitals: No LastFont?!" ); Size aPartSize; long nKana = 0; @@ -696,8 +696,8 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER); if( nPos == STRING_LEN || nPos > nMaxPos ) nPos = nMaxPos; - ASSERT( nPos, "nextCharBlock not implemented?" ); -#ifdef DBG_UTIL + OSL_ENSURE( nPos, "nextCharBlock not implemented?" ); +#if OSL_DEBUG_LEVEL > 1 if( !nPos ) nPos = nMaxPos; #endif @@ -810,8 +810,8 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER); if( nPos == STRING_LEN || nPos > nMaxPos ) nPos = nMaxPos; - ASSERT( nPos, "endOfCharBlock not implemented?" ); -#ifdef DBG_UTIL + OSL_ENSURE( nPos, "endOfCharBlock not implemented?" ); +#if OSL_DEBUG_LEVEL > 1 if( !nPos ) nPos = nMaxPos; #endif diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index b6806be5917b..48293a96584f 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -35,7 +35,7 @@ #include "ndhints.hxx" #include <txtatr.hxx> -#ifndef PRODUCT +#if OSL_DEBUG_LEVEL > 1 #include <pam.hxx> #endif @@ -48,7 +48,7 @@ _SV_IMPL_SORTAR_ALG( SwpHtEnd, SwTxtAttr* ) void DumpHints( const SwpHtStart &rHtStart, const SwpHtEnd &rHtEnd ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aDbstream << "DumpHints:" << endl; (aDbstream << "\tStarts:" ).WriteNumber(rHtStart.Count()) << endl; for( USHORT i = 0; i < rHtStart.Count(); ++i ) @@ -114,7 +114,7 @@ static BOOL lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 ) { const USHORT nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber(); const USHORT nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber(); - ASSERT( nS1 != nS2, "AUTOSTYLES: lcl_IsLessStart trouble" ) + OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessStart trouble" ); if ( nS1 != nS2 ) // robust return nS1 < nS2; } @@ -150,7 +150,7 @@ static BOOL lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 ) { const USHORT nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber(); const USHORT nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber(); - ASSERT( nS1 != nS2, "AUTOSTYLES: lcl_IsLessEnd trouble" ) + OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessEnd trouble" ); if ( nS1 != nS2 ) // robust return nS1 > nS2; } @@ -245,16 +245,16 @@ BOOL SwpHtEnd::Seek_Entry( const SwTxtAttr *pElement, USHORT *pPos ) const void SwpHintsArray::Insert( const SwTxtAttr *pHt ) { Resort(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT nPos; - ASSERT(!m_HintStarts.Seek_Entry( pHt, &nPos ), + OSL_ENSURE(!m_HintStarts.Seek_Entry( pHt, &nPos ), "Insert: hint already in HtStart"); - ASSERT(!m_HintEnds.Seek_Entry( pHt, &nPos ), + OSL_ENSURE(!m_HintEnds.Seek_Entry( pHt, &nPos ), "Insert: hint already in HtEnd"); #endif m_HintStarts.Insert( pHt ); m_HintEnds.Insert( pHt ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #ifdef NIE (aDbstream << "Insert: " ).WriteNumber( long( pHt ) ) << endl; DumpHints( m_HintStarts, m_HintEnds ); @@ -273,7 +273,7 @@ void SwpHintsArray::DeleteAtPos( const USHORT nPos ) USHORT nEndPos; m_HintEnds.Seek_Entry( pHt, &nEndPos ); m_HintEnds.Remove( nEndPos ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #ifdef NIE (aDbstream << "DeleteAtPos: " ).WriteNumber( long( pHt ) ) << endl; DumpHints( m_HintStarts, m_HintEnds ); @@ -281,7 +281,7 @@ void SwpHintsArray::DeleteAtPos( const USHORT nPos ) #endif } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 /************************************************************************* * SwpHintsArray::Check() @@ -291,7 +291,7 @@ void SwpHintsArray::DeleteAtPos( const USHORT nPos ) #define CHECK_ERR(cond, text) \ if(!(cond)) \ { \ - ASSERT(!this, text); \ + OSL_ENSURE(!this, text); \ DumpHints(m_HintStarts, m_HintEnds); \ return !(const_cast<SwpHintsArray*>(this))->Resort(); \ } @@ -447,8 +447,8 @@ bool SwpHintsArray::Resort() if( pLast && !lcl_IsLessStart( *pLast, *pHt ) ) { #ifdef NIE -#ifdef DBG_UTIL -// ASSERT( bResort, "!Resort/Start: correcting hints-array" ); +#if OSL_DEBUG_LEVEL > 1 +// OSL_ENSURE( bResort, "!Resort/Start: correcting hints-array" ); aDbstream << "Resort: Starts" << endl; DumpHints( m_HintStarts, m_HintEnds ); #endif @@ -470,7 +470,7 @@ bool SwpHintsArray::Resort() if( pLast && !lcl_IsLessEnd( *pLast, *pHt ) ) { #ifdef NIE -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aDbstream << "Resort: Ends" << endl; DumpHints( m_HintStarts, m_HintEnds ); #endif @@ -486,7 +486,7 @@ bool SwpHintsArray::Resort() } pLast = pHt; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #ifdef NIE aDbstream << "Resorted:" << endl; DumpHints( m_HintStarts, m_HintEnds ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 61faf03c4cf4..a242e6cd8633 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -103,7 +103,7 @@ SV_DECL_PTRARR(SwpHts,SwTxtAttr*,1,1) // Leider ist das SwpHints nicht ganz wasserdicht: // Jeder darf an den Hints rumfummeln, ohne die Sortierreihenfolge // und Verkettung sicherstellen zu muessen. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #define CHECK_SWPHINTS(pNd) { if( pNd->GetpSwpHints() && \ !pNd->GetDoc()->IsInReading() ) \ pNd->GetpSwpHints()->Check(); } @@ -115,7 +115,7 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, SwTxtFmtColl *pColl, SwAttrSet* pAutoAttr ) { - ASSERT( pColl, "Collectionpointer ist 0." ); + OSL_ENSURE( pColl, "Collectionpointer ist 0." ); SwTxtNode *pNode = new SwTxtNode( rWhere, pColl, pAutoAttr ); @@ -312,7 +312,7 @@ void lcl_ChangeFtnRef( SwTxtNode &rNode ) return; } SwTxtFtn *pAttr = (SwTxtFtn*)pHt; - ASSERT( pAttr->GetStartNode(), "FtnAtr ohne StartNode." ); + OSL_ENSURE( pAttr->GetStartNode(), "FtnAtr ohne StartNode." ); SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 ); SwCntntNode *pNd = aIdx.GetNode().GetCntntNode(); if ( !pNd ) @@ -324,7 +324,7 @@ void lcl_ChangeFtnRef( SwTxtNode &rNode ) SwCntntFrm* pCntnt = (SwCntntFrm*)aIter.First(TYPE(SwCntntFrm)); if( pCntnt ) { - ASSERT( pCntnt->FindRootFrm() == pFrm->FindRootFrm(), + OSL_ENSURE( pCntnt->FindRootFrm() == pFrm->FindRootFrm(), "lcl_ChangeFtnRef: Layout double?" ); SwFtnFrm *pFtn = pCntnt->FindFtnFrm(); if( pFtn && pFtn->GetAttr() == pAttr ) @@ -340,11 +340,11 @@ void lcl_ChangeFtnRef( SwTxtNode &rNode ) ((SwTxtFrm*)pFrm)->SetFtn( TRUE ); } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 while( 0 != (pCntnt = (SwCntntFrm*)aIter.Next()) ) { SwFtnFrm *pDbgFtn = pCntnt->FindFtnFrm(); - ASSERT( !pDbgFtn || pDbgFtn->GetRef() == pFrm, + OSL_ENSURE( !pDbgFtn || pDbgFtn->GetRef() == pFrm, "lcl_ChangeFtnRef: Who's that guy?" ); } #endif @@ -607,7 +607,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) void SwTxtNode::MoveTxtAttr_To_AttrSet() { - ASSERT( m_pSwpHints, "MoveTxtAttr_To_AttrSet without SwpHints?" ); + OSL_ENSURE( m_pSwpHints, "MoveTxtAttr_To_AttrSet without SwpHints?" ); for ( USHORT i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i ) { SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i); @@ -723,7 +723,7 @@ SwCntntNode *SwTxtNode::JoinNext() InvalidateNumRule(); } else { - ASSERT( FALSE, "kein TxtNode." ); + OSL_ENSURE( FALSE, "kein TxtNode." ); } return this; @@ -818,7 +818,7 @@ SwCntntNode *SwTxtNode::JoinPrev() InvalidateNumRule(); } else { - ASSERT( FALSE, "kein TxtNode." ); + OSL_ENSURE( FALSE, "kein TxtNode." ); } return this; @@ -827,7 +827,7 @@ SwCntntNode *SwTxtNode::JoinPrev() // erzeugt einen AttrSet mit Bereichen fuer Frame-/Para/Char-Attributen void SwTxtNode::NewAttrSet( SwAttrPool& rPool ) { - ASSERT( !mpAttrSet.get(), "AttrSet ist doch gesetzt" ); + OSL_ENSURE( !mpAttrSet.get(), "AttrSet ist doch gesetzt" ); SwAttrSet aNewAttrSet( rPool, aTxtNodeSetRange ); // put names of parent style and conditional style: @@ -930,7 +930,7 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen, USHORT nWhPos; const USHORT nWhich = pHint->Which(); - ASSERT(!isCHRATR(nWhich), "Update: char attr hint?"); + OSL_ENSURE(!isCHRATR(nWhich), "Update: char attr hint?"); if (isCHRATR(nWhich) || isTXTATR_WITHEND(nWhich)) { nWhPos = static_cast<USHORT>(nWhich - @@ -1077,7 +1077,7 @@ void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl, const SwTxtFmtColl *pNewColl) { SwDoc* pDoc = GetDoc(); - ASSERT( pDoc, "Kein Doc?" ); + OSL_ENSURE( pDoc, "Kein Doc?" ); // erfrage die OutlineLevel und update gegebenenfalls das Nodes-Array, // falls sich die Level geaendert haben ! const int nOldLevel = pOldColl && pOldColl->IsAssignedToListLevelOfOutlineStyle() ? @@ -1200,7 +1200,7 @@ lcl_GetTxtAttrs( } xub_StrLen const*const pEndIdx = pHint->GetEnd(); - ASSERT(pEndIdx || pHint->HasDummyChar(), + OSL_ENSURE(pEndIdx || pHint->HasDummyChar(), "hint with no end and no dummy char?"); // Wenn bExpand gesetzt ist, wird das Verhalten bei Eingabe // simuliert, d.h. der Start wuede verschoben, das Ende expandiert, @@ -1243,7 +1243,7 @@ SwTxtAttr * SwTxtNode::GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich, enum GetTxtAttrMode const eMode) const { - ASSERT( (nWhich == RES_TXTATR_META) + OSL_ENSURE( (nWhich == RES_TXTATR_META) || (nWhich == RES_TXTATR_METAFIELD) || (nWhich == RES_TXTATR_AUTOFMT) || (nWhich == RES_TXTATR_INETFMT) @@ -1279,12 +1279,12 @@ SwCharFmt* lcl_FindCharFmt( const SwCharFmts* pCharFmts, const XubString& rName void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr * const pHt, SwTxtAttr *const pNewHt, SwDoc *const pOtherDoc, SwTxtNode *const pDest ) { - ASSERT( nWhich == pHt->Which(), "Falsche Hint-Id" ); + OSL_ENSURE( nWhich == pHt->Which(), "Falsche Hint-Id" ); switch( nWhich ) { // copy nodesarray section with footnote content case RES_TXTATR_FTN : - ASSERT(pDest, "lcl_CopyHint: no destination text node?"); + OSL_ENSURE(pDest, "lcl_CopyHint: no destination text node?"); static_cast<const SwTxtFtn*>(pHt)->CopyFtn( *static_cast<SwTxtFtn*>(pNewHt), *pDest); break; @@ -1385,8 +1385,8 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr * const pHt, } case RES_TXTATR_META: case RES_TXTATR_METAFIELD: - ASSERT(pNewHt, "copying META should not fail! cannot call DoCopy"); - ASSERT(pDest && (CH_TXTATR_INWORD == + OSL_ENSURE(pNewHt, "copying META should not fail! cannot call DoCopy"); + OSL_ENSURE(pDest && (CH_TXTATR_INWORD == pDest->GetTxt().GetChar(*pNewHt->GetStart())), "missing CH_TXTATR?"); if (pNewHt) @@ -1727,8 +1727,8 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, void SwTxtNode::InsertText( const XubString & rStr, const SwIndex & rIdx, const IDocumentContentOperations::InsertFlags nMode ) { - ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::InsertText: invalid index." ); - ASSERT( (ULONG)m_Text.Len() + (ULONG)rStr.Len() <= STRING_LEN, + OSL_ENSURE( rIdx <= m_Text.Len(), "SwTxtNode::InsertText: invalid index." ); + OSL_ENSURE( (ULONG)m_Text.Len() + (ULONG)rStr.Len() <= STRING_LEN, "SwTxtNode::InsertText: node text with insertion > STRING_LEN." ); xub_StrLen aPos = rIdx.GetIndex(); @@ -1843,7 +1843,7 @@ void SwTxtNode::CutText( SwTxtNode * const pDest, } else { - ASSERT(false, + OSL_ENSURE(false, "mst: entering dead and bitrotted code; fasten your seatbelts!"); EraseText( rStart, nLen ); } @@ -1855,7 +1855,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, { if(!pDest) { - ASSERT(false, + OSL_ENSURE(false, "mst: entering dead and bitrotted code; fasten your seatbelts!"); EraseText( rStart, nLen ); return; @@ -1864,7 +1864,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, // nicht im Dokument verschieben ? if( GetDoc() != pDest->GetDoc() ) { - ASSERT(false, + OSL_ENSURE(false, "mst: entering dead and bitrotted code; fasten your seatbelts!"); CopyText( pDest, rDestStart, rStart, nLen); EraseText(rStart, nLen); @@ -1886,7 +1886,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, // wird in sich selbst verschoben, muss es gesondert behandelt werden !! if( pDest == this ) { - ASSERT(false, + OSL_ENSURE(false, "mst: entering dead and bitrotted code; fasten your seatbelts!"); m_Text.Insert( m_Text, nTxtStartIdx, nLen, nDestStart ); m_Text.Erase( nTxtStartIdx + (nDestStart<nTxtStartIdx ? nLen : 0), nLen ); @@ -2050,7 +2050,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, const bool bUndoNodes = !pOtherDoc && GetDoc()->GetUndoNds() == &GetNodes(); - ASSERT(!pOtherDoc, + OSL_ENSURE(!pOtherDoc, "mst: entering dead and bitrotted code; fasten your seatbelts!"); // harte Absatz umspannende Attribute kopieren @@ -2216,7 +2216,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount, const IDocumentContentOperations::InsertFlags nMode ) { - ASSERT( rIdx <= m_Text.Len(), "SwTxtNode::EraseText: invalid index." ); + OSL_ENSURE( rIdx <= m_Text.Len(), "SwTxtNode::EraseText: invalid index." ); const xub_StrLen nStartIdx = rIdx.GetIndex(); const xub_StrLen nCnt = (STRING_LEN == nCount) @@ -2246,7 +2246,7 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount, if( !pHtEndIdx ) { - ASSERT(pHt->HasDummyChar(), + OSL_ENSURE(pHt->HasDummyChar(), "attribute with neither end nor CH_TXTATR?"); if (isTXTATR(nWhich) && (nHintStart >= nStartIdx) && (nHintStart < nEndIdx)) @@ -2258,7 +2258,7 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount, continue; } - ASSERT (!( (nHintStart < nEndIdx) && (*pHtEndIdx > nEndIdx) + OSL_ENSURE(!( (nHintStart < nEndIdx) && (*pHtEndIdx > nEndIdx) && pHt->HasDummyChar() ) // next line: deleting exactly dummy char: DeleteAttributes || ((nHintStart == nStartIdx) && (nHintStart + 1 == nEndIdx)), @@ -2290,7 +2290,7 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount, } } - ASSERT(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?"); + OSL_ENSURE(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?"); TryDeleteSwpHints(); @@ -2307,7 +2307,7 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount, SwModify::Modify( 0, &aHint ); } - ASSERT(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?"); + OSL_ENSURE(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?"); // By deleting a character, the hidden flags // at the TxtNode can become invalid: @@ -3263,7 +3263,7 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen, void SwTxtNode::ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen, const XubString& rText ) { - ASSERT( rStart.GetIndex() < m_Text.Len() && + OSL_ENSURE( rStart.GetIndex() < m_Text.Len() && rStart.GetIndex() + nDelLen <= m_Text.Len(), "SwTxtNode::ReplaceText: index out of bounds" ); const xub_StrLen nStartPos = rStart.GetIndex(); @@ -3277,7 +3277,7 @@ void SwTxtNode::ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen, SwTxtAttr *const pHint = GetTxtAttrForCharAt( nPos ); if (pHint) { - ASSERT (!( pHint->GetEnd() && pHint->HasDummyChar() + OSL_ENSURE(!( pHint->GetEnd() && pHint->HasDummyChar() && (*pHint->GetStart() < nEndPos) && (*pHint->GetEnd() > nEndPos) ), "ReplaceText: ERROR: " @@ -3464,7 +3464,7 @@ namespace { String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ) ) { // --> OD 2008-09-10 #i70748# - ASSERT( rTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle(), + OSL_ENSURE( rTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle(), "<HandleModifyAtTxtNode()> - text node with outline style, but its paragraph style is not assigned to outline style." ); int nNewListLevel = rTxtNode.GetTxtColl()->GetAssignedOutlineStyleLevel(); @@ -3558,8 +3558,8 @@ void SwTxtNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl ) { - ASSERT( pNewColl,"ChgFmtColl: Collectionpointer ist 0." ); - ASSERT( HAS_BASE( SwTxtFmtColl, pNewColl ), + OSL_ENSURE( pNewColl,"ChgFmtColl: Collectionpointer ist 0." ); + OSL_ENSURE( HAS_BASE( SwTxtFmtColl, pNewColl ), "ChgFmtColl: ist kein Text-Collectionpointer." ); SwTxtFmtColl *pOldColl = GetTxtColl(); @@ -3570,8 +3570,8 @@ SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl ) // --> OD 2008-03-27 #refactorlists# // NumRuleChgd(); #if OSL_DEBUG_LEVEL > 1 - ASSERT( !mbInSetOrResetAttr, - "DEBUG ASSERTION - <SwTxtNode::ChgFmtColl(..)> called during <Set/ResetAttr(..)>" ) + OSL_ENSURE( !mbInSetOrResetAttr, + "DEBUG OSL_ENSURE(ON - <SwTxtNode::ChgFmtColl(..)> called during <Set/ResetAttr(..)>" ); #endif if ( !mbInSetOrResetAttr ) { @@ -3654,7 +3654,7 @@ int SwTxtNode::GetAttrOutlineLevel() const } void SwTxtNode::SetAttrOutlineLevel(int nLevel) { - ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtNode: Level Out Of Range" );//#outline level,zhaojianwei + OSL_ENSURE( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtNode: Level Out Of Range" );//#outline level,zhaojianwei if ( 0 <= nLevel && nLevel <= MAXLEVEL ) { SetAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, @@ -3694,7 +3694,7 @@ void SwTxtNode::SetAttrListLevel( int nLevel ) { if ( nLevel < 0 || nLevel >= MAXLEVEL ) { - ASSERT( false, + OSL_ENSURE( false, "<SwTxtNode::SetAttrListLevel()> - value of parameter <nLevel> is out of valid range" ); return; } @@ -3818,7 +3818,7 @@ bool SwTxtNode::HasAttrListRestartValue() const // <-- SwNumberTree::tSwNumTreeNumber SwTxtNode::GetAttrListRestartValue() const { - ASSERT( HasAttrListRestartValue(), + OSL_ENSURE( HasAttrListRestartValue(), "<SwTxtNode::GetAttrListRestartValue()> - only ask for list restart value, if attribute is set at text node." ); const SfxInt16Item& aListRestartValueItem = @@ -3900,7 +3900,7 @@ void SwTxtNode::AddToList() { if ( IsInList() ) { - ASSERT( false, + OSL_ENSURE( false, "<SwTxtNode::AddToList()> - the text node is already added to a list. Serious defect -> please inform OD" ); return; } @@ -3918,7 +3918,7 @@ void SwTxtNode::AddToList() pList = GetDoc()->createList( sListId, GetNumRule()->GetName() ); } } - ASSERT( pList != 0, + OSL_ENSURE( pList != 0, "<SwTxtNode::AddToList()> - no list for given list id. Serious defect -> please inform OD" ); if ( pList ) { @@ -4061,7 +4061,7 @@ bool SwTxtNode::AreListLevelIndentsApplicable() const } pColl = dynamic_cast<const SwTxtFmtColl*>(pColl->DerivedFrom()); - ASSERT( pColl, + OSL_ENSURE( pColl, "<SwTxtNode::AreListLevelIndentsApplicable()> - something wrong in paragraph's style hierarchy. The applied list style is not found." ); } } @@ -4155,7 +4155,7 @@ XubString SwTxtNode::GetLabelFollowedBy() const break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwTxtNode::GetLabelFollowedBy()> - unknown SvxNumberFormat::GetLabelFollowedBy() return value" ); } } @@ -4272,7 +4272,7 @@ namespace { { const SfxStringItem& pListIdItem = dynamic_cast<const SfxStringItem&>(pItem); - ASSERT( pListIdItem.GetValue().Len() > 0, + OSL_ENSURE( pListIdItem.GetValue().Len() > 0, "<HandleSetAttrAtTxtNode(..)> - empty list id attribute not excepted. Serious defect -> please inform OD." ); const String sListIdOfTxtNode = rTxtNode.GetListId(); if ( pListIdItem.GetValue() != sListIdOfTxtNode ) diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 1c56676eadb7..28f483a3f6ae 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -78,7 +78,7 @@ #define FNT_ATM_HACK #endif -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // globale Variable SvStatistics aSvStat; #endif @@ -115,7 +115,7 @@ USHORT MapDirection( USHORT nDir, const BOOL bVertFormat ) break; #if OSL_DEBUG_LEVEL > 1 default : - ASSERT( sal_False, "Unsupported direction" ); + OSL_ENSURE( sal_False, "Unsupported direction" ); break; #endif } @@ -142,7 +142,7 @@ USHORT UnMapDirection( USHORT nDir, const BOOL bVertFormat ) break; #if OSL_DEBUG_LEVEL > 1 default : - ASSERT( sal_False, "Unsupported direction" ); + OSL_ENSURE( sal_False, "Unsupported direction" ); break; #endif } @@ -419,7 +419,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, } bPaintBlank = FALSE; bPaintWrong = FALSE; - ASSERT( aSub[SW_LATIN].IsTransparent(), "SwFont: Transparent revolution" ); + OSL_ENSURE( aSub[SW_LATIN].IsTransparent(), "SwFont: Transparent revolution" ); } /************************************************************************* @@ -1162,8 +1162,10 @@ void SwSubFont::CalcEsc( SwDrawTextInfo& rInf, Point& rPos ) // used during painting of small capitals void SwDrawTextInfo::Shift( USHORT nDir ) { - ASSERT( bPos, "DrawTextInfo: Undefined Position" ); - ASSERT( bSize, "DrawTextInfo: Undefined Width" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bPos, "DrawTextInfo: Undefined Position" ); + OSL_ENSURE( bSize, "DrawTextInfo: Undefined Width" ); +#endif const BOOL bBidiPor = ( GetFrm() && GetFrm()->IsRightToLeft() ) != ( 0 != ( TEXT_LAYOUT_BIDI_RTL & GetpOut()->GetLayoutMode() ) ); @@ -1178,7 +1180,7 @@ void SwDrawTextInfo::Shift( USHORT nDir ) ((Point*)pPos)->X() += GetSize().Width(); break; case 900 : - ASSERT( ((Point*)pPos)->Y() >= GetSize().Width(), "Going underground" ); + OSL_ENSURE( ((Point*)pPos)->Y() >= GetSize().Width(), "Going underground" ); ((Point*)pPos)->Y() -= GetSize().Width(); break; case 1800 : diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index bc395138e5e9..9a26ee36fc65 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -86,7 +86,7 @@ #include <algorithm> #include <map> -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #define CHECK Check(); #else #define CHECK @@ -173,7 +173,7 @@ bool isSelfNestable(const USHORT nWhich) if ((RES_TXTATR_INETFMT == nWhich) || (RES_TXTATR_CJK_RUBY == nWhich)) return false; - ASSERT((RES_TXTATR_META == nWhich) || + OSL_ENSURE((RES_TXTATR_META == nWhich) || (RES_TXTATR_METAFIELD == nWhich), "???"); return true; } @@ -184,7 +184,7 @@ bool isSplittable(const USHORT nWhich) if ((RES_TXTATR_INETFMT == nWhich) || (RES_TXTATR_CJK_RUBY == nWhich)) return true; - ASSERT((RES_TXTATR_META == nWhich) || + OSL_ENSURE((RES_TXTATR_META == nWhich) || (RES_TXTATR_METAFIELD == nWhich), "???"); return false; } @@ -254,7 +254,7 @@ MakeTxtAttrNesting(SwTxtNode & rNode, SwTxtAttrNesting & rNesting, break; } default: - ASSERT(false, "MakeTxtAttrNesting: what the hell is that?"); + OSL_ENSURE(false, "MakeTxtAttrNesting: what the hell is that?"); break; } return static_cast<SwTxtAttrNesting*>(pNew); @@ -371,7 +371,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) //??? const bool bNoLengthAttribute( nNewStart == nNewEnd ); const bool bNewSelfNestable( isSelfNestable(nNewWhich) ); - ASSERT( (RES_TXTATR_INETFMT == nNewWhich) || + OSL_ENSURE( (RES_TXTATR_INETFMT == nNewWhich) || (RES_TXTATR_CJK_RUBY == nNewWhich) || (RES_TXTATR_META == nNewWhich) || (RES_TXTATR_METAFIELD == nNewWhich), @@ -411,7 +411,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) static_cast<SwTxtAttrNesting*>(pOther)); break; default: - ASSERT(false, "bad code monkey"); + OSL_ENSURE(false, "bad code monkey"); break; } } @@ -427,7 +427,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) { if (rNewHint.HasDummyChar()) { - ASSERT(false, + OSL_ENSURE(false, "ERROR: inserting duplicate CH_TXTATR hint"); return false; } else if (nNewEnd < nOtherEnd) { @@ -437,7 +437,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) // in SwXMeta::createEnumeration // SplitNew is sorted, so this is the first split xub_StrLen *const pStart(SplitNew.front()->GetStart()); - ASSERT(*pStart == nNewStart, "how did that happen?"); + OSL_ENSURE(*pStart == nNewStart, "how did that happen?"); *pStart = nNewStart + 1; } } @@ -445,7 +445,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) } } - ASSERT (isSplittable(nNewWhich) || SplitNew.size() == 1, + OSL_ENSURE(isSplittable(nNewWhich) || SplitNew.size() == 1, "splitting the unsplittable ???"); // pass 2: split existing hints that overlap/nest with new hint @@ -476,14 +476,14 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) { case POS_INSIDE: { - ASSERT(!bRemoveOverlap, + OSL_ENSURE(!bRemoveOverlap, "this one should be in OverwrittenExisting?"); } break; case POS_OUTSIDE: case POS_EQUAL: { - ASSERT(false, "existing hint inside new hint: why?"); + OSL_ENSURE(false, "existing hint inside new hint: why?"); } break; case POS_OVERLAP_BEFORE: @@ -495,7 +495,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) { if ( USHRT_MAX == Count() ) { - ASSERT(false, "hints array full :-("); + OSL_ENSURE(false, "hints array full :-("); return false; } SwTxtAttrNesting * const pOtherLeft( @@ -514,7 +514,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) { if ( USHRT_MAX == Count() ) { - ASSERT(false, "hints array full :-("); + OSL_ENSURE(false, "hints array full :-("); return false; } SwTxtAttrNesting * const pOtherRight( @@ -532,7 +532,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) if ( USHRT_MAX - SplitNew.size() <= Count() ) { - ASSERT(false, "hints array full :-("); + OSL_ENSURE(false, "hints array full :-("); return false; } @@ -560,7 +560,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) } else { - ASSERT((nOtherStart < nNewStart) && (nNewEnd < nOtherEnd), "huh?"); + OSL_ENSURE((nOtherStart < nNewStart) && (nNewEnd < nOtherEnd), "huh?"); // scenario: there is a RUBY, and contained within that a META; // now a RUBY is inserted within the META => the exising RUBY is split: // here it is not possible to simply insert the left/right fragment @@ -568,12 +568,12 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) Delete( *itOther ); // this also does NoteInHistory! *(*itOther)->GetEnd() = nNewStart; bool bSuccess( TryInsertNesting(rNode, **itOther) ); - ASSERT(bSuccess, "recursive call 1 failed?"); + OSL_ENSURE(bSuccess, "recursive call 1 failed?"); SwTxtAttrNesting * const pOtherRight( MakeTxtAttrNesting( rNode, **itOther, nNewEnd, nOtherEnd ) ); bSuccess = TryInsertNesting(rNode, *pOtherRight); - ASSERT(bSuccess, "recursive call 2 failed?"); + OSL_ENSURE(bSuccess, "recursive call 2 failed?"); } } @@ -602,7 +602,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, std::vector<SwTxtAttr*> aInsDelHints; std::vector<SwTxtAttr*>::iterator aIter; - ASSERT( RES_TXTATR_CHARFMT == rNewHint.Which() || + OSL_ENSURE( RES_TXTATR_CHARFMT == rNewHint.Which() || RES_TXTATR_AUTOFMT == rNewHint.Which(), "Expecting CHARFMT or AUTOFMT" ); @@ -664,7 +664,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( !rNode.GetDoc()->IsInReading() ) CHECK; #endif @@ -705,7 +705,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, // while ( aStartIter != aEndIter || bNoLengthAttribute ) { - ASSERT( bNoLengthAttribute || nPorStart < *aStartIter, "AUTOSTYLES: BuildPortion trouble" ) + OSL_ENSURE( bNoLengthAttribute || nPorStart < *aStartIter, "AUTOSTYLES: BuildPortion trouble" ); const xub_StrLen nPorEnd = bNoLengthAttribute ? nPorStart : *aStartIter; aInsDelHints.clear(); @@ -726,7 +726,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, if ( pOther->GetEnd() && *pOther->GetEnd() == nPorEnd && nOtherStart == nPorStart ) { - ASSERT( *pOther->GetEnd() == nPorEnd, "AUTOSTYLES: BuildPortion trouble" ) + OSL_ENSURE( *pOther->GetEnd() == nPorEnd, "AUTOSTYLES: BuildPortion trouble" ); aInsDelHints.push_back( pOther ); } } @@ -768,7 +768,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, { // remove all attributes from auto styles, which are explicitely set in // the new character format: - ASSERT( RES_TXTATR_AUTOFMT == (*aIter)->Which(), "AUTOSTYLES - Misc trouble" ) + OSL_ENSURE( RES_TXTATR_AUTOFMT == (*aIter)->Which(), "AUTOSTYLES - Misc trouble" ); SwTxtAttr* pOther = *aIter; boost::shared_ptr<SfxItemSet> pOldStyle = static_cast<const SwFmtAutoFmt&>(pOther->GetAttr()).GetStyleHandle(); @@ -983,7 +983,7 @@ SwTxtAttr* MakeRedlineTxtAttr( SwDoc & rDoc, SfxPoolItem & rAttr ) case RES_CHRATR_BACKGROUND: break; default: - ASSERT(false, "unsupported redline attribute"); + OSL_ENSURE(false, "unsupported redline attribute"); break; } @@ -1081,7 +1081,7 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr, pNew = new SwTxtMeta( static_cast<SwFmtMeta&>(rNew), nStt, nEnd ); break; default: - ASSERT(RES_TXTATR_AUTOFMT == rNew.Which(), "unknown attribute"); + OSL_ENSURE(RES_TXTATR_AUTOFMT == rNew.Which(), "unknown attribute"); pNew = new SwTxtAttrEnd( rNew, nStt, nEnd ); break; } @@ -1138,9 +1138,9 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr ) const SwField* pFld = pAttr->GetFld().GetFld(); //JP 06-08-95: DDE-Felder bilden eine Ausnahme - ASSERT( RES_DDEFLD == pFld->GetTyp()->Which() || + OSL_ENSURE( RES_DDEFLD == pFld->GetTyp()->Which() || this == ((SwTxtFld*)pAttr)->GetpTxtNode(), - "Wo steht denn dieses Feld?" ) + "Wo steht denn dieses Feld?" ); // bestimmte Felder mussen am Doc das Calculations-Flag updaten switch( pFld->GetTyp()->Which() ) @@ -1209,7 +1209,7 @@ SwTxtNode::InsertItem( SfxPoolItem& rAttr, const xub_StrLen nStart, const xub_StrLen nEnd, const SetAttrMode nMode ) { // character attributes will be inserted as automatic styles: - ASSERT( !isCHRATR(rAttr.Which()), "AUTOSTYLES - " + OSL_ENSURE( !isCHRATR(rAttr.Which()), "AUTOSTYLES - " "SwTxtNode::InsertItem should not be called with character attributes"); SwTxtAttr* const pNew = MakeTxtAttr( *GetDoc(), rAttr, nStart, nEnd ); @@ -1234,8 +1234,8 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) { BOOL bHiddenPara = FALSE; - ASSERT( pAttr && *pAttr->GetStart() <= Len(), "StartIdx out of bounds!" ); - ASSERT( !pAttr->GetEnd() || (*pAttr->GetEnd() <= Len()), + OSL_ENSURE( pAttr && *pAttr->GetStart() <= Len(), "StartIdx out of bounds!" ); + OSL_ENSURE( !pAttr->GetEnd() || (*pAttr->GetEnd() <= Len()), "EndIdx out of bounds!" ); // translate from SetAttrMode to InsertMode (for hints with CH_TXTATR) @@ -1310,7 +1310,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) if( nsSetAttrMode::SETATTR_NOTXTATRCHR & nInsMode ) { // loesche das Zeichen aus dem String ! - ASSERT( ( CH_TXTATR_BREAKWORD == + OSL_ENSURE( ( CH_TXTATR_BREAKWORD == m_Text.GetChar(*pAttr->GetStart() ) || CH_TXTATR_INWORD == m_Text.GetChar(*pAttr->GetStart())), @@ -1348,7 +1348,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) if( nsSetAttrMode::SETATTR_NOTXTATRCHR & nInsMode ) { // loesche das Zeichen aus dem String ! - ASSERT( ( CH_TXTATR_BREAKWORD == + OSL_ENSURE( ( CH_TXTATR_BREAKWORD == m_Text.GetChar(*pAttr->GetStart() ) || CH_TXTATR_INWORD == m_Text.GetChar(*pAttr->GetStart())), @@ -1422,12 +1422,12 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) // FussNote im Redline-Bereich NICHT ins FtnArray einfuegen! if( StartOfSectionIndex() > rNodes.GetEndOfRedlines().GetIndex() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const BOOL bSuccess = #endif pDoc->GetFtnIdxs().Insert( pTxtFtn ); -#ifdef DBG_UTIL - ASSERT( bSuccess, "FtnIdx nicht eingetragen." ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bSuccess, "FtnIdx nicht eingetragen." ); #endif } SwNodeIndex aTmpIndex( *this ); @@ -1478,7 +1478,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) // resulting in infinite recursion if ( !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nMode) ) { - ASSERT( ( CH_TXTATR_BREAKWORD == m_Text.GetChar(nStart) || + OSL_ENSURE( ( CH_TXTATR_BREAKWORD == m_Text.GetChar(nStart) || CH_TXTATR_INWORD == m_Text.GetChar(nStart) ), "where is my attribute character?" ); SwIndex aIdx( this, nStart ); @@ -1503,7 +1503,7 @@ void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr ) { if ( !HasHints() ) { - ASSERT(false, "DeleteAttribute called, but text node without hints?"); + OSL_ENSURE(false, "DeleteAttribute called, but text node without hints?"); return; } @@ -1550,7 +1550,7 @@ void SwTxtNode::DeleteAttributes( const USHORT nWhich, { if ( nWhich == RES_CHRATR_HIDDEN ) { - ASSERT(false, "hey, that's a CHRATR! how did that get in?"); + OSL_ENSURE(false, "hey, that's a CHRATR! how did that get in?"); SetCalcHiddenCharFlags(); } else if ( nWhich == RES_TXTATR_CHARFMT ) @@ -1685,7 +1685,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, if ( pItem && (reinterpret_cast<SfxPoolItem*>(-1) != pItem)) { const USHORT nWhich = pItem->Which(); - ASSERT( isCHRATR(nWhich) || isTXTATR(nWhich), + OSL_ENSURE( isCHRATR(nWhich) || isTXTATR(nWhich), "SwTxtNode::SetAttr(): unknown attribute" ); if ( isCHRATR(nWhich) || isTXTATR(nWhich) ) { @@ -1713,7 +1713,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, { if ( nEnd != nStt && !pNew->GetEnd() ) { - ASSERT(false, + OSL_ENSURE(false, "Attribut without end, but area marked"); DestroyAttr( pNew ); // do not insert } @@ -1953,7 +1953,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, while ( pItem ) { const USHORT nHintWhich = pItem->Which(); - ASSERT(!isUNKNOWNATR(nHintWhich), + OSL_ENSURE(!isUNKNOWNATR(nHintWhich), "SwTxtNode::GetAttr(): unkonwn attribute?"); if ( !pAttrArr.get() ) @@ -2595,7 +2595,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, { if ( USHRT_MAX == Count() ) // we're sorry, this flight is overbooked... { - ASSERT(false, "hints array full :-("); + OSL_ENSURE(false, "hints array full :-("); return false; } @@ -2791,7 +2791,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, { SwpHintsArray::Insert( pHint ); CalcFlags(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( !rNode.GetDoc()->IsInReading() ) CHECK; #endif @@ -2809,7 +2809,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, if( *pHtEnd < nHtStart ) { - ASSERT( *pHtEnd >= nHtStart, + OSL_ENSURE( *pHtEnd >= nHtStart, "+SwpHints::Insert: invalid hint, end < start" ); // Wir drehen den Quatsch einfach um: @@ -2841,10 +2841,10 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, ( RES_TXTATR_AUTOFMT == nWhich || RES_TXTATR_CHARFMT == nWhich ) ) { - ASSERT( nWhich != RES_TXTATR_AUTOFMT || + OSL_ENSURE( nWhich != RES_TXTATR_AUTOFMT || static_cast<const SwFmtAutoFmt&>(pHint->GetAttr()).GetStyleHandle()->GetPool() == &rNode.GetDoc()->GetAttrPool(), - "AUTOSTYLES - Pool mismatch" ) + "AUTOSTYLES - Pool mismatch" ); BuildPortions( rNode, *pHint, nMode ); @@ -2884,7 +2884,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, rNode.Modify( 0, &aHint ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( !bNoHintAdjustMode && !rNode.GetDoc()->IsInReading() ) CHECK; #endif @@ -2929,13 +2929,13 @@ void SwpHints::DeleteAtPos( const USHORT nPos ) } // Ist der Hint schon bekannt, dann suche die Position und loesche ihn. -// Ist er nicht im Array, so gibt es ein ASSERT !! +// Ist er nicht im Array, so gibt es ein OSL_ENSURE(!! void SwpHints::Delete( SwTxtAttr* pTxtHt ) { // Attr 2.0: SwpHintsArr::Delete( pTxtHt ); const USHORT nPos = GetStartOf( pTxtHt ); - ASSERT( USHRT_MAX != nPos, "Attribut nicht im Attribut-Array!" ); + OSL_ENSURE( USHRT_MAX != nPos, "Attribut nicht im Attribut-Array!" ); if( USHRT_MAX != nPos ) DeleteAtPos( nPos ); } @@ -3057,7 +3057,7 @@ sal_Unicode GetCharOfTxtAttr( const SwTxtAttr& rAttr ) break; default: - ASSERT(false, "GetCharOfTxtAttr: unknown attr"); + OSL_ENSURE(false, "GetCharOfTxtAttr: unknown attr"); break; } return cRet; diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index 0285bdb89d63..0e4434679d7b 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -71,7 +71,7 @@ SwTxtCharFmt::~SwTxtCharFmt( ) void SwTxtCharFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) { USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; - ASSERT( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) + OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich), "SwTxtCharFmt::Modify(): unknown Modify"); @@ -190,7 +190,7 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt() void SwTxtINetFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) { USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; - ASSERT( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) + OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich), "SwTxtINetFmt::Modify(): unknown Modify"); @@ -239,7 +239,7 @@ SwTxtRuby::~SwTxtRuby() void SwTxtRuby::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; - ASSERT( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) + OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich), "SwTxtRuby::Modify(): unknown Modify"); diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 20888cb5116e..8ba83e61ddf5 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -334,7 +334,7 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess, if ( !pSet1 ) { - ASSERT( nWhichId, "lcl_HaveCommonAttributes not used correctly" ) + OSL_ENSURE( nWhichId, "lcl_HaveCommonAttributes not used correctly" ); if ( SFX_ITEM_SET == rSet2.GetItemState( nWhichId, FALSE ) ) { pNewSet = rSet2.Clone( TRUE ); @@ -634,7 +634,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich, XubString SwTxtNode::GetCurWord( xub_StrLen nPos ) const { - ASSERT( nPos <= m_Text.Len(), "SwTxtNode::GetCurWord: invalid index." ); + OSL_ENSURE( nPos <= m_Text.Len(), "SwTxtNode::GetCurWord: invalid index." ); if (!m_Text.Len()) return m_Text; @@ -675,7 +675,7 @@ SwScanner::SwScanner( const SwTxtNode& rNd, const String& rTxt, const LanguageTy USHORT nType, xub_StrLen nStart, xub_StrLen nEnde, BOOL bClp ) : rNode( rNd ), rText( rTxt), pLanguage( pLang ), pConversionMap( pConvMap ), nLen( 0 ), nWordType( nType ), bClip( bClp ) { - ASSERT( rText.Len(), "SwScanner: EmptyString" ); + OSL_ENSURE( rText.Len(), "SwScanner: EmptyString" ); nStartPos = nBegin = nStart; nEndPos = nEnde; @@ -749,7 +749,7 @@ BOOL SwScanner::NextWord() // we have to differenciate between these cases: if ( aBound.startPos <= nBegin ) { - ASSERT( aBound.endPos >= nBegin, "Unexpected aBound result" ) + OSL_ENSURE( aBound.endPos >= nBegin, "Unexpected aBound result" ); // restrict boundaries to script boundaries and nEndPos const USHORT nCurrScript = @@ -1475,9 +1475,9 @@ BOOL SwTxtNode::Hyphenate( SwInterHyphInfo &rHyphInf ) { // 4935: Seit der Trennung ueber Sonderbereiche sind Faelle // moeglich, in denen kein Frame zum Node vorliegt. - // Also kein ASSERT! + // Also keinOSL_ENSURE #if OSL_DEBUG_LEVEL > 1 - ASSERT( pFrm, "!SwTxtNode::Hyphenate: can't find any frame" ); + OSL_ENSURE( pFrm, "!SwTxtNode::Hyphenate: can't find any frame" ); #endif return FALSE; } @@ -1924,8 +1924,8 @@ void SwTxtNode::CountWords( SwDocStat& rStat, } } - ASSERT( aExpandText.getLength() >= nNumOfMaskedChars, - "More characters hidden that characters in string!" ) + OSL_ENSURE( aExpandText.getLength() >= nNumOfMaskedChars, + "More characters hidden that characters in string!" ); nTmpChars = nExpandEnd - nExpandBegin - nNumOfMaskedChars; // count words in numbering string: @@ -2066,8 +2066,8 @@ SwGrammarMarkUp* SwTxtNode::GetGrammarCheck() void SwTxtNode::SetSmartTags( SwWrongList* pNew, bool bDelete ) { - ASSERT( !pNew || SwSmartTagMgr::Get().IsSmartTagsEnabled(), - "Weird - we have a smart tag list without any recognizers?" ) + OSL_ENSURE( !pNew || SwSmartTagMgr::Get().IsSmartTagsEnabled(), + "Weird - we have a smart tag list without any recognizers?" ); if ( m_pParaIdleData_Impl ) { |