diff options
author | Jan Holesovsky <kendy@suse.cz> | 2010-11-25 18:50:04 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-11-25 18:50:04 +0100 |
commit | d6c29a6c27745e2526f5e83c3018fc8a47450a61 (patch) | |
tree | 670df02c0e4bc0307fad81b4b73541e12dc18ee5 | |
parent | e84f5d6f20585567ca70752ce5188cb10b518acf (diff) | |
parent | df07d391d83966cf2369ac7fec8d0b88cbe49bcf (diff) |
Merge remote branch 'origin/libreoffice-3-3'
Conflicts:
sw/inc/SwNumberTree.hxx
sw/inc/calbck.hxx
sw/inc/tox.hxx
sw/inc/viscrs.hxx
sw/source/core/doc/docnum.cxx
sw/source/core/docnode/finalthreadmanager.cxx
sw/source/core/docnode/ndnum.cxx
sw/source/core/docnode/ndtbl.cxx
sw/source/core/draw/dcontact.cxx
sw/source/core/edit/edlingu.cxx
sw/source/core/edit/ednumber.cxx
sw/source/core/except/errhdl.cxx
sw/source/core/fields/chpfld.cxx
sw/source/core/fields/fldbas.cxx
sw/source/core/frmedt/fetab.cxx
sw/source/core/layout/flycnt.cxx
sw/source/core/layout/makefile.mk
sw/source/core/layout/pagechg.cxx
sw/source/core/layout/tabfrm.cxx
sw/source/core/ole/ndole.cxx
sw/source/core/text/makefile.mk
sw/source/core/txtnode/txtedt.cxx
sw/source/filter/basflt/fltini.cxx
sw/source/filter/html/swhtml.cxx
sw/source/filter/ww1/fltshell.cxx
sw/source/filter/ww1/w1sprm.cxx
sw/source/filter/ww8/wrtw8nds.cxx
sw/source/filter/ww8/wrtw8num.cxx
sw/source/filter/ww8/ww8par3.cxx
sw/source/filter/ww8/ww8par5.cxx
sw/source/filter/ww8/ww8par6.cxx
sw/source/filter/xml/xmltble.cxx
sw/source/filter/xml/xmltbli.cxx
sw/source/ui/dbui/dbinsdlg.cxx
sw/source/ui/dbui/mmoutputpage.cxx
sw/source/ui/dialog/swdlgfact.cxx
sw/source/ui/docvw/edtwin.cxx
sw/source/ui/docvw/srcedtw.cxx
404 files changed, 4144 insertions, 4302 deletions
diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx index 8451f2222f..c314041360 100644 --- a/sw/inc/SwNumberTree.hxx +++ b/sw/inc/SwNumberTree.hxx @@ -347,7 +347,7 @@ public: */ const SwNumberTreeNode* GetPrecedingNodeOf( const SwNumberTreeNode& rNode ) const; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static unsigned long GetInstances(); unsigned long GetSerial(); #endif @@ -450,7 +450,7 @@ protected: */ mutable tSwNumberTreeChildren::iterator mItLastValid; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 /** Counter for the number of created instances. */ diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 979fb08266..c23cb9f5a7 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -195,7 +195,7 @@ private: class SwClientIter { friend SwClient* SwModify::_Remove(SwClient *); // for ptr correction - friend void SwModify::Add(SwClient *); // only for ASSERT ! + friend void SwModify::Add(SwClient *); // only for OSL_ENSURE ! SwModify const& rRoot; SwClient *pAkt, *pDelNext; diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 7f61680051..d4f1c6a108 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -442,13 +442,13 @@ public: */ void Combine(); -#if !defined(DBG_UTIL) +#if OSL_DEBUG_LEVEL > 1 + void SttCrsrMove(); + void EndCrsrMove( const BOOL bIdleEnd = FALSE ); +#else void SttCrsrMove() { ++nCrsrMove; StartAction(); } void EndCrsrMove( const BOOL bIdleEnd = FALSE ) { EndAction( bIdleEnd ); --nCrsrMove; } -#else - void SttCrsrMove(); - void EndCrsrMove( const BOOL bIdleEnd = FALSE ); #endif /* diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 6f8b48e9ac..95005fba86 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -162,7 +162,7 @@ public: // about the object (Writer fly frame resp. drawing object) const SwFmtAnchor& GetAnchorFmt() const { - ASSERT( GetFmt(), + OSL_ENSURE( GetFmt(), "<SwContact::GetAnchorFmt()> - no frame format -> crash" ); return GetFmt()->GetAnchor(); @@ -177,7 +177,7 @@ public: const SwPosition& GetCntntAnchor() const { - ASSERT( GetAnchorFmt().GetCntntAnchor(), + OSL_ENSURE( GetAnchorFmt().GetCntntAnchor(), "<SwContact::GetCntntAnchor()> - no content anchor -> crash" ); return *(GetAnchorFmt().GetCntntAnchor()); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index df0bab81fc..3636b882c9 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -489,7 +489,7 @@ private: bool mbColumnSelection : 1; // true: this content has bee created by a column selection // (clipboard docs only) -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bool mbXMLExport : 1; // TRUE: during XML export #endif @@ -1049,7 +1049,7 @@ public: inline void SetOLEPrtNotifyPending( bool bSet = true ); void PrtOLENotify( sal_Bool bAll ); //All or only marked -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bool InXMLExport() const { return mbXMLExport; } void SetXMLExport( bool bFlag ) { mbXMLExport = bFlag; } #endif diff --git a/sw/inc/errhdl.hxx b/sw/inc/errhdl.hxx index 325567185b..1b89d0aa84 100644 --- a/sw/inc/errhdl.hxx +++ b/sw/inc/errhdl.hxx @@ -28,13 +28,13 @@ #ifndef _ERRHDL_HXX #define _ERRHDL_HXX -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include <tools/solar.h> #include <sal/types.h> #include "swdllapi.h" -extern BOOL bAssert; // TRUE, wenn eine ASSERT-Box hochkam +extern BOOL bAssert; // TRUE, wenn eine ASSERT Box hochkam // ----------------------------------------------------------------------- @@ -42,15 +42,7 @@ extern BOOL bAssert; // TRUE, wenn eine ASSERT-Box hochkam // wo der Fehler auftrat. // Die Funktion darf nicht direkt benutzt werden! // ----------------------------------------------------------------------- -SW_DLLPUBLIC void AssertFail( const sal_Char*, const sal_Char*, USHORT ); -SW_DLLPUBLIC void AssertFail( USHORT, const sal_Char*, USHORT ); - -#define ASSERT( cond, message ) \ - if( !(cond) ) { \ - const char *_pErrorText = #message; \ - const char *_pFileName = __FILE__; \ - ::AssertFail( _pErrorText, _pFileName, __LINE__ ); \ - } +SW_DLLPUBLIC void AssertFail( USHORT, const sal_Char* ); // ----------------------------------------------------------------------- // Prueft ob die angegebene Bedingung wahr ist, wenn nicht wird eine @@ -59,7 +51,7 @@ SW_DLLPUBLIC void AssertFail( USHORT, const sal_Char*, USHORT ); #define ASSERT_ID( cond, id ) \ if( !(cond) ) { \ const char *_pFileName = __FILE__; \ - ::AssertFail( (USHORT)id, _pFileName, __LINE__ ); \ + ::AssertFail( (USHORT)id, _pFileName ); \ } @@ -68,7 +60,6 @@ SW_DLLPUBLIC void AssertFail( USHORT, const sal_Char*, USHORT ); // ignoriert // ----------------------------------------------------------------------- #else -#define ASSERT( cond, message ) ; #define ASSERT_ID( cond, id ) ; #endif // PRODUCT diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index d57f2e5348..f6499718fc 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -274,7 +274,7 @@ protected: public: -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 virtual ~SwFieldType(); #endif static const String& GetTypeStr( USHORT nTypeId ); @@ -342,10 +342,10 @@ public: // ResId USHORT Which() const -#ifndef DBG_UTIL - { return pType->Which(); } +#if OSL_DEBUG_LEVEL > 1 + ; // implemented in fldbas.cxx #else - ; // in fldbas.cxx implementiert + { return pType->Which(); } #endif // TYP_ID diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 8d78bb7e28..b37d722c80 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -196,10 +196,10 @@ public: USHORT Count() const { return pChgSet->Count(); } void ClearItem( USHORT nWhichL = 0 ) -#ifndef DBG_UTIL - { pChgSet->ClearItem( nWhichL ); } -#else +#if OSL_DEBUG_LEVEL > 1 ; +#else + { pChgSet->ClearItem( nWhichL ); } #endif }; diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx index 13ffd4ecf9..41f9a2d30f 100644 --- a/sw/inc/index.hxx +++ b/sw/inc/index.hxx @@ -41,17 +41,17 @@ class SwIndex; class SwIndexReg; struct SwPosition; -#ifndef DBG_UTIL -#define INLINE inline -#else +#if OSL_DEBUG_LEVEL > 1 #define INLINE +#else +#define INLINE inline #endif class SW_DLLPUBLIC SwIndex { friend class SwIndexReg; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static int nSerial; int MySerial; #endif @@ -148,7 +148,7 @@ public: void MoveTo( SwIndexReg& rArr ); }; -#ifndef DBG_UTIL +#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL < 2 inline xub_StrLen SwIndex::operator++() { diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx index ee5b4082c4..92bfda7b2a 100644 --- a/sw/inc/ndhints.hxx +++ b/sw/inc/ndhints.hxx @@ -113,7 +113,7 @@ public: { return m_HintStarts[nIdx]; } inline USHORT Count() const { return m_HintStarts.Count(); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bool Check() const; #endif }; diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx index 7e773b66c8..fc4fe8499d 100644 --- a/sw/inc/ndindex.hxx +++ b/sw/inc/ndindex.hxx @@ -43,7 +43,7 @@ class SW_DLLPUBLIC SwNodeIndex friend void SwNodes::DeRegisterIndex( SwNodeIndex& ); friend void SwNodes::RemoveNode( ULONG, ULONG, BOOL ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static int nSerial; int MySerial; #endif diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index aa626de04e..87fc228dfd 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -91,7 +91,7 @@ class SW_DLLPUBLIC SwNode : private /* public*/ BigPtrEntry { friend class SwNodes; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static long nSerial; long nMySerial; #endif @@ -115,7 +115,7 @@ protected: public: virtual ~SwNode(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 long int GetSerial() const { return nMySerial; } #endif diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx index 13930ed9ad..7bd6443ccc 100644 --- a/sw/inc/numrule.hxx +++ b/sw/inc/numrule.hxx @@ -36,8 +36,8 @@ #include "swdllapi.h" #include <swtypes.hxx> #include <calbck.hxx> -#include <errhdl.hxx> // Fuer die inline-ASSERTs -#include <error.h> // Fuer die inline-ASSERTs +#include <errhdl.hxx> // Fuer die inline ASSERT +#include <error.h> // Fuer die inline ASSERT #include <hints.hxx> #include <hash_map> #include <stringhash.hxx> @@ -107,7 +107,7 @@ public: private: friend void _FinitCore(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 long int nSerial; static long int nInstances; #endif diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 0fd51a6e3a..1a99a18171 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -189,8 +189,10 @@ public: m_pMark = m_pPoint; } } -#ifndef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 + void Exchange(); +#else void Exchange() { if (m_pPoint != m_pMark) @@ -200,8 +202,6 @@ public: m_pMark = pTmp; } } -#else - void Exchange(); #endif /** A PaM marks a selection if Point and Mark are distinct positions. diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index c279f4dbd1..38882b6f24 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -28,6 +28,7 @@ #ifndef _SWRECT_HXX #define _SWRECT_HXX #include "errhdl.hxx" +#include <osl/diagnose.h> #include <tools/gen.hxx> class SvStream; @@ -303,7 +304,7 @@ inline SwRect &SwRect::operator-=( const Size &rSz ) // other inline Rectangle SwRect::SVRect() const { - ASSERT( !IsEmpty(), "SVRect() without Width or Height" ); + OSL_ENSURE( !IsEmpty(), "SVRect() without Width or Height" ); return Rectangle( m_Point.getX(), m_Point.getY(), m_Point.getX() + m_Size.getWidth() - 1, //Right() m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom() diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 550962bab4..10c7addb34 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -34,12 +34,13 @@ #include <swtypes.hxx> #include <calbck.hxx> #include <swrect.hxx> -#ifndef DBG_UTIL -#include <node.hxx> // fuer StartNode->GetMyIndex -#else + +#if OSL_DEBUG_LEVEL > 1 class SwStartNode; #include <memory> #include <boost/noncopyable.hpp> +#else +#include <node.hxx> // fuer StartNode->GetMyIndex #endif class Color; @@ -109,7 +110,7 @@ protected: BOOL bModifyLocked :1; BOOL bNewModel :1; // FALSE: old SubTableModel; TRUE: new RowSpanModel -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bool bDontChangeModel; // This is set by functions (like Merge()) to forbid a laet model change #endif @@ -208,7 +209,7 @@ public: BOOL Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged, SwTableBox* pMergeBox, SwUndoTblMerge* pUndo = 0 ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bDontChangeModel = true; #endif return bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pMergeBox, pUndo ) : @@ -217,7 +218,7 @@ public: BOOL SplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt=1, BOOL bSameHeight = FALSE ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bDontChangeModel = true; #endif return bNewModel ? NewSplitRow( pDoc, rBoxes, nCnt, bSameHeight ) : @@ -319,7 +320,7 @@ public: SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo ); BOOL SetRowHeight( SwTableBox& rAktBox, USHORT eType, SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void CheckConsistency() const; #endif }; @@ -408,10 +409,10 @@ public: const SwStartNode *GetSttNd() const { return pSttNd; } ULONG GetSttIdx() const -#ifndef DBG_UTIL - { return pSttNd ? pSttNd->GetIndex() : 0; } -#else +#if OSL_DEBUG_LEVEL > 1 ; +#else + { return pSttNd ? pSttNd->GetIndex() : 0; } #endif // suche nach der naechsten/vorherigen Box mit Inhalt diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx index b66f4ca1b2..c78236e8fc 100644 --- a/sw/inc/tox.hxx +++ b/sw/inc/tox.hxx @@ -32,6 +32,7 @@ #include <i18npool/lang.h> #include <tools/string.hxx> +#include <osl/diagnose.h> #include <editeng/svxenum.hxx> #include <svl/svarray.hxx> @@ -605,73 +606,73 @@ inline void SwTOXMark::SetAlternativeText(const String& rAlt) inline void SwTOXMark::SetLevel( USHORT nLvl ) { - ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); nLevel = nLvl; } inline void SwTOXMark::SetPrimaryKey( const String& rKey ) { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE( GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); aPrimaryKey = rKey; } inline void SwTOXMark::SetSecondaryKey( const String& rKey ) { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); aSecondaryKey = rKey; } inline void SwTOXMark::SetTextReading( const String& rTxt ) { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); aTextReading = rTxt; } inline void SwTOXMark::SetPrimaryKeyReading( const String& rKey ) { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); aPrimaryKeyReading = rKey; } inline void SwTOXMark::SetSecondaryKeyReading( const String& rKey ) { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); aSecondaryKeyReading = rKey; } inline USHORT SwTOXMark::GetLevel() const { - ASSERT( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); return nLevel; } inline const String& SwTOXMark::GetPrimaryKey() const { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); return aPrimaryKey; } inline const String& SwTOXMark::GetSecondaryKey() const { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); return aSecondaryKey; } inline const String& SwTOXMark::GetTextReading() const { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); return aTextReading; } inline const String& SwTOXMark::GetPrimaryKeyReading() const { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); return aPrimaryKeyReading; } inline const String& SwTOXMark::GetSecondaryKeyReading() const { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); return aSecondaryKeyReading; } @@ -680,13 +681,13 @@ inline const String& SwTOXMark::GetSecondaryKeyReading() const // inline void SwForm::SetTemplate(USHORT nLevel, const String& rTemplate) { - ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); + OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX"); aTemplate[nLevel] = rTemplate; } inline const String& SwForm::GetTemplate(USHORT nLevel) const { - ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); + OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX"); return aTemplate[nLevel]; } @@ -744,13 +745,13 @@ inline TOXTypes SwTOXBase::GetType() const inline void SwTOXBase::SetLevel(USHORT nLev) { - ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); aData.nLevel = nLev; } inline USHORT SwTOXBase::GetLevel() const { - ASSERT(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); return aData.nLevel; } @@ -758,18 +759,17 @@ inline void SwTOXBase::SetTemplateName(const String& rName) { DBG_WARNING("SwTOXBase::SetTemplateName obsolete"); aStyleNames[0] = rName; - } inline USHORT SwTOXBase::GetOptions() const { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); return aData.nOptions; } inline void SwTOXBase::SetOptions(USHORT nOpt) { - ASSERT(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); aData.nOptions = nOpt; } diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx index 5a5ec2ec7d..062dfaa17f 100644 --- a/sw/inc/txatbase.hxx +++ b/sw/inc/txatbase.hxx @@ -152,7 +152,7 @@ inline const xub_StrLen* SwTxtAttr::GetAnyEnd() const inline const SfxPoolItem& SwTxtAttr::GetAttr() const { - ASSERT( m_pAttr, "SwTxtAttr: where is my attribute?" ); + OSL_ENSURE( m_pAttr, "SwTxtAttr: where is my attribute?" ); return *m_pAttr; } @@ -174,69 +174,69 @@ inline void SwTxtAttr::SetDontExpand( bool bDontExpand ) inline const SwFmtCharFmt& SwTxtAttr::GetCharFmt() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_CHARFMT, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_CHARFMT, "Wrong attribute" ); return (const SwFmtCharFmt&)(*m_pAttr); } inline const SwFmtAutoFmt& SwTxtAttr::GetAutoFmt() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_AUTOFMT, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_AUTOFMT, "Wrong attribute" ); return (const SwFmtAutoFmt&)(*m_pAttr); } inline const SwFmtFld& SwTxtAttr::GetFld() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD, "Wrong attribute" ); return (const SwFmtFld&)(*m_pAttr); } inline const SwFmtFtn& SwTxtAttr::GetFtn() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FTN, "Wrong attribute" ); + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_FTN, "Wrong attribute" ); return (const SwFmtFtn&)(*m_pAttr); } inline const SwFmtFlyCnt& SwTxtAttr::GetFlyCnt() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_FLYCNT, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_FLYCNT, "Wrong attribute" ); return (const SwFmtFlyCnt&)(*m_pAttr); } inline const SwTOXMark& SwTxtAttr::GetTOXMark() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_TOXMARK, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_TOXMARK, "Wrong attribute" ); return (const SwTOXMark&)(*m_pAttr); } inline const SwFmtRefMark& SwTxtAttr::GetRefMark() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_REFMARK, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_REFMARK, "Wrong attribute" ); return (const SwFmtRefMark&)(*m_pAttr); } inline const SwFmtINetFmt& SwTxtAttr::GetINetFmt() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_INETFMT, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_INETFMT, "Wrong attribute" ); return (const SwFmtINetFmt&)(*m_pAttr); } inline const SwFmtRuby& SwTxtAttr::GetRuby() const { - ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY, + OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY, "Wrong attribute" ); return (const SwFmtRuby&)(*m_pAttr); } inline const SwFmtMeta& SwTxtAttr::GetMeta() const { - ASSERT( m_pAttr && (m_pAttr->Which() == RES_TXTATR_META || + OSL_ENSURE( m_pAttr && (m_pAttr->Which() == RES_TXTATR_META || m_pAttr->Which() == RES_TXTATR_METAFIELD), "Wrong attribute" ); return (const SwFmtMeta&)(*m_pAttr); diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index f3dc429ad9..aa346e0e1d 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -112,7 +112,7 @@ public: inline const SwTxtNode& SwTxtRuby::GetTxtNode() const { - ASSERT( m_pTxtNode, "SwTxtRuby: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtRuby: where is my TxtNode?" ); return *m_pTxtNode; } diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx index c1f5dc6626..246de80f5e 100644 --- a/sw/inc/txtfld.hxx +++ b/sw/inc/txtfld.hxx @@ -66,7 +66,7 @@ public: inline SwTxtNode& SwTxtFld::GetTxtNode() const { - ASSERT( m_pTxtNode, "SwTxtFld:: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtFld:: where is my TxtNode?" ); return *m_pTxtNode; } diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx index c029d9983e..873ac6b885 100644 --- a/sw/inc/txtftn.hxx +++ b/sw/inc/txtftn.hxx @@ -74,7 +74,7 @@ public: inline const SwTxtNode& SwTxtFtn::GetTxtNode() const { - ASSERT( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" ); return *m_pTxtNode; } diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx index 70fe31f018..66790f4da2 100644 --- a/sw/inc/txtinet.hxx +++ b/sw/inc/txtinet.hxx @@ -74,7 +74,7 @@ public: inline const SwTxtNode& SwTxtINetFmt::GetTxtNode() const { - ASSERT( m_pTxtNode, "SwTxtINetFmt: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtINetFmt: where is my TxtNode?" ); return *m_pTxtNode; } diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx index 512b8e3709..ac94184340 100644 --- a/sw/inc/txtrfmrk.hxx +++ b/sw/inc/txtrfmrk.hxx @@ -54,7 +54,7 @@ public: inline const SwTxtNode& SwTxtRefMark::GetTxtNode() const { - ASSERT( m_pTxtNode, "SwTxtRefMark: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtRefMark: where is my TxtNode?" ); return *m_pTxtNode; } diff --git a/sw/inc/txttxmrk.hxx b/sw/inc/txttxmrk.hxx index 4335de6a55..ac2738bb30 100644 --- a/sw/inc/txttxmrk.hxx +++ b/sw/inc/txttxmrk.hxx @@ -58,7 +58,7 @@ public: inline const SwTxtNode& SwTxtTOXMark::GetTxtNode() const { - ASSERT( m_pTxtNode, "SwTxtTOXMark: where is my TxtNode?" ); + OSL_ENSURE( m_pTxtNode, "SwTxtTOXMark: where is my TxtNode?" ); return *m_pTxtNode; } diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx index 0927cf5f4f..5008005ffd 100644 --- a/sw/inc/viscrs.hxx +++ b/sw/inc/viscrs.hxx @@ -162,9 +162,9 @@ public: // TRUE: an die Position kann der Cursor gesetzt werden virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const; -#ifdef DBG_UTIL -// zum Testen des UNO-Crsr Verhaltens hier die Implementierung -// am sichtbaren Cursor +#if OSL_DEBUG_LEVEL > 1 + // zum Testen des UNO-Crsr Verhaltens hier die Implementierung + // am sichtbaren Cursor virtual BOOL IsSelOvr( int eFlags = ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE | @@ -206,9 +206,9 @@ public: // TRUE: an die Position kann der Cursor gesetzt werden virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const; -#ifdef DBG_UTIL -// zum Testen des UNO-Crsr Verhaltens hier die Implementierung -// am sichtbaren Cursor +#if OSL_DEBUG_LEVEL > 1 + // zum Testen des UNO-Crsr Verhaltens hier die Implementierung + // am sichtbaren Cursor virtual BOOL IsSelOvr( int eFlags = ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE | diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx index 171ac44f0d..73c19f2eaf 100644 --- a/sw/source/core/SwNumberTree/SwNodeNum.cxx +++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx @@ -74,7 +74,7 @@ SwNumRule * SwNodeNum::GetNumRule() const void SwNodeNum::ChangeNumRule( SwNumRule& rNumRule ) { - ASSERT( GetNumRule() && GetTxtNode(), + OSL_ENSURE( GetNumRule() && GetTxtNode(), "<SwNodeNum::ChangeNumRule(..)> - missing list style and/or text node. Serious defect -> please informm OD." ); if ( GetNumRule() && GetTxtNode() ) { @@ -91,7 +91,7 @@ void SwNodeNum::ChangeNumRule( SwNumRule& rNumRule ) SwPosition SwNodeNum::GetPosition() const { - ASSERT( GetTxtNode(), + OSL_ENSURE( GetTxtNode(), "<SwNodeNum::GetPosition()> - no text node set at <SwNodeNum> instance" ); return SwPosition(*mpTxtNode); } @@ -110,13 +110,13 @@ SwNumberTreeNode * SwNodeNum::Create() const // --> OD 2008-02-19 #refactorlists# void SwNodeNum::PreAdd() { - ASSERT( GetTxtNode(), + OSL_ENSURE( GetTxtNode(), "<SwNodeNum::PreAdd()> - no text node set at <SwNodeNum> instance" ); if ( !GetNumRule() && GetTxtNode() ) { mpNumRule = GetTxtNode()->GetNumRule(); } - ASSERT( GetNumRule(), + OSL_ENSURE( GetNumRule(), "<SwNodeNum::PreAdd()> - no list style set at <SwNodeNum> instance" ); if ( GetNumRule() && GetTxtNode() ) { @@ -135,9 +135,9 @@ void SwNodeNum::PreAdd() void SwNodeNum::PostRemove() { - ASSERT( GetTxtNode(), + OSL_ENSURE( GetTxtNode(), "<SwNodeNum::PostRemove()> - no text node set at <SwNodeNum> instance" ); - ASSERT( GetNumRule(), + OSL_ENSURE( GetNumRule(), "<SwNodeNum::PostRemove()> - no list style set at <SwNodeNum> instance" ); if ( GetTxtNode() ) @@ -191,7 +191,7 @@ bool SwNodeNum::IsContinuous() const } else { - ASSERT( false, "<SwNodeNum::IsContinuous()> - OD debug" ); + OSL_ENSURE( false, "<SwNodeNum::IsContinuous()> - OD debug" ); } // <-- @@ -232,7 +232,7 @@ bool SwNodeNum::HasCountedChildren() const for (aIt = mChildren.begin(); aIt != mChildren.end(); aIt++) { SwNodeNum* pChild( dynamic_cast<SwNodeNum*>(*aIt) ); - ASSERT( pChild, + OSL_ENSURE( pChild, "<SwNodeNum::HasCountedChildren()> - unexcepted type of child -> please inform OD" ); if ( pChild && ( pChild->IsCountedForNumbering() || @@ -348,7 +348,7 @@ bool SwNodeNum::IsCountPhantoms() const mpNumRule->IsCountPhantoms(); else { - ASSERT( false, + OSL_ENSURE( false, "<SwNodeNum::IsCountPhantoms(): missing numbering rule - please inform OD" ); } // <-- @@ -471,7 +471,7 @@ void SwNodeNum::_UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum ) SwNodeNum* pChildNode( dynamic_cast<SwNodeNum*>((*rNodeNum.mChildren.begin())) ); if ( !pChildNode ) { - ASSERT( false, + OSL_ENSURE( false, "<SwNodeNum::_UnregisterMeAndChildrenDueToRootDelete(..)> - unknown number tree node child" ); ++nAllowedChildCount; continue; diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx b/sw/source/core/SwNumberTree/SwNumberTree.cxx index 4cfb2702fb..8d28fbf9b4 100644 --- a/sw/source/core/SwNumberTree/SwNumberTree.cxx +++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx @@ -37,7 +37,7 @@ using std::vector; using std::find; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 unsigned long SwNumberTreeNode::nInstances = 0; #endif @@ -53,7 +53,7 @@ SwNumberTreeNode::SwNumberTreeNode() { mItLastValid = mChildren.end(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 mnSerial = nInstances; nInstances++; #endif @@ -72,19 +72,19 @@ SwNumberTreeNode::~SwNumberTreeNode() } else { - ASSERT(false, "lost children!"); + OSL_ENSURE(false, "lost children!"); } } - ASSERT( IsPhantom() || mpParent == NULL, ": I'm not supposed to have a parent."); + OSL_ENSURE( IsPhantom() || mpParent == NULL, ": I'm not supposed to have a parent."); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nInstances--; #endif mpParent = (SwNumberTreeNode *) 0xdeadbeef; - ASSERT(mChildren.empty(), "children left!"); + OSL_ENSURE(mChildren.empty(), "children left!"); } SwNumberTreeNode * SwNumberTreeNode::CreatePhantom() @@ -94,7 +94,7 @@ SwNumberTreeNode * SwNumberTreeNode::CreatePhantom() if (! mChildren.empty() && (*mChildren.begin())->IsPhantom()) { - ASSERT(false, "phantom already present"); + OSL_ENSURE(false, "phantom already present"); } else { @@ -107,7 +107,7 @@ SwNumberTreeNode * SwNumberTreeNode::CreatePhantom() if (! aInsert.second) { - ASSERT(false, "insert of phantom failed!"); + OSL_ENSURE(false, "insert of phantom failed!"); delete pNew; pNew = NULL; @@ -158,7 +158,7 @@ void SwNumberTreeNode::ValidateHierarchical(const SwNumberTreeNode * pNode) cons if (aValidateIt != mChildren.end()) { - ASSERT((*aValidateIt)->mpParent == this, "wrong parent"); + OSL_ENSURE((*aValidateIt)->mpParent == this, "wrong parent"); tSwNumberTreeChildren::iterator aIt = mItLastValid; @@ -501,10 +501,10 @@ void SwNumberTreeNode::MoveChildren(SwNumberTreeNode * pDest) // <-- } - ASSERT (mChildren.empty(), "MoveChildren failed!"); + OSL_ENSURE(mChildren.empty(), "MoveChildren failed!"); #ifdef __SW_NUMBER_TREE_SANITY_CHECK - ASSERT(IsSane(false) && pDest->IsSane(false), "insanity!"); + OSL_ENSURE(IsSane(false) && pDest->IsSane(false), "insanity!"); #endif } @@ -539,7 +539,7 @@ void SwNumberTreeNode::AddChild( SwNumberTreeNode * pChild, // --> OD 2008-03-13 #refactorlists# if ( nDepth < 0 ) { - ASSERT( false, + OSL_ENSURE( false, "<SwNumberTreeNode::AddChild(..)> - parameter <nDepth> out of valid range. Serious defect -> please inform OD." ); return; } @@ -547,7 +547,7 @@ void SwNumberTreeNode::AddChild( SwNumberTreeNode * pChild, if ( pChild->GetParent() != NULL || pChild->GetChildCount() > 0 ) { - ASSERT(false, "only orphans allowed."); + OSL_ENSURE(false, "only orphans allowed."); return; } @@ -556,7 +556,7 @@ void SwNumberTreeNode::AddChild( SwNumberTreeNode * pChild, tSwNumberTreeChildren::iterator aInsertDeepIt = mChildren.upper_bound(pChild); - ASSERT(! (aInsertDeepIt != mChildren.end() && + OSL_ENSURE(! (aInsertDeepIt != mChildren.end() && (*aInsertDeepIt)->IsPhantom()), " unexspected phantom"); @@ -684,7 +684,7 @@ void SwNumberTreeNode::RemoveChild(SwNumberTreeNode * pChild) if (pChild->IsPhantom()) { - ASSERT(false, "not applicable to phantoms!"); + OSL_ENSURE(false, "not applicable to phantoms!"); return; } @@ -744,7 +744,7 @@ void SwNumberTreeNode::RemoveChild(SwNumberTreeNode * pChild) } else { - ASSERT(false, "RemoveChild: failed!"); + OSL_ENSURE(false, "RemoveChild: failed!"); } // --> OD 2008-02-19 #refactorlists# @@ -857,7 +857,7 @@ bool SwNumberTreeNode::HasPhantomCountedParent() const { bool bRet( false ); - ASSERT( IsPhantom(), + OSL_ENSURE( IsPhantom(), "<SwNumberTreeNode::HasPhantomCountedParent()> - wrong usage of method - it's only for phantoms" ); if ( IsPhantom() && mpParent ) { @@ -934,19 +934,19 @@ void SwNumberTreeNode::SetLevelInListTree( const int nLevel ) { if ( nLevel < 0 ) { - ASSERT( false, + OSL_ENSURE( false, "<SwNumberTreeNode::SetLevelInListTree(..)> - parameter <nLevel> out of valid range. Serious defect -> please inform OD." ); return; } - ASSERT( GetParent(), + OSL_ENSURE( GetParent(), "<SwNumberTreeNode::SetLevelInListTree(..)> - can only be called for number tree nodes in a list tree" ); if ( GetParent() ) { if ( nLevel != GetLevelInListTree() ) { SwNumberTreeNode* pRootTreeNode = GetRoot(); - ASSERT( pRootTreeNode, + OSL_ENSURE( pRootTreeNode, "<SwNumberTreeNode::SetLevelInListTree(..)> - no root tree node found. Serious defect -> please inform OD." ); RemoveMe(); @@ -988,14 +988,14 @@ bool SwNumberTreeNode::IsSane(bool bRecursive, if (find(rParents.begin(), rParents.end(), this) != rParents.end()) { - ASSERT(false, " I'm my own ancestor!"); + OSL_ENSURE(false, " I'm my own ancestor!"); bResult = false; } if (! rParents.empty() && rParents.back() != mpParent) { - ASSERT(false, " I'm a bastard!"); + OSL_ENSURE(false, " I'm a bastard!"); bResult = false; } @@ -1016,7 +1016,7 @@ bool SwNumberTreeNode::IsSane(bool bRecursive, if (! bFirst) { - ASSERT(false, " found phantom not at first position."); + OSL_ENSURE(false, " found phantom not at first position."); bResult = false; } @@ -1024,7 +1024,7 @@ bool SwNumberTreeNode::IsSane(bool bRecursive, if ((*aIt)->mpParent != (SwNumberTreeNode *) this) { - ASSERT(false, "found a bastard"); + OSL_ENSURE(false, "found a bastard"); bResult = false; } @@ -1033,7 +1033,7 @@ bool SwNumberTreeNode::IsSane(bool bRecursive, { if (!(*aIt)->IsPhantom() && (*aIt)->LessThan(*this)) { - ASSERT(false, " found child less than me"); + OSL_ENSURE(false, " found child less than me"); bResult = false; } @@ -1041,7 +1041,7 @@ bool SwNumberTreeNode::IsSane(bool bRecursive, } else { - ASSERT(false, "found child that is NULL"); + OSL_ENSURE(false, "found child that is NULL"); bResult = false; } @@ -1061,7 +1061,7 @@ SwNumberTreeNode::GetIterator(const SwNumberTreeNode * pChild) const tSwNumberTreeChildren::iterator aItResult = mChildren.find(const_cast<SwNumberTreeNode *>(pChild)); - ASSERT( aItResult != mChildren.end(), + OSL_ENSURE( aItResult != mChildren.end(), "something went wrong getting the iterator for a child"); return aItResult; @@ -1093,7 +1093,7 @@ SwNumberTreeNode::GetIterator(const SwNumberTreeNode * pChild) const // return aStr; //} -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 unsigned long SwNumberTreeNode::GetInstances() { return nInstances; @@ -1176,7 +1176,7 @@ void SwNumberTreeNode::SetLastValid ( SwNumberTreeNode::tSwNumberTreeChildren::iterator aItValid, bool bValidating ) const { - ASSERT( (aItValid == mChildren.end() || GetIterator(*aItValid) != mChildren.end()), + OSL_ENSURE( (aItValid == mChildren.end() || GetIterator(*aItValid) != mChildren.end()), "last-valid iterator"); if ( @@ -1376,7 +1376,7 @@ void SwNumberTreeNode::NotifyNodesOnListLevel( const int nListLevel ) { if ( nListLevel < 0 ) { - ASSERT( false, + OSL_ENSURE( false, "<SwNumberTreeNode::NotifyNodesOnListLevel(..)> - invalid list level provided" ); return; } @@ -1388,7 +1388,7 @@ void SwNumberTreeNode::NotifyNodesOnListLevel( const int nListLevel ) void SwNumberTreeNode::NotifyChildrenOnDepth( const int nDepth ) { - ASSERT( nDepth >= 0, + OSL_ENSURE( nDepth >= 0, "<SwNumberTreeNode::NotifyChildrenOnDepth(..)> - misusage" ); SwNumberTreeNode::tSwNumberTreeChildren::iterator aChildIter = diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index d0ba1db4e1..dbd1b51965 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -100,7 +100,7 @@ void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) if( IsSelected() ) { rStateSet.AddState( AccessibleStateType::SELECTED ); - ASSERT( bIsSelected, "bSelected out of sync" ); + OSL_ENSURE( bIsSelected, "bSelected out of sync" ); ::rtl::Reference < SwAccessibleContext > xThis( this ); GetMap()->SetCursorContext( xThis ); } @@ -160,8 +160,8 @@ sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm ) GetMap()->GetContextImpl( pLower, sal_False ) ); if( xAccImpl.is() ) { - ASSERT( xAccImpl->GetFrm()->IsCellFrm(), - "table child is not a cell frame" ) + OSL_ENSURE( xAccImpl->GetFrm()->IsCellFrm(), + "table child is not a cell frame" ); bChanged |= static_cast< SwAccessibleCell *>( xAccImpl.get() )->_InvalidateMyCursorPos(); } @@ -186,7 +186,7 @@ void SwAccessibleCell::_InvalidateCursorPos() { const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() ); - ASSERT( pParent->IsTabFrm(), "parent is not a tab frame" ); + OSL_ENSURE( pParent->IsTabFrm(), "parent is not a tab frame" ); const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( pParent ); if( pTabFrm->IsFollow() ) pTabFrm = pTabFrm->FindMaster(); diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index ea03b7c44c..127820fe1f 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -127,11 +127,11 @@ Window *SwAccessibleContext::GetWindow() if( GetMap() ) { const ViewShell *pVSh = GetMap()->GetShell(); - ASSERT( pVSh, "no view shell" ); + OSL_ENSURE( pVSh, "no view shell" ); if( pVSh ) pWin = pVSh->GetWin(); - ASSERT( pWin, "no window" ); + OSL_ENSURE( pWin, "no window" ); } return pWin; @@ -142,7 +142,7 @@ SwCrsrShell* SwAccessibleContext::GetCrsrShell() { SwCrsrShell* pCrsrShell; ViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0; - ASSERT( pViewShell, "no view shell" ); + OSL_ENSURE( pViewShell, "no view shell" ); if( pViewShell && pViewShell->ISA( SwCrsrShell ) ) pCrsrShell = static_cast<SwCrsrShell*>( pViewShell ); else @@ -156,7 +156,7 @@ const SwCrsrShell* SwAccessibleContext::GetCrsrShell() const // just like non-const GetCrsrShell const SwCrsrShell* pCrsrShell; const ViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0; - ASSERT( pViewShell, "no view shell" ); + OSL_ENSURE( pViewShell, "no view shell" ); if( pViewShell && pViewShell->ISA( SwCrsrShell ) ) pCrsrShell = static_cast<const SwCrsrShell*>( pViewShell ); else @@ -226,7 +226,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm, { if ( rLower.GetSwFrm() ) { - ASSERT( !rLower.AlwaysIncludeAsChild(), + OSL_ENSURE( !rLower.AlwaysIncludeAsChild(), "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" ); const SwFrm* pLower( rLower.GetSwFrm() ); ::rtl::Reference< SwAccessibleContext > xAccImpl = @@ -259,7 +259,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm, } else if ( rLower.GetDrawObject() ) { - ASSERT( !rLower.AlwaysIncludeAsChild(), + OSL_ENSURE( !rLower.AlwaysIncludeAsChild(), "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" ); ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl = GetMap()->GetContextImpl( rLower.GetDrawObject(), @@ -297,7 +297,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm, else if ( rLower.GetWindow() ) { // nothing to do - as such children are always included as children. - ASSERT( rLower.AlwaysIncludeAsChild(), + OSL_ENSURE( rLower.AlwaysIncludeAsChild(), "<SwAccessibleContext::ChildrenScrolled(..)> - not always included child not considered!" ); } } @@ -347,7 +347,7 @@ void SwAccessibleContext::ScrolledIn() // This accessible should be freshly created, because it // was not visisble before. Therefor, its vis area must already // reflect the scrolling. - ASSERT( GetVisArea() == GetMap()->GetVisArea(), + OSL_ENSURE( GetVisArea() == GetMap()->GetVisArea(), "Vis area of child is wrong. Did it exist already?" ); // Send child event at parent. That's all we have to do here. @@ -483,7 +483,7 @@ void SwAccessibleContext::_InvalidateFocus() void SwAccessibleContext::FireAccessibleEvent( AccessibleEventObject& rEvent ) { - ASSERT( GetFrm(), "fire event for diposed frame?" ); + OSL_ENSURE( GetFrm(), "fire event for diposed frame?" ); if( !GetFrm() ) return; @@ -653,13 +653,13 @@ uno::Reference< XAccessible> SAL_CALL SwAccessibleContext::getAccessibleParent ( CHECK_FOR_DEFUNC( XAccessibleContext ) const SwFrm *pUpper = GetParent(); - ASSERT( pUpper != 0 || bDisposing, "no upper found" ); + OSL_ENSURE( pUpper != 0 || bDisposing, "no upper found" ); uno::Reference< XAccessible > xAcc; if( pUpper ) xAcc = GetMap()->GetContext( pUpper, !bDisposing ); - ASSERT( xAcc.is() || bDisposing, "no parent found" ); + OSL_ENSURE( xAcc.is() || bDisposing, "no parent found" ); // Remember the parent as weak ref. { @@ -678,14 +678,14 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleIndexInParent (void) CHECK_FOR_DEFUNC( XAccessibleContext ) const SwFrm *pUpper = GetParent(); - ASSERT( pUpper != 0 || bDisposing, "no upper found" ); + OSL_ENSURE( pUpper != 0 || bDisposing, "no upper found" ); sal_Int32 nIndex = -1; if( pUpper ) { ::rtl::Reference < SwAccessibleContext > xAccImpl( GetMap()->GetContextImpl( pUpper, !bDisposing ) ); - ASSERT( xAccImpl.is() || bDisposing, "no parent found" ); + OSL_ENSURE( xAccImpl.is() || bDisposing, "no parent found" ); if( xAccImpl.is() ) nIndex = xAccImpl->GetChildIndex( *(GetMap()), SwAccessibleChild(GetFrm()) ); } @@ -702,7 +702,7 @@ sal_Int16 SAL_CALL SwAccessibleContext::getAccessibleRole (void) OUString SAL_CALL SwAccessibleContext::getAccessibleDescription (void) throw (uno::RuntimeException) { - ASSERT( !this, "description needs to be overloaded" ); + OSL_ENSURE( !this, "description needs to be overloaded" ); THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (method must be overloaded)" ); } @@ -873,7 +873,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative) CHECK_FOR_DEFUNC( XAccessibleComponent ) const SwFrm *pParent = GetParent(); - ASSERT( pParent, "no Parent found" ); + OSL_ENSURE( pParent, "no Parent found" ); Window *pWin = GetWindow(); CHECK_FOR_WINDOW( XAccessibleComponent, pWin && pParent ) @@ -883,7 +883,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative) if( GetFrm()->IsPageFrm() && static_cast < const SwPageFrm * >( GetFrm() )->IsEmptyPage() ) { - ASSERT( GetShell()->IsPreView(), "empty page accessible?" ); + OSL_ENSURE( GetShell()->IsPreView(), "empty page accessible?" ); if( GetShell()->IsPreView() ) { // OD 15.01.2003 #103492# - adjust method call <GetMap()->GetPreViewPageSize()> @@ -1016,7 +1016,7 @@ sal_Int32 SAL_CALL SwAccessibleContext::getBackground() OUString SAL_CALL SwAccessibleContext::getImplementationName() throw( uno::RuntimeException ) { - ASSERT( !this, "implementation name needs to be overloaded" ); + OSL_ENSURE( !this, "implementation name needs to be overloaded" ); THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "implementation name needs to be overloaded" ) } @@ -1025,14 +1025,14 @@ sal_Bool SAL_CALL SwAccessibleContext::supportsService (const ::rtl::OUString& ) throw (uno::RuntimeException) { - ASSERT( !this, "supports service needs to be overloaded" ); + OSL_ENSURE( !this, "supports service needs to be overloaded" ); THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "supports service needs to be overloaded" ) } uno::Sequence< OUString > SAL_CALL SwAccessibleContext::getSupportedServiceNames() throw( uno::RuntimeException ) { - ASSERT( !this, "supported services names needs to be overloaded" ); + OSL_ENSURE( !this, "supported services names needs to be overloaded" ); THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "supported services needs to be overloaded" ) } @@ -1081,8 +1081,8 @@ void SwAccessibleContext::Dispose( sal_Bool bRecursive ) { SolarMutexGuard aGuard; - ASSERT( GetFrm() && GetMap(), "already disposed" ); - ASSERT( GetMap()->GetVisArea() == GetVisArea(), + OSL_ENSURE( GetFrm() && GetMap(), "already disposed" ); + OSL_ENSURE( GetMap()->GetVisArea() == GetVisArea(), "invalid vis area for dispose" ); bDisposing = sal_True; @@ -1174,7 +1174,7 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& ) { SolarMutexGuard aGuard; - ASSERT( GetFrm() && !GetFrm()->Frm().IsEmpty(), "context should have a size" ); + OSL_ENSURE( GetFrm() && !GetFrm()->Frm().IsEmpty(), "context should have a size" ); sal_Bool bIsOldShowingState; sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) ); @@ -1213,7 +1213,7 @@ void SwAccessibleContext::InvalidateChildPosOrSize( { SolarMutexGuard aGuard; - ASSERT( !rChildFrmOrObj.GetSwFrm() || + OSL_ENSURE( !rChildFrmOrObj.GetSwFrm() || !rChildFrmOrObj.GetSwFrm()->Frm().IsEmpty(), "child context should have a size" ); @@ -1254,7 +1254,7 @@ void SwAccessibleContext::InvalidateChildPosOrSize( } else { - ASSERT( false , + OSL_ENSURE( false , "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - no accessible shape found." ); } // <-- @@ -1295,7 +1295,7 @@ void SwAccessibleContext::InvalidateChildPosOrSize( } else if ( rChildFrmOrObj.GetWindow() ) { - ASSERT( false, + OSL_ENSURE( false, "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - not expected to handle dispose of child of type <Window>." ); } } diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index e93cf81348..e7b8e8b431 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -99,7 +99,7 @@ void SwAccessibleDocumentBase::AddChild( Window *pWin, sal_Bool bFireEvent ) { SolarMutexGuard aGuard; - ASSERT( !mpChildWin, "only one child window is supported" ); + OSL_ENSURE( !mpChildWin, "only one child window is supported" ); if( !mpChildWin ) { mpChildWin = pWin; @@ -118,7 +118,7 @@ void SwAccessibleDocumentBase::RemoveChild( Window *pWin ) { SolarMutexGuard aGuard; - ASSERT( !mpChildWin || pWin == mpChildWin, "invalid child window to remove" ); + OSL_ENSURE( !mpChildWin || pWin == mpChildWin, "invalid child window to remove" ); if( mpChildWin && pWin == mpChildWin ) { AccessibleEventObject aEvent; @@ -338,7 +338,7 @@ SwAccessibleDocument::~SwAccessibleDocument() void SwAccessibleDocument::Dispose( sal_Bool bRecursive ) { - ASSERT( GetFrm() && GetMap(), "already disposed" ); + OSL_ENSURE( GetFrm() && GetMap(), "already disposed" ); Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : 0; if( pWin ) diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx index d0e76d103b..4bb48d0b82 100644 --- a/sw/source/core/access/accframe.cxx +++ b/sw/source/core/access/accframe.cxx @@ -361,7 +361,7 @@ sal_Bool SwAccessibleFrame::IsEditable( ViewShell *pVSh ) const if( !pFrm ) return sal_False; - ASSERT( pVSh, "no view shell" ); + OSL_ENSURE( pVSh, "no view shell" ); if( pVSh && (pVSh->GetViewOptions()->IsReadonly() || pVSh->IsPreView()) ) return sal_False; @@ -378,7 +378,7 @@ sal_Bool SwAccessibleFrame::IsOpaque( ViewShell *pVSh ) const if( !aFrm.GetSwFrm() ) return sal_False; - ASSERT( pVSh, "no view shell" ); + OSL_ENSURE( pVSh, "no view shell" ); if( !pVSh ) return sal_False; diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx index 647258c17c..f9c77e2a0e 100644 --- a/sw/source/core/access/accframebase.cxx +++ b/sw/source/core/access/accframebase.cxx @@ -90,7 +90,7 @@ void SwAccessibleFrameBase::GetStates( if( IsSelected() ) { rStateSet.AddState( AccessibleStateType::SELECTED ); - ASSERT( bIsSelected, "bSelected out of sync" ); + OSL_ENSURE( bIsSelected, "bSelected out of sync" ); ::rtl::Reference < SwAccessibleContext > xThis( this ); GetMap()->SetCursorContext( xThis ); @@ -199,7 +199,7 @@ void SwAccessibleFrameBase::_InvalidateFocus() osl::MutexGuard aGuard( aMutex ); bSelected = bIsSelected; } - ASSERT( bSelected, "focus object should be selected" ); + OSL_ENSURE( bSelected, "focus object should be selected" ); FireStateChangedEvent( AccessibleStateType::FOCUSED, pWin->HasFocus() && bSelected ); @@ -227,16 +227,16 @@ void SwAccessibleFrameBase::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) if( pFlyFrm ) { const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt(); - ASSERT( pFrmFmt == GetRegisteredIn(), "invalid frame" ); + OSL_ENSURE( pFrmFmt == GetRegisteredIn(), "invalid frame" ); OUString sOldName( GetName() ); - ASSERT( !pOld || + OSL_ENSURE( !pOld || static_cast < SwStringMsgPoolItem * >( pOld )->GetString() == String( sOldName ), "invalid old name" ); const String& rNewName = pFrmFmt->GetName(); SetName( rNewName ); - ASSERT( !pNew || + OSL_ENSURE( !pNew || static_cast < SwStringMsgPoolItem * >( pNew )->GetString() == rNewName, "invalid new name" ); diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx index a63e9e09d4..1e72847fbe 100644 --- a/sw/source/core/access/accfrmobj.cxx +++ b/sw/source/core/access/accfrmobj.cxx @@ -98,7 +98,7 @@ SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm, { Init( pWindow ); } - ASSERT( (!pFrm || pFrm == mpFrm) && + OSL_ENSURE( (!pFrm || pFrm == mpFrm) && (!pDrawObj || pDrawObj == mpDrawObj) && (!pWindow || pWindow == mpWindow), "invalid frame/object/window combination" ); @@ -347,7 +347,7 @@ const SwFrm* SwAccessibleChild::GetParent( const sal_Bool bInPagePreview ) const { // For FLY_AS_CHAR the parent is the anchor pParent = pFly->GetAnchorFrm(); - ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ), + OSL_ENSURE( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ), "parent is not accessible" ); } else @@ -374,16 +374,16 @@ const SwFrm* SwAccessibleChild::GetParent( const sal_Bool bInPagePreview ) const { const SwDrawContact *pContact = static_cast< const SwDrawContact* >( GetUserCall( mpDrawObj ) ); - ASSERT( pContact, "sdr contact is missing" ); + OSL_ENSURE( pContact, "sdr contact is missing" ); if( pContact ) { const SwFrmFmt *pFrmFmt = pContact->GetFmt(); - ASSERT( pFrmFmt, "frame format is missing" ); + OSL_ENSURE( pFrmFmt, "frame format is missing" ); if( pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() ) { // For FLY_AS_CHAR the parent is the anchor pParent = pContact->GetAnchorFrm(); - ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ), + OSL_ENSURE( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ), "parent is not accessible" ); } diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx index 3ace3e1a96..e7fd8644da 100644 --- a/sw/source/core/access/accfrmobjmap.cxx +++ b/sw/source/core/access/accfrmobjmap.cxx @@ -71,7 +71,7 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea, if ( rFrm.IsPageFrm() ) { - ASSERT( bVisibleChildrenOnly, "page frame within tab frame???" ); + OSL_ENSURE( bVisibleChildrenOnly, "page frame within tab frame???" ); const SwPageFrm *pPgFrm = static_cast< const SwPageFrm * >( &rFrm ); const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs(); diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx index 4967f022bd..96fd0c70bf 100644 --- a/sw/source/core/access/acchyperlink.cxx +++ b/sw/source/core/access/acchyperlink.cxx @@ -94,7 +94,7 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) { LoadURL( rINetFmt.GetValue(), pVSh, URLLOAD_NOFILTER, &rINetFmt.GetTargetFrame() ); - ASSERT( pTxtAttr == rINetFmt.GetTxtINetFmt(), + OSL_ENSURE( pTxtAttr == rINetFmt.GetTxtINetFmt(), "lost my txt attr" ); const SwTxtINetFmt* pTxtAttr2 = rINetFmt.GetTxtINetFmt(); if( pTxtAttr2 ) diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index e8df92467e..3c9a7d6794 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -95,12 +95,12 @@ class SwAccessibleContextMap_Impl: public _SwAccessibleContextMap_Impl { public: -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool mbLocked; #endif SwAccessibleContextMap_Impl() -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 : mbLocked( sal_False ) #endif {} @@ -165,7 +165,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, return; } - ASSERT( mpDrawModel, "draw model listener is disposed" ); + OSL_ENSURE( mpDrawModel, "draw model listener is disposed" ); if( !mpDrawModel ) return; @@ -218,11 +218,11 @@ class SwAccessibleShapeMap_Impl: public _SwAccessibleShapeMap_Impl public: -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool mbLocked; #endif SwAccessibleShapeMap_Impl( SwAccessibleMap *pMap ) -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 : mbLocked( sal_False ) #endif { @@ -296,7 +296,7 @@ SwAccessibleObjShape_Impl } ++aIter; } - ASSERT( pSelShape == pShape, "copying shapes went wrong!" ); + OSL_ENSURE( pSelShape == pShape, "copying shapes went wrong!" ); } if( pSelStart ) @@ -345,7 +345,7 @@ public: meType( eT ), mnStates( 0 ) { - ASSERT( SwAccessibleEvent_Impl::DISPOSE == meType, + OSL_ENSURE( SwAccessibleEvent_Impl::DISPOSE == meType, "wrong event constructor, DISPOSE only" ); } @@ -353,7 +353,7 @@ public: : meType( eT ), mnStates( 0 ) { - ASSERT( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType, + OSL_ENSURE( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType, "wrong event constructor, SHAPE_SELECTION only" ); } @@ -367,7 +367,7 @@ public: meType( eT ), mnStates( 0 ) { - ASSERT( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType || + OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType || SwAccessibleEvent_Impl::POS_CHANGED == meType, "wrong event constructor, (CHILD_)POS_CHANGED only" ); } @@ -381,7 +381,7 @@ public: meType( eT ), mnStates( _nStates ) { - ASSERT( SwAccessibleEvent_Impl::CARET_OR_STATES == meType, + OSL_ENSURE( SwAccessibleEvent_Impl::CARET_OR_STATES == meType, "wrong event constructor, CARET_OR_STATES only" ); } @@ -679,7 +679,7 @@ void SwAccPreviewData::Update( const SwAccessibleMap& rAccMap, void SwAccPreviewData::InvalidateSelection( const SwPageFrm* _pSelectedPageFrm ) { mpSelPage = _pSelectedPageFrm; - ASSERT( mpSelPage, "selected page not found" ); + OSL_ENSURE( mpSelPage, "selected page not found" ); } struct ContainsPredicate @@ -815,7 +815,7 @@ void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent ) rEvent.GetOldBox() ); break; case SwAccessibleEvent_Impl::DISPOSE: - ASSERT( xAccImpl.is(), + OSL_ENSURE( xAccImpl.is(), "dispose event has been stored" ); break; case SwAccessibleEvent_Impl::INVALID_ATTR: @@ -867,7 +867,7 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) { // While events are fired new ones are generated. They have to be fired // now. This does not work for DISPOSE events! - ASSERT( rEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE, + OSL_ENSURE( rEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE, "dispose event while firing events" ); FireEvent( rEvent ); } @@ -879,7 +879,7 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) if( aIter != mpEventMap->end() ) { SwAccessibleEvent_Impl aEvent( *(*aIter).second ); - ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE, + OSL_ENSURE( aEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE, "dispose events should not be stored" ); sal_Bool bAppendEvent = sal_True; switch( rEvent.GetType() ) @@ -888,7 +888,7 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) // A CARET_OR_STATES event is added to any other // event only. It is broadcasted after any other event, so the // event should be put to the back. - ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED, + OSL_ENSURE( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED, "invalid event combination" ); aEvent.SetStates( rEvent.GetAllStates() ); break; @@ -898,7 +898,7 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) // POS_CHANGED event. // Therefor, the event's type has to be adapted and the event // has to be put at the end. - ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED, + OSL_ENSURE( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED, "invalid event combination" ); if( aEvent.GetType() == SwAccessibleEvent_Impl::CARET_OR_STATES ) aEvent.SetType( SwAccessibleEvent_Impl::INVALID_CONTENT ); @@ -908,7 +908,7 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) // flags) as well as INVALID_CONTENT. The old box position // has to be stored however if the old event is not a // POS_CHANGED itself. - ASSERT( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED, + OSL_ENSURE( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED, "invalid event combination" ); if( aEvent.GetType() != SwAccessibleEvent_Impl::POS_CHANGED ) aEvent.SetOldBox( rEvent.GetOldBox() ); @@ -919,11 +919,11 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) // events. The only action that needs to be done again is // to put the old event to the back. The new one cannot be used, // because we are interested in the old frame bounds. - ASSERT( aEvent.GetType() == SwAccessibleEvent_Impl::CHILD_POS_CHANGED, + OSL_ENSURE( aEvent.GetType() == SwAccessibleEvent_Impl::CHILD_POS_CHANGED, "invalid event combination" ); break; case SwAccessibleEvent_Impl::SHAPE_SELECTION: - ASSERT( aEvent.GetType() == SwAccessibleEvent_Impl::SHAPE_SELECTION, + OSL_ENSURE( aEvent.GetType() == SwAccessibleEvent_Impl::SHAPE_SELECTION, "invalid event combination" ); break; case SwAccessibleEvent_Impl::DISPOSE: @@ -934,7 +934,7 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) bAppendEvent = sal_False; break; case SwAccessibleEvent_Impl::INVALID_ATTR: - ASSERT( aEvent.GetType() == SwAccessibleEvent_Impl::INVALID_ATTR, + OSL_ENSURE( aEvent.GetType() == SwAccessibleEvent_Impl::INVALID_ATTR, "invalid event combination" ); break; } @@ -963,8 +963,8 @@ void SwAccessibleMap::InvalidateCursorPosition( { SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( rAcc.get() ); - ASSERT( pAccImpl, "no caret context" ); - ASSERT( pAccImpl->GetFrm(), "caret context is disposed" ); + OSL_ENSURE( pAccImpl, "no caret context" ); + OSL_ENSURE( pAccImpl->GetFrm(), "caret context is disposed" ); if( GetShell()->ActionPend() ) { SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES, @@ -1175,8 +1175,8 @@ SwAccessibleMap::~SwAccessibleMap() { osl::MutexGuard aGuard( maMutex ); -#ifdef DBG_UTIL - ASSERT( !mpFrmMap || mpFrmMap->empty(), +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !mpFrmMap || mpFrmMap->empty(), "Frame map should be empty after disposing the root frame" ); if( mpFrmMap ) { @@ -1193,7 +1193,7 @@ SwAccessibleMap::~SwAccessibleMap() ++aIter; } } - ASSERT( !mpShapeMap || mpShapeMap->empty(), + OSL_ENSURE( !mpShapeMap || mpShapeMap->empty(), "Object map should be empty after disposing the root frame" ); if( mpShapeMap ) { @@ -1226,8 +1226,8 @@ SwAccessibleMap::~SwAccessibleMap() { osl::MutexGuard aGuard( maEventMutex ); -#ifdef DBG_UTIL - ASSERT( !(mpEvents || mpEventMap), "pending events" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !(mpEvents || mpEventMap), "pending events" ); if( mpEvents ) { SwAccessibleEventList_Impl::iterator aIter = mpEvents->begin(); @@ -1265,13 +1265,13 @@ uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView( if( !mpFrmMap ) { mpFrmMap = new SwAccessibleContextMap_Impl; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 mpFrmMap->mbLocked = sal_False; #endif } -#ifdef DBG_UTIL - ASSERT( !mpFrmMap->mbLocked, "Map is locked" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !mpFrmMap->mbLocked, "Map is locked" ); mpFrmMap->mbLocked = sal_True; #endif @@ -1302,7 +1302,7 @@ uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView( } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 mpFrmMap->mbLocked = sal_False; #endif } @@ -1418,7 +1418,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrm *pFrm, } xAcc = pAcc; - ASSERT( xAcc.is(), "unknown frame type" ); + OSL_ENSURE( xAcc.is(), "unknown frame type" ); if( xAcc.is() ) { if( aIter != mpFrmMap->end() ) @@ -1519,7 +1519,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( } xAcc = pAcc; - ASSERT( xAcc.is(), "unknown shape type" ); + OSL_ENSURE( xAcc.is(), "unknown shape type" ); if( xAcc.is() ) { pAcc->Init(); @@ -1580,7 +1580,7 @@ void SwAccessibleMap::RemoveContext( const SwFrm *pFrm ) { SwAccessibleContext *pOldAccImpl = static_cast< SwAccessibleContext *>( xOldAcc.get() ); - ASSERT( pOldAccImpl->GetFrm(), "old caret context is disposed" ); + OSL_ENSURE( pOldAccImpl->GetFrm(), "old caret context is disposed" ); if( pOldAccImpl->GetFrm() == pFrm ) { xOldAcc.clear(); // get an empty ref @@ -1634,7 +1634,7 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, // because that's the one that is evaluated in the layout. The frame // might not be accessible anyway. That's the case for cell frames that // contain further cells. - ASSERT( !aFrmOrObj.GetSwFrm() || aFrmOrObj.GetSwFrm()->IsAccessibleFrm(), + OSL_ENSURE( !aFrmOrObj.GetSwFrm() || aFrmOrObj.GetSwFrm()->IsAccessibleFrm(), "non accessible frame should be disposed" ); if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) ) @@ -1931,7 +1931,7 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) const SwFrm *pFlyFrm = pFESh->GetCurrFlyFrm(); if( pFlyFrm ) { - ASSERT( !pFrm || pFrm->FindFlyFrm() == pFlyFrm, + OSL_ENSURE( !pFrm || pFrm->FindFlyFrm() == pFlyFrm, "cursor is not contained in fly frame" ); aFrmOrObj = pFlyFrm; } @@ -1943,7 +1943,7 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) } } - ASSERT( bShapeSelected || aFrmOrObj.IsAccessible(GetShell()->IsPreView()), + OSL_ENSURE( bShapeSelected || aFrmOrObj.IsAccessible(GetShell()->IsPreView()), "frame is not accessible" ); uno::Reference < XAccessible > xOldAcc; @@ -2633,7 +2633,7 @@ SwAccessibleSelectedParas_Impl* SwAccessibleMap::_BuildSelectedParas() pFrm; pFrm = (SwFrm*)aIter.Next() ) { - ASSERT( dynamic_cast<SwTxtFrm*>(pFrm), + OSL_ENSURE( dynamic_cast<SwTxtFrm*>(pFrm), "<SwAccessibleMap::_BuildSelectedParas()> - unexpected frame type" ); SwTxtFrm* pTxtFrm( dynamic_cast<SwTxtFrm*>(pFrm) ); if ( pTxtFrm ) @@ -2734,7 +2734,7 @@ void SwAccessibleMap::InvalidateTextSelectionOfAllParas() { const SwTxtFrm* pTxtFrm( dynamic_cast<const SwTxtFrm*>(xAccImpl->GetFrm()) ); - ASSERT( pTxtFrm, + OSL_ENSURE( pTxtFrm, "<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexcepted type of frame" ); if ( pTxtFrm ) { @@ -2762,7 +2762,7 @@ void SwAccessibleMap::InvalidateTextSelectionOfAllParas() { const SwTxtFrm* pTxtFrm( dynamic_cast<const SwTxtFrm*>(xAccImpl->GetFrm()) ); - ASSERT( pTxtFrm, + OSL_ENSURE( pTxtFrm, "<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexcepted type of frame" ); if ( pTxtFrm ) { diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx index 2abd2e1151..8eaf92162d 100644 --- a/sw/source/core/access/accnotextframe.cxx +++ b/sw/source/core/access/accnotextframe.cxx @@ -106,7 +106,7 @@ void SwAccessibleNoTextFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) } const SwNoTxtNode *pNd = GetNoTxtNode(); - ASSERT( pNd == aDepend.GetRegisteredIn(), "invalid frame" ); + OSL_ENSURE( pNd == aDepend.GetRegisteredIn(), "invalid frame" ); switch( nWhich ) { // --> OD 2009-07-14 #i73249# diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx index a1015ca938..cd1dc8a02a 100644 --- a/sw/source/core/access/accpage.cxx +++ b/sw/source/core/access/accpage.cxx @@ -69,7 +69,7 @@ void SwAccessiblePage::GetStates( // FOCUSED if( IsSelected() ) { - ASSERT( bIsSelected, "bSelected out of sync" ); + OSL_ENSURE( bIsSelected, "bSelected out of sync" ); ::rtl::Reference < SwAccessibleContext > xThis( this ); GetMap()->SetCursorContext( xThis ); @@ -117,7 +117,7 @@ void SwAccessiblePage::_InvalidateFocus() osl::MutexGuard aGuard( aMutex ); bSelected = bIsSelected; } - ASSERT( bSelected, "focus object should be selected" ); + OSL_ENSURE( bSelected, "focus object should be selected" ); FireStateChangedEvent( AccessibleStateType::FOCUSED, pWin->HasFocus() && bSelected ); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 33f68a734d..8a1a24ea02 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -484,7 +484,7 @@ void SwAccessibleParagraph::_InvalidateFocus() osl::MutexGuard aGuard( aMutex ); nPos = nOldCaretPos; } - ASSERT( nPos != -1, "focus object should be selected" ); + OSL_ENSURE( nPos != -1, "focus object should be selected" ); FireStateChangedEvent( AccessibleStateType::FOCUSED, pWin->HasFocus() && nPos != -1 ); @@ -877,7 +877,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleParagraph::getAccess utl::AccessibleRelationSetHelper* pHelper = new utl::AccessibleRelationSetHelper(); const SwTxtFrm* pTxtFrm = dynamic_cast<const SwTxtFrm*>(GetFrm()); - ASSERT( pTxtFrm, + OSL_ENSURE( pTxtFrm, "<SwAccessibleParagraph::getAccessibleRelationSet()> - missing text frame"); if ( pTxtFrm ) { @@ -1147,7 +1147,7 @@ sal_Int32 SwAccessibleParagraph::getCaretPosition() sal_Int32 nRet = GetCaretPos(); { osl::MutexGuard aOldCaretPosGuard( aMutex ); - ASSERT( nRet == nOldCaretPos, "caret pos out of sync" ); + OSL_ENSURE( nRet == nOldCaretPos, "caret pos out of sync" ); nOldCaretPos = nRet; } if( -1 != nRet ) @@ -1299,7 +1299,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( pSet->Put( aParaSet ); } // get default character attributes and merge these into <pSet> - ASSERT( pTxtNode->GetTxtColl(), + OSL_ENSURE( pTxtNode->GetTxtColl(), "<SwAccessibleParagraph::_getDefaultAttributesImpl(..)> - missing paragraph style. Serious defect, please inform OD!" ); if ( pTxtNode->GetTxtColl() ) { diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index cbbbcccf27..558f19feec 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -237,17 +237,17 @@ sal_Bool SwAccessibleTableData_Impl::FindCell( { const SwAccessibleChild& rLower = *aIter; const SwFrm *pLower = rLower.GetSwFrm(); - ASSERT( pLower, "child should be a frame" ); + OSL_ENSURE( pLower, "child should be a frame" ); if( pLower ) { if( rLower.IsAccessible( mbIsInPagePreview ) ) { - ASSERT( pLower->IsCellFrm(), "lower is not a cell frame" ); + OSL_ENSURE( pLower->IsCellFrm(), "lower is not a cell frame" ); const SwRect& rFrm = pLower->Frm(); if( rFrm.Right() >= rPos.X() && rFrm.Bottom() >= rPos.Y() ) { // We have found the cell - ASSERT( rFrm.Left() <= rPos.X() && rFrm.Top() <= rPos.Y(), + OSL_ENSURE( rFrm.Left() <= rPos.X() && rFrm.Top() <= rPos.Y(), "find frame moved to far!" ); bFound = sal_True; if( !bExact || @@ -289,13 +289,13 @@ void SwAccessibleTableData_Impl::GetSelection( { const SwAccessibleChild& rLower = *aIter; const SwFrm *pLower = rLower.GetSwFrm(); - ASSERT( pLower, "child should be a frame" ); + OSL_ENSURE( pLower, "child should be a frame" ); const SwRect& rBox = rLower.GetBox( mrAccMap ); if( pLower && rBox.IsOver( rArea ) ) { if( rLower.IsAccessible( mbIsInPagePreview ) ) { - ASSERT( pLower->IsCellFrm(), "lower is not a cell frame" ); + OSL_ENSURE( pLower->IsCellFrm(), "lower is not a cell frame" ); const SwCellFrm *pCFrm = static_cast < const SwCellFrm * >( pLower ); SwTableBox *pBox = @@ -561,7 +561,7 @@ inline SwAccAllTableSelHander_Impl::SwAccAllTableSelHander_Impl( sal_Int32 nSize uno::Sequence < sal_Int32 > SwAccAllTableSelHander_Impl::GetSelSequence() { - ASSERT( nCount >= 0, "underflow" ); + OSL_ENSURE( nCount >= 0, "underflow" ); uno::Sequence < sal_Int32 > aRet( nCount ); sal_Int32 *pRet = aRet.getArray(); sal_Int32 nPos = 0; @@ -575,7 +575,7 @@ uno::Sequence < sal_Int32 > SwAccAllTableSelHander_Impl::GetSelSequence() } } - ASSERT( nPos == nCount, "count is wrong" ); + OSL_ENSURE( nPos == nCount, "count is wrong" ); return aRet; } @@ -583,9 +583,9 @@ uno::Sequence < sal_Int32 > SwAccAllTableSelHander_Impl::GetSelSequence() void SwAccAllTableSelHander_Impl::Unselect( sal_Int32 nRowOrCol, sal_Int32 nExt ) { - ASSERT( static_cast< size_t >( nRowOrCol ) < aSelected.size(), + OSL_ENSURE( static_cast< size_t >( nRowOrCol ) < aSelected.size(), "index to large" ); - ASSERT( static_cast< size_t >( nRowOrCol+nExt ) <= aSelected.size(), + OSL_ENSURE( static_cast< size_t >( nRowOrCol+nExt ) <= aSelected.size(), "extent to large" ); while( nExt ) { @@ -751,7 +751,7 @@ void SwAccessibleTable::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) if( pTabFrm ) { const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt(); - ASSERT( pFrmFmt == GetRegisteredIn(), "invalid frame" ); + OSL_ENSURE( pFrmFmt == GetRegisteredIn(), "invalid frame" ); OUString sOldName( GetName() ); @@ -919,7 +919,7 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription( { uno::Reference< XAccessible > xRowHeaderCell = xTableRowHeader->getAccessibleCellAt( nRow, 0 ); - ASSERT( xRowHeaderCell.is(), + OSL_ENSURE( xRowHeaderCell.is(), "<SwAccessibleTable::getAccessibleRowDescription(..)> - missing row header cell -> serious issue." ); uno::Reference< XAccessibleContext > xRowHeaderCellContext = xRowHeaderCell->getAccessibleContext(); @@ -955,7 +955,7 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription( { uno::Reference< XAccessible > xColumnHeaderCell = xTableColumnHeader->getAccessibleCellAt( 0, nColumn ); - ASSERT( xColumnHeaderCell.is(), + OSL_ENSURE( xColumnHeaderCell.is(), "<SwAccessibleTable::getAccessibleColumnDescription(..)> - missing column header cell -> serious issue." ); uno::Reference< XAccessibleContext > xColumnHeaderCellContext = xColumnHeaderCell->getAccessibleContext(); @@ -1271,7 +1271,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex ) } else { - ASSERT( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:" + OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:" "aCell not expected to be valid."); throw lang::IndexOutOfBoundsException(); @@ -1310,7 +1310,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumn( } else { - ASSERT( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:" + OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:" "aCell not expected to be valid."); throw lang::IndexOutOfBoundsException(); @@ -1372,7 +1372,7 @@ void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrmOrObj, SolarMutexGuard aGuard; const SwFrm *pFrm = rChildFrmOrObj.GetSwFrm(); - ASSERT( pFrm, "frame expected" ); + OSL_ENSURE( pFrm, "frame expected" ); if( HasTableData() ) { FireTableChangeEvent( GetTableData() ); @@ -1396,7 +1396,7 @@ void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChil if( HasTableData() ) { - ASSERT( !HasTableData() || + OSL_ENSURE( !HasTableData() || GetFrm()->Frm().Pos() == GetTableData().GetTablePos(), "table has invalid position" ); if( HasTableData() ) diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx index e3b9c4fd1b..8dd2af0a0d 100644 --- a/sw/source/core/access/parachangetrackinginfo.cxx +++ b/sw/source/core/access/parachangetrackinginfo.cxx @@ -57,7 +57,7 @@ namespace { if ( !rTxtFrm.GetTxtNode() ) { - ASSERT( false, + OSL_ENSURE( false, "<initChangeTrackTextMarkupLists(..) - missing <SwTxtNode> instance!" ); return; } @@ -66,7 +66,7 @@ namespace { const IDocumentRedlineAccess* pIDocChangeTrack( rTxtNode.getIDocumentRedlineAccess() ); if ( !pIDocChangeTrack ) { - ASSERT( false, + OSL_ENSURE( false, "<initChangeTrackTextMarkupLists(..) - missing <IDocumentRedlineAccess> instance!" ); return; } @@ -194,9 +194,9 @@ const SwWrongList* SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList( co if ( mpChangeTrackInsertionTextMarkupList == 0 ) { - ASSERT( mpChangeTrackDeletionTextMarkupList == 0, + OSL_ENSURE( mpChangeTrackDeletionTextMarkupList == 0, "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackDeletionTextMarkupList> expected to be NULL." ); - ASSERT( mpChangeTrackFormatChangeTextMarkupList == 0, + OSL_ENSURE( mpChangeTrackFormatChangeTextMarkupList == 0, "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackFormatChangeTextMarkupList> expected to be NULL." ); initChangeTrackTextMarkupLists( mrTxtFrm, mpChangeTrackInsertionTextMarkupList, @@ -223,7 +223,7 @@ const SwWrongList* SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList( co break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..)> - misusage - unexpected text markup type for change tracking." ); } } diff --git a/sw/source/core/access/textmarkuphelper.cxx b/sw/source/core/access/textmarkuphelper.cxx index c62a2981e6..e49054879a 100644 --- a/sw/source/core/access/textmarkuphelper.cxx +++ b/sw/source/core/access/textmarkuphelper.cxx @@ -162,7 +162,7 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 nTextMarkupTyp } else { - ASSERT( false, + OSL_ENSURE( false, "<SwTextMarkupHelper::getTextMarkup(..)> - missing <SwWrongArea> instance" ); } } @@ -204,7 +204,7 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 nTextMarkupTyp { const SwWrongArea* pTextMarkup = pTextMarkupList->GetElement( static_cast<USHORT>(nTextMarkupIdx) ); - ASSERT( pTextMarkup, + OSL_ENSURE( pTextMarkup, "<SwTextMarkupHelper::getTextMarkup(..)> - missing <SwWrongArea> instance" ); if ( pTextMarkup && pTextMarkup->mnPos <= nCoreCharIndex && diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 9e5294413d..6381df188e 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -36,7 +36,7 @@ #include <swcache.hxx> #include <swfntcch.hxx> -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include <unotextmarkup.hxx> #endif @@ -107,7 +107,7 @@ SwClient::~SwClient() if( pRegisteredIn && pRegisteredIn->GetDepends() ) pRegisteredIn->Remove( this ); - ASSERT( !IsModifyLocked(), "Modify destroyed but locked." ); + OSL_ENSURE( !IsModifyLocked(), "Modify destroyed but locked." ); } @@ -209,9 +209,7 @@ void SwModify::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) LockModify(); -#ifndef DBG_UTIL - bInModify = TRUE; -#else +#if OSL_DEBUG_LEVEL > 1 if( !pOldValue ) bInModify = TRUE; else @@ -232,6 +230,8 @@ void SwModify::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) default: bInModify = TRUE; } +#else + bInModify = TRUE; #endif SwClientIter aIter( *this ); @@ -280,16 +280,16 @@ BOOL SwModify::GetInfo( SfxPoolItem& rInfo ) const void SwModify::Add(SwClient *pDepend) { - ASSERT( !bInModify, "Client innerhalb des eigenen Modifies einfuegen?" ); + OSL_ENSURE( !bInModify, "Client innerhalb des eigenen Modifies einfuegen?" ); // nur wenn das hier noch nicht eingetragen ist einfuegen if(pDepend->pRegisteredIn != this ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwClientIter* pTmp = pClientIters; while( pTmp ) { - ASSERT( &pTmp->rRoot != pRoot, + OSL_ENSURE( &pTmp->rRoot != pRoot, "Client beim angemeldeten ClientIter einfuegen?" ); pTmp = pTmp->pNxtIter; } @@ -331,7 +331,9 @@ void SwModify::Add(SwClient *pDepend) SwClient *SwModify::_Remove(SwClient * pDepend) { // FME 2007-07-16 #i79641# SwXTextMarkup is allowed to be removed ... - ASSERT( !bInModify || 0 != dynamic_cast<SwXTextMarkup*>(pDepend), "Client innerhalb des eigenen Modifies loeschen?" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !bInModify || 0 != dynamic_cast<SwXTextMarkup*>(pDepend), "Client innerhalb des eigenen Modifies loeschen?" ); +#endif // loesche das Object aus der Liste und setze den // Registrierungs-Pointer zurueck @@ -366,7 +368,7 @@ SwClient *SwModify::_Remove(SwClient * pDepend) pDepend->pRight = 0; } else { - ASSERT( FALSE, "SwModify::Remove(): pDepend nicht gefunden"); + OSL_ENSURE( FALSE, "SwModify::Remove(): pDepend nicht gefunden"); } pDepend->pRegisteredIn = 0; return pDepend; @@ -495,7 +497,7 @@ SwClientIter::~SwClientIter() while( pTmp->pNxtIter != this ) if( 0 == ( pTmp = pTmp->pNxtIter ) ) { - ASSERT( this, "wo ist mein Pointer" ); + OSL_ENSURE( this, "wo ist mein Pointer" ); return ; } pTmp->pNxtIter = pNxtIter; diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx index 2196b02f0b..4cb92a0e4f 100644 --- a/sw/source/core/attr/cellatr.cxx +++ b/sw/source/core/attr/cellatr.cxx @@ -60,7 +60,7 @@ SwTblBoxNumFormat::SwTblBoxNumFormat( UINT32 nFormat, BOOL bFlag ) int SwTblBoxNumFormat::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return GetValue() == ((SwTblBoxNumFormat&)rAttr).GetValue() && bAuto == ((SwTblBoxNumFormat&)rAttr).bAuto; } @@ -88,7 +88,7 @@ SwTblBoxFormula::SwTblBoxFormula( const String& rFormula ) int SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return GetFormula() == ((SwTblBoxFormula&)rAttr).GetFormula() && pDefinedIn == ((SwTblBoxFormula&)rAttr).pDefinedIn; } @@ -248,7 +248,7 @@ SwTblBoxValue::SwTblBoxValue( const double nVal ) int SwTblBoxValue::operator==( const SfxPoolItem& rAttr ) const { - ASSERT(SfxPoolItem::operator==(rAttr), "SwTblBoxValue: item not equal"); + OSL_ENSURE(SfxPoolItem::operator==(rAttr), "SwTblBoxValue: item not equal"); SwTblBoxValue const& rOther( static_cast<SwTblBoxValue const&>(rAttr) ); // items with NaN should be equal to enable pooling return ::rtl::math::isNan(nValue) diff --git a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx index f5c2b5cdba..49de186fde 100644 --- a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx +++ b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx @@ -65,7 +65,7 @@ SwFmtWrapInfluenceOnObjPos& SwFmtWrapInfluenceOnObjPos::operator=( int SwFmtWrapInfluenceOnObjPos::operator==( const SfxPoolItem& _rAttr ) const { - ASSERT( SfxPoolItem::operator==( _rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( _rAttr ), "keine gleichen Attribute" ); return ( mnWrapInfluenceOnPosition == static_cast<const SwFmtWrapInfluenceOnObjPos&>(_rAttr). GetWrapInfluenceOnObjPos() ); @@ -88,7 +88,7 @@ bool SwFmtWrapInfluenceOnObjPos::QueryValue( Any& rVal, BYTE nMemberId ) const } break; default: - ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" ); + OSL_ENSURE( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" ); bRet = false; } @@ -117,13 +117,13 @@ bool SwFmtWrapInfluenceOnObjPos::PutValue( const Any& rVal, BYTE nMemberId ) } else { - ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" ); + OSL_ENSURE( false, "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" ); bRet = false; } } break; default: - ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" ); + OSL_ENSURE( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" ); bRet = false; } @@ -143,7 +143,7 @@ void SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInflu } else { - ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos(..)> - invalid attribute value" ); + OSL_ENSURE( false, "<SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos(..)> - invalid attribute value" ); } } diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 9fc327136d..9b4aaceae4 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -165,7 +165,7 @@ SwFmt &SwFmt::operator=(const SwFmt& rFmt) void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast ) { - ASSERT(!IsDefault(), "SetName: Defaultformat" ); + OSL_ENSURE(!IsDefault(), "SetName: Defaultformat" ); if( bBroadcast ) { SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName ); @@ -253,7 +253,7 @@ SwFmt::~SwFmt() /* alle Abhaengigen auf DerivedFrom umhaengen */ if( GetDepends() ) { - ASSERT(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" ); + OSL_ENSURE(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" ); bFmtInDTOR = TRUE; @@ -372,9 +372,9 @@ void SwFmt::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) { // wie finde ich heraus, ob nicht ich die Message versende ?? // aber wer ruft das hier ???? -//ASSERT( FALSE, "Modify ohne Absender verschickt" ); +// OSL_ENSURE( FALSE, "Modify ohne Absender verschickt" ); //JP 11.06.96: DropCaps koennen hierher kommen -ASSERT( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" ); + OSL_ENSURE( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" ); bWeiter = FALSE; } @@ -414,7 +414,7 @@ BOOL SwFmt::SetDerivedFrom(SwFmt *pDerFrom) if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) ) return FALSE; - ASSERT( Which()==pDerFrom->Which() + OSL_ENSURE( Which()==pDerFrom->Which() || ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL) || ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL) || ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ), diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index bd102377ba..de91cc847e 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -84,7 +84,7 @@ SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput ) : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ), pOut( pOutput ) { - ASSERT( pOut, "es muss ein OutputDevice-Pointer gesetzt werden!" ); + OSL_ENSURE( pOut, "es muss ein OutputDevice-Pointer gesetzt werden!" ); } @@ -103,7 +103,7 @@ SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl ) { DATA.pDelTbl = 0; bModified = bBehindSplitLine = FALSE; - ASSERT( pTbl, "es muss ein Table-Pointer gesetzt werden!" ); + OSL_ENSURE( pTbl, "es muss ein Table-Pointer gesetzt werden!" ); } @@ -137,11 +137,11 @@ SwAttrSetChg::~SwAttrSetChg() } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void SwAttrSetChg::ClearItem( USHORT nWhch ) { - ASSERT( bDelSet, "der Set darf nicht veraendert werden!" ); + OSL_ENSURE( bDelSet, "der Set darf nicht veraendert werden!" ); pChgSet->ClearItem( nWhch ); } @@ -156,14 +156,14 @@ SwMsgPoolItem::SwMsgPoolItem( USHORT nWhch ) // "Overhead" vom SfxPoolItem int SwMsgPoolItem::operator==( const SfxPoolItem& ) const { - ASSERT( FALSE, "SwMsgPoolItem kennt kein ==" ); + OSL_ENSURE( FALSE, "SwMsgPoolItem kennt kein ==" ); return 0; } SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const { - ASSERT( FALSE, "SwMsgPoolItem kennt kein Clone" ); + OSL_ENSURE( FALSE, "SwMsgPoolItem kennt kein Clone" ); return 0; } @@ -173,21 +173,21 @@ SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const * Ist keines vorhanden, returnt ein 0-Pointer !!! * Used to be inlined (hintids.hxx) in PRODUCT. ******************************************************************************/ -#ifndef DBG_UTIL -const SfxPoolItem* GetDfltAttr( USHORT nWhich ) -{ - return aAttrTab[ nWhich - POOLATTR_BEGIN ]; -} -#else +#if OSL_DEBUG_LEVEL > 1 const SfxPoolItem* GetDfltAttr( USHORT nWhich ) { ASSERT_ID( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN, ERR_OUTOFSCOPE ); SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ]; - ASSERT( pHt, "GetDfltFmtAttr(): Dflt == 0" ); + OSL_ENSURE( pHt, "GetDfltFmtAttr(): Dflt == 0" ); return pHt; } +#else +const SfxPoolItem* GetDfltAttr( USHORT nWhich ) +{ + return aAttrTab[ nWhich - POOLATTR_BEGIN ]; +} #endif diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx index 0a65d55667..c7bf788640 100644 --- a/sw/source/core/attr/swatrset.cxx +++ b/sw/source/core/attr/swatrset.cxx @@ -158,7 +158,7 @@ USHORT SwAttrSet::ClearItem_BC( USHORT nWhich, USHORT SwAttrSet::ClearItem_BC( USHORT nWhich1, USHORT nWhich2, SwAttrSet* pOld, SwAttrSet* pNew ) { - ASSERT( nWhich1 <= nWhich2, "kein gueltiger Bereich" ); + OSL_ENSURE( nWhich1 <= nWhich2, "kein gueltiger Bereich" ); pNewSet = pNew; pOldSet = pOld; USHORT nRet = 0; @@ -383,9 +383,9 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const // <-- } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else - ASSERT( !this, "weder Format noch ContentNode - keine Attribute kopiert"); + OSL_ENSURE( !this, "weder Format noch ContentNode - keine Attribute kopiert"); #endif } diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index f82f23bbbc..28a4daa767 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -39,11 +39,7 @@ // immer ~ 20 * MAXENTRY == 20000 Eintraege const USHORT nBlockGrowSize = 20; -#ifndef DBG_UTIL - -#define CHECKIDX( p, n, i, c ) - -#else +#if OSL_DEBUG_LEVEL > 2 #define CHECKIDX( p, n, i, c ) CheckIdx( p, n, i, c ); @@ -63,6 +59,10 @@ void CheckIdx( BlockInfo** ppInf, USHORT nBlock, ULONG nSize, USHORT nCur ) DBG_ASSERT( nIdx == nSize, "BigPtrArray: Anzahl ungueltig" ); } +#else + +#define CHECKIDX( p, n, i, c ) + #endif diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 42a35037a8..296ed748bb 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -601,7 +601,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins ) pMgr->OpenDataSource(sSourceName, sTableName, -1, false)) { String sColumnName( GetColumnName( sTmpName )); - ASSERT (sColumnName.Len(), "DB-Spaltenname fehlt!"); + OSL_ENSURE(sColumnName.Len(), "DB-Spaltenname fehlt!"); String sDBNum( SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD) ); pCharClass->toLower(sDBNum); @@ -651,7 +651,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins ) VarTable[ ii ] = pNewExp; String sColumnName( GetColumnName( sTmpName )); - ASSERT( sColumnName.Len(), "DB-Spaltenname fehlt!" ); + OSL_ENSURE( sColumnName.Len(), "DB-Spaltenname fehlt!" ); if( sColumnName.EqualsIgnoreCaseAscii( SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) )) { @@ -732,7 +732,7 @@ BOOL SwCalc::Push( const VoidPtr pPtr ) void SwCalc::Pop( const VoidPtr ) { - ASSERT( aRekurStk.Count(), "SwCalc: Pop auf ungueltigen Ptr" ); + OSL_ENSURE( aRekurStk.Count(), "SwCalc: Pop auf ungueltigen Ptr" ); aRekurStk.Remove( aRekurStk.Count() - 1 ); } diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx index abb2a07636..bff41705d6 100644 --- a/sw/source/core/bastyp/index.cxx +++ b/sw/source/core/bastyp/index.cxx @@ -37,7 +37,7 @@ #include "index.hxx" #include "error.h" // fuers ASSERT -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 int SwIndex::nSerial = 0; #endif @@ -53,7 +53,7 @@ TYPEINIT0(SwIndexReg); // rtti void SwIndexReg::ChkArr() { - ASSERT( (pFirst && pLast) || (!pFirst && !pLast), + OSL_ENSURE( (pFirst && pLast) || (!pFirst && !pLast), "Array falsch Indiziert" ); if( !pFirst ) @@ -61,15 +61,15 @@ void SwIndexReg::ChkArr() xub_StrLen nVal = 0; const SwIndex* pIdx = pFirst, *pPrev = 0; - ASSERT( !pIdx->pPrev, "Array-pFirst nicht am Anfang" ); + OSL_ENSURE( !pIdx->pPrev, "Array-pFirst nicht am Anfang" ); while( pIdx != pLast ) { - ASSERT( pIdx->pPrev != pIdx && pIdx->pNext != pIdx, - "Index zeigt auf sich selbst" ) + OSL_ENSURE( pIdx->pPrev != pIdx && pIdx->pNext != pIdx, + "Index zeigt auf sich selbst" ); - ASSERT( pIdx->nIndex >= nVal, "Reihenfolge stimmt nicht" ); - ASSERT( pPrev == pIdx->pPrev, "Verkettung stimmt nicht" ); + OSL_ENSURE( pIdx->nIndex >= nVal, "Reihenfolge stimmt nicht" ); + OSL_ENSURE( pPrev == pIdx->pPrev, "Verkettung stimmt nicht" ); pPrev = pIdx; pIdx = pIdx->pNext; nVal = pPrev->nIndex; @@ -101,7 +101,7 @@ SwIndex::SwIndex(SwIndexReg *const pArr, xub_StrLen const nIdx) else ChgValue( *pArray->pFirst, nIdx ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif IDX_CHK_ARRAY @@ -113,7 +113,7 @@ SwIndex::SwIndex( const SwIndex& rIdx, short nIdx ) { ChgValue( rIdx, rIdx.nIndex + nIdx ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif IDX_CHK_ARRAY @@ -124,7 +124,7 @@ SwIndex::SwIndex( const SwIndex& rIdx ) : nIndex( rIdx.nIndex ), pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 ) { ChgValue( rIdx, rIdx.nIndex ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif IDX_CHK_ARRAY @@ -321,7 +321,7 @@ SwIndexReg::SwIndexReg() SwIndexReg::~SwIndexReg() { - ASSERT( !pFirst || !pLast, "Es sind noch Indizies angemeldet" ); + OSL_ENSURE( !pFirst || !pLast, "Es sind noch Indizies angemeldet" ); } @@ -369,7 +369,7 @@ void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff, ARR_CHK_ARRAY } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #ifndef CFRONT /************************************************************************* @@ -505,7 +505,7 @@ xub_StrLen SwIndex::operator-=( const SwIndex & rIndex ) BOOL SwIndex::operator<( const SwIndex & rIndex ) const { - ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); + OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); return nIndex < rIndex.nIndex; } @@ -521,7 +521,7 @@ BOOL SwIndex::operator<( const SwIndex & rIndex ) const BOOL SwIndex::operator<=( const SwIndex & rIndex ) const { - ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); + OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); return nIndex <= rIndex.nIndex; } @@ -537,7 +537,7 @@ BOOL SwIndex::operator<=( const SwIndex & rIndex ) const BOOL SwIndex::operator>( const SwIndex & rIndex ) const { - ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); + OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); return nIndex > rIndex.nIndex; } @@ -553,7 +553,7 @@ BOOL SwIndex::operator>( const SwIndex & rIndex ) const BOOL SwIndex::operator>=( const SwIndex & rIndex ) const { - ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); + OSL_ENSURE( pArray == rIndex.pArray, "Attempt to compare indices into different arrays."); return nIndex >= rIndex.nIndex; } diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index b5b006572f..1b42c0e09d 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -773,7 +773,7 @@ void _FinitCore() delete SwEditShell::pAutoFmtFlags; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //Defaultattribut freigeben lassen um asserts zu vermeiden. if ( aAttrTab[0]->GetRefCount() ) SfxItemPool::ReleaseDefaults( aAttrTab, POOLATTR_END-POOLATTR_BEGIN, FALSE); diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx index b9f068dc42..0ed62cf0d2 100644 --- a/sw/source/core/bastyp/swcache.cxx +++ b/sw/source/core/bastyp/swcache.cxx @@ -36,10 +36,10 @@ SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*); -#ifndef DBG_UTIL -#define INCREMENT( nVar ) -#else +#if OSL_DEBUG_LEVEL > 1 #define INCREMENT( nVar ) ++nVar +#else +#define INCREMENT( nVar ) #endif /************************************************************************* @@ -51,7 +51,7 @@ SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*); |* |*************************************************************************/ -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void SwCache::Check() { @@ -59,8 +59,8 @@ void SwCache::Check() return; //Konsistenspruefung. - ASSERT( !pLast->GetNext(), "Last but not last." ); - ASSERT( !pRealFirst->GetPrev(), "First but not first." ); + OSL_ENSURE( !pLast->GetNext(), "Last but not last." ); + OSL_ENSURE( !pRealFirst->GetPrev(), "First but not first." ); USHORT nCnt = 0; BOOL bFirstFound = FALSE; SwCacheObj *pObj = pRealFirst; @@ -71,24 +71,24 @@ void SwCache::Check() SwCacheObj *pTmp = pLast; while ( pTmp && pTmp != pObj ) pTmp = pTmp->GetPrev(); - ASSERT( pTmp, "Objekt not found." ); + OSL_ENSURE( pTmp, "Objekt not found." ); ++nCnt; if ( pObj == pFirst ) bFirstFound = TRUE; if ( !pObj->GetNext() ) - ASSERT( pObj == pLast, "Last not Found." ); + OSL_ENSURE( pObj == pLast, "Last not Found." ); pObj = pObj->GetNext(); - ASSERT( pObj != pRekursive, "Recursion in SwCache." ); + OSL_ENSURE( pObj != pRekursive, "Recursion in SwCache." ); } - ASSERT( bFirstFound, "First not Found." ); - ASSERT( (nCnt + aFreePositions.Count()) == Count(), "Lost Chain." ); + OSL_ENSURE( bFirstFound, "First not Found." ); + OSL_ENSURE( (nCnt + aFreePositions.Count()) == Count(), "Lost Chain." ); if ( Count() == nCurMax ) - ASSERT( (nCurMax - nCnt) == aFreePositions.Count(), "Lost FreePositions." ); + OSL_ENSURE( (nCurMax - nCnt) == aFreePositions.Count(), "Lost FreePositions." ); } #endif -#if defined(DBG_UTIL) && defined(MADEBUG) +#if OSL_DEBUG_LEVEL > 1 #define CHECK Check(); #else #define CHECK @@ -105,7 +105,7 @@ void SwCache::Check() SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 , const ByteString &rNm #endif ) : @@ -116,7 +116,7 @@ SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize pLast( 0 ), nMax( nInitSize ), nCurMax( nInitSize ) -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 , aName( rNm ), nAppend( 0 ), nInsertFree( 0 ), @@ -135,7 +135,7 @@ SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize { } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwCache::~SwCache() @@ -195,10 +195,10 @@ void SwCache::Flush( const BYTE ) SwCacheObj *pTmp; while ( pObj ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( pObj->IsLocked() ) { - ASSERT( TRUE, "Flushing locked objects." ); + OSL_ENSURE( TRUE, "Flushing locked objects." ); if ( !pRealFirst ) { pRealFirst = pFirst = pLast = pObj; @@ -250,7 +250,7 @@ void SwCache::ToTop( SwCacheObj *pObj ) if ( !pRealFirst ) { //Der erste wird eingetragen. - ASSERT( !pFirst && !pLast, "First not first." ); + OSL_ENSURE( !pFirst && !pLast, "First not first." ); pRealFirst = pFirst = pLast = pObj; CHECK; return; @@ -259,7 +259,7 @@ void SwCache::ToTop( SwCacheObj *pObj ) //Ausschneiden. if ( pObj == pLast ) { - ASSERT( pObj->GetPrev(), "Last but no Prev." ); + OSL_ENSURE( pObj->GetPrev(), "Last but no Prev." ); pLast = pObj->GetPrev(); pLast->SetNext( 0 ); } @@ -282,7 +282,7 @@ void SwCache::ToTop( SwCacheObj *pObj ) } else { - ASSERT( pFirst, "ToTop, First ist not RealFirst an Empty." ); + OSL_ENSURE( pFirst, "ToTop, First ist not RealFirst an Empty." ); if ( pFirst->GetPrev() ) { @@ -320,7 +320,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const USHORT nIndex, ToTop( pRet ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( pRet ) ++nGetSuccess; else @@ -344,7 +344,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const BOOL bToTop ) if ( bToTop && pRet && pRet != pFirst ) ToTop( pRet ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( pRet ) ++nGetSuccess; else @@ -367,7 +367,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const BOOL bToTop ) void SwCache::DeleteObj( SwCacheObj *pObj ) { CHECK; - ASSERT( !pObj->IsLocked(), "SwCache::Delete: Object ist Locked." ); + OSL_ENSURE( !pObj->IsLocked(), "SwCache::Delete: Object ist Locked." ); if ( pObj->IsLocked() ) return; @@ -437,7 +437,7 @@ void SwCache::Delete( const void *pOwner ) BOOL SwCache::Insert( SwCacheObj *pNew ) { CHECK; - ASSERT( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." ); + OSL_ENSURE( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." ); USHORT nPos;//Wird hinter den if's zum setzen am Obj benutzt. if ( Count() < nCurMax ) @@ -466,13 +466,13 @@ BOOL SwCache::Insert( SwCacheObj *pNew ) pObj = pObj->GetPrev(); if ( !pObj ) { - ASSERT( FALSE, "Cache overflow." ); + OSL_ENSURE( FALSE, "Cache overflow." ); return FALSE; } nPos = pObj->GetCachePos(); if ( pObj == pLast ) - { ASSERT( pObj->GetPrev(), "Last but no Prev" ); + { OSL_ENSURE( pObj->GetPrev(), "Last but no Prev" ); pLast = pObj->GetPrev(); pLast->SetNext( 0 ); } @@ -500,7 +500,7 @@ BOOL SwCache::Insert( SwCacheObj *pNew ) pNew->SetNext( pFirst ); } else - { ASSERT( !pLast, "Last but no First." ); + { OSL_ENSURE( !pLast, "Last but no First." ); pLast = pNew; } if ( pFirst == pRealFirst ) @@ -572,13 +572,13 @@ SwCacheObj::~SwCacheObj() |* |*************************************************************************/ -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void SwCacheObj::Lock() { - ASSERT( nLock < UCHAR_MAX, "To many Locks for CacheObject." ); + OSL_ENSURE( nLock < UCHAR_MAX, "To many Locks for CacheObject." ); ++nLock; } @@ -586,7 +586,7 @@ void SwCacheObj::Lock() void SwCacheObj::Unlock() { - ASSERT( nLock, "No more Locks available." ); + OSL_ENSURE( nLock, "No more Locks available." ); --nLock; } #endif @@ -610,7 +610,7 @@ SwCacheAccess::~SwCacheAccess() void SwCacheAccess::_Get() { - ASSERT( !pObj, "SwCacheAcces Obj already available." ); + OSL_ENSURE( !pObj, "SwCacheAcces Obj already available." ); pObj = NewObj(); if ( !rCache.Insert( pObj ) ) diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index da4aa4efdc..6999b9d722 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -30,7 +30,7 @@ #include "precompiled_sw.hxx" -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include <tools/stream.hxx> #endif #include <stdlib.h> @@ -310,7 +310,7 @@ void SwRect::SetUpperRightCorner( const Point& rNew ) void SwRect::SetLowerLeftCorner( const Point& rNew ) { m_Point = Point(rNew.nA, rNew.nB - m_Size.getHeight()); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 /************************************************************************* * operator<<( ostream&, SwRect&) *************************************************************************/ diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx index 27a488579c..b87ad1fe2f 100644 --- a/sw/source/core/bastyp/tabcol.cxx +++ b/sw/source/core/bastyp/tabcol.cxx @@ -61,11 +61,11 @@ SwTabCols::SwTabCols( const SwTabCols& rCpy ) : SwTabColsEntry aEntry2 = rCpy.GetData()[i]; (void) aEntry1; (void) aEntry2; - ASSERT( aEntry1.nPos == aEntry2.nPos && + OSL_ENSURE( aEntry1.nPos == aEntry2.nPos && aEntry1.nMin == aEntry2.nMin && aEntry1.nMax == aEntry2.nMax && aEntry1.bHidden == aEntry2.bHidden, - "CopyContructor of SwTabColsEntries did not succeed!" ) + "CopyContructor of SwTabColsEntries did not succeed!" ); } #endif } diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index 53f5425c91..ea998febda 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -244,7 +244,7 @@ SwCallLink::~SwCallLink() 0 != ( pFlyFrm = pFrm->FindFlyFrm() ) && !rShell.IsTableMode() ) { const SwNodeIndex* pIndex = pFlyFrm->GetFmt()->GetCntnt().GetCntntIdx(); - ASSERT( pIndex, "Fly ohne Cntnt" ); + OSL_ENSURE( pIndex, "Fly ohne Cntnt" ); if (!pIndex) return; diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 171233cb6f..5b92560e5a 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -133,7 +133,7 @@ void CheckRange( SwCursor* pCurCrsr ) SwPaM * SwCrsrShell::CreateCrsr() { // Innerhalb der Tabellen-SSelection keinen neuen Crsr anlegen - ASSERT( !IsTableMode(), "in Tabellen SSelection" ); + OSL_ENSURE( !IsTableMode(), "in Tabellen SSelection" ); // neuen Cursor als Kopie vom akt. und in den Ring aufnehmen // Verkettung zeigt immer auf den zuerst erzeugten, also vorwaerts @@ -158,7 +158,7 @@ SwPaM * SwCrsrShell::CreateCrsr() BOOL SwCrsrShell::DestroyCrsr() { // Innerhalb der Tabellen-SSelection keinen neuen Crsr loeschen - ASSERT( !IsTableMode(), "in Tabellen SSelection" ); + OSL_ENSURE( !IsTableMode(), "in Tabellen SSelection" ); // ist ueberhaupt ein naechtser vorhanden ? if(pCurCrsr->GetNext() == pCurCrsr) @@ -318,18 +318,18 @@ if( GetWin() ) } -#if defined(DBG_UTIL) +#if OSL_DEBUG_LEVEL > 1 void SwCrsrShell::SttCrsrMove() { - ASSERT( nCrsrMove < USHRT_MAX, "To many nested CrsrMoves." ); + OSL_ENSURE( nCrsrMove < USHRT_MAX, "To many nested CrsrMoves." ); ++nCrsrMove; StartAction(); } void SwCrsrShell::EndCrsrMove( const BOOL bIdleEnd ) { - ASSERT( nCrsrMove, "EndCrsrMove() ohne SttCrsrMove()." ); + OSL_ENSURE( nCrsrMove, "EndCrsrMove() ohne SttCrsrMove()." ); EndAction( bIdleEnd ); if( !--nCrsrMove ) bInCMvVisportChgd = FALSE; @@ -437,8 +437,8 @@ void SwCrsrShell::UpdateMarkedListLevel() { if ( pTxtNd->IsInList() ) { - ASSERT( pTxtNd->GetActualListLevel() >= 0 && - pTxtNd->GetActualListLevel() < MAXLEVEL, "Which level?") + OSL_ENSURE( pTxtNd->GetActualListLevel() >= 0 && + pTxtNd->GetActualListLevel() < MAXLEVEL, "Which level?"); MarkListLevel( pTxtNd->GetListId(), pTxtNd->GetActualListLevel() ); } @@ -778,13 +778,13 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, BOOL bOnlyText, bool bBlock ) void SwCrsrShell::TblCrsrToCursor() { - ASSERT( pTblCrsr, "TblCrsrToCursor: Why?" ); + OSL_ENSURE( pTblCrsr, "TblCrsrToCursor: Why?" ); delete pTblCrsr, pTblCrsr = 0; } void SwCrsrShell::BlockCrsrToCrsr() { - ASSERT( pBlockCrsr, "BlockCrsrToCrsr: Why?" ); + OSL_ENSURE( pBlockCrsr, "BlockCrsrToCrsr: Why?" ); if( pBlockCrsr && !HasSelection() ) { SwPaM& rPam = pBlockCrsr->getShellCrsr(); @@ -1264,7 +1264,7 @@ static void lcl_CheckHiddenSection( SwNodeIndex& rIdx ) #if OSL_DEBUG_LEVEL > 1 (void) pFrmNd; - ASSERT( pFrmNd, "keinen Node mit Frames gefunden" ); + OSL_ENSURE( pFrmNd, "keinen Node mit Frames gefunden" ); #endif rIdx = aTmp; } @@ -1367,7 +1367,7 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) SwCntntFrm *pTblFrm = pPos->nNode.GetNode().GetCntntNode()-> GetFrm( &aTmpPt, pPos ); - ASSERT( pTblFrm, "Tabelle Crsr nicht im Content ??" ); + OSL_ENSURE( pTblFrm, "Tabelle Crsr nicht im Content ??" ); // --> FME 2005-12-02 #126107# Make code robust. The table // cursor may point to a table in a currently inactive header. @@ -1383,12 +1383,12 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) if ( !bInRepeatedHeadline ) { SwCntntFrm* pMarkTblFrm = pITmpCrsr->GetCntntNode( FALSE )->GetFrm( &aTmpMk, pITmpCrsr->GetMark() ); - ASSERT( pMarkTblFrm, "Tabelle Crsr nicht im Content ??" ); + OSL_ENSURE( pMarkTblFrm, "Tabelle Crsr nicht im Content ??" ); if ( pMarkTblFrm ) { SwTabFrm* pMarkTab = pMarkTblFrm->FindTabFrm(); - ASSERT( pMarkTab, "Tabelle Crsr nicht im Content ??" ); + OSL_ENSURE( pMarkTab, "Tabelle Crsr nicht im Content ??" ); // --> FME 2005-11-28 #120360# Make code robust: if ( pMarkTab ) @@ -1444,11 +1444,11 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) Point aCentrPt( aCharRect.Center() ); aTmpState.bSetInReadOnly = IsReadOnlyAvailable(); pTblFrm->GetCrsrOfst( pTblCrsr->GetPoint(), aCentrPt, &aTmpState ); -#ifndef DBG_UTIL - pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ); -#else +#if OSL_DEBUG_LEVEL > 1 if ( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ) ) - ASSERT( !this, "GetCharRect failed." ); + OSL_ENSURE( !this, "GetCharRect failed." ); +#else + pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ); #endif } @@ -1701,7 +1701,7 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) // siehe Bug: 29658 if( !--nLoopCnt ) { - ASSERT( !this, "Endlosschleife? CharRect != OldCharRect "); + OSL_ENSURE( !this, "Endlosschleife? CharRect != OldCharRect "); break; } aOld = aCharRect; @@ -1786,7 +1786,7 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) void SwCrsrShell::RefreshBlockCursor() { - ASSERT( pBlockCrsr, "Don't call me without a block cursor" ); + OSL_ENSURE( pBlockCrsr, "Don't call me without a block cursor" ); SwShellCrsr &rBlock = pBlockCrsr->getShellCrsr(); Point aPt = rBlock.GetPtPos(); SwCntntFrm* pFrm = rBlock.GetCntntNode()->GetFrm( &aPt, rBlock.GetPoint() ); @@ -1823,7 +1823,7 @@ void SwCrsrShell::RefreshBlockCursor() std::list<SwPaM*>::iterator pStart = aSelList.getStart(); std::list<SwPaM*>::iterator pPam = aSelList.getEnd(); - ASSERT( pPam != pStart, "FillSelection should deliver at least one PaM" ) + OSL_ENSURE( pPam != pStart, "FillSelection should deliver at least one PaM" ); pCurCrsr->SetMark(); --pPam; // If there is only one text portion inside the rectangle, a simple @@ -1990,11 +1990,11 @@ void SwCrsrShell::Combine() SwCrsrSaveState aSaveState( *pCurCrsr ); if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde { -#ifndef DBG_UTIL - CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, TRUE ); -#else +#if OSL_DEBUG_LEVEL > 1 if( !CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, TRUE )) - ASSERT( !this, "StackCrsr & akt. Crsr nicht in gleicher Section." ); + OSL_ENSURE( !this, "StackCrsr & akt. Crsr nicht in gleicher Section." ); +#else + CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, TRUE ); #endif // kopiere das GetMark if( !pCurCrsr->HasMark() ) @@ -2243,7 +2243,7 @@ BOOL SwCrsrShell::ExtendSelection( BOOL bEnd, xub_StrLen nCount ) SwPosition* pPos = bEnd ? pCurCrsr->End() : pCurCrsr->Start(); SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "kein TextNode, wie soll erweitert werden?" ); + OSL_ENSURE( pTxtNd, "kein TextNode, wie soll erweitert werden?" ); xub_StrLen nPos = pPos->nContent.GetIndex(); if( bEnd ) @@ -2682,7 +2682,7 @@ USHORT SwCrsrShell::UpdateTblSelBoxes() // zeige das akt. selektierte "Object" an void SwCrsrShell::MakeSelVisible() { - ASSERT( bHasFocus, "kein Focus aber Cursor sichtbar machen?" ); + OSL_ENSURE( bHasFocus, "kein Focus aber Cursor sichtbar machen?" ); if( aCrsrHeight.Y() < aCharRect.Height() && aCharRect.Height() > VisArea().Height() ) { SwRect aTmp( aCharRect ); @@ -2720,7 +2720,7 @@ BOOL SwCrsrShell::FindValidCntntNode( BOOL bOnlyText ) { if( pTblCrsr ) // was soll ich jetzt machen ?? { - ASSERT( !this, "TabellenSelection nicht aufgehoben!" ); + OSL_ENSURE( !this, "TabellenSelection nicht aufgehoben!" ); return FALSE; } @@ -3138,7 +3138,7 @@ void SwCrsrShell::SetSelection( const SwPaM& rCrsr ) void lcl_RemoveMark( SwPaM* pPam ) { - ASSERT( pPam->HasMark(), "Don't remove pPoint!" ) + OSL_ENSURE( pPam->HasMark(), "Don't remove pPoint!" ); pPam->GetMark()->nContent.Assign( 0, 0 ); pPam->GetMark()->nNode = 0; pPam->DeleteMark(); @@ -3231,7 +3231,7 @@ void SwCrsrShell::ClearUpCrsrs() } bool bFound = (pNode != NULL); - ASSERT(bFound, "no content node found"); + OSL_ENSURE(bFound, "no content node found"); if (bFound) { diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 12ae978510..e610ed5042 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -701,7 +701,7 @@ BOOL SwCrsrShell::MoveFldType( const SwFieldType* pFldType, BOOL bNext, const SwPosition& rPos = *pCrsr->GetPoint(); SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode(); - ASSERT( pTNd, "Wo ist mein CntntNode?" ); + OSL_ENSURE( pTNd, "Wo ist mein CntntNode?" ); SwTxtFld * pTxtFld = static_cast<SwTxtFld *>( pTNd->GetTxtAttrForCharAt(rPos.nContent.GetIndex(), @@ -918,7 +918,7 @@ BOOL SwCrsrShell::MakeOutlineSel( USHORT nSttPos, USHORT nEndPos, if( nSttPos > nEndPos ) // sollte jemand das vertauscht haben? { - ASSERT( !this, "Start- > Ende-Position im Array" ); + OSL_ENSURE( !this, "Start- > Ende-Position im Array" ); USHORT nTmp = nSttPos; nSttPos = nEndPos; nEndPos = nTmp; @@ -1356,7 +1356,7 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) && 0 != ( pBox = pTblNd->GetTable().GetTblBox( pSttNd->GetIndex() )) && -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState( RES_BOXATR_FORMULA, FALSE, &pItem ) || SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState( @@ -1801,7 +1801,7 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) GetDoc()->InsertItemSet( *pCurCrsr, aSet, 0 ); } else { - ASSERT( !this, "wo ist mein CntntNode?" ); + OSL_ENSURE( !this, "wo ist mein CntntNode?" ); } break; diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 17a094cdd9..65b6c969bf 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -435,7 +435,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) // vorhanden, auf den Stack. Aber nur wenn es noch grosser ist if( pCmp->nEnd > aTmp.nEnd ) { - ASSERT( !pStackArr[ nWhch - nArrStart ].nWhich, + OSL_ENSURE( !pStackArr[ nWhch - nArrStart ].nWhich, "Stack-Platz ist noch belegt" ); if( aTmp.nStt <= pCmp->nStt ) @@ -588,7 +588,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) // vorhanden, auf den Stack. Aber nur wenn es noch grosser ist if( pCmp->nStt < aTmp.nStt ) { - ASSERT( !pStackArr[ nWhch - nArrStart ].nWhich, + OSL_ENSURE( !pStackArr[ nWhch - nArrStart ].nWhich, "Stack-Platz ist noch belegt" ); if( aTmp.nEnd <= pCmp->nEnd ) @@ -667,7 +667,7 @@ int SwAttrCheckArr::CheckStack() { // alle die "offen" sind, heisst ueber die Start Position ragen, // im FndSet setzen - ASSERT( !pFndArr[ n ].nWhich, "Array-Platz ist noch belegt" ); + OSL_ENSURE( !pFndArr[ n ].nWhich, "Array-Platz ist noch belegt" ); pFndArr[ n ] = *pArrPtr; pArrPtr->nWhich = 0; nFound++; diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 3d5c243b9f..4896237537 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -161,7 +161,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, } break; default: - ASSERT( false, "unknown case in lcl_CleanStr" ) + OSL_ENSURE( false, "unknown case in lcl_CleanStr" ); break; } } diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 87215573ba..e1527b4a6a 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -551,7 +551,7 @@ void SwPaM::SetMark() (*m_pMark) = (*m_pPoint); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void SwPaM::Exchange() { @@ -756,7 +756,7 @@ BOOL SwPaM::HasReadonlySel( bool bFormView ) const if( pFmt->GetProtect().IsCntntProtected() ) { const SwFmtCntnt& rCntnt = pFmt->GetCntnt(FALSE); - ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" ); ULONG nIdx = rCntnt.GetCntntIdx()->GetIndex(); if( nSttIdx <= nIdx && nEndIdx >= nIdx && rCntnt.GetCntntIdx()->GetNode().GetNodes().IsDocNodes() ) diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 266a612914..71d7945235 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -326,7 +326,7 @@ BOOL SwCursor::IsSelOvr( int eFlags ) if( rProtect.IsCntntProtected() ) { const SwFmtCntnt& rCntnt = pFmt->GetCntnt(FALSE); - ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" ); ULONG nIdx = rCntnt.GetCntntIdx()->GetIndex(); if( nSttIdx <= nIdx && nEndIdx >= nIdx ) { @@ -536,7 +536,7 @@ BOOL SwCursor::IsInProtectTable( BOOL bMove, BOOL bChgCrsr ) // Check for convered cell: bool bInCoveredCell = false; const SwStartNode* pTmpSttNode = pCNd->FindTableBoxStartNode(); - ASSERT( pTmpSttNode, "In table, therefore I expect to get a SwTableBoxStartNode" ) + OSL_ENSURE( pTmpSttNode, "In table, therefore I expect to get a SwTableBoxStartNode" ); const SwTableBox* pBox = pTmpSttNode ? pTableNode->GetTable().GetTblBox( pTmpSttNode->GetIndex() ) : 0; //Robust #151355 if ( pBox && pBox->getRowSpan() < 1 ) // Robust #151270 bInCoveredCell = true; @@ -1641,7 +1641,7 @@ BOOL SwCursor::LeftRight( BOOL bLeft, USHORT nCnt, USHORT nMode, else fnGo = CRSR_SKIP_CELLS == nMode ? fnGoCntntCells : fnGoCntnt; - // ASSERT( not in covered cell ) + // OSL_ENSURE( not in covered cell ) while( nCnt ) { @@ -1835,7 +1835,7 @@ BOOL SwCursor::UpDown( BOOL bUp, USHORT nCnt, // set the point to the last frame in the table box. This is // only necessary if we do not already have a table selection const SwStartNode* pTblNd = GetNode( TRUE )->FindTableBoxStartNode(); - ASSERT( pTblNd, "pTblCrsr without SwTableNode?" ) + OSL_ENSURE( pTblNd, "pTblCrsr without SwTableNode?" ); if ( pTblNd ) // safety first { diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 24368c1a6c..f466c34e1e 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -99,7 +99,7 @@ BOOL SwCrsrShell::GoNextCell( BOOL bAppendLine ) pCrsr->GetPoint()->nNode.GetNode(). StartOfSectionIndex() ); - ASSERT( pTableBox, "Box steht nicht in dieser Tabelle" ); + OSL_ENSURE( pTableBox, "Box steht nicht in dieser Tabelle" ); SwSelBoxes aBoxes; //Das Dokument veraendert sich evtl. ohne Action wuerden die Sichten @@ -305,7 +305,7 @@ BOOL SwCrsrShell::SelTblBox() const SwStartNode* pStartNode = pCurCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // the old code checks whether we're in a table by asking the // frame. This should yield the same result as searching for the // table box start node, right? @@ -365,7 +365,7 @@ bool lcl_FindNextCell( SwNodeIndex& rIdx, BOOL bInReadOnly ) if ( !pTblNd ) { - ASSERT( false, "lcl_FindNextCell not celled with table start node!" ) + OSL_ENSURE( false, "lcl_FindNextCell not celled with table start node!" ); return false; } @@ -443,7 +443,7 @@ bool lcl_FindPrevCell( SwNodeIndex& rIdx, BOOL bInReadOnly ) if ( !pTblNd ) { - ASSERT( false, "lcl_FindPrevCell not celled with table start node!" ) + OSL_ENSURE( false, "lcl_FindPrevCell not celled with table start node!" ); return false; } @@ -756,7 +756,7 @@ String SwCrsrShell::GetBoxNms() const pFrm = pFrm->GetUpper(); } while ( pFrm && !pFrm->IsCellFrm() ); - ASSERT( pFrm, "kein Frame zur Box" ); + OSL_ENSURE( pFrm, "kein Frame zur Box" ); sNm = ((SwCellFrm*)pFrm)->GetTabBox()->GetName(); sNm += ':'; pPos = pTblCrsr->End(); diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx index a8cbc61024..3dc6bc55c2 100644 --- a/sw/source/core/crsr/unocrsr.cxx +++ b/sw/source/core/crsr/unocrsr.cxx @@ -68,7 +68,7 @@ SwUnoCrsr::~SwUnoCrsr() if( USHRT_MAX != nDelPos ) rTbl.Remove( nDelPos ); else { - ASSERT( !this, "UNO Cursor nicht mehr im Array" ); + OSL_ENSURE( !this, "UNO Cursor nicht mehr im Array" ); } } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index ec304ba966..4c9066f4fd 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -298,7 +298,7 @@ void SwVisCrsr::Hide() void __EXPORT SwVisCrsr::Timeout() { - ASSERT( !bIsDragCrsr, "Timer vorher abschalten" ); + OSL_ENSURE( !bIsDragCrsr, "Timer vorher abschalten" ); if( bIsVisible ) { if ( !pCrsrShell->GetWin() ) //SwFrmFmt::GetGraphic setzt das Win temp aus! @@ -756,7 +756,7 @@ BOOL SwShellCrsr::UpDown( BOOL bUp, USHORT nCnt ) &GetPtPos(), GetShell()->GetUpDownX() ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung // am sichtbaren Cursor @@ -853,7 +853,7 @@ void SwShellTableCrsr::FillRects() while( pFrm && !pFrm->IsCellFrm() ) pFrm = pFrm->GetUpper(); - ASSERT( pFrm, "Node nicht in einer Tabelle" ); + OSL_ENSURE( pFrm, "Node nicht in einer Tabelle" ); while ( pFrm ) { @@ -888,14 +888,14 @@ BOOL SwShellTableCrsr::IsInside( const Point& rPt ) const SwFrm* pFrm = pCNd->GetFrm( &GetPtPos() ); while( pFrm && !pFrm->IsCellFrm() ) pFrm = pFrm->GetUpper(); - ASSERT( pFrm, "Node nicht in einer Tabelle" ); + OSL_ENSURE( pFrm, "Node nicht in einer Tabelle" ); if( pFrm && pFrm->Frm().IsInside( rPt ) ) return TRUE; } return FALSE; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung // am sichtbaren Cursor diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx index 6b8e430c1d..12c56ca650 100644 --- a/sw/source/core/doc/acmplwrd.cxx +++ b/sw/source/core/doc/acmplwrd.cxx @@ -55,7 +55,7 @@ class SwAutoCompleteClient : public SwClient { SwAutoCompleteWord* pAutoCompleteWord; SwDoc* pDoc; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static ULONG nSwAutoCompleteClientCount; #endif public: @@ -67,7 +67,7 @@ public: virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew); const SwDoc& GetDoc(){return *pDoc;} -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static ULONG GetElementCount() {return nSwAutoCompleteClientCount;} #endif }; @@ -89,7 +89,7 @@ typedef const SwDoc* SwDocPtr; typedef std::vector<SwDocPtr> SwDocPtrVector; class SwAutoCompleteString : public String { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static ULONG nSwAutoCompleteStringCount; #endif SwDocPtrVector aSourceDocs; @@ -100,11 +100,11 @@ class SwAutoCompleteString : public String void AddDocument(const SwDoc& rDoc); //returns true if last document reference has been removed sal_Bool RemoveDocument(const SwDoc& rDoc); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static ULONG GetElementCount() {return nSwAutoCompleteStringCount;} #endif }; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ULONG SwAutoCompleteClient::nSwAutoCompleteClientCount = 0; ULONG SwAutoCompleteString::nSwAutoCompleteStringCount = 0; #endif @@ -114,7 +114,7 @@ SwAutoCompleteClient::SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& r pDoc(&rSwDoc) { pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ++nSwAutoCompleteClientCount; #endif } @@ -125,14 +125,14 @@ SwAutoCompleteClient::SwAutoCompleteClient(const SwAutoCompleteClient& rClient) pDoc(rClient.pDoc) { pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ++nSwAutoCompleteClientCount; #endif } SwAutoCompleteClient::~SwAutoCompleteClient() { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 --nSwAutoCompleteClientCount; #endif } @@ -189,14 +189,14 @@ void SwAutoCompleteWord_Impl::RemoveDocument(const SwDoc& rDoc) SwAutoCompleteString::SwAutoCompleteString(const String& rStr, xub_StrLen nPos, xub_StrLen nLen) : String( rStr, nPos, nLen ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ++nSwAutoCompleteStringCount; #endif } SwAutoCompleteString::~SwAutoCompleteString() { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 --nSwAutoCompleteStringCount; #endif } @@ -245,7 +245,7 @@ SwAutoCompleteWord::~SwAutoCompleteWord() delete pCurrent; } delete pImpl; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ULONG nStrings = SwAutoCompleteString::GetElementCount(); ULONG nClients = SwAutoCompleteClient::GetElementCount(); DBG_ASSERT(!nStrings && !nClients, "AutoComplete: clients or string count mismatch"); @@ -310,7 +310,7 @@ BOOL SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) pCurrent->AddDocument(rDoc); nInsPos = aLRULst.GetPos( (void*)pNew ); - ASSERT( USHRT_MAX != nInsPos, "String nicht gefunden" ); + OSL_ENSURE( USHRT_MAX != nInsPos, "String nicht gefunden" ); if( nInsPos ) { void** ppData = (void**)aLRULst.GetData(); @@ -331,7 +331,7 @@ void SwAutoCompleteWord::SetMaxCount( USHORT nNewMax ) while( nNewMax < aWordLst.Count() && nLRUIndex < aLRULst.Count()) { USHORT nPos = aWordLst.GetPos( (String*)aLRULst[ nLRUIndex++ ] ); - ASSERT( USHRT_MAX != nPos, "String nicht gefunden" ); + OSL_ENSURE( USHRT_MAX != nPos, "String nicht gefunden" ); void * pDel = aWordLst[nPos]; aWordLst.Remove(nPos); delete (SwAutoCompleteString*)pDel; @@ -357,7 +357,7 @@ void SwAutoCompleteWord::SetMinWordLen( USHORT n ) aWordLst.Remove(nPos); USHORT nDelPos = aLRULst.GetPos( pDel ); - ASSERT( USHRT_MAX != nDelPos, "String nicht gefunden" ); + OSL_ENSURE( USHRT_MAX != nDelPos, "String nicht gefunden" ); aLRULst.Remove( nDelPos ); --nPos; delete (SwAutoCompleteString*)pDel; @@ -395,7 +395,7 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst ) aWordLst.Remove(nMyPos); USHORT nPos = aLRULst.GetPos( pDel ); - ASSERT( USHRT_MAX != nPos, "String nicht gefunden" ); + OSL_ENSURE( USHRT_MAX != nPos, "String nicht gefunden" ); aLRULst.Remove( nPos ); delete (SwAutoCompleteString*)pDel; if( nMyPos >= --nMyLen ) @@ -410,7 +410,7 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst ) { void* pDel = aWordLst[ nNewPos ]; USHORT nPos = aLRULst.GetPos( pDel ); - ASSERT( USHRT_MAX != nPos, "String nicht gefunden" ); + OSL_ENSURE( USHRT_MAX != nPos, "String nicht gefunden" ); aLRULst.Remove( nPos ); delete (SwAutoCompleteString*)pDel; } diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 17ae2826c1..c818c54686 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -550,7 +550,7 @@ String lcl_dbg_out(const SwNode & rNode) aTmpStr += String::CreateFromInt32(rNode.GetIndex()); aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 aTmpStr += String(" serial=\"", RTL_TEXTENCODING_ASCII_US); aTmpStr += String::CreateFromInt32(rNode.GetSerial()); aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US); @@ -1042,7 +1042,7 @@ String lcl_TokenType2Str(FormTokenType nType) return String("??", RTL_TEXTENCODING_ASCII_US); } - ASSERT(false, "should not be reached"); + OSL_ENSURE(false, "should not be reached"); return String("??", RTL_TEXTENCODING_ASCII_US); } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 27689b50e1..30f398504d 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -142,7 +142,7 @@ SV_IMPL_PTRARR( SwFldTypes, SwFldTypePtr) /* IInterface */ sal_Int32 SwDoc::acquire() { - OSL_ASSERT(mReferenceCount >= 0 && "Negative reference count detected! This is a sign for unbalanced acquire/release calls."); + OSL_ENSURE(mReferenceCount >= 0, "Negative reference count detected! This is a sign for unbalanced acquire/release calls."); return osl_incrementInterlockedCount(&mReferenceCount); } @@ -154,7 +154,7 @@ sal_Int32 SwDoc::release() sal_Int32 SwDoc::getReferenceCount() const { - OSL_ASSERT(mReferenceCount >= 0 && "Negative reference count detected! This is a sign for unbalanced acquire/release calls."); + OSL_ENSURE(mReferenceCount >= 0, "Negative reference count detected! This is a sign for unbalanced acquire/release calls."); return mReferenceCount; } @@ -206,7 +206,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation; case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont; default: - ASSERT(false, "Invalid setting id"); + OSL_ENSURE(false, "Invalid setting id"); } return false; } @@ -360,7 +360,7 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) break; default: - ASSERT(false, "Invalid setting id"); + OSL_ENSURE(false, "Invalid setting id"); } } @@ -773,7 +773,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) _SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), aBkmkArr, SAVEFLY_SPLIT ); // FIXME: only SwTxtNode has a valid implementation of SplitCntntNode! - ASSERT(pNode->IsTxtNode(), "splitting non-text node?"); + OSL_ENSURE(pNode->IsTxtNode(), "splitting non-text node?"); pNode = pNode->SplitCntntNode( rPos ); if (pNode) { @@ -2082,7 +2082,7 @@ BOOL lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void* ) ************************************************************************/ void SwDoc::SpellItAgainSam( BOOL bInvalid, BOOL bOnlyWrong, BOOL bSmartTags ) { - ASSERT( GetRootFrm(), "SpellAgain: Where's my RootFrm?" ); + OSL_ENSURE( GetRootFrm(), "SpellAgain: Where's my RootFrm?" ); if( bInvalid ) { SwPageFrm *pPage = (SwPageFrm*)GetRootFrm()->Lower(); diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index 7628704ecb..5ded86eb0e 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -79,7 +79,7 @@ BOOL SwTable::IsTblComplexForChart( const String& rSelection, if( '>' == sBox.GetChar( sBox.Len()-1 ) ) sBox.Erase( sBox.Len()-1 ); xub_StrLen nTrenner = sBox.Search( ':' ); - ASSERT( STRING_NOTFOUND != nTrenner, "keine gueltige Selektion" ); + OSL_ENSURE( STRING_NOTFOUND != nTrenner, "keine gueltige Selektion" ); pSttBox = GetTblBox( sBox.Copy( 0, nTrenner )); pEndBox = GetTblBox( sBox.Copy( nTrenner+1 )); diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 9627404694..f05f36a76d 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -369,7 +369,7 @@ void Hash::CalcHashValue( CompareData& rData ) for( ULONG n = 0; n < rData.GetLineCount(); ++n ) { const CompareLine* pLine = rData.GetLine( n ); - ASSERT( pLine, "wo ist die Line?" ); + OSL_ENSURE( pLine, "wo ist die Line?" ); ULONG nH = pLine->GetHashValue(); ULONG* pFound = &pHashArr[ nH % nPrime ]; diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 120d17d0e9..997e4e6bb5 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -196,7 +196,7 @@ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) { - ASSERT( i < aPageDescs.Count(), "PageDescs ueberindiziert." ); + OSL_ENSURE( i < aPageDescs.Count(), "PageDescs ueberindiziert." ); SwPageDesc *pDesc = aPageDescs[i]; @@ -485,7 +485,7 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel) ((SwFmt*)pMod)->SetFmtAttr( aDfltDesc ); else { - ASSERT( !this, "was ist das fuer ein Mofify-Obj?" ); + OSL_ENSURE( !this, "was ist das fuer ein Mofify-Obj?" ); aPageDescs[0]->Add( pLast ); } } @@ -554,8 +554,8 @@ void SwDoc::BroadcastStyleOperation(String rName, SfxStyleFamily eFamily, void SwDoc::DelPageDesc( USHORT i, BOOL bBroadcast ) { - ASSERT( i < aPageDescs.Count(), "PageDescs ueberindiziert." ); - ASSERT( i != 0, "Default Pagedesc loeschen is nicht." ); + OSL_ENSURE( i < aPageDescs.Count(), "PageDescs ueberindiziert." ); + OSL_ENSURE( i != 0, "Default Pagedesc loeschen is nicht." ); if ( i == 0 ) return; @@ -661,8 +661,8 @@ void SwDoc::PrtDataChanged() //!!!!!!!! Bei Aenderungen hier bitte ggf. InJobSetup im Sw3io mitpflegen // --> FME 2005-01-21 #i41075# - ASSERT( get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) || - 0 != getPrinter( sal_False ), "PrtDataChanged will be called recursive!" ) + OSL_ENSURE( get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) || + 0 != getPrinter( sal_False ), "PrtDataChanged will be called recursive!" ); // <-- SwWait *pWait = 0; diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 415f905cb7..712c4e6dcb 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -96,14 +96,14 @@ void lcl_AdjustPositioningAttr( SwDrawFrmFmt* _pFrmFmt, const SdrObject& _rSdrObj ) { const SwContact* pContact = GetUserCall( &_rSdrObj ); - ASSERT( pContact, "<lcl_AdjustPositioningAttr(..)> - missing contact object." ); + OSL_ENSURE( pContact, "<lcl_AdjustPositioningAttr(..)> - missing contact object." ); // determine position of new group object relative to its anchor frame position SwTwips nHoriRelPos = 0; SwTwips nVertRelPos = 0; { const SwFrm* pAnchorFrm = pContact->GetAnchoredObj( &_rSdrObj )->GetAnchorFrm(); - ASSERT( !pAnchorFrm || + OSL_ENSURE( !pAnchorFrm || !pAnchorFrm->IsTxtFrm() || !static_cast<const SwTxtFrm*>(pAnchorFrm)->IsFollow(), "<lcl_AdjustPositioningAttr(..)> - anchor frame is a follow. Please inform OD." ); @@ -136,7 +136,7 @@ void lcl_AdjustPositioningAttr( SwDrawFrmFmt* _pFrmFmt, // vertical from left-to-right - not supported yet bVert = true; bR2L = true; - ASSERT( false, + OSL_ENSURE( false, "<lcl_AdjustPositioningAttr(..)> - vertical from left-to-right not supported." ); } break; @@ -241,10 +241,10 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); // --> OD 2005-08-16 #i53320# -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwAnchoredDrawObject* pAnchoredDrawObj = static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( pObj )); - ASSERT( bGroupMembersNotPositioned == pAnchoredDrawObj->NotYetPositioned(), + OSL_ENSURE( bGroupMembersNotPositioned == pAnchoredDrawObj->NotYetPositioned(), "<SwDoc::GroupSelection(..)> - group members have different positioning status!" ); #endif // <-- @@ -278,7 +278,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) // <-- rDrawView.GroupMarked(); - ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." ); + OSL_ENSURE( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." ); SdrObject* pNewGroupObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); pNewContact = new SwDrawContact( pFmt, pNewGroupObj ); @@ -308,7 +308,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) ClearRedo(); rDrawView.GroupMarked(); - ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." ); + OSL_ENSURE( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." ); } return pNewContact; @@ -483,7 +483,7 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) // Thus, assert, if a <SwDrawVirt>-object is found in the mark list. if ( pObj->ISA(SwDrawVirtObj) ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawVirtObj> is still marked for delete. application will crash!" ); } //loescht sich selbst! @@ -550,7 +550,7 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn, nOrdNum = ((SwDrawContact*)aIter())->GetMaster()->GetOrdNum(); } else { - ASSERT( !this, "was ist das fuer ein Format?" ); + OSL_ENSURE( !this, "was ist das fuer ein Format?" ); } } @@ -708,7 +708,7 @@ bool SwDoc::IsVisibleLayerId( const SdrLayerID& _nLayerId ) const } else { - ASSERT( false, "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." ); + OSL_ENSURE( false, "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." ); bRetVal = false; } @@ -743,12 +743,12 @@ SdrLayerID SwDoc::GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisible _nInvisibleLayerId == GetHellId() || _nInvisibleLayerId == GetControlsId() ) { - ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." ); + OSL_ENSURE( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." ); nVisibleLayerId = _nInvisibleLayerId; } else { - ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." ); + OSL_ENSURE( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." ); nVisibleLayerId = _nInvisibleLayerId; } @@ -783,12 +783,12 @@ SdrLayerID SwDoc::GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLa _nVisibleLayerId == GetInvisibleHellId() || _nVisibleLayerId == GetInvisibleControlsId() ) { - ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." ); + OSL_ENSURE( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." ); nInvisibleLayerId = _nVisibleLayerId; } else { - ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." ); + OSL_ENSURE( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." ); nInvisibleLayerId = _nVisibleLayerId; } @@ -807,9 +807,9 @@ void SwDoc::ReleaseDrawModel() delete pDrawModel; pDrawModel = 0; SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool(); - ASSERT( pSdrPool, "missing Pool" ); + OSL_ENSURE( pSdrPool, "missing Pool" ); SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool(); - ASSERT( !pEEgPool->GetSecondaryPool(), "i don't accept additional pools"); + OSL_ENSURE( !pEEgPool->GetSecondaryPool(), "i don't accept additional pools"); pSdrPool->Delete(); //Erst die Items vernichten lassen, //dann erst die Verkettung loesen GetAttrPool().SetSecondaryPool( 0 ); //Der ist ein muss! @@ -824,7 +824,7 @@ void SwDoc::ReleaseDrawModel() SdrModel* SwDoc::_MakeDrawModel() { - ASSERT( !pDrawModel, "_MakeDrawModel: Why?" ); + OSL_ENSURE( !pDrawModel, "_MakeDrawModel: Why?" ); InitDrawModel(); if ( pLayout && pLayout->GetCurrShell() ) { @@ -1017,7 +1017,7 @@ namespace docfunc { if ( !pAnchoredDrawObj ) { - ASSERT( false, + OSL_ENSURE( false, "<docfunc::AllDrawObjsOnPage() - missing anchored draw object" ); bAllDrawObjsOnPage = false; break; diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 3affa09365..50f3681e57 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -714,7 +714,7 @@ void _SaveRedlEndPosForRestore::_Restore() // Der uebergebene Node steht irgendwo in der gewuenschten Section void SwDoc::DeleteSection( SwNode *pNode ) { - ASSERT( pNode, "Kein Node uebergeben." ); + OSL_ENSURE( pNode, "Kein Node uebergeben." ); SwStartNode* pSttNd = pNode->IsStartNode() ? (SwStartNode*)pNode : pNode->StartOfSectionNode(); SwNodeIndex aSttIdx( *pSttNd ), aEndIdx( *pNode->EndOfSectionNode() ); @@ -1000,7 +1000,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) else rPaM.DeleteMark(); - ASSERT( *aSavePam.GetMark() == rPos || + OSL_ENSURE( *aSavePam.GetMark() == rPos || ( aSavePam.GetMark()->nNode.GetNode().GetCntntNode() == NULL ), "PaM wurde nicht verschoben, am Anfang/Ende keine ContentNodes?" ); *aSavePam.GetMark() = rPos; @@ -1259,7 +1259,7 @@ SvUShorts * lcl_RangesToUShorts(USHORT * pRanges) int i = 0; while (pRanges[i] != 0) { - ASSERT(pRanges[i+1] != 0, "malformed ranges"); + OSL_ENSURE(pRanges[i+1] != 0, "malformed ranges"); for (USHORT j = pRanges[i]; j < pRanges[i+1]; j++) pResult->Insert(j, pResult->Count()); @@ -1311,7 +1311,7 @@ void lcl_GetJoinFlags( SwPaM& rPam, sal_Bool& rJoinTxt, sal_Bool& rJoinPrev ) if( bExchange ) rPam.Exchange(); rJoinPrev = rPam.GetPoint() == pStt; - ASSERT( !pStt->nContent.GetIndex() && + OSL_ENSURE( !pStt->nContent.GetIndex() && pEndNd->GetTxt().Len() != pEnd->nContent.GetIndex() ? rPam.GetPoint()->nNode < rPam.GetMark()->nNode : rPam.GetPoint()->nNode > rPam.GetMark()->nNode, @@ -1475,7 +1475,7 @@ lcl_CalcBreaks( ::std::vector<xub_StrLen> & rBreaks, SwPaM const & rPam ) SwTxtAttr const * const pAttr( pTxtNode->GetTxtAttrForCharAt(i) ); if (pAttr && pAttr->GetEnd() && (*pAttr->GetEnd() > nEnd)) { - ASSERT(pAttr->HasDummyChar(), "GetTxtAttrForCharAt broken?"); + OSL_ENSURE(pAttr->HasDummyChar(), "GetTxtAttrForCharAt broken?"); rBreaks.push_back(i); } } @@ -1530,7 +1530,7 @@ bool lcl_DoWithBreaks(SwDoc & rDoc, SwPaM & rPam, bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool ) { - ASSERT( IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" ); + OSL_ENSURE( IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" ); { sal_uInt16 nUndoSize = 0; @@ -2052,8 +2052,8 @@ SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCrsrPos, // Folgende Bedingungen muessen eingehalten werden: // 1) es gibt mindestens eine Selektion // 2) SPoint() == Start() - ASSERT( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind"); - ASSERT( *pPam->GetPoint() <= *pPam->GetMark(), + OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind"); + OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(), "SwDoc::Hyphenate: New York, New York"); const SwPosition *pPoint = pPam->GetPoint(); @@ -2088,7 +2088,7 @@ void SwHyphArgs::SetPam( SwPaM *pPam ) const pPam->GetMark()->nNode = nNode; pPam->GetMark()->nContent.Assign( pNode->GetCntntNode(), nWordStart + nWordLen ); - ASSERT( nNode == pNode->GetIndex(), + OSL_ENSURE( nNode == pNode->GetIndex(), "SwHyphArgs::SetPam: Pam desaster" ); } } @@ -2136,7 +2136,7 @@ uno::Reference< XHyphenatedWord > SwDoc::Hyphenate( SwPaM *pPam, const Point &rCrsrPos, sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) { - ASSERT(this == pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night"); + OSL_ENSURE(this == pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night"); if( *pPam->GetPoint() > *pPam->GetMark() ) pPam->Exchange(); @@ -2196,7 +2196,7 @@ bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr, { aPam.Move(fnMoveBackward); } - ASSERT((aPam.GetPoint()->nNode == aPam.GetMark()->nNode), "invalid pam?"); + OSL_ENSURE((aPam.GetPoint()->nNode == aPam.GetMark()->nNode), "invalid pam?"); lcl_CalcBreaks(Breaks, aPam); @@ -2222,7 +2222,7 @@ bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr, bool bRet( true ); // iterate from end to start, to avoid invalidating the offsets! ::std::vector<xub_StrLen>::reverse_iterator iter( Breaks.rbegin() ); - ASSERT(aPam.GetPoint() == aPam.End(), "wrong!"); + OSL_ENSURE(aPam.GetPoint() == aPam.End(), "wrong!"); SwPosition & rEnd( *aPam.End() ); SwPosition & rStart( *aPam.Start() ); @@ -2244,7 +2244,7 @@ bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr, } rStart = *rPam.Start(); // set to original start - ASSERT(rEnd.nContent > rStart.nContent, "replace part empty!"); + OSL_ENSURE(rEnd.nContent > rStart.nContent, "replace part empty!"); if (rEnd.nContent > rStart.nContent) // check if part is empty { bRet &= ReplaceRangeImpl(aPam, rStr, bRegExReplace); @@ -2275,7 +2275,7 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr, SwPosition *pStt = (SwPosition*)aDelPam.Start(), *pEnd = (SwPosition*)aDelPam.End(); - ASSERT( pStt->nNode == pEnd->nNode || + OSL_ENSURE( pStt->nNode == pEnd->nNode || ( pStt->nNode.GetIndex() + 1 == pEnd->nNode.GetIndex() && !pEnd->nContent.GetIndex() ), "invalid range: Point and Mark on different nodes" ); @@ -2591,7 +2591,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) rPam.Exchange(); if( !rPam.Move( fnMoveBackward, fnGoNode )) { - ASSERT( sal_False, "kein Node mehr vorhanden" ); + OSL_ENSURE( sal_False, "kein Node mehr vorhanden" ); return sal_False; } } diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 46cfd0acaf..5f06609201 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -174,7 +174,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) USHORT nSize = pFldTypes->Count(), nFldWhich = rFldTyp.Which(); USHORT i = INIT_FLDTYPES; - ASSERT( RES_SETEXPFLD == nFldWhich || + OSL_ENSURE( RES_SETEXPFLD == nFldWhich || RES_USERFLD == nFldWhich || RES_DDEFLD == nFldWhich, "Falscher FeldTyp" ); @@ -227,7 +227,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) --------------------------------------------------------------------*/ void SwDoc::RemoveFldType(USHORT nFld) { - ASSERT( INIT_FLDTYPES <= nFld, "keine InitFields loeschen" ); + OSL_ENSURE( INIT_FLDTYPES <= nFld, "keine InitFields loeschen" ); /* * Abheangige Felder vorhanden -> ErrRaise */ @@ -260,7 +260,7 @@ void SwDoc::RemoveFldType(USHORT nFld) if( nWhich ) { - ASSERT( !pTmp->GetDepends(), "Abhaengige vorh.!" ); + OSL_ENSURE( !pTmp->GetDepends(), "Abhaengige vorh.!" ); // Feldtype loschen delete pTmp; } @@ -423,7 +423,7 @@ void SwDoc::UpdateRefFlds( SfxPoolItem* pHt ) void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { - ASSERT( !pHt || RES_TABLEFML_UPDATE == pHt->Which(), + OSL_ENSURE( !pHt || RES_TABLEFML_UPDATE == pHt->Which(), "Was ist das fuer ein MessageItem?" ); SwFieldType* pFldType(0); @@ -584,11 +584,11 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { if( aPara.CalcWithStackOverflow() ) pFld->CalcField( aPara ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { // mind. ein ASSERT - ASSERT( !this, "die Kettenformel konnte nicht errechnet werden" ); + OSL_ENSURE( !this, "die Kettenformel konnte nicht errechnet werden" ); } #endif } @@ -652,11 +652,11 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { if( aPara.CalcWithStackOverflow() ) pFml->Calc( aPara, nValue ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { // mind. ein ASSERT - ASSERT( !this, "die Kettenformel konnte nicht errechnet werden" ); + OSL_ENSURE( !this, "die Kettenformel konnte nicht errechnet werden" ); } #endif } @@ -882,8 +882,8 @@ void _SetGetExpFld::SetBodyPos( const SwCntntFrm& rFrm ) SwNodeIndex aIdx( *rFrm.GetNode() ); SwDoc& rDoc = *aIdx.GetNodes().GetDoc(); SwPosition aPos( aIdx ); -#ifdef DBG_UTIL - ASSERT( ::GetBodyTxtNode( rDoc, aPos, rFrm ), "wo steht das Feld" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( ::GetBodyTxtNode( rDoc, aPos, rFrm ), "wo steht das Feld" ); #else ::GetBodyTxtNode( rDoc, aPos, rFrm ); #endif @@ -1318,7 +1318,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) SwTxtFld* pTxtFld = (SwTxtFld*)(*ppSortLst)->GetFld(); if( !pTxtFld ) { - ASSERT( !this, "was ist es denn nun" ); + OSL_ENSURE( !this, "was ist es denn nun" ); continue; } @@ -1608,7 +1608,7 @@ void SwDoc::_InitFieldTypes() // wird vom CTOR gerufen!! pFldTypes->Insert( new SwSetExpFieldType(this, SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING), nsSwGetSetExpType::GSE_SEQ),nFldType++); - ASSERT( nFldType == INIT_FLDTYPES, "Bad initsize: SwFldTypes" ); + OSL_ENSURE( nFldType == INIT_FLDTYPES, "Bad initsize: SwFldTypes" ); } void SwDoc::InsDelFldInFldLst( bool bIns, const SwTxtFld& rFld ) @@ -2275,13 +2275,13 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) for( n = nArrStt; n < aTmpArr.Count(); ++n ) { pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode(); - ASSERT( pSectNd, "Wo ist mein SectionNode" ); + OSL_ENSURE( pSectNd, "Wo ist mein SectionNode" ); pSectNd->GetSection().SetCondHidden( FALSE ); } for( n = 0; n < nArrStt; ++n ) { pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode(); - ASSERT( pSectNd, "Wo ist mein SectionNode" ); + OSL_ENSURE( pSectNd, "Wo ist mein SectionNode" ); pSectNd->GetSection().SetCondHidden( FALSE ); } @@ -2460,8 +2460,8 @@ void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, USHORT nFldWhich ) { // einen Index fuers bestimmen vom TextNode anlegen SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() ); -#ifdef DBG_UTIL - ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" ); #else GetBodyTxtNode( rDoc, aPos, *pFrm ); #endif @@ -2508,8 +2508,8 @@ void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd ) if( !pFrm ) break; -#ifdef DBG_UTIL - ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" ); #else GetBodyTxtNode( rDoc, aPos, *pFrm ); #endif @@ -2537,7 +2537,7 @@ void SwDocUpdtFld::InsertFldType( const SwFieldType& rType ) sFldName = ((SwSetExpFieldType&)rType).GetName(); break; default: - ASSERT( !this, "kein gueltiger FeldTyp" ); + OSL_ENSURE( !this, "kein gueltiger FeldTyp" ); } if( sFldName.Len() ) @@ -2616,7 +2616,7 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, SwMsgPoolItem * pMsgHnt, bool bUpdateFlds) { - ASSERT(pDstTxtFld, "no field to update!"); + OSL_ENSURE(pDstTxtFld, "no field to update!"); BOOL bTblSelBreak = FALSE; diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 16d46bf554..1c9010c9de 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -262,13 +262,13 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms //Verbindung zwischen Attribut und Format. const SwPosition *pPos = rOldAnch.GetCntntAnchor(); SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); const xub_StrLen nIdx = pPos->nContent.GetIndex(); SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); - ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, + OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == &rFmt, + OSL_ENSURE( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == &rFmt, "Wrong TxtFlyCnt-Hint." ); const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(); @@ -292,7 +292,7 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms { const SwPosition *pPos = aNewAnch.GetCntntAnchor(); SwTxtNode *pNd = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pNd, "Crsr steht nicht auf TxtNode." ); + OSL_ENSURE( pNd, "Crsr steht nicht auf TxtNode." ); SwFmtFlyCnt aFmt( static_cast<SwFlyFrmFmt*>(&rFmt) ); pNd->InsertItem( aFmt, pPos->nContent.GetIndex(), 0 ); @@ -417,7 +417,7 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) case RES_PAGEDESC: case RES_CNTNT: case RES_FOOTER: - ASSERT( !this, ":-) Unbekanntes Attribut fuer Fly." ); + OSL_ENSURE( !this, ":-) Unbekanntes Attribut fuer Fly." ); // kein break; case RES_CHAIN: rSet.ClearItem( nWhich ); @@ -641,7 +641,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, const sal_Bool _bSameOnly, const sal_Bool _bPosCorr ) { - ASSERT( GetRootFrm(), "Ohne Layout geht gar nichts" ); + OSL_ENSURE( GetRootFrm(), "Ohne Layout geht gar nichts" ); if ( !_rMrkList.GetMarkCount() || _rMrkList.GetMark( 0 )->GetMarkedSdrObj()->GetUpGroup() ) @@ -665,11 +665,11 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, // Continue with next selected object and assert, if this isn't excepted. if ( !pContact ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bool bNoUserCallExcepted = pObj->ISA(SwDrawVirtObj) && !static_cast<SwDrawVirtObj*>(pObj)->IsConnected(); - ASSERT( bNoUserCallExcepted, "SwDoc::ChgAnchor(..) - no contact at selected drawing object" ); + OSL_ENSURE( bNoUserCallExcepted, "SwDoc::ChgAnchor(..) - no contact at selected drawing object" ); #endif continue; } @@ -817,14 +817,14 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, // 'center to baseline' SetAttr( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ), *pContact->GetFmt() ); SwTxtNode *pNd = aPos.nNode.GetNode().GetTxtNode(); - ASSERT( pNd, "Cursor not positioned at TxtNode." ); + OSL_ENSURE( pNd, "Cursor not positioned at TxtNode." ); SwFmtFlyCnt aFmt( pContact->GetFmt() ); pNd->InsertItem( aFmt, aPos.nContent.GetIndex(), 0 ); } break; default: - ASSERT( !this, "unexpected AnchorId." ); + OSL_ENSURE( !this, "unexpected AnchorId." ); } if ( (FLY_AS_CHAR != _eAnchorType) && @@ -865,8 +865,8 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, //Verbindung zwischen Attribut und Format. const xub_StrLen nIndx( pOldAsCharAnchorPos->nContent.GetIndex() ); SwTxtNode* pTxtNode( pOldAsCharAnchorPos->nNode.GetNode().GetTxtNode() ); - ASSERT( pTxtNode, "<SwDoc::ChgAnchor(..)> - missing previous anchor text node for as-character anchored object" ); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode, "<SwDoc::ChgAnchor(..)> - missing previous anchor text node for as-character anchored object" ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt( nIndx, RES_TXTATR_FLYCNT ); const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index f0d97bf32d..7dc1642a36 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -306,7 +306,7 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) if( pPara->pDelSet && pPara->pDelSet->Count() ) { // --> OD 2008-04-15 #refactorlists# - ASSERT( !bKeepAttributes, + OSL_ENSURE( !bKeepAttributes, "<lcl_RstAttr(..)> - certain attributes are kept, but not needed. -> please inform OD" ); // <-- SfxItemIter aIter( *pPara->pDelSet ); @@ -687,7 +687,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, // --> OD 2005-10-24 #126346# - make code robust: if ( !pNumRule ) { - ASSERT( false, + OSL_ENSURE( false, "<InsAttr(..)> - PaM in front of label, but text node has no numbering rule set. This is a serious defect, please inform OD." ); DELETECHARSETS return false; @@ -1411,7 +1411,7 @@ void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) void SwDoc::DelCharFmt( SwCharFmt *pFmt, BOOL bBroadcast ) { USHORT nFmt = pCharFmtTbl->GetPos( pFmt ); - ASSERT( USHRT_MAX != nFmt, "Fmt not found," ); + OSL_ENSURE( USHRT_MAX != nFmt, "Fmt not found," ); DelCharFmt( nFmt, bBroadcast ); } @@ -1420,7 +1420,7 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) { if( pFmt->ISA( SwTableBoxFmt ) || pFmt->ISA( SwTableLineFmt )) { - ASSERT( !this, "Format steht nicht mehr im DocArray, " + OSL_ENSURE( !this, "Format steht nicht mehr im DocArray, " "kann per delete geloescht werden" ); delete pFmt; } @@ -1449,7 +1449,7 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) else { nPos = GetSpzFrmFmts()->GetPos( pFmt ); - ASSERT( nPos != USHRT_MAX, "FrmFmt not found." ); + OSL_ENSURE( nPos != USHRT_MAX, "FrmFmt not found." ); if( USHRT_MAX != nPos ) GetSpzFrmFmts()->DeleteAndDestroy( nPos ); } @@ -1459,7 +1459,7 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt ) { USHORT nPos = pTblFrmFmtTbl->GetPos( pFmt ); - ASSERT( USHRT_MAX != nPos, "Fmt not found," ); + OSL_ENSURE( USHRT_MAX != nPos, "Fmt not found," ); pTblFrmFmtTbl->DeleteAndDestroy( nPos ); } @@ -1681,7 +1681,7 @@ SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const String &rFmtName, void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) { - ASSERT( nFmtColl, "Remove fuer Coll 0." ); + OSL_ENSURE( nFmtColl, "Remove fuer Coll 0." ); // Wer hat die zu loeschende als Next SwTxtFmtColl *pDel = (*pTxtFmtCollTbl)[nFmtColl]; @@ -1712,7 +1712,7 @@ void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, BOOL bBroadcast ) { USHORT nFmt = pTxtFmtCollTbl->GetPos( pColl ); - ASSERT( USHRT_MAX != nFmt, "Collection not found," ); + OSL_ENSURE( USHRT_MAX != nFmt, "Collection not found," ); DelTxtFmtColl( nFmt, bBroadcast ); } @@ -1744,7 +1744,7 @@ BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) // Check, if the list style of the paragraph will change. bool bChangeOfListStyleAtParagraph( true ); SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) ); - ASSERT( pTNd, + OSL_ENSURE( pTNd, "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" ); { SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() ); @@ -2426,7 +2426,7 @@ void SwDoc::_CreateNumberFormatter() { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::_CreateNumberFormatter" ); - ASSERT( !pNumberFormatter, "ist doch schon vorhanden" ); + OSL_ENSURE( !pNumberFormatter, "ist doch schon vorhanden" ); LanguageType eLang = LANGUAGE_SYSTEM; diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 556be535d6..bb973ec6d9 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -349,7 +349,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, aTmp.Exchange(); if( !aTmp.Move( fnMoveBackward, fnGoNode )) { - ASSERT( FALSE, "kein Node mehr vorhanden" ); + OSL_ENSURE( FALSE, "kein Node mehr vorhanden" ); } } // Bookmarks usw. verschieben @@ -696,7 +696,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) aTmp.Exchange(); if( !aTmp.Move( fnMoveBackward, fnGoNode )) { - ASSERT( FALSE, "kein Node mehr vorhanden" ); + OSL_ENSURE( FALSE, "kein Node mehr vorhanden" ); } } // Bookmarks usw. verschieben diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index e45b8e0493..2f042a0c04 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -199,18 +199,18 @@ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) } break; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 case FLY_AT_PAGE: case FLY_AT_CHAR: case FLY_AT_FLY: case FLY_AT_PARA: case FLY_AS_CHAR: - ASSERT( false, "use new interface instead: SwDoc::MakeFlySection!" ); + OSL_ENSURE( false, "use new interface instead: SwDoc::MakeFlySection!" ); break; #endif default: - ASSERT( !this, + OSL_ENSURE( !this, "Layoutformat mit ungueltigem Request angefordert." ); } @@ -379,7 +379,7 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource, { const bool bFly = RES_FLYFRMFMT == rSource.Which(); const bool bDraw = RES_DRAWFRMFMT == rSource.Which(); - ASSERT( bFly || bDraw, "this method only works for fly or draw" ); + OSL_ENSURE( bFly || bDraw, "this method only works for fly or draw" ); SwDoc* pSrcDoc = (SwDoc*)rSource.GetDoc(); @@ -486,7 +486,7 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource, } else { - ASSERT( RES_DRAWFRMFMT == rSource.Which(), "Weder Fly noch Draw." ); + OSL_ENSURE( RES_DRAWFRMFMT == rSource.Which(), "Weder Fly noch Draw." ); // OD 2005-08-02 #i52780# - Note: moving object to visible layer not needed. SwDrawContact* pSourceContact = (SwDrawContact *)rSource.FindContactObj(); @@ -676,7 +676,7 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, xub_StrLen nStt = rAnchPos.nContent.GetIndex(); SwTxtNode * pTxtNode = rAnchPos.nNode.GetNode().GetTxtNode(); - ASSERT(pTxtNode!= 0, "There should be a SwTxtNode!"); + OSL_ENSURE(pTxtNode!= 0, "There should be a SwTxtNode!"); if (pTxtNode != NULL) { @@ -796,7 +796,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, { do { // middle check loop const SwFmtCntnt &rCntnt = pFmt->GetCntnt(); - ASSERT( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." ); SwNodeIndex aIndex( *(rCntnt.GetCntntIdx()), 1 ); SwCntntNode *pNode = aIndex.GetNode().GetCntntNode(); @@ -845,7 +845,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, // wenn Tabelle im Rahmen, dann ohne nachfolgenden TextNode aIndex = rCntnt.GetCntntIdx()->GetNode().EndOfSectionIndex() - 1; - ASSERT( aIndex.GetNode().GetTxtNode(), + OSL_ENSURE( aIndex.GetNode().GetTxtNode(), "hier sollte ein TextNode stehen" ); aPos.nContent.Assign( 0, 0 ); // Index abmelden !! GetNodes().Delete( aIndex, 1 ); @@ -1162,11 +1162,11 @@ void lcl_CpyAttr( SfxItemSet &rNewSet, const SfxItemSet &rOldSet, sal_uInt16 nWh rNewSet.Put( *pOldItem ); } else { - ASSERT(0, "What am I doing here?"); + OSL_ENSURE(0, "What am I doing here?"); } } else { - ASSERT(0, "What am I doing here?"); + OSL_ENSURE(0, "What am I doing here?"); } } @@ -1192,9 +1192,9 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co //Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt werden //muss - ASSERT( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType ueberindiziert." ); + OSL_ENSURE( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType ueberindiziert." ); SwFieldType *pType = nId != USHRT_MAX ? (*GetFldTypes())[nId] : NULL; - ASSERT( !pType || pType->Which() == RES_SETEXPFLD, "Falsche Id fuer Label" ); + OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Falsche Id fuer Label" ); SwTxtFmtColl *pColl = NULL; if( pType ) @@ -1226,7 +1226,7 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co //einfuegen (Frame wird automatisch erzeugt). { SwStartNode *pSttNd = GetNodes()[nNdIdx]->GetStartNode(); - ASSERT( pSttNd, "Kein StartNode in InsertLabel." ); + OSL_ENSURE( pSttNd, "Kein StartNode in InsertLabel." ); ULONG nNode; if( bBefore ) { @@ -1259,7 +1259,7 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co //Erstmal das Format zum Fly besorgen und das Layout entkoppeln. SwFrmFmt *pOldFmt = GetNodes()[nNdIdx]->GetFlyFmt(); - ASSERT( pOldFmt, "Format des Fly nicht gefunden." ); + OSL_ENSURE( pOldFmt, "Format des Fly nicht gefunden." ); pOldFmt->DelFrms(); pNewFmt = MakeFlyFrmFmt( GetUniqueFrameName(), @@ -1338,14 +1338,14 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co { const SwPosition *pPos = rAnchor.GetCntntAnchor(); SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); const xub_StrLen nIdx = pPos->nContent.GetIndex(); SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt(nIdx, RES_TXTATR_FLYCNT); - ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, + OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pOldFmt, + OSL_ENSURE( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pOldFmt, "Wrong TxtFlyCnt-Hint." ); const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt( @@ -1401,9 +1401,9 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co break; default: - ASSERT( !this, "Neuer LabelType?." ); + OSL_ENSURE( !this, "Neuer LabelType?." ); } - ASSERT( pNew, "No Label inserted" ); + OSL_ENSURE( pNew, "No Label inserted" ); if( pNew ) { //#i61007# order of captions @@ -1504,7 +1504,7 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, { SwDrawContact* pContact = (SwDrawContact*)GetUserCall( &rSdrObj ); - ASSERT( RES_DRAWFRMFMT == pContact->GetFmt()->Which(), + OSL_ENSURE( RES_DRAWFRMFMT == pContact->GetFmt()->Which(), "Kein DrawFrmFmt" ); if ( !pContact ) return 0; @@ -1527,9 +1527,9 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, // Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt // werden muss - ASSERT( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType overflow" ); + OSL_ENSURE( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType overflow" ); SwFieldType *pType = nId != USHRT_MAX ? (*GetFldTypes())[nId] : 0; - ASSERT( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" ); + OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" ); SwTxtFmtColl *pColl = NULL; if( pType ) @@ -1637,15 +1637,15 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, { const SwPosition *pPos = rAnchor.GetCntntAnchor(); SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); const xub_StrLen nIdx = pPos->nContent.GetIndex(); SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); -#ifdef DBG_UTIL - ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - ASSERT( pHnt && ((SwFmtFlyCnt&)pHnt->GetFlyCnt()). + OSL_ENSURE( pHnt && ((SwFmtFlyCnt&)pHnt->GetFlyCnt()). GetFrmFmt() == (SwFrmFmt*)pOldFmt, "Wrong TxtFlyCnt-Hint." ); #endif @@ -1693,7 +1693,7 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, //wir vorhanden Methoden (insb. fuer InCntFlys etwas aufwendig). pNewFmt->MakeFrms(); - ASSERT( pNew, "No Label inserted" ); + OSL_ENSURE( pNew, "No Label inserted" ); if( pNew ) { @@ -2162,7 +2162,7 @@ sal_Bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const } if( n >= GetSpzFrmFmts()->Count() ) { - ASSERT( mbInReading, "Fly-Section aber kein Format gefunden" ); + OSL_ENSURE( mbInReading, "Fly-Section aber kein Format gefunden" ); return sal_False; } } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 01f353d6ba..7e78a4b9b7 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -329,7 +329,7 @@ SwDoc::SwDoc() : mbInsOnlyTxtGlssry = mbContains_MSVBasic = mbKernAsianPunctuation = -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 mbXMLExport = #endif // --> OD 2006-03-21 #b6375613# @@ -605,7 +605,7 @@ SwDoc::~SwDoc() pFtnColl = pEndNoteInfo->GetFtnTxtColl(); if ( pFtnColl ) pFtnColl->Remove(pEndNoteInfo); - ASSERT( pDfltTxtFmtColl == (*pTxtFmtCollTbl)[0], + OSL_ENSURE( pDfltTxtFmtColl == (*pTxtFmtCollTbl)[0], "Default-Text-Collection muss immer am Anfang stehen" ); // JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array @@ -616,7 +616,7 @@ SwDoc::~SwDoc() pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 ); delete pTxtFmtCollTbl; - ASSERT( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0], + OSL_ENSURE( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0], "Default-Grf-Collection muss immer am Anfang stehen" ); pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 ); @@ -720,10 +720,10 @@ VirtualDevice& SwDoc::CreateVirtualDevice_() const SfxPrinter& SwDoc::CreatePrinter_() const { - ASSERT( ! pPrt, "Do not call CreatePrinter_(), call getPrinter() instead" ) + OSL_ENSURE( ! pPrt, "Do not call CreatePrinter_(), call getPrinter() instead" ); #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "Printer will be created!" ) + OSL_ENSURE( false, "Printer will be created!" ); #endif // wir erzeugen einen default SfxPrinter. @@ -752,7 +752,7 @@ void SwDoc::SetDocShell( SwDocShell* pDSh ) { ((SwDrawDocument*)pDrawModel)->SetObjectShell( pDocShell ); pDrawModel->SetPersist( pDocShell ); - ASSERT( pDrawModel->GetPersist() == GetPersist(), + OSL_ENSURE( pDrawModel->GetPersist() == GetPersist(), "draw model's persist is out of sync" ); } } @@ -791,7 +791,7 @@ void SwDoc::ClearDoc() USHORT n; while ( 0 != (n = GetSpzFrmFmts()->Count()) ) DelLayoutFmt((*pSpzFrmFmtTbl)[n-1]); - ASSERT( !pDrawModel || !pDrawModel->GetPage(0)->GetObjCount(), + OSL_ENSURE( !pDrawModel || !pDrawModel->GetPage(0)->GetObjCount(), "not all DrawObjects removed from the page" ); pRedlineTbl->DeleteAndDestroy( 0, pRedlineTbl->Count() ); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 580af91f7e..a38f9caed2 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -365,10 +365,9 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) if( pColl->IsAssignedToListLevelOfOutlineStyle() ) { - const int nLevel = pColl->GetAssignedOutlineStyleLevel();//#outline level,add by zhaojianwei - ASSERT(aMoveArr[nLevel] >= 0, + OSL_ENSURE(aMoveArr[nLevel] >= 0, "move table: current TxtColl not found when building table!"); @@ -453,7 +452,7 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) nAktPos = nTmpPos; if( aEndRg == aSttRg ) { - ASSERT( false, "Moving outlines: Surprising selection" ); + OSL_ENSURE( false, "Moving outlines: Surprising selection" ); aEndRg++; } @@ -535,7 +534,7 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) if( pNd->FindTableNode() ) return FALSE; - ASSERT( aSttRg.GetIndex() > nNewPos || nNewPos >= aEndRg.GetIndex(), + OSL_ENSURE( aSttRg.GetIndex() > nNewPos || nNewPos >= aEndRg.GetIndex(), "Position liegt im MoveBereich" ); // wurde ein Position in den Sonderbereichen errechnet, dann @@ -660,7 +659,7 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) // has as hard attribute 'no numbering' set, has an outline level, // but no numbering tree node. Thus, consider this situation in // the assertion condition. - ASSERT( !pNd->GetNumRule(), + OSL_ENSURE( !pNd->GetNumRule(), "<lcl_FindOutlineNum(..)> - text node with outline level and numbering rule, but without numbering tree node. This is a serious defect -> inform OD" ); } } @@ -750,7 +749,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) { SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() ); - ASSERT( pOld, "ohne die alte NumRule geht gar nichts" ); + OSL_ENSURE( pOld, "ohne die alte NumRule geht gar nichts" ); USHORT nChgFmtLevel = 0, nMask = 1; BYTE n; @@ -869,7 +868,7 @@ void SwDoc::SetNumRule( const SwPaM& rPam, { // create new list and apply its list id SwList* pNewList = createList( String(), pNew->GetName() ); - ASSERT( pNewList, + OSL_ENSURE( pNewList, "<SwDoc::SetNumRule(..)> - could not create new list. Serious defect -> please inform OD." ); sListId = pNewList->GetListId(); } @@ -1006,7 +1005,7 @@ BOOL SwDoc::DelNumRule( const String& rName, BOOL bBroadcast ) if ( (*pNumRuleTbl)[ nPos ] == GetOutlineNumRule() ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::DelNumRule(..)> - No deletion of outline list style. This is serious defect - please inform OD" ); return FALSE; } @@ -1218,7 +1217,7 @@ namespace void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) { - ASSERT( rPaM.GetDoc() == this, "need same doc" ); + OSL_ENSURE( rPaM.GetDoc() == this, "need same doc" ); ::std::map<SwNumRule *, ListStyleData> aMyNumRuleMap; @@ -1381,7 +1380,7 @@ void SwDoc::InvalidateNumRules() BOOL lcl_IsNumOk( BYTE nSrchNum, BYTE& rLower, BYTE& rUpper, BOOL bOverUpper, BYTE nNumber ) { - ASSERT( nNumber < MAXLEVEL, + OSL_ENSURE( nNumber < MAXLEVEL, "<lcl_IsNumOk(..)> - misusage of method" ); BOOL bRet = FALSE; @@ -1939,7 +1938,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) the previous content node. */ SwPaM aInsPam(aInsPos); BOOL bMoved = aInsPam.Move(fnMoveBackward); - ASSERT(bMoved, "No content node found!"); + OSL_ENSURE(bMoved, "No content node found!"); if (bMoved) { @@ -2347,7 +2346,7 @@ void SwDoc::addListItem( const SwNodeNum& rNodeNum ) const bool bAlreadyInserted( mpListItemsList->find( &rNodeNum ) != mpListItemsList->end() ); - ASSERT( !bAlreadyInserted, + OSL_ENSURE( !bAlreadyInserted, "<SwDoc::InsertListItem(..)> - <SwNodeNum> instance already registered as numbered item!" ); if ( !bAlreadyInserted ) { @@ -2365,7 +2364,7 @@ void SwDoc::removeListItem( const SwNodeNum& rNodeNum ) const tImplSortedNodeNumList::size_type nDeleted = mpListItemsList->erase( &rNodeNum ); if ( nDeleted > 1 ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::RemoveListItem(..)> - <SwNodeNum> was registered more than once as numbered item!" ); } } @@ -2462,7 +2461,7 @@ SwList* SwDoc::createList( String sListId, if ( getListByName( sListId ) ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::createList(..)> - provided list id already used. Serious defect -> please inform OD." ); return 0; } @@ -2470,7 +2469,7 @@ SwList* SwDoc::createList( String sListId, SwNumRule* pDefaultNumRuleForNewList = FindNumRulePtr( sDefaultListStyleName ); if ( !pDefaultNumRuleForNewList ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::createList(..)> - for provided default list style name no list style is found. Serious defect -> please inform OD." ); return 0; } @@ -2509,14 +2508,14 @@ SwList* SwDoc::createListForListStyle( const String sListStyleName ) { if ( sListStyleName.Len() == 0 ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::createListForListStyle(..)> - no list style name provided. Serious defect -> please inform OD." ); return 0; } if ( getListForListStyle( sListStyleName ) ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::createListForListStyle(..)> - a list for the provided list style name already exists. Serious defect -> please inform OD." ); return 0; } @@ -2524,7 +2523,7 @@ SwList* SwDoc::createListForListStyle( const String sListStyleName ) SwNumRule* pNumRule = FindNumRulePtr( sListStyleName ); if ( !pNumRule ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::createListForListStyle(..)> - for provided list style name no list style is found. Serious defect -> please inform OD." ); return 0; } @@ -2560,7 +2559,7 @@ void SwDoc::deleteListForListStyle( const String sListStyleName ) String sListId; { SwList* pList = getListForListStyle( sListStyleName ); - ASSERT( pList, + OSL_ENSURE( pList, "<SwDoc::deleteListForListStyle(..)> - misusage of method: no list found for given list style name" ); if ( pList ) { @@ -2578,7 +2577,7 @@ void SwDoc::trackChangeOfListStyleName( const String sListStyleName, const String sNewListStyleName ) { SwList* pList = getListForListStyle( sListStyleName ); - ASSERT( pList, + OSL_ENSURE( pList, "<SwDoc::changeOfListStyleName(..)> - misusage of method: no list found for given list style name" ); if ( pList != 0 ) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index a1ff8e2947..0ebd260836 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -55,14 +55,9 @@ using namespace com::sun::star; TYPEINIT1(SwRedlineHint, SfxHint); -#ifndef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 - #define _CHECK_REDLINE( pDoc ) - #define _DEBUG_REDLINE( pDoc ) - -#else - -#define _ERROR_PREFIX "redline table corrupted: " + #define _ERROR_PREFIX "redline table corrupted: " // helper function for lcl_CheckRedline // 1. make sure that pPos->nContent points into pPos->nNode @@ -152,6 +147,12 @@ TYPEINIT1(SwRedlineHint, SfxHint); #define _DEBUG_REDLINE( pDoc ) lcl_DebugRedline( pDoc ); + +#else + + #define _CHECK_REDLINE( pDoc ) + #define _DEBUG_REDLINE( pDoc ) + #endif SV_IMPL_OP_PTRARR_SORT( _SwRedlineTbl, SwRedlinePtr ) @@ -1028,7 +1029,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) // pNew must be deleted if Insert() wasn't // successful. But that can't happen, since pNew is // part of the original pRedl redline. - // ASSERT( bRet, "Can't insert existing redline?" ); + // OSL_ENSURE( bRet, "Can't insert existing redline?" ); // restart (now with pRedl being split up) n = 0; @@ -2634,7 +2635,7 @@ BOOL SwRedlineTbl::Insert( SwRedlinePtr& p, BOOL bIns ) bRet = InsertWithValidRanges( p ); else { - ASSERT( !this, "Redline: falscher Bereich" ); + OSL_ENSURE( !this, "Redline: falscher Bereich" ); } return bRet; } @@ -2651,7 +2652,7 @@ BOOL SwRedlineTbl::Insert( SwRedlinePtr& p, USHORT& rP, BOOL bIns ) bRet = InsertWithValidRanges( p, &rP ); else { - ASSERT( !this, "Redline: falscher Bereich" ); + OSL_ENSURE( !this, "Redline: falscher Bereich" ); } return bRet; } @@ -3314,7 +3315,7 @@ void SwRedline::CalcStartEnd( ULONG nNdIdx, USHORT& nStart, USHORT& nEnd ) const } else { - ASSERT( pREnd->nNode == nNdIdx, + OSL_ENSURE( pREnd->nNode == nNdIdx, "SwRedlineItr::Seek: GetRedlinePos Error" ); nStart = 0; // Absatz wird vorne ueberlappt nEnd = pREnd->nContent.GetIndex(); @@ -3538,7 +3539,7 @@ void SwRedline::DelCopyOfSection() // current ones can be affected. const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); USHORT n = rTbl.GetPos( this ); - ASSERT( n != USHRT_MAX, "How strange. We don't exist!" ); + OSL_ENSURE( n != USHRT_MAX, "How strange. We don't exist!" ); for( BOOL bBreak = FALSE; !bBreak && n > 0; ) { --n; @@ -3586,7 +3587,7 @@ void SwRedline::MoveFromSection() const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); SvPtrarr aBeforeArr( 16, 16 ), aBehindArr( 16, 16 ); USHORT nMyPos = rTbl.GetPos( this ); - ASSERT( this, "this nicht im Array?" ); + OSL_ENSURE( this, "this nicht im Array?" ); BOOL bBreak = FALSE; USHORT n; @@ -3714,9 +3715,9 @@ void SwRedline::SetContentIdx( const SwNodeIndex* pIdx ) delete pCntntSect, pCntntSect = 0; bIsVisible = FALSE; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else - ASSERT( !this, "das ist keine gueltige Operation" ); + OSL_ENSURE( !this, "das ist keine gueltige Operation" ); #endif } @@ -3817,7 +3818,7 @@ const SwRedlineData & SwRedline::GetRedlineData(USHORT nPos) const nPos--; } - ASSERT( 0 == nPos, "Pos angabe ist zu gross" ); + OSL_ENSURE( 0 == nPos, "Pos angabe ist zu gross" ); return *pCur; } diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 8f32b0c490..c2bd65425c 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -77,7 +77,7 @@ SV_IMPL_OP_PTRARR_SORT( SwSortElements, SwSortElementPtr ); void SwSortElement::Init( SwDoc* pD, const SwSortOptions& rOpt, FlatFndBox* pFltBx ) { - ASSERT( !pDoc && !pOptions && !pBox, "wer hat das Finit vergessen?" ); + OSL_ENSURE( !pDoc && !pOptions && !pBox, "wer hat das Finit vergessen?" ); pDoc = pD; pOptions = new SwSortOptions( rOpt ); pBox = pFltBx; @@ -265,7 +265,7 @@ String SwSortBoxElement::GetKey(USHORT nKey) const if( pFndBox ) { // StartNode holen und ueberlesen const SwTableBox* pMyBox = pFndBox->GetBox(); - ASSERT(pMyBox, "Keine atomare Box"); + OSL_ENSURE(pMyBox, "Keine atomare Box"); if( pMyBox->GetSttNd() ) { @@ -485,7 +485,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) { // uebers SwDoc fuer Undo !! - ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -712,7 +712,7 @@ void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, USHORT nS, USHORT nT, void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, BOOL bMovedBefore, SwUndoSort* pUD) { - ASSERT(pSource && pTar,"Fehlende Quelle oder Ziel"); + OSL_ENSURE(pSource && pTar,"Fehlende Quelle oder Ziel"); if(pSource == pTar) return; @@ -742,7 +742,7 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, BOOL bDelFirst = FALSE; if( nCount == 2 ) { - ASSERT( pNd->GetCntntNode(), "Kein ContentNode"); + OSL_ENSURE( pNd->GetCntntNode(), "Kein ContentNode"); bDelFirst = !pNd->GetCntntNode()->Len() && bMovedBefore; } @@ -969,13 +969,13 @@ const _FndBox* FlatFndBox::GetBox(USHORT n_Col, USHORT n_Row) const USHORT nOff = n_Row * nCols + n_Col; const _FndBox* pTmp = *(pArr + nOff); - ASSERT(n_Col < nCols && n_Row < nRows && pTmp, "unzulaessiger Array-Zugriff"); + OSL_ENSURE(n_Col < nCols && n_Row < nRows && pTmp, "unzulaessiger Array-Zugriff"); return pTmp; } const SfxItemSet* FlatFndBox::GetItemSet(USHORT n_Col, USHORT n_Row) const { - ASSERT( !ppItemSets || ( n_Col < nCols && n_Row < nRows), "unzulaessiger Array-Zugriff"); + OSL_ENSURE( !ppItemSets || ( n_Col < nCols && n_Row < nRows), "unzulaessiger Array-Zugriff"); return ppItemSets ? *(ppItemSets + (n_Row * nCols + n_Col )) : 0; } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index df298c3492..bcd6546f0b 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -181,10 +181,10 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) { // hole den TextNode und const SwTxtTOXMark* pTxtTOXMark = pTOXMark->GetTxtTOXMark(); - ASSERT( pTxtTOXMark, "Kein TxtTOXMark, kann nicht geloescht werden" ); + OSL_ENSURE( pTxtTOXMark, "Kein TxtTOXMark, kann nicht geloescht werden" ); SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode()); - ASSERT( rTxtNd.GetpSwpHints(), "kann nicht geloescht werden" ); + OSL_ENSURE( rTxtNd.GetpSwpHints(), "kann nicht geloescht werden" ); if( DoesUndo() ) { @@ -242,7 +242,7 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, SwTOXSearch eDir, BOOL bInReadOnly ) { const SwTxtTOXMark* pMark = rCurTOXMark.GetTxtTOXMark(); - ASSERT(pMark, "pMark==0 Ungueltige TxtTOXMark"); + OSL_ENSURE(pMark, "pMark==0 Ungueltige TxtTOXMark"); const SwTxtNode *pTOXSrc = pMark->GetpTxtNd(); @@ -459,7 +459,7 @@ const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const SectionType eT = pSectNd->GetSection().GetType(); if( TOX_CONTENT_SECTION == eT ) { - ASSERT( pSectNd->GetSection().ISA( SwTOXBaseSection ), + OSL_ENSURE( pSectNd->GetSection().ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); SwTOXBaseSection& rTOXSect = (SwTOXBaseSection&) pSectNd->GetSection(); @@ -472,10 +472,10 @@ const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& rTOXBase) const { - ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; SwSectionFmt* pFmt = rTOXSect.GetFmt(); - ASSERT( pFmt, "invalid TOXBaseSection!" ); + OSL_ENSURE( pFmt, "invalid TOXBaseSection!" ); return pFmt->GetAttrSet(); } @@ -526,7 +526,7 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes ) { // its only delete the TOX, not the nodes BOOL bRet = FALSE; - ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); + OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; SwSectionFmt* pFmt = rTOXSect.GetFmt(); @@ -697,7 +697,7 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, BOOL SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName) { - ASSERT( rTOXBase.ISA( SwTOXBaseSection ), + OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOXBase; @@ -726,7 +726,7 @@ const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, BYTE nLvl = 0 ) { SwPosition aPos( *pNd ); pNd = GetBodyTxtNode( *pNd->GetDoc(), aPos, *pFrm ); - ASSERT( pNd, "wo steht der Absatz" ); + OSL_ENSURE( pNd, "wo steht der Absatz" ); } } return pNd ? pNd->FindOutlineNodeOfLevel( nLvl ) : 0; @@ -1621,7 +1621,7 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, // String mit dem Pattern aus der Form initialisieren const SwTOXSortTabBase& rBase = *aSortArr[nIndex]; USHORT nLvl = rBase.GetLevel(); - ASSERT( nLvl < GetTOXForm().GetFormMax(), "ungueltiges FORM_LEVEL"); + OSL_ENSURE( nLvl < GetTOXForm().GetFormMax(), "ungueltiges FORM_LEVEL"); SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); xub_StrLen nLinkStartPosition = STRING_NOTFOUND; @@ -1949,7 +1949,7 @@ void SwTOXBaseSection::UpdatePageNum() if( rTOXSource.pNd ) { SwCntntFrm* pFrm = rTOXSource.pNd->GetFrm(); - ASSERT( pFrm || pDoc->IsUpdateTOX(), "TOX, no Frame found"); + OSL_ENSURE( pFrm || pDoc->IsUpdateTOX(), "TOX, no Frame found"); if( !pFrm ) continue; if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->HasFollow() ) @@ -1992,7 +1992,7 @@ void SwTOXBaseSection::UpdatePageNum() if(pBase->pTOXNd) { const SwTxtNode* pTxtNd = pBase->pTOXNd->GetTxtNode(); - ASSERT( pTxtNd, "kein TextNode, falsches Verzeichnis" ); + OSL_ENSURE( pTxtNd, "kein TextNode, falsches Verzeichnis" ); _UpdatePageNum( (SwTxtNode*)pTxtNd, aNums, aDescs, pMainNums, aIntl ); @@ -2262,7 +2262,7 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew) delete pNew; return; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else DBG_ERROR("Bibliography entries cannot be found here"); #endif @@ -2296,7 +2296,7 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReadin sToCompare.Erase( 0, 1 ).Insert( sUpper, 0 ); } - ASSERT(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0"); + OSL_ENSURE(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0"); const USHORT nMin = (USHORT)rRange.Min(); const USHORT nMax = (USHORT)rRange.Max(); diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 3d38e1d5d7..01dcfd2956 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -287,7 +287,7 @@ SwExtTextInput* SwDoc::GetExtTextInput( const SwNode& rNd, SwExtTextInput* SwDoc::GetExtTextInput() const { - ASSERT( !pExtInputRing || pExtInputRing == pExtInputRing->GetNext(), + OSL_ENSURE( !pExtInputRing || pExtInputRing == pExtInputRing->GetNext(), "more then one InputEngine available" ); return (SwExtTextInput*)pExtInputRing; } diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index da6482da83..de62c60129 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -70,7 +70,7 @@ namespace TxtFmtCollFunc if ( !pTxtFmtColl ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, + OSL_ENSURE( false, "<TxtFmtCollFunc::CheckTxtFmtCollFuncForDeletionOfAssignmentToOutlineStyle> - misuse of method - it's only for instances of <SwTxtFmtColl>" ); #endif return; @@ -501,7 +501,7 @@ bool SwTxtFmtColl::AreListLevelIndentsApplicable() const } pColl = dynamic_cast<const SwTxtFmtColl*>(pColl->DerivedFrom()); - ASSERT( pColl, + OSL_ENSURE( pColl, "<SwTxtFmtColl::AreListLevelIndentsApplicable()> - something wrong in paragraph style hierarchy. The applied list style is not found." ); } } @@ -661,7 +661,7 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls ) //#outline level, zhaojianwei void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel) { - ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" ); + OSL_ENSURE( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" ); SetFmtAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, static_cast<UINT16>(nLevel) ) ); } @@ -673,7 +673,7 @@ int SwTxtFmtColl::GetAttrOutlineLevel() const int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const { - ASSERT( IsAssignedToListLevelOfOutlineStyle(), + OSL_ENSURE( IsAssignedToListLevelOfOutlineStyle(), "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method"); return GetAttrOutlineLevel() - 1; } diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index fa5ba73b09..401affef93 100644 --- a/sw/source/core/doc/gctable.cxx +++ b/sw/source/core/doc/gctable.cxx @@ -397,7 +397,7 @@ BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ) SwTableLines& rLns = *pGCPara->pLns; const SwTableLine* pTmp = pLn; USHORT nInsPos = rLns.GetPos( pTmp ); - ASSERT( USHRT_MAX != nInsPos, "Line nicht gefunden!" ); + OSL_ENSURE( USHRT_MAX != nInsPos, "Line nicht gefunden!" ); SwTableBox* pUpper = pLn->GetUpper(); diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index cd5715063d..7afb7a1fa1 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -273,7 +273,7 @@ USHORT SwHTMLTableLayout::GetLeftCellSpace( USHORT nCol, USHORT nColSpan, else if( nCol+nColSpan == nCols && nRightBorderWidth && nSpace < MIN_BORDER_DIST ) { - ASSERT( !nCellPadding, "GetLeftCellSpace: CELLPADDING!=0" ); + OSL_ENSURE( !nCellPadding, "GetLeftCellSpace: CELLPADDING!=0" ); // Wenn die Gegenueberliegende Seite umrandet ist muessen // wir zumindest den minimalen Abstand zum Inhalt // beruecksichtigen. (Koennte man zusaetzlich auch an @@ -299,7 +299,7 @@ USHORT SwHTMLTableLayout::GetRightCellSpace( USHORT nCol, USHORT nColSpan, else if( bSwBorders && GetColumn(nCol)->HasLeftBorder() && nSpace < MIN_BORDER_DIST ) { - ASSERT( !nCellPadding, "GetRightCellSpace: CELLPADDING!=0" ); + OSL_ENSURE( !nCellPadding, "GetRightCellSpace: CELLPADDING!=0" ); // Wenn die Gegenueberliegende Seite umrandet ist muessen // wir zumindest den minimalen Abstand zum Inhalt // beruecksichtigen. (Koennte man zusaetzlich auch an @@ -438,9 +438,9 @@ const SwStartNode *SwHTMLTableLayout::GetAnyBoxStartNode() const const SwTableBox* pBox = pSwTable->GetTabLines()[0]->GetTabBoxes()[0]; while( 0 == (pBoxSttNd = pBox->GetSttNd()) ) { - ASSERT( pBox->GetTabLines().Count() > 0, + OSL_ENSURE( pBox->GetTabLines().Count() > 0, "Box ohne Start-Node und Lines" ); - ASSERT( pBox->GetTabLines()[0]->GetTabBoxes().Count() > 0, + OSL_ENSURE( pBox->GetTabLines()[0]->GetTabBoxes().Count() > 0, "Line ohne Boxen" ); pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; } @@ -451,7 +451,7 @@ const SwStartNode *SwHTMLTableLayout::GetAnyBoxStartNode() const SwFrmFmt *SwHTMLTableLayout::FindFlyFrmFmt() const { const SwTableNode *pTblNd = GetAnyBoxStartNode()->FindTableNode(); - ASSERT( pTblNd, "Kein Table-Node?" ); + OSL_ENSURE( pTblNd, "Kein Table-Node?" ); return pTblNd->GetFlyFmt(); } @@ -464,9 +464,9 @@ static void lcl_GetMinMaxSize( ULONG& rMinNoAlignCnts, ULONG& rMaxNoAlignCnts, { pTxtNd->GetMinMaxSize( nIdx, rMinNoAlignCnts, rMaxNoAlignCnts, rAbsMinNoAlignCnts ); - ASSERT( rAbsMinNoAlignCnts <= rMinNoAlignCnts, + OSL_ENSURE( rAbsMinNoAlignCnts <= rMinNoAlignCnts, "GetMinMaxSize: absmin > min" ); - ASSERT( rMinNoAlignCnts <= rMaxNoAlignCnts, + OSL_ENSURE( rMinNoAlignCnts <= rMaxNoAlignCnts, "GetMinMaxSize: max > min" ); //Bei einen <PRE>-Absatz entspricht die maximale Breite der @@ -615,7 +615,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() } else { - ASSERT( !this, "Sub tables in HTML import?" ) + OSL_ENSURE( !this, "Sub tables in HTML import?" ); SwHTMLTableLayout *pChild = pCnts->GetTable(); pChild->AutoLayoutPass1(); ULONG nMaxTableCnts = pChild->nMax; @@ -770,9 +770,9 @@ void SwHTMLTableLayout::AutoLayoutPass1() } } - ASSERT( nMinColSpan>0 && nColSkip>0 && nColSkip <= nMinColSpan, + OSL_ENSURE( nMinColSpan>0 && nColSkip>0 && nColSkip <= nMinColSpan, "Layout Pass 1: Da werden Spalten vergessen!" ); - ASSERT( nMinColSpan!=USHRT_MAX, + OSL_ENSURE( nMinColSpan!=USHRT_MAX, "Layout Pass 1: unnoetiger Schleifendurchlauf oder Bug" ); if( 1==nMinColSpan ) @@ -890,7 +890,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() : nDiff; nColMin += nAdd; nMin += nColMin; - ASSERT( nDiff >= nAdd, "Ooops: nDiff stimmt nicht mehr" ); + OSL_ENSURE( nDiff >= nAdd, "Ooops: nDiff stimmt nicht mehr" ); nDiff -= nAdd; if( nColMax < nColMin ) @@ -918,8 +918,8 @@ void SwHTMLTableLayout::AutoLayoutPass1() pColumn->AddToMin( nDiff ); - ASSERT( pColumn->GetMax() >= pColumn->GetMin(), - "Wieso ist die SPalte auf einmal zu schmal?" ) + OSL_ENSURE( pColumn->GetMax() >= pColumn->GetMin(), + "Wieso ist die SPalte auf einmal zu schmal?" ); nMin += nDiff; nMinD -= nDiff; @@ -991,7 +991,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() } } } - ASSERT( 0==nRel || nQuot!=ULONG_MAX, + OSL_ENSURE( 0==nRel || nQuot!=ULONG_MAX, "Wo sind die relativen Spalten geblieben?" ); for( i=0; i<nCols; i++ ) { @@ -1002,7 +1002,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() pColumn->SetMax( pColumn->GetMax() / nQuot ); else pColumn->SetMax( pColumn->GetMin() ); - ASSERT( pColumn->GetMax() >= pColumn->GetMin(), + OSL_ENSURE( pColumn->GetMax() >= pColumn->GetMin(), "Maximale Spaltenbreite kleiner als Minimale" ); nMax += pColumn->GetMax(); } @@ -1015,7 +1015,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() ULONG nRelMax = 0; // Anteil am Maximum dieser Spalten for( i=0; i<nCols; i++ ) { - ASSERT( nRel<=100, "relative Breite aller Spalten>100%" ); + OSL_ENSURE( nRel<=100, "relative Breite aller Spalten>100%" ); SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() ) { @@ -1102,7 +1102,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() pColumn->SetMax( pColumn->GetMin() ); } // und durch den Quotienten teilen - ASSERT( nQuotMax!=ULONG_MAX, "Wo sind die relativen Spalten geblieben?" ); + OSL_ENSURE( nQuotMax!=ULONG_MAX, "Wo sind die relativen Spalten geblieben?" ); for( i=0; i<nCols; i++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); @@ -1111,7 +1111,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( pColumn->GetWidthOption() ) { pColumn->SetMax( pColumn->GetMax() / nQuotMax ); - ASSERT( pColumn->GetMax() >= pColumn->GetMin(), + OSL_ENSURE( pColumn->GetMax() >= pColumn->GetMin(), "Minimalbreite ein Spalte Groesser Maximum" ); if( pColumn->GetMax() < pColumn->GetMin() ) pColumn->SetMax( pColumn->GetMin() ); @@ -1138,16 +1138,16 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // Eine abolute zur Verfuegung stehende Breite muss immer uebergeben // werden. - ASSERT( nAbsAvail, "AutoLayout Pass 2: Keine absolute Breite gegeben" ); + OSL_ENSURE( nAbsAvail, "AutoLayout Pass 2: Keine absolute Breite gegeben" ); // Eine realtive zur Verfuegung stehende Breite darf nur und muss fuer // Tabellen in Tabellen uebergeben - ASSERT( IsTopTable() == (nRelAvail==0), + OSL_ENSURE( IsTopTable() == (nRelAvail==0), "AutoLayout Pass 2: Rel. Breite bei Tab in Tab oder umgekehrt" ); // Die Minimalbreite der Tabelle darf natuerlich nie groesser sein // als das die Maximalbreite. - ASSERT( nMin<=nMax, "AutoLayout Pass2: nMin > nMax" ); + OSL_ENSURE( nMin<=nMax, "AutoLayout Pass2: nMin > nMax" ); // Die verfuegbare Breite, fuer die die Tabelle berechnet wurde, merken. // (Dies ist ein guter Ort, denn hier kommer wir bei der Erstberechnung @@ -1216,7 +1216,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, { if( bPrcWidthOption ) { - ASSERT( nWidthOption<=100, "Prozentangabe zu gross" ); + OSL_ENSURE( nWidthOption<=100, "Prozentangabe zu gross" ); if( nWidthOption > 100 ) nWidthOption = 100; @@ -1254,9 +1254,9 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, } } - ASSERT( IsTopTable() || nAbsTabWidth<=nAbsAvail, + OSL_ENSURE( IsTopTable() || nAbsTabWidth<=nAbsAvail, "AutoLayout Pass2: nAbsTabWidth > nAbsAvail fuer Tab in Tab" ); - ASSERT( !nRelAvail || nAbsTabWidth<=nAbsAvail, + OSL_ENSURE( !nRelAvail || nAbsTabWidth<=nAbsAvail, "AutoLayout Pass2: nAbsTabWidth > nAbsAvail fuer relative Breite" ); // Catch fuer die beiden Asserts von oben (man weiss ja nie!) @@ -1380,7 +1380,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // Eine Top-Table darf auch beriter werden als der verfuegbare Platz. if( nAbsTabWidth > nAbsAvail ) { - ASSERT( IsTopTable(), + OSL_ENSURE( IsTopTable(), "Tabelle in Tabelle soll breiter werden als umgebende Zelle" ); nAbsAvail = nAbsTabWidth; } @@ -1447,7 +1447,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // absoluten Breiten. nFixMax entspricht an dieser Stelle // nAbs, so dass man gleich nFixMax haette nehmen koennen. // Der Code ist so aber verstaendlicher. - ASSERT( nFixMax == nAbs, "Zwei Schleifen, zwei Summen?" ) + OSL_ENSURE( nFixMax == nAbs, "Zwei Schleifen, zwei Summen?" ); ULONG nDistMax = nMax - nFixMax; USHORT nDistAbsTabWidth = nAbsTabWidth - nAbs; USHORT nDistRelTabWidth = nRelTabWidth - nRel; @@ -1476,7 +1476,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, nRel = nRel + pColumn->GetRelColWidth(); } } - ASSERT( nCols==nFixedCols, "Spalte vergessen!" ); + OSL_ENSURE( nCols==nFixedCols, "Spalte vergessen!" ); } else { @@ -1503,7 +1503,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, if( nAbsTabWidth > nAbsAvail ) { - ASSERT( IsTopTable(), + OSL_ENSURE( IsTopTable(), "Tabelle in Tabelle soll breiter werden als Platz da ist" ); nAbsAvail = nAbsTabWidth; } @@ -1575,9 +1575,9 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, break; } - ASSERT( !pLeftFillerBox || nRelLeftFill>0, + OSL_ENSURE( !pLeftFillerBox || nRelLeftFill>0, "Fuer linke Filler-Box ist keine Breite da!" ); - ASSERT( !pRightFillerBox || nRelRightFill>0, + OSL_ENSURE( !pRightFillerBox || nRelRightFill>0, "Fuer rechte Filler-Box ist keine Breite da!" ); // Filler-Breiten werden auf die ausseren Spalten geschlagen, wenn @@ -1634,14 +1634,14 @@ static BOOL lcl_ResizeBox( const SwTableBox*& rpBox, void* pPara ) static BOOL lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ) { USHORT *pWidth = (USHORT *)pPara; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT nOldWidth = *pWidth; #endif *pWidth = 0; ((SwTableLine *)rpLine)->GetTabBoxes().ForEach( &lcl_ResizeBox, pWidth ); -#ifdef DBG_UTIL - ASSERT( !nOldWidth || Abs(*pWidth-nOldWidth) < COLFUZZY, +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !nOldWidth || Abs(*pWidth-nOldWidth) < COLFUZZY, "Zeilen einer Box sind unterschiedlich lang" ); #endif @@ -1715,7 +1715,7 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, USHORT nCalcTabWidth = 0; ((SwTable *)pSwTable)->GetTabLines().ForEach( &lcl_ResizeLine, &nCalcTabWidth ); - ASSERT( Abs( nRelTabWidth-nCalcTabWidth ) < COLFUZZY, + OSL_ENSURE( Abs( nRelTabWidth-nCalcTabWidth ) < COLFUZZY, "Tabellebreite stimmt nicht mit Zeilenbreite ueberein." ); // Beim Anpassen des Tabellen-Formats dieses locken, weil sonst @@ -1751,7 +1751,7 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { // steht im tblrwcl.cxx extern void _CheckBoxWidth( const SwTableLine&, SwTwips ); @@ -1818,7 +1818,7 @@ BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, { if( 0 == nAbsAvail ) return FALSE; - ASSERT( IsTopTable(), "Resize darf nur an Top-Tabellen aufgerufen werden" ); + OSL_ENSURE( IsTopTable(), "Resize darf nur an Top-Tabellen aufgerufen werden" ); // Darf die Tabelle uberhaupt Resized werden oder soll sie es trotzdem? if( bMustNotResize && !bForce ) diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index 4b8f025f93..92d8bb88cf 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -134,7 +134,7 @@ SwCharFmt* SwLineNumberInfo::GetCharFmt( IDocumentStylePoolAccess& rIDSPA ) cons void SwLineNumberInfo::SetCharFmt( SwCharFmt *pChFmt ) { - ASSERT( pChFmt, "SetCharFmt, 0 is not a valid pointer" ); + OSL_ENSURE( pChFmt, "SetCharFmt, 0 is not a valid pointer" ); pChFmt->Add( this ); } diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index f42f6f3137..1b3aea2d90 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -937,7 +937,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons else pVout = 0; - ASSERT( OUTDEV_VIRDEV != pOut->GetOutDevType() || + OSL_ENSURE( OUTDEV_VIRDEV != pOut->GetOutDevType() || pShell->GetViewOptions()->IsPDFExport(), "pOut sollte kein virtuelles Device sein" ); @@ -1043,7 +1043,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) { const SwFlyFrm *pFly = FindFlyFrm(); - ASSERT( pFly, "OLE not in FlyFrm" ); + OSL_ENSURE( pFly, "OLE not in FlyFrm" ); ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm()); } diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 5aeb1175d5..504ee06ef8 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -175,14 +175,14 @@ void SwNumRule::SetNumRuleMap(std::hash_map<String, SwNumRule *, StringHash> * USHORT SwNumRule::GetNumIndent( BYTE nLvl ) { - ASSERT( MAXLEVEL > nLvl, "NumLevel is out of range" ); + OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" ); return aDefNumIndents[ nLvl ]; } USHORT SwNumRule::GetBullIndent( BYTE nLvl ) { - ASSERT( MAXLEVEL > nLvl, "NumLevel is out of range" ); + OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" ); return aDefNumIndents[ nLvl ]; } @@ -391,7 +391,7 @@ const SwFmtVertOrient* SwNumFmt::GetGraphicOrientation() const } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 long int SwNumRule::nInstances = 0; #endif @@ -416,7 +416,7 @@ SwNumRule::SwNumRule( const String& rNm, meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ), msDefaultListId() { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nSerial = nInstances++; #endif @@ -498,7 +498,7 @@ SwNumRule::SwNumRule( const String& rNm, } } memset( aFmts, 0, sizeof( aFmts )); - ASSERT( sName.Len(), "NumRule ohne Namen!" ); + OSL_ENSURE( sName.Len(), "NumRule ohne Namen!" ); } SwNumRule::SwNumRule( const SwNumRule& rNumRule ) @@ -518,7 +518,7 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule ) meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ), msDefaultListId( rNumRule.msDefaultListId ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nSerial = nInstances++; #endif @@ -624,7 +624,7 @@ BOOL SwNumRule::operator==( const SwNumRule& rRule ) const void SwNumRule::Set( USHORT i, const SwNumFmt& rNumFmt ) { - ASSERT( i < MAXLEVEL, "Serious defect, please inform OD" ) + OSL_ENSURE( i < MAXLEVEL, "Serious defect, please inform OD" ); if( i < MAXLEVEL ) { if( !aFmts[ i ] || !(rNumFmt == Get( i )) ) @@ -638,7 +638,7 @@ void SwNumRule::Set( USHORT i, const SwNumFmt& rNumFmt ) void SwNumRule::Set( USHORT i, const SwNumFmt* pNumFmt ) { - ASSERT( i < MAXLEVEL, "Serious defect, please inform OD" ) + OSL_ENSURE( i < MAXLEVEL, "Serious defect, please inform OD" ); if( i >= MAXLEVEL ) return; SwNumFmt* pOld = aFmts[ i ]; @@ -870,7 +870,7 @@ void SwNumRule::SetInvalidRule(BOOL bFlag) const SwTxtNode* pTxtNode = *aIter; // --> OD 2010-06-04 #i111681# - applying patch from cmc SwList* pList = pTxtNode->GetDoc()->getListByName( pTxtNode->GetListId() ); - ASSERT( pList, "<SwNumRule::SetInvalidRule(..)> - list at which the text node is registered at does not exist. This is a serious issue --> please inform OD."); + OSL_ENSURE( pList, "<SwNumRule::SetInvalidRule(..)> - list at which the text node is registered at does not exist. This is a serious issue --> please inform OD."); if ( pList ) { aLists.insert( pList ); @@ -1207,8 +1207,8 @@ namespace numfunc uno::Sequence<uno::Any> aValues = GetProperties( aPropNames ); const uno::Any* pValues = aValues.getConstArray(); - ASSERT( aValues.getLength() == aPropNames.getLength(), - "<SwDefBulletConfig::SwDefBulletConfig()> - GetProperties failed") + OSL_ENSURE( aValues.getLength() == aPropNames.getLength(), + "<SwDefBulletConfig::SwDefBulletConfig()> - GetProperties failed"); if ( aValues.getLength() == aPropNames.getLength() ) { for ( int nProp = 0; nProp < aPropNames.getLength(); ++nProp ) @@ -1395,8 +1395,8 @@ namespace numfunc com::sun::star::uno::Sequence<com::sun::star::uno::Any> aValues = GetProperties( aPropNames ); const com::sun::star::uno::Any* pValues = aValues.getConstArray(); - ASSERT( aValues.getLength() == aPropNames.getLength(), - "<SwNumberingUIBehaviorConfig::LoadConfig()> - GetProperties failed") + OSL_ENSURE( aValues.getLength() == aPropNames.getLength(), + "<SwNumberingUIBehaviorConfig::LoadConfig()> - GetProperties failed"); if ( aValues.getLength() == aPropNames.getLength() ) { for ( int nProp = 0; nProp < aPropNames.getLength(); ++nProp ) @@ -1412,8 +1412,8 @@ namespace numfunc break; default: { - ASSERT( false, - "<SwNumberingUIBehaviorConfig::LoadConfig()> - unknown configuration property") + OSL_ENSURE( false, + "<SwNumberingUIBehaviorConfig::LoadConfig()> - unknown configuration property"); } } } diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index 1b77c25dcb..f10fa7b3d6 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -319,7 +319,7 @@ SvxFrameDirection GetDefaultFrameDirection(ULONG nLanguage) SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) { - ASSERT( + OSL_ENSURE( (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) || (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) || (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) || @@ -356,7 +356,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END) nResId = RC_POOLCOLL_HTML_BEGIN - RES_POOLCOLL_HTML_BEGIN; - ASSERT( nResId, "Ungueltige Pool-ID" ); + OSL_ENSURE( nResId, "Ungueltige Pool-ID" ); if( !nResId ) return GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); @@ -1057,7 +1057,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) // benutzt wird bool SwDoc::IsPoolTxtCollUsed( USHORT nId ) const { - ASSERT( + OSL_ENSURE( (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) || (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) || (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) || @@ -1111,7 +1111,7 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) // -> returne das erste if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END ) { - ASSERT( !this, "ungueltige Id" ); + OSL_ENSURE( !this, "ungueltige Id" ); nId = RES_POOLCHR_BEGIN; } } @@ -1129,7 +1129,7 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) // -> returne das erste if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END ) { - ASSERT( !this, "ungueltige Id" ); + OSL_ENSURE( !this, "ungueltige Id" ); nId = RES_POOLFRM_BEGIN; } } @@ -1137,10 +1137,10 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) default: // Fehlerfall, unbekanntes Format - ASSERT( nId, "ungueltige Id" ); + OSL_ENSURE( nId, "ungueltige Id" ); return 0; } - ASSERT( nRCId, "ungueltige Id" ); + OSL_ENSURE( nRCId, "ungueltige Id" ); while( nArrCnt-- ) for( USHORT n = 0; n < (*pArray[nArrCnt]).Count(); ++n ) @@ -1399,7 +1399,7 @@ bool SwDoc::IsPoolFmtUsed( USHORT nId ) const } else { - ASSERT( FALSE, "ungueltige Id" ); + OSL_ENSURE( FALSE, "ungueltige Id" ); bFnd = FALSE; } @@ -1444,7 +1444,7 @@ void lcl_GetStdPgSize( SwDoc* pDoc, SfxItemSet& rSet ) SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) { - ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, + OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, "Falsche AutoFormat-Id" ); SwPageDesc *pNewPgDsc; @@ -1459,7 +1459,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) // Fehlerfall: unbekannte Poolvorlage if( RES_POOLPAGE_BEGIN > nId || nId >= RES_POOLPAGE_END ) { - ASSERT( !this, "ungueltige Id" ); + OSL_ENSURE( !this, "ungueltige Id" ); nId = RES_POOLPAGE_BEGIN; } @@ -1616,7 +1616,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) { - ASSERT( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END, + OSL_ENSURE( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END, "Falsche AutoFormat-Id" ); SwNumRule* pNewRule; @@ -1631,7 +1631,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) // Fehlerfall: unbekannte Poolvorlage if( RES_POOLNUMRULE_BEGIN > nId || nId >= RES_POOLNUMRULE_END ) { - ASSERT( !this, "ungueltige Id" ); + OSL_ENSURE( !this, "ungueltige Id" ); nId = RES_POOLNUMRULE_BEGIN; } @@ -2321,7 +2321,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) // benutzt wird bool SwDoc::IsPoolPageDescUsed( USHORT nId ) const { - ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, + OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, "Falsche AutoFormat-Id" ); SwPageDesc *pNewPgDsc = 0; BOOL bFnd = FALSE; @@ -2365,7 +2365,7 @@ sal_Bool SwDoc::IsUsed( const SwNumRule& rRule ) const // dann fuege neu ein USHORT SwDoc::SetDocPattern( const String& rPatternName ) { - ASSERT( rPatternName.Len(), "kein Dokument-Vorlagenname" ); + OSL_ENSURE( rPatternName.Len(), "kein Dokument-Vorlagenname" ); USHORT nNewPos = aPatternNms.Count(); for( USHORT n = 0; n < aPatternNms.Count(); ++n ) diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx index e3972476ac..b43291b58b 100644 --- a/sw/source/core/doc/swstylemanager.cxx +++ b/sw/source/core/doc/swstylemanager.cxx @@ -148,7 +148,7 @@ StylePool::SfxItemSet_Pointer_t SwStyleManager::getByName( const rtl::OUString& { // Ok, ok, it's allowed to ask for uncached styles (from UNO) but it should not be done // during loading a document - ASSERT( false, "Don't ask for uncached styles" ); + OSL_ENSURE( false, "Don't ask for uncached styles" ); rpCache->addCompletePool( rAutoPool ); pStyle = rpCache->getByName( rName ); } diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 1018586d65..b720b91afd 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -586,7 +586,7 @@ SwTableAutoFmt::~SwTableAutoFmt() void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, BYTE nPos ) { - ASSERT( nPos < 16, "falscher Bereich" ); + OSL_ENSURE( nPos < 16, "falscher Bereich" ); SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ]; if( pFmt ) // ist gesetzt -> kopieren @@ -598,7 +598,7 @@ void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, BYTE nPos ) const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( BYTE nPos ) const { - ASSERT( nPos < 16, "falscher Bereich" ); + OSL_ENSURE( nPos < 16, "falscher Bereich" ); SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ]; if( pFmt ) // ist gesetzt -> kopieren @@ -619,7 +619,7 @@ SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( BYTE nPos, UpdateFlags eFlags, SvNumberFormatter* pNFmtr ) { - ASSERT( nPos < 16, "falscher Bereich" ); + OSL_ENSURE( nPos < 16, "falscher Bereich" ); SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ]; if( !pFmt ) // ist gesetzt -> kopieren @@ -997,7 +997,7 @@ BOOL SwTableAutoFmtTbl::Load( SvStream& rStream ) // rStream >> nFileVers; if( rStream.Tell() != ULONG(nPos + nCnt) ) { - ASSERT( !this, "Der Header enthaelt mehr/neuere Daten" ); + OSL_ENSURE( !this, "Der Header enthaelt mehr/neuere Daten" ); rStream.Seek( nPos + nCnt ); } rStream.SetStreamCharSet( (CharSet)nChrSet ); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index b589a5db0c..b8f3701bfc 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -141,7 +141,7 @@ namespace for( USHORT nLine = 0; nLine < rBox.GetTabLines().Count(); ++nLine ) pStartLn = insertSubLine( rSubTable, *rBox.GetTabLines()[nLine], pStartLn ); - ASSERT( pStartLn == pEndLn, "Sub line confusion" ); + OSL_ENSURE( pStartLn == pEndLn, "Sub line confusion" ); } else { @@ -527,7 +527,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, SwTable& rDstTbl, SwTableBox* pDstBox, BOOL bDelCntnt, SwUndoTblCpyTbl* pUndo ) { - ASSERT( ( !pCpyBox || pCpyBox->GetSttNd() ) && pDstBox->GetSttNd(), + OSL_ENSURE( ( !pCpyBox || pCpyBox->GetSttNd() ) && pDstBox->GetSttNd(), "Keine inhaltstragende Box" ); SwDoc* pCpyDoc = rCpyTbl.GetFrmFmt()->GetDoc(); @@ -756,7 +756,7 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, SwTableBox* pMyBox = (SwTableBox*)GetTblBox( rSttBox.GetNode().FindTableBoxStartNode()->GetIndex() ); - ASSERT( pMyBox, "Index steht nicht in dieser Tabelle in einer Box" ); + OSL_ENSURE( pMyBox, "Index steht nicht in dieser Tabelle in einer Box" ); // loesche erstmal die Frames der Tabelle _FndBox aFndBox( 0, 0 ); @@ -826,14 +826,14 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, SwUndoTblCpyTbl* pUndo ) { - ASSERT( rSelBoxes.Count(), "Missing selection" ) + OSL_ENSURE( rSelBoxes.Count(), "Missing selection" ); SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen if( IsNewModel() || rCpyTbl.IsNewModel() ) return InsNewTable( rCpyTbl, rSelBoxes, pUndo ); - ASSERT( !rCpyTbl.IsTblComplex(), "Table too complex" ) + OSL_ENSURE( !rCpyTbl.IsTblComplex(), "Table too complex" ); SwDoc* pDoc = GetFrmFmt()->GetDoc(); SwDoc* pCpyDoc = rCpyTbl.GetFrmFmt()->GetDoc(); @@ -909,7 +909,7 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // es ist also Platz fuer das zu kopierende vorhanden, also // fuege entsprechend neue Zeilen ein. SwTableBox* pInsBox = pLastLn->GetTabBoxes()[ nSttBox ]; - ASSERT( pInsBox && pInsBox->GetSttNd(), + OSL_ENSURE( pInsBox && pInsBox->GetSttNd(), "kein CntntBox oder steht nicht in dieser Tabelle" ); SwSelBoxes aBoxes; diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 22fd94af32..f40ec609e4 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -72,15 +72,11 @@ using namespace com::sun::star::uno; using namespace ::com::sun::star; -#ifndef DBG_UTIL -#define CHECK_TABLE(t) -#else -#ifdef DEBUG +#if OSL_DEBUG_LEVEL > 2 #define CHECK_TABLE(t) (t).CheckConsistency(); #else #define CHECK_TABLE(t) #endif -#endif typedef SwTableLine* SwTableLinePtr; SV_DECL_PTRARR_SORT( SwSortTableLines, SwTableLinePtr, 16, 16 ) @@ -195,7 +191,7 @@ BOOL lcl_DelOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, typedef BOOL (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, BOOL ); -#if defined(DBG_UTIL) || defined( JP_DEBUG ) +#if OSL_DEBUG_LEVEL > 1 void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); @@ -221,8 +217,8 @@ void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); if ( pFrm && \ ((SwRowFrm*)pFrm)->GetTabLine() == GetTabLines()[i] ) \ { \ - ASSERT( pFrm->GetUpper()->IsTabFrm(), \ - "Table layout does not match table structure" ) \ + OSL_ENSURE( pFrm->GetUpper()->IsTabFrm(), \ + "Table layout does not match table structure" ); \ } \ } while ( 0 != ( pLast = aIter++ ) ); \ } \ @@ -533,7 +529,7 @@ SwRowFrm* GetRowFrm( SwTableLine& rLine ) BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) { - ASSERT( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -573,8 +569,8 @@ BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOO //Layout updaten aFndBox.MakeFrms( *this ); - CHECKBOXWIDTH - CHECKTABLELAYOUT + CHECKBOXWIDTH; + CHECKTABLELAYOUT; bRes = TRUE; } @@ -589,7 +585,7 @@ BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOO BOOL SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) { - ASSERT( pDoc && rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); + OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -674,8 +670,8 @@ BOOL SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, aFndBox.MakeNewFrms( *this, nCnt, bBehind ); } - CHECKBOXWIDTH - CHECKTABLELAYOUT + CHECKBOXWIDTH; + CHECKTABLELAYOUT; SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); if (pPCD && nCnt) @@ -773,8 +769,8 @@ BOOL SwTable::AppendRow( SwDoc* pDoc, USHORT nCnt ) // TL_CHART2: need to inform chart of probably changed cell names pDoc->UpdateCharts( GetFrmFmt()->GetName() ); - CHECKBOXWIDTH - CHECKTABLELAYOUT + CHECKBOXWIDTH; + CHECKTABLELAYOUT; return TRUE; } @@ -1086,7 +1082,7 @@ BOOL SwTable::DeleteSel( const SwSelBoxes* pMerged, SwUndo* pUndo, const BOOL bDelMakeFrms, const BOOL bCorrBorder ) { - ASSERT( pDoc, "No doc?" ); + OSL_ENSURE( pDoc, "No doc?" ); SwTableNode* pTblNd = 0; if( rBoxes.Count() ) { @@ -1148,8 +1144,8 @@ BOOL SwTable::DeleteSel( // TL_CHART2: now inform chart that sth has changed pDoc->UpdateCharts( GetFrmFmt()->GetName() ); - CHECKTABLELAYOUT - CHECK_TABLE( *this ) + CHECKTABLELAYOUT; + CHECK_TABLE( *this ); return TRUE; } @@ -1157,7 +1153,7 @@ BOOL SwTable::DeleteSel( BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bSameHeight ) { - ASSERT( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" ); + OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -1179,7 +1175,7 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, { SwTableBox* pSelBox = *( rBoxes.GetData() + n ); const SwRowFrm* pRow = GetRowFrm( *pSelBox->GetUpper() ); - ASSERT( pRow, "wo ist der Frm von der SwTableLine?" ) + OSL_ENSURE( pRow, "wo ist der Frm von der SwTableLine?" ); SWRECTFN( pRow ) pRowHeights[ n ] = (pRow->Frm().*fnRect->fnGetHeight)(); } @@ -1193,7 +1189,7 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, for( USHORT n = 0; n < rBoxes.Count(); ++n ) { SwTableBox* pSelBox = *( rBoxes.GetData() + n ); - ASSERT( pSelBox, "Box steht nicht in der Tabelle" ); + OSL_ENSURE( pSelBox, "Box steht nicht in der Tabelle" ); // dann fuege in die Box nCnt neue Zeilen ein SwTableLine* pInsLine = pSelBox->GetUpper(); @@ -1300,7 +1296,7 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) { - ASSERT( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" ); + OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -1326,7 +1322,7 @@ BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) for( USHORT n = 0; n < aSelBoxes.Count(); ++n ) { SwTableBox* pSelBox = *( aSelBoxes.GetData() + n ); - ASSERT( pSelBox, "Box steht nicht in der Tabelle" ); + OSL_ENSURE( pSelBox, "Box steht nicht in der Tabelle" ); // We don't want to split small table cells into very very small cells if( pSelBox->GetFrmFmt()->GetFrmSize().GetWidth()/( nCnt + 1 ) < 10 ) @@ -1452,10 +1448,10 @@ void lcl_CalcWidth( SwTableBox* pBox ) { // Annahme: jede Line in der Box ist gleich gross SwFrmFmt* pFmt = pBox->ClaimFrmFmt(); - ASSERT( pBox->GetTabLines().Count(), "Box hat keine Lines" ); + OSL_ENSURE( pBox->GetTabLines().Count(), "Box hat keine Lines" ); SwTableLine* pLine = pBox->GetTabLines()[0]; - ASSERT( pLine, "Box steht in keiner Line" ); + OSL_ENSURE( pLine, "Box steht in keiner Line" ); long nWidth = 0; for( USHORT n = 0; n < pLine->GetTabBoxes().Count(); ++n ) @@ -1706,7 +1702,7 @@ BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) lcl_CalcWidth( pRMBox ); // bereche die Breite der Box } else { - ASSERT( FALSE , "Was denn nun" ); + OSL_ENSURE( FALSE , "Was denn nun" ); } } // Left/Right @@ -1739,7 +1735,7 @@ BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableBox* pMergeBox, SwUndoTblMerge* pUndo ) { - ASSERT( rBoxes.Count() && pMergeBox, "keine gueltigen Werte" ); + OSL_ENSURE( rBoxes.Count() && pMergeBox, "keine gueltigen Werte" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -2200,11 +2196,11 @@ BOOL SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) { // The copied line must not contain any row span attributes > 1 SwTableLine* pLine = rTblNd.GetTable().GetTabLines()[0]; USHORT nColCount = pLine->GetTabBoxes().Count(); - ASSERT( nColCount, "Empty Table Line" ) + OSL_ENSURE( nColCount, "Empty Table Line" ); for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { SwTableBox* pTableBox = pLine->GetTabBoxes()[nCurrCol]; - ASSERT( pTableBox, "Missing Table Box" ); + OSL_ENSURE( pTableBox, "Missing Table Box" ); pTableBox->setRowSpan( 1 ); } } @@ -2244,7 +2240,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, SwNodeIndex aIdx( rPos.nNode, -1 ); SwTableNode* pTblNd = aIdx.GetNode().FindTableNode(); aIdx++; - ASSERT( pTblNd, "wo ist denn nun der TableNode?" ); + OSL_ENSURE( pTblNd, "wo ist denn nun der TableNode?" ); pTblNd->GetTable().SetRowsToRepeat( GetRowsToRepeat() ); @@ -2254,7 +2250,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, // ist im neuen Dokument ueberhaupt der FeldTyp vorhanden ? SwFieldType* pFldType = pInsDoc->InsertFldType( *((SwDDETable*)this)->GetDDEFldType() ); - ASSERT( pFldType, "unbekannter FieldType" ); + OSL_ENSURE( pFldType, "unbekannter FieldType" ); // tauschen am Node den Tabellen-Pointer aus pNewTbl = new SwDDETable( *pNewTbl, @@ -2372,7 +2368,7 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, if( GetUpper() ) { nFndPos = GetUpper()->GetTabLines().GetPos( pLine ); - ASSERT( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" ); + OSL_ENSURE( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" ); // gibts eine weitere Line if( nFndPos+1 >= GetUpper()->GetTabLines().Count() ) return GetUpper()->GetUpper()->FindNextBox( rTbl, GetUpper(), bOvrTblLns ); @@ -2423,7 +2419,7 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, if( GetUpper() ) { nFndPos = GetUpper()->GetTabLines().GetPos( pLine ); - ASSERT( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" ); + OSL_ENSURE( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" ); // gibts eine weitere Line if( !nFndPos ) return GetUpper()->GetUpper()->FindPreviousBox( rTbl, GetUpper(), bOvrTblLns ); @@ -2793,7 +2789,7 @@ BOOL lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, } else { - ASSERT( pBox->GetSttNd(), "Das muss eine EndBox sein!"); + OSL_ENSURE( pBox->GetSttNd(), "Das muss eine EndBox sein!"); if( !rParam.bLeft && 3 != nCmp ) ++n; @@ -3394,7 +3390,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, break; default: - ASSERT( !pBox, "hier sollte man nie hinkommen" ); + OSL_ENSURE( !pBox, "hier sollte man nie hinkommen" ); break; } } @@ -3466,7 +3462,7 @@ void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam ) } } -#if defined(DBG_UTIL) || defined( JP_DEBUG ) +#if OSL_DEBUG_LEVEL > 1 void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ) { @@ -3524,7 +3520,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo, { _FndPara aPara( rParam.aBoxes, pFndBox ); rTbl.GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); - ASSERT( pFndBox->GetLines().Count(), "Wo sind die Boxen" ); + OSL_ENSURE( pFndBox->GetLines().Count(), "Wo sind die Boxen" ); pFndBox->SetTableLines( rTbl ); if( ppUndo ) @@ -4041,7 +4037,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetLineHeight& rParam, SwUndo** ppUndo, // suche alle Boxen / Lines SwTable& rTbl = rParam.pTblNd->GetTable(); - ASSERT( rParam.aBoxes.Count(), "ohne Boxen ist nichts zu machen!" ); + OSL_ENSURE( rParam.aBoxes.Count(), "ohne Boxen ist nichts zu machen!" ); // loeschen der gesamten Tabelle verhindern if( !rParam.bBigger && rParam.aBoxes.Count() == @@ -4055,7 +4051,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetLineHeight& rParam, SwUndo** ppUndo, { _FndPara aPara( rParam.aBoxes, pFndBox ); rTbl.GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); - ASSERT( pFndBox->GetLines().Count(), "Wo sind die Boxen" ); + OSL_ENSURE( pFndBox->GetLines().Count(), "Wo sind die Boxen" ); pFndBox->SetTableLines( rTbl ); if( ppUndo ) @@ -4074,7 +4070,7 @@ void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight, BOOL bMinSize ) { SwLayoutFrm* pLineFrm = GetRowFrm( rLine ); - ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" ); + OSL_ENSURE( pLineFrm, "wo ist der Frm von der SwTableLine?" ); SwFrmFmt* pFmt = rLine.ClaimFrmFmt(); @@ -4121,7 +4117,7 @@ BOOL lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, { // anhand der alten Size die neue relative errechnen SwLayoutFrm* pLineFrm = GetRowFrm( *pLine ); - ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" ); + OSL_ENSURE( pLineFrm, "wo ist der Frm von der SwTableLine?" ); SwTwips nRstHeight = CalcRowRstHeight( pLineFrm ); if( (nRstHeight + ROWFUZZY) < nDist ) bRet = FALSE; @@ -4139,7 +4135,7 @@ BOOL lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, { // anhand der alten Size die neue relative errechnen SwLayoutFrm* pLineFrm = GetRowFrm( *pLine ); - ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" ); + OSL_ENSURE( pLineFrm, "wo ist der Frm von der SwTableLine?" ); if( TBLFIX_CHGPROP == rParam.nMode ) { @@ -4156,7 +4152,7 @@ BOOL lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, if( TBLFIX_CHGPROP == rParam.nMode ) { SwLayoutFrm* pLineFrm = GetRowFrm( *pLine ); - ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" ); + OSL_ENSURE( pLineFrm, "wo ist der Frm von der SwTableLine?" ); // aus der alten Size die neue relative errechnen // Wird die selektierte Box groesser ueber den MaxSpace anpassen, @@ -4402,7 +4398,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, for( n = nStt; n < nEnd; ++n ) { SwLayoutFrm* pLineFrm = GetRowFrm( *(*pLines)[ n ] ); - ASSERT( pLineFrm, "wo ist der Frm von der SwTableLine?" ); + OSL_ENSURE( pLineFrm, "wo ist der Frm von der SwTableLine?" ); aParam.nMaxSpace += CalcRowRstHeight( pLineFrm ); aParam.nMaxHeight += pLineFrm->Frm().Height(); } diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx index bfd9fa6bd4..6d5d0c9685 100644 --- a/sw/source/core/docnode/finalthreadmanager.cxx +++ b/sw/source/core/docnode/finalthreadmanager.cxx @@ -241,14 +241,14 @@ void TerminateOfficeThread::PerformOfficeTermination() css::uno::UNO_QUERY ); if ( !xTasksSupplier.is() ) { - ASSERT( false, "<TerminateOfficeThread::PerformOfficeTermination()> - no XFramesSupplier!" ); + OSL_ENSURE( false, "<TerminateOfficeThread::PerformOfficeTermination()> - no XFramesSupplier!" ); return; } css::uno::Reference< css::container::XElementAccess > xList( xTasksSupplier->getFrames(), css::uno::UNO_QUERY ); if ( !xList.is() ) { - ASSERT( false, "<TerminateOfficeThread::PerformOfficeTermination()> - no XElementAccess!" ); + OSL_ENSURE( false, "<TerminateOfficeThread::PerformOfficeTermination()> - no XElementAccess!" ); return; } @@ -317,7 +317,7 @@ FinalThreadManager::~FinalThreadManager() if ( !maThreads.empty() ) { - ASSERT( false, "<FinalThreadManager::~FinalThreadManager()> - still registered jobs are existing -> perform cancellation" ); + OSL_ENSURE( false, "<FinalThreadManager::~FinalThreadManager()> - still registered jobs are existing -> perform cancellation" ); cancelAllJobs(); } @@ -325,7 +325,7 @@ FinalThreadManager::~FinalThreadManager() { if ( !mpCancelJobsThread->allJobsCancelled() ) { - ASSERT( false, "<FinalThreadManager::~FinalThreadManager()> - cancellation of registered jobs not yet finished -> wait for its finish" ); + OSL_ENSURE( false, "<FinalThreadManager::~FinalThreadManager()> - cancellation of registered jobs not yet finished -> wait for its finish" ); } mpCancelJobsThread->stopWhenAllJobsCancelled(); @@ -493,11 +493,6 @@ void SAL_CALL FinalThreadManager::notifyTermination( const css::lang::EventObjec if ( mpCancelJobsThread != 0 ) { - if ( !mpCancelJobsThread->allJobsCancelled() ) - { - - } - mpCancelJobsThread->stopWhenAllJobsCancelled(); mpCancelJobsThread->join(); delete mpCancelJobsThread; diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index c9704913d0..465870b538 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -57,15 +57,12 @@ #include <pagedesc.hxx> #include <poolfmt.hxx> #include <SwNodeNum.hxx> -#ifndef DBG_UTIL -#define CHECK_TABLE(t) -#else -#ifdef DEBUG + +#if OSL_DEBUG_LEVEL > 1 #define CHECK_TABLE(t) (t).CheckConsistency(); #else #define CHECK_TABLE(t) #endif -#endif namespace { @@ -364,7 +361,7 @@ BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) { SwNodeIndex aNewIdx( *pCT->pTblNd, rpBox->GetSttIdx() - pCT->nOldTblSttIdx ); - ASSERT( aNewIdx.GetNode().IsStartNode(), "Index nicht auf einem StartNode" ); + OSL_ENSURE( aNewIdx.GetNode().IsStartNode(), "Index nicht auf einem StartNode" ); pNewBox = new SwTableBox( pBoxFmt, aNewIdx, pCT->pInsLine ); pNewBox->setRowSpan( rpBox->getRowSpan() ); } @@ -461,7 +458,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const pDoc->InsDeletedFldType( *pDDEType ); else pDDEType = (SwDDEFieldType*)pDoc->InsertFldType( *pDDEType ); - ASSERT( pDDEType, "unbekannter FieldType" ); + OSL_ENSURE( pDDEType, "unbekannter FieldType" ); // tauschen am Node den Tabellen-Pointer aus SwDDETable* pNewTable = new SwDDETable( pTblNd->GetTable(), pDDEType ); @@ -722,8 +719,8 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const } else { - ASSERT( this == pDoc, " falscher Copy-Zweig!" ); - ASSERT(false, "mst: i thought this could be dead code;" + OSL_ENSURE( this == pDoc, " falscher Copy-Zweig!" ); + OSL_ENSURE(false, "mst: i thought this could be dead code;" "please tell me what you did to get here!"); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); @@ -1318,7 +1315,7 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte aRedlRest.Restore(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { //JP 17.06.99: Bug 66973 - check count only if the selection is in // the same (or no) section. Becaus not full selected @@ -1330,9 +1327,9 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte !rRg.aStart.GetNode().IsSectionNode() && !aTmpI.GetNode().IsEndNode() ) { - ASSERT( rInsPos.GetIndex() - aSavePos.GetIndex() == + OSL_ENSURE( rInsPos.GetIndex() - aSavePos.GetIndex() == rRg.aEnd.GetIndex() - rRg.aStart.GetIndex(), - "Es wurden zu wenig Nodes kopiert!" ) + "Es wurden zu wenig Nodes kopiert!" ); } } #endif @@ -1495,7 +1492,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, { // This case can *not* happen, but to be robust take the first // text node in the destination document. - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::_CopyFlyInFly(..)> - anchor text node in copied range not found" ); nAnchorTxtNdNumInRange = 1; } @@ -1521,7 +1518,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, { // This case can *not* happen, but to be robust take the first // text node in the destination document. - ASSERT( false, + OSL_ENSURE( false, "<SwDoc::_CopyFlyInFly(..)> - found anchor node index isn't a text node" ); aAnchorNdIdx = rStartIdx; while ( !aAnchorNdIdx.GetNode().IsTxtNode() ) @@ -1577,7 +1574,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, //Alle chains, die im Original vorhanden sind, soweit wie moeglich wieder //aufbauen. - ASSERT( aArr.Count() == aNewArr.Count(), "Missing new Flys" ); + OSL_ENSURE( aArr.Count() == aNewArr.Count(), "Missing new Flys" ); if ( aArr.Count() == aNewArr.Count() ) { for ( USHORT n = 0; n < aArr.Count(); ++n ) diff --git a/sw/source/core/docnode/ndindex.cxx b/sw/source/core/docnode/ndindex.cxx index 94105fc7e7..3b5e5ecef6 100644 --- a/sw/source/core/docnode/ndindex.cxx +++ b/sw/source/core/docnode/ndindex.cxx @@ -35,7 +35,7 @@ #include "error.h" // fuers ASSERT #include "ndindex.hxx" -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 int SwNodeIndex::nSerial = 0; #endif @@ -69,7 +69,7 @@ SwNodeIndex::SwNodeIndex( SwNodes& rNds, ULONG nIdx ) { rNds.RegisterIndex( *this ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif } @@ -84,7 +84,7 @@ SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff ) pNd = rIdx.pNd; pNd->GetNodes().RegisterIndex( *this ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif } @@ -99,7 +99,7 @@ SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff ) pNd = (SwNode*)&rNd; pNd->GetNodes().RegisterIndex( *this ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif } diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index d4f0661051..001394d43c 100644 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -76,7 +76,7 @@ SwNoTxtNode::~SwNoTxtNode() // fuer Frame- und Grafik-Attributen void SwNoTxtNode::NewAttrSet( SwAttrPool& rPool ) { - ASSERT( !mpAttrSet.get(), "AttrSet ist doch gesetzt" ); + OSL_ENSURE( !mpAttrSet.get(), "AttrSet ist doch gesetzt" ); SwAttrSet aNewAttrSet( rPool, aNoTxtNodeSetRange ); // put names of parent style and conditional style: @@ -121,7 +121,7 @@ void SwNoTxtNode::SetContour( const PolyPolygon *pPoly, BOOL bAutomatic ) void SwNoTxtNode::CreateContour() { - ASSERT( !pContour, "Contour available." ); + OSL_ENSURE( !pContour, "Contour available." ); pContour = new PolyPolygon(SvxContourDlg::CreateAutoContour(GetGraphic())); bAutomaticContour = TRUE; bContourMapModeValid = TRUE; @@ -137,7 +137,7 @@ const PolyPolygon *SwNoTxtNode::HasContour() const const MapMode aContourMap( bPixelGrf ? MAP_PIXEL : MAP_100TH_MM ); if( bPixelGrf ? !bPixelContour : aGrfMap != aContourMap ) { - ASSERT( !bPixelGrf || aGrfMap == aContourMap, + OSL_ENSURE( !bPixelGrf || aGrfMap == aContourMap, "scale factor for pixel unsupported" ); OutputDevice* pOutDev = (bPixelGrf || bPixelContour) ? Application::GetDefaultDevice() @@ -171,7 +171,7 @@ const PolyPolygon *SwNoTxtNode::HasContour() const void SwNoTxtNode::GetContour( PolyPolygon &rPoly ) const { - ASSERT( pContour, "Contour not available." ); + OSL_ENSURE( pContour, "Contour not available." ); rPoly = *HasContour(); } @@ -195,7 +195,7 @@ BOOL SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const { const MapMode aGrfMap( GetGraphic().GetPrefMapMode() ); const MapMode aContourMap( MAP_100TH_MM ); - ASSERT( aGrfMap.GetMapUnit() != MAP_PIXEL || + OSL_ENSURE( aGrfMap.GetMapUnit() != MAP_PIXEL || aGrfMap == MapMode( MAP_PIXEL ), "scale factor for pixel unsupported" ); if( aGrfMap.GetMapUnit() != MAP_PIXEL && @@ -246,7 +246,7 @@ Graphic SwNoTxtNode::GetGraphic() const } else { - ASSERT( GetOLENode(), "new type of Node?" ); + OSL_ENSURE( GetOLENode(), "new type of Node?" ); aRet = *((SwOLENode*)this)->SwOLENode::GetGraphic(); } return aRet; @@ -257,7 +257,7 @@ void SwNoTxtNode::SetTitle( const String& rTitle, bool bBroadcast ) { // Title attribute of <SdrObject> replaces own AlternateText attribute SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(GetFlyFmt()); - ASSERT( pFlyFmt, + OSL_ENSURE( pFlyFmt, "<SwNoTxtNode::SetTitle(..)> - missing <SwFlyFrmFmt> instance" ); if ( !pFlyFmt ) { @@ -270,7 +270,7 @@ void SwNoTxtNode::SetTitle( const String& rTitle, bool bBroadcast ) const String SwNoTxtNode::GetTitle() const { const SwFlyFrmFmt* pFlyFmt = dynamic_cast<const SwFlyFrmFmt*>(GetFlyFmt()); - ASSERT( pFlyFmt, + OSL_ENSURE( pFlyFmt, "<SwNoTxtNode::GetTitle(..)> - missing <SwFlyFrmFmt> instance" ); if ( !pFlyFmt ) { @@ -283,7 +283,7 @@ const String SwNoTxtNode::GetTitle() const void SwNoTxtNode::SetDescription( const String& rDescription, bool bBroadcast ) { SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(GetFlyFmt()); - ASSERT( pFlyFmt, + OSL_ENSURE( pFlyFmt, "<SwNoTxtNode::SetDescription(..)> - missing <SwFlyFrmFmt> instance" ); if ( !pFlyFmt ) { @@ -296,7 +296,7 @@ void SwNoTxtNode::SetDescription( const String& rDescription, bool bBroadcast ) const String SwNoTxtNode::GetDescription() const { const SwFlyFrmFmt* pFlyFmt = dynamic_cast<const SwFlyFrmFmt*>(GetFlyFmt()); - ASSERT( pFlyFmt, + OSL_ENSURE( pFlyFmt, "<SwNoTxtNode::GetDescription(..)> - missing <SwFlyFrmFmt> instance" ); if ( !pFlyFmt ) { diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index c88a5fdfa3..fcb6c225d9 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -48,13 +48,13 @@ BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const //JP 17.03.98: aufgrund des Bug 48592 - wo unter anderem nach Undo/Redo // Nodes aus dem falschen NodesArray im OutlineArray standen, // jetzt mal einen Check eingebaut. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { for( USHORT n = 1; n < nO; ++n ) if( &(*this)[ n-1 ]->GetNodes() != &(*this)[ n ]->GetNodes() ) { - ASSERT( !this, "Node im falschen Outline-Array" ); + OSL_ENSURE( !this, "Node im falschen Outline-Array" ); } } #endif @@ -106,7 +106,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) } else { - ASSERT( false, + OSL_ENSURE( false, "<SwNodes::UpdateOutlineNode(..)> - given text node isn't in the correct nodes array. This is a serious defect -> inform OD" ); } // <-- diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index dc3c3c013f..a7168c27fe 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -93,7 +93,7 @@ bool lcl_IsInSameTblBox( SwNodes& _rNds, ? !_rNds.GoPrevSection( &aChkIdx, FALSE, FALSE ) : !_rNds.GoNextSection( &aChkIdx, FALSE, FALSE ) ) { - ASSERT( false, "<lcl_IsInSameTblBox(..)> - no previous/next!" ); + OSL_ENSURE( false, "<lcl_IsInSameTblBox(..)> - no previous/next!" ); return false; } else @@ -166,7 +166,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, if( rRange.HasMark() && 0 == ( nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd ) )) { - ASSERT( !this, "Selection ueber verschiedene Sections" ); + OSL_ENSURE( !this, "Selection ueber verschiedene Sections" ); return 0; } @@ -212,7 +212,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, *pEndPos = (SwPosition*)rRange.End(); if( pPrvNd && 3 == nRegionRet ) { - ASSERT( pPrvNd, "der SectionNode fehlt" ); + OSL_ENSURE( pPrvNd, "der SectionNode fehlt" ); SwNodeIndex aStt( pSttPos->nNode ), aEnd( pEndPos->nNode, +1 ); while( pPrvNd != aStt.GetNode().StartOfSectionNode() ) aStt--; @@ -832,7 +832,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, if( !pEnde ) // kein Bereich also neue Section davor/hinter anlegen { // #i26762# - ASSERT(!pEnde || rNdIdx <= *pEnde, + OSL_ENSURE(!pEnde || rNdIdx <= *pEnde, "Section start and end in wrong order!"); if( bInsAtStart ) @@ -1055,7 +1055,7 @@ SwFrm* SwClearDummies( SwFrm* pFrm ) SwFrm* pTmp = pFrm; while( pTmp ) { - ASSERT( !pTmp->GetUpper(), "SwClearDummies: No Upper allowed!" ); + OSL_ENSURE( !pTmp->GetUpper(), "SwClearDummies: No Upper allowed!" ); if( pTmp->IsSctFrm() ) { SwSectionFrm* pSectFrm = (SwSectionFrm*)pFrm; @@ -1149,7 +1149,7 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx ) SwFrm *pFrm, *pNew; while( 0 != (pFrm = aNode2Layout.NextFrm()) ) { - ASSERT( pFrm->IsSctFrm(), "Depend von Section keine Section." ); + OSL_ENSURE( pFrm->IsSctFrm(), "Depend von Section keine Section." ); pNew = rIdx.GetNode().GetCntntNode()->MakeFrm(); SwSectionNode* pS = rIdx.GetNode().FindSectionNode(); @@ -1179,7 +1179,7 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx ) SwLayoutFrm* pUp = pSct; while( pUp->Lower() ) // for columned sections { - ASSERT( pUp->Lower()->IsLayoutFrm(),"Who's in there?" ); + OSL_ENSURE( pUp->Lower()->IsLayoutFrm(),"Who's in there?" ); pUp = (SwLayoutFrm*)pUp->Lower(); } pNew->Paste( pUp, NULL ); @@ -1239,7 +1239,7 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx ) void SwSectionNode::MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx ) { - ASSERT( pIdxBehind, "kein Index" ); + OSL_ENSURE( pIdxBehind, "kein Index" ); SwNodes& rNds = GetNodes(); SwDoc* pDoc = rNds.GetDoc(); @@ -1307,7 +1307,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c ::std::auto_ptr<SwTOXBase> pTOXBase; if (TOX_CONTENT_SECTION == GetSection().GetType()) { - ASSERT( GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); SwTOXBaseSection const& rTBS( dynamic_cast<SwTOXBaseSection const&>(GetSection())); pTOXBase.reset( new SwTOXBase(rTBS, pDoc) ); @@ -1375,7 +1375,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c BOOL SwSectionNode::IsCntntHidden() const { - ASSERT( !m_pSection->IsHidden(), + OSL_ENSURE( !m_pSection->IsHidden(), "That's simple: Hidden Section => Hidden Content" ); SwNodeIndex aTmp( *this, 1 ); ULONG nEnd = EndOfSectionIndex(); @@ -1392,7 +1392,7 @@ BOOL SwSectionNode::IsCntntHidden() const { if( aTmp.GetNode().IsCntntNode() || aTmp.GetNode().IsTableNode() ) return FALSE; // Nicht versteckter Inhalt wurde gefunden - ASSERT( aTmp.GetNode().IsEndNode(), "EndNode expected" ); + OSL_ENSURE( aTmp.GetNode().IsEndNode(), "EndNode expected" ); } aTmp++; } @@ -1436,7 +1436,7 @@ void SwSectionNode::NodesArrChgd() // verschieben vom Nodes- ins UndoNodes-Array? if( rNds.IsDocNodes() ) { - ASSERT( pDoc == GetDoc(), + OSL_ENSURE( pDoc == GetDoc(), "verschieben in unterschiedliche Documente?" ); if (m_pSection->IsLinkType()) { diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 4936b20aad..b9463a04da 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -100,17 +100,11 @@ // <-- #include <fldupde.hxx> - -#ifndef DBG_UTIL -#define CHECK_TABLE(t) -#else -#ifdef DEBUG +#if OSL_DEBUG_LEVEL > 1 #define CHECK_TABLE(t) (t).CheckConsistency(); #else #define CHECK_TABLE(t) #endif -#endif - using namespace ::com::sun::star; @@ -278,7 +272,7 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, { if( !nCnt ) return FALSE; - ASSERT( pLine, "keine gueltige Zeile" ); + OSL_ENSURE( pLine, "keine gueltige Zeile" ); // Index hinter die letzte Box der Line ULONG nIdxPos = 0; @@ -372,8 +366,8 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, BOOL bCalledFromShell, BOOL bNewModel ) { - ASSERT( nRows, "Tabelle ohne Zeile?" ); - ASSERT( nCols, "Tabelle ohne Spalten?" ); + OSL_ENSURE( nRows, "Tabelle ohne Zeile?" ); + OSL_ENSURE( nCols, "Tabelle ohne Spalten?" ); { // nicht in Fussnoten kopieren !! @@ -728,7 +722,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() ) { - ASSERT( FALSE, "Kein Bereich" ); + OSL_ENSURE( FALSE, "Kein Bereich" ); aRg.aEnd++; } @@ -769,7 +763,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, GetTxtCollFromPool( RES_POOLCOLL_STANDARD ), pUndo ); SwTable * pNdTbl = &pTblNd->GetTable(); - ASSERT( pNdTbl, "kein Tabellen-Node angelegt." ) + OSL_ENSURE( pNdTbl, "kein Tabellen-Node angelegt." ); const USHORT nRowsToRepeat = tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ? @@ -944,7 +938,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, aSttIdx += 2, nLines++, nBoxes = 0 ) { SwTxtNode* pTxtNd = aSttIdx.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "nur TextNodes in der Tabelle aufnehmen" ); + OSL_ENSURE( pTxtNd, "nur TextNodes in der Tabelle aufnehmen" ); if( !nLines && 0x0b == cCh ) { @@ -1101,7 +1095,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, // damit die Tabelle die richtige Groesse bekommt, im BoxFormat die // Groesse nach "oben" transportieren. - ASSERT( !pBoxFmt->GetDepends(), "wer ist in dem Format noch angemeldet" ); + OSL_ENSURE( !pBoxFmt->GetDepends(), "wer ist in dem Format noch angemeldet" ); pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nLastPos )); } else @@ -1170,7 +1164,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() ) { - ASSERT( FALSE, "Kein Bereich" ); + OSL_ENSURE( FALSE, "Kein Bereich" ); aRg.aEnd++; } @@ -1209,7 +1203,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > GetTxtCollFromPool( RES_POOLCOLL_STANDARD )/*, pUndo*/ ); SwTable * pNdTbl = &pTblNd->GetTable(); - ASSERT( pNdTbl, "kein Tabellen-Node angelegt." ) + OSL_ENSURE( pNdTbl, "kein Tabellen-Node angelegt." ); pTableFmt->Add( pNdTbl ); // das Frame-Format setzen BOOL bUseBoxFmt = FALSE; @@ -1371,7 +1365,6 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, aRowIter != rTableNodes.end(); ++aRowIter, nLines++, nBoxes = 0 ) { - pLine = new SwTableLine( pLineFmt, 1, 0 ); pTable->GetTabLines().C40_INSERT( SwTableLine, pLine, nLines ); @@ -1426,7 +1419,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, // damit die Tabelle die richtige Groesse bekommt, im BoxFormat die // Groesse nach "oben" transportieren. - ASSERT( !pBoxFmt->GetDepends(), "wer ist in dem Format noch angemeldet" ); + OSL_ENSURE( !pBoxFmt->GetDepends(), "wer ist in dem Format noch angemeldet" ); pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nLastPos )); } else @@ -1509,7 +1502,7 @@ BOOL lcl_DelBox( const SwTableBox*&, void *pPara ); BOOL lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) { - ASSERT( pPara, "die Parameter fehlen" ); + OSL_ENSURE( pPara, "die Parameter fehlen" ); _DelTabPara aPara( *(_DelTabPara*)pPara ); ((SwTableLine*&)rpLine)->GetTabBoxes().ForEach( &lcl_DelBox, &aPara ); if( rpLine->GetUpper() ) // gibt es noch eine uebergeordnete Box ?? @@ -1521,7 +1514,7 @@ BOOL lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) { - ASSERT( pPara, "die Parameter fehlen" ); + OSL_ENSURE( pPara, "die Parameter fehlen" ); // loesche erstmal die Lines der Box _DelTabPara* pDelPara = (_DelTabPara*)pPara; @@ -1717,7 +1710,7 @@ BOOL SwDoc::InsertCol( const SwCursor& rCursor, USHORT nCnt, BOOL bBehind ) BOOL SwDoc::InsertCol( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) { // uebers SwDoc fuer Undo !! - ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -1782,7 +1775,7 @@ BOOL SwDoc::InsertRow( const SwCursor& rCursor, USHORT nCnt, BOOL bBehind ) BOOL SwDoc::InsertRow( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) { // uebers SwDoc fuer Undo !! - ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -1973,7 +1966,7 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) return FALSE; // uebers SwDoc fuer Undo !! - ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -2183,7 +2176,7 @@ BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt, sal_Bool bSameHeight ) { // uebers SwDoc fuer Undo !! - ASSERT( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -2397,7 +2390,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx ) SwFrm *pFrm, *pNew; SwCntntNode * pNode = rIdx.GetNode().GetCntntNode(); - ASSERT( pNode, "Kein Contentnode oder Copy-Node und neuer Node identisch."); + OSL_ENSURE( pNode, "Kein Contentnode oder Copy-Node und neuer Node identisch."); BOOL bBefore = rIdx < GetIndex(); @@ -2421,7 +2414,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx ) void SwTableNode::MakeFrms( SwNodeIndex* pIdxBehind ) { - ASSERT( pIdxBehind, "kein Index" ); + OSL_ENSURE( pIdxBehind, "kein Index" ); *pIdxBehind = *this; SwNode *pNd = GetNodes().FindPrvNxtFrmNode( *pIdxBehind, EndOfSectionNode() ); if( !pNd ) @@ -2546,7 +2539,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr, } else if( !pCrsr && !pBoxFrm ) { - ASSERT( !this, "einer von beiden muss angegeben werden!" ); + OSL_ENSURE( !this, "einer von beiden muss angegeben werden!" ); return ; } @@ -2600,7 +2593,7 @@ bool lcl_IsFrmInColumn( const SwCellFrm& rFrm, SwSelBoxes& rBoxes ) void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , const SwCellFrm* pBoxFrm ) const { - ASSERT( pBoxFrm, "GetTabRows called without pBoxFrm" ) + OSL_ENSURE( pBoxFrm, "GetTabRows called without pBoxFrm" ); // --> FME 2005-09-12 #121591# Make code robust: if ( !pBoxFrm ) @@ -2625,14 +2618,14 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , // --> FME 2005-09-12 #121591# Make code robust: if ( aDelCheck.HasBeenDeleted() ) { - ASSERT( false, "Current box has been deleted during GetTabRows()" ) + OSL_ENSURE( false, "Current box has been deleted during GetTabRows()" ); return; } // <-- // --> FME 2005-09-12 #121591# Make code robust: const SwTabFrm* pTab = pBoxFrm->FindTabFrm(); - ASSERT( pTab, "GetTabRows called without a table" ) + OSL_ENSURE( pTab, "GetTabRows called without a table" ); if ( !pTab ) return; // <-- @@ -2729,7 +2722,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , } // delete first and last entry - ASSERT( rFill.Count(), "Deleting from empty vector. Fasten your seatbelts!" ) + OSL_ENSURE( rFill.Count(), "Deleting from empty vector. Fasten your seatbelts!" ); // --> FME 2006-01-19 #i60818# There may be only one entry in rFill. Make // code robust by checking count of rFill. if ( rFill.Count() ) rFill.Remove( 0, 1 ); @@ -2771,7 +2764,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, BOOL bCurRowOnly, } else if( !pCrsr && !pBoxFrm ) { - ASSERT( !this, "einer von beiden muss angegeben werden!" ); + OSL_ENSURE( !this, "einer von beiden muss angegeben werden!" ); return ; } @@ -2820,7 +2813,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* const SwTableBox* pBox; SwTabFrm *pTab; - ASSERT( pBoxFrm, "SetTabRows called without pBoxFrm" ) + OSL_ENSURE( pBoxFrm, "SetTabRows called without pBoxFrm" ); pTab = ((SwFrm*)pBoxFrm)->ImplFindTabFrm(); pBox = pBoxFrm->GetTabBox(); @@ -2857,7 +2850,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* // check for differences between aOld and rNew: const USHORT nCount = rNew.Count(); const SwTable* pTable = pTab->GetTable(); - ASSERT( pTable, "My colleague told me, this couldn't happen" ); + OSL_ENSURE( pTable, "My colleague told me, this couldn't happen" ); for ( USHORT i = 0; i <= nCount; ++i ) { @@ -3429,7 +3422,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, BOOL bAfter, SwTableNode * pNewTblNd; { SwEndNode* pOldTblEndNd = (SwEndNode*)pTNd->EndOfSectionNode()->GetEndNode(); - ASSERT( pOldTblEndNd, "wo ist der EndNode?" ) + OSL_ENSURE( pOldTblEndNd, "wo ist der EndNode?" ); SwNodeIndex aIdx( *pBox->GetSttNd() ); new SwEndNode( aIdx, *pTNd ); @@ -3441,7 +3434,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, BOOL bAfter, SwNode* pBoxNd = aIdx.GetNode().GetStartNode(); do { - ASSERT( pBoxNd->IsStartNode(), "das muss ein StartNode sein!" ); + OSL_ENSURE( pBoxNd->IsStartNode(), "das muss ein StartNode sein!" ); pBoxNd->pStartOfSection = pNewTblNd; pBoxNd = (*this)[ pBoxNd->EndOfSectionIndex() + 1 ]; } while( pBoxNd != pOldTblEndNd ); @@ -3569,10 +3562,10 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, USHORT nMode, SwHistory* ) { SwTableNode* pDelTblNd = rPos.GetNode().GetTableNode(); - ASSERT( pDelTblNd, "wo ist der TableNode geblieben?" ); + OSL_ENSURE( pDelTblNd, "wo ist der TableNode geblieben?" ); SwTableNode* pTblNd = (*this)[ rPos.GetIndex() - 1]->FindTableNode(); - ASSERT( pTblNd, "wo ist der TableNode geblieben?" ); + OSL_ENSURE( pTblNd, "wo ist der TableNode geblieben?" ); if( !pDelTblNd || !pTblNd ) return FALSE; @@ -3643,7 +3636,7 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, SwNode* pBoxNd = aIdx.GetNode().GetStartNode(); do { - ASSERT( pBoxNd->IsStartNode(), "das muss ein StartNode sein!" ); + OSL_ENSURE( pBoxNd->IsStartNode(), "das muss ein StartNode sein!" ); pBoxNd->pStartOfSection = pTblNd; pBoxNd = (*this)[ pBoxNd->EndOfSectionIndex() + 1 ]; } while( pBoxNd != pTblEndNd ); @@ -3766,7 +3759,7 @@ BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) // AutoFormat fuer die Tabelle/TabellenSelection BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew ) { - ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -3841,7 +3834,7 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe // Erfrage wie attributiert ist BOOL SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) { - ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); + OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) return FALSE; @@ -4382,7 +4375,7 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, { SwTableBox* pBox = pInsTblNd->GetTable().GetTblBox( pSttNd->GetIndex() ); - ASSERT( pBox, "Box steht nicht in dieser Tabelle" ); + OSL_ENSURE( pBox, "Box steht nicht in dieser Tabelle" ); aBoxes.Insert( pBox ); pBoxes = &aBoxes; } diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index d801c05a1e..35d0cd1332 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -111,7 +111,7 @@ void SwTblFmtCmp::Delete( SvPtrarr &rArr ) void lcl_GetStartEndCell( const SwCursor& rCrsr, SwLayoutFrm *&prStart, SwLayoutFrm *&prEnd ) { - ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ), + OSL_ENSURE( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ), "Tabselection nicht auf Cnt." ); Point aPtPos, aMkPos; @@ -573,7 +573,7 @@ void lcl_CollectCells( SvPtrarr &rArr, const SwRect &rUnion, // uns erst wieder zur Zelle hochhangeln while ( !pCell->IsCellFrm() ) pCell = pCell->GetUpper(); - ASSERT( pCell, "Frame ist keine Zelle." ); + OSL_ENSURE( pCell, "Frame ist keine Zelle." ); if ( rUnion.IsOver( pCell->Frm() ) ) ::InsertCell( rArr, (SwCellFrm*)pCell ); //Dafuer sorgen, dass die Zelle auch verlassen wird (Bereiche) @@ -1234,7 +1234,7 @@ BOOL SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const #***********************************************************************/ void SwDoc::SetBoxAlign( const SwCursor& rCursor, USHORT nAlign ) { - ASSERT( nAlign == text::VertOrientation::NONE || + OSL_ENSURE( nAlign == text::VertOrientation::NONE || nAlign == text::VertOrientation::CENTER || nAlign == text::VertOrientation::BOTTOM, "wrong alignment" ); SwFmtVertOrient aVertOri( 0, nAlign ); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 1b394ffc00..5cbc3b7ad9 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -116,8 +116,8 @@ void SetParent( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, const SwFmt* pConditionalFmt ) { const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(mrpAttrSet.get()); - ASSERT( pAttrSet, "no SwAttrSet" ) - ASSERT( pParentFmt || !pConditionalFmt, "ConditionalFmt without ParentFmt?" ) + OSL_ENSURE( pAttrSet, "no SwAttrSet" ); + OSL_ENSURE( pParentFmt || !pConditionalFmt, "ConditionalFmt without ParentFmt?" ); const SwAttrSet* pParentSet = pParentFmt ? &pParentFmt->GetAttrSet() : 0; @@ -337,7 +337,7 @@ USHORT SwNode::GetSectionLevel() const |* *******************************************************************/ -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 long SwNode::nSerial = 0; #endif @@ -369,7 +369,7 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const BYTE nNdType ) pStartOfSection = (SwStartNode*)this; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nMySerial = nSerial; nSerial++; #endif @@ -402,7 +402,7 @@ SwNode::SwNode( SwNodes& rNodes, ULONG nPos, const BYTE nNdType ) pStartOfSection = (SwStartNode*)this; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nMySerial = nSerial; nSerial++; #endif @@ -641,7 +641,7 @@ const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, } if( n >= rFmts.Count() ) { - ASSERT( !this, "Fly-Section aber kein Format gefunden" ); + OSL_ENSURE( !this, "Fly-Section aber kein Format gefunden" ); return FALSE; } } @@ -727,7 +727,7 @@ const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, // kann jetzt nur noch ein Seitengebundener Fly sein // oder irgendetwas neueres. // Hier koennen wir nur noch den Standard returnen - ASSERT( pNd->FindFlyStartNode(), + OSL_ENSURE( pNd->FindFlyStartNode(), "wo befindet sich dieser Node?" ); pPgDesc = &pDoc->GetPageDesc( 0 ); @@ -1191,7 +1191,7 @@ xub_StrLen SwCntntNode::Len() const { return 0; } SwFmtColl *SwCntntNode::ChgFmtColl( SwFmtColl *pNewColl ) { - ASSERT( pNewColl, "Collectionpointer ist 0." ); + OSL_ENSURE( pNewColl, "Collectionpointer ist 0." ); SwFmtColl *pOldColl = GetFmtColl(); if( pNewColl != pOldColl ) @@ -1335,7 +1335,7 @@ BOOL SwCntntNode::GoPrevious(SwIndex * pIdx, USHORT nMode ) const void SwCntntNode::MakeFrms( SwCntntNode& rNode ) { - ASSERT( &rNode != this, + OSL_ENSURE( &rNode != this, "Kein Contentnode oder Copy-Node und neuer Node identisch." ); if( !GetDepends() || &rNode == this ) // gibt es ueberhaupt Frames ?? @@ -1344,7 +1344,7 @@ void SwCntntNode::MakeFrms( SwCntntNode& rNode ) SwFrm *pFrm, *pNew; SwLayoutFrm *pUpper; // Frames anlegen fuer Nodes, die vor oder hinter der Tabelle stehen ?? - ASSERT( FindTableNode() == rNode.FindTableNode(), "Table confusion" ) + OSL_ENSURE( FindTableNode() == rNode.FindTableNode(), "Table confusion" ); SwNode2Layout aNode2Layout( *this, rNode.GetIndex() ); @@ -1426,12 +1426,12 @@ void SwCntntNode::DelFrms() !pFrm->GetIndPrev() ) { SwFtnFrm *pFtn = pFrm->FindFtnFrm(); - ASSERT( pFtn, "You promised a FtnFrm?" ); + OSL_ENSURE( pFtn, "You promised a FtnFrm?" ); SwCntntFrm* pCFrm; if( !pFtn->GetFollow() && !pFtn->GetMaster() && 0 != ( pCFrm = pFtn->GetRefFromAttr()) && pCFrm->IsFollow() ) { - ASSERT( pCFrm->IsTxtFrm(), "NoTxtFrm has Footnote?" ); + OSL_ENSURE( pCFrm->IsTxtFrm(), "NoTxtFrm has Footnote?" ); ((SwTxtFrm*)pCFrm->FindMaster())->Prepare( PREP_FTN_GONE ); } } @@ -1504,7 +1504,7 @@ BOOL SwCntntNode::SetAttr(const SfxPoolItem& rAttr ) if( !GetpSwAttrSet() ) // lasse von den entsprechenden Nodes die NewAttrSet( GetDoc()->GetAttrPool() ); // AttrSets anlegen - ASSERT( GetpSwAttrSet(), "warum wurde kein AttrSet angelegt?" ); + OSL_ENSURE( GetpSwAttrSet(), "warum wurde kein AttrSet angelegt?" ); if ( IsInCache() ) { @@ -1545,7 +1545,7 @@ BOOL SwCntntNode::SetAttr( const SfxItemSet& rSet ) const SfxPoolItem* pFnd = 0; if( SFX_ITEM_SET == rSet.GetItemState( RES_AUTO_STYLE, FALSE, &pFnd ) ) { - ASSERT( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" ); + OSL_ENSURE( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" ); const SwFmtAutoFmt* pTmp = static_cast<const SwFmtAutoFmt*>(pFnd); // If there already is an attribute set (usually containing a numbering @@ -1761,7 +1761,7 @@ USHORT SwCntntNode::ClearItemsFromAttrSet( const std::vector<USHORT>& rWhichIds if ( 0 == rWhichIds.size() ) return nRet; - ASSERT( GetpSwAttrSet(), "no item set" ) + OSL_ENSURE( GetpSwAttrSet(), "no item set" ); SwAttrSet aNewAttrSet( *GetpSwAttrSet() ); for ( std::vector<USHORT>::const_iterator aIter = rWhichIds.begin(); aIter != rWhichIds.end(); diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index 89cde23623..3ff7287a3a 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -115,7 +115,7 @@ SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, ULONG nIdx, BOOL bSearch ) pMod = (SwModify*)pNd->GetCntntNode(); else { - ASSERT( pNd->IsTableNode(), "For Tablenodes only" ); + OSL_ENSURE( pNd->IsTableNode(), "For Tablenodes only" ); pMod = pNd->GetTableNode()->GetTable().GetFrmFmt(); } pIter = new SwClientIter( *pMod ); @@ -150,7 +150,7 @@ SwFrm* SwNode2LayImpl::NextFrm() while( pRet ) { SwFlowFrm* pFlow = SwFlowFrm::CastFlowFrm( pRet ); - ASSERT( pFlow, "Cntnt or Table expected?!" ); + OSL_ENSURE( pFlow, "Cntnt or Table expected?!" ); // Follows sind fluechtige Gestalten, deshalb werden sie ignoriert. // Auch wenn wir hinter dem Frame eingefuegt werden sollen, nehmen wir // zunaechst den Master, hangeln uns dann aber zum letzten Follow durch. @@ -172,9 +172,9 @@ SwFrm* SwNode2LayImpl::NextFrm() // und nicht ausserhalb liegt. if( !pRet->IsInFtn() || pSct->IsInFtn() ) { - ASSERT( pSct && pSct->GetSection(), "Where's my section?" ); + OSL_ENSURE( pSct && pSct->GetSection(), "Where's my section?" ); SwSectionNode* pNd = pSct->GetSection()->GetFmt()->GetSectionNode(); - ASSERT( pNd, "Lost SectionNode" ); + OSL_ENSURE( pNd, "Lost SectionNode" ); // Wenn der erhaltene Frame in einem Bereichsframe steht, // dessen Bereich den Ausgangsnode nicht umfasst, so kehren // wir mit dem SectionFrm zurueck, sonst mit dem Cntnt/TabFrm @@ -247,11 +247,11 @@ SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode ) { pFrm = static_cast<SwLayoutFrm*>(pFrm)->Lower(); } - ASSERT( pFrm->IsLayoutFrm(), + OSL_ENSURE( pFrm->IsLayoutFrm(), "<SwNode2LayImpl::UpperFrm(..)> - expected upper frame isn't a layout frame." ); rpFrm = bMaster ? NULL : static_cast<SwLayoutFrm*>(pFrm)->Lower(); - ASSERT( !rpFrm || rpFrm->IsFlowFrm(), + OSL_ENSURE( !rpFrm || rpFrm->IsFlowFrm(), "<SwNode2LayImpl::UpperFrm(..)> - expected sibling isn't a flow frame." ); return static_cast<SwLayoutFrm*>(pFrm); } @@ -280,7 +280,7 @@ SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode ) void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) { - ASSERT( pUpperFrms, "RestoreUpper without SaveUpper?" ) + OSL_ENSURE( pUpperFrms, "RestoreUpper without SaveUpper?" ); SwNode* pNd; SwDoc *pDoc = rNds.GetDoc(); BOOL bFirst = TRUE; @@ -316,7 +316,7 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) else pNxt = pUp->Lower(); pNew = ((SwTableNode*)pNd)->MakeFrm(); - ASSERT( pNew->IsTabFrm(), "Table exspected" ); + OSL_ENSURE( pNew->IsTabFrm(), "Table exspected" ); pNew->Paste( pUp, pNxt ); ((SwTabFrm*)pNew)->RegistFlys(); (*pUpperFrms)[x-2] = pNew; @@ -330,7 +330,7 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) if( bFirst && pNxt && pNxt->IsSctFrm() ) ((SwSectionFrm*)pNxt)->UnlockJoin(); pUp = (SwLayoutFrm*)(*pUpperFrms)[x++]; - ASSERT( pUp->GetUpper() || pUp->IsFlyFrm(), "Lost Upper" ); + OSL_ENSURE( pUp->GetUpper() || pUp->IsFlyFrm(), "Lost Upper" ); ::_InsertCnt( pUp, pDoc, pNd->GetIndex(), FALSE, nStt+1, pNxt ); pNxt = pUp->GetLastLower(); (*pUpperFrms)[x-2] = pNxt; @@ -377,7 +377,7 @@ SwNode2Layout::SwNode2Layout( const SwNode& rNd ) void SwNode2Layout::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) { - ASSERT( pImpl, "RestoreUpperFrms without SaveUpperFrms" ); + OSL_ENSURE( pImpl, "RestoreUpperFrms without SaveUpperFrms" ); pImpl->RestoreUpperFrms( rNds, nStt, nEnd ); } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index ad438cc611..944d2ffd11 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -81,7 +81,7 @@ SwNodes::SwNodes( SwDoc* pDocument ) { bInNodesDel = bInDelUpdOutl = bInDelUpdNum = FALSE; - ASSERT( pMyDoc, "in welchem Doc stehe ich denn?" ); + OSL_ENSURE( pMyDoc, "in welchem Doc stehe ich denn?" ); ULONG nPos = 0; SwStartNode* pSttNd = new SwStartNode( *this, nPos++ ); @@ -395,15 +395,15 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, if( !pFrmNd && aFrmNdIdx > rNds.GetEndOfExtras().GetIndex() ) { - ASSERT( !this, "ob das so richtig ist ??" ); + OSL_ENSURE( !this, "ob das so richtig ist ??" ); aFrmNdIdx = rNds.GetEndOfContent(); pFrmNd = rNds.GoPrevSection( &aFrmNdIdx, TRUE, FALSE ); if( pFrmNd && !((SwCntntNode*)pFrmNd)->GetDepends() ) pFrmNd = 0; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( !pFrmNd ) - ASSERT( !this, "ChgNode() - kein FrameNode gefunden" ); + OSL_ENSURE( !this, "ChgNode() - kein FrameNode gefunden" ); #endif } if( pFrmNd ) @@ -806,7 +806,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, } else // es wurden alle Nodes innerhalb eines { // Start- und End-Nodes verschoben - ASSERT( pAktNode == aSttNdStack[nLevel] || + OSL_ENSURE( pAktNode == aSttNdStack[nLevel] || ( pAktNode->IsStartNode() && aSttNdStack[nLevel]->IsSectionNode()), "falscher StartNode" ); @@ -886,13 +886,13 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, } } else { - ASSERT( FALSE, "wie kommt diser Node ins Nodes-Array??" ); + OSL_ENSURE( FALSE, "wie kommt diser Node ins Nodes-Array??" ); } aRg.aEnd--; break; default: - ASSERT( FALSE, "was ist das fuer ein Node??" ); + OSL_ENSURE( FALSE, "was ist das fuer ein Node??" ); break; } @@ -1971,7 +1971,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if ( &pStt->nNode.GetNode() == &GetEndOfContent() ) { const bool bSuccess = GoPrevious( &pStt->nNode ); - ASSERT( bSuccess, "Move() - no ContentNode here" ); + OSL_ENSURE( bSuccess, "Move() - no ContentNode here" ); (void) bSuccess; } pStt->nContent.Assign( (*this)[ pStt->nNode ]->GetCntntNode(), @@ -2190,12 +2190,12 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, aInsPos++; // ueberspringen } else { - ASSERT( FALSE, "wie kommt diser Node ins Nodes-Array??" ); + OSL_ENSURE( FALSE, "wie kommt diser Node ins Nodes-Array??" ); } break; default: - ASSERT( FALSE, "weder Start-/End-/Content-Node, unbekannter Typ" ); + OSL_ENSURE( FALSE, "weder Start-/End-/Content-Node, unbekannter Typ" ); } aRg.aStart++; } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index d94cac2612..e0a3da77bb 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -320,7 +320,7 @@ bool SwSection::DataEquals(SwSectionData const& rCmp) const void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition) { SwSectionFmt* pFmt = GetFmt(); - ASSERT(pFmt, "ImplSetHiddenFlag: no format?"); + OSL_ENSURE(pFmt, "ImplSetHiddenFlag: no format?"); if( pFmt ) { const bool bHide = bTmpHidden && bCondition; @@ -373,7 +373,7 @@ BOOL SwSection::CalcHiddenFlag() const bool SwSection::IsProtect() const { SwSectionFmt *const pFmt( GetFmt() ); - ASSERT(pFmt, "SwSection::IsProtect: no format?"); + OSL_ENSURE(pFmt, "SwSection::IsProtect: no format?"); return (pFmt) ? pFmt->GetProtect().IsCntntProtected() : IsProtectFlag(); @@ -383,7 +383,7 @@ bool SwSection::IsProtect() const bool SwSection::IsEditInReadonly() const { SwSectionFmt *const pFmt( GetFmt() ); - ASSERT(pFmt, "SwSection::IsEditInReadonly: no format?"); + OSL_ENSURE(pFmt, "SwSection::IsEditInReadonly: no format?"); return (pFmt) ? pFmt->GetEditInReadonly().GetValue() : IsEditInReadonlyFlag(); @@ -403,7 +403,7 @@ void SwSection::SetHidden(bool const bFlag) void SwSection::SetProtect(bool const bFlag) { SwSectionFmt *const pFormat( GetFmt() ); - ASSERT(pFormat, "SwSection::SetProtect: no format?"); + OSL_ENSURE(pFormat, "SwSection::SetProtect: no format?"); if (pFormat) { SvxProtectItem aItem( RES_PROTECT ); @@ -421,7 +421,7 @@ void SwSection::SetProtect(bool const bFlag) void SwSection::SetEditInReadonly(bool const bFlag) { SwSectionFmt *const pFormat( GetFmt() ); - ASSERT(pFormat, "SwSection::SetEditInReadonly: no format?"); + OSL_ENSURE(pFormat, "SwSection::SetEditInReadonly: no format?"); if (pFormat) { SwFmtEditInReadonly aItem; @@ -730,7 +730,7 @@ SwSection * SwSectionFmt::GetSection() const return (SwSectionPtr)aIter.First( TYPE(SwSection) ); } - ASSERT( FALSE, "keine Section als Client." ) + OSL_ENSURE( FALSE, "keine Section als Client." ); return 0; } @@ -989,7 +989,7 @@ extern "C" { { const SwSectionFmt* pFSectFmt = (*(SwSectionPtr*)pFirst)->GetFmt(); const SwSectionFmt* pSSectFmt = (*(SwSectionPtr*)pSecond)->GetFmt(); - ASSERT( pFSectFmt && pSSectFmt && + OSL_ENSURE( pFSectFmt && pSSectFmt && pFSectFmt->GetCntnt(FALSE).GetCntntIdx() && pSSectFmt->GetCntnt(FALSE).GetCntntIdx(), "ungueltige Sections" ); @@ -1008,7 +1008,7 @@ extern "C" { { const SwSectionPtr pFSect = *(SwSectionPtr*)pFirst; const SwSectionPtr pSSect = *(SwSectionPtr*)pSecond; - ASSERT( pFSect && pSSect, "ungueltige Sections" ); + OSL_ENSURE( pFSect && pSSect, "ungueltige Sections" ); StringCompare const eCmp = pFSect->GetSectionName().CompareTo( pSSect->GetSectionName() ); return eCmp == COMPARE_EQUAL ? 0 @@ -1231,14 +1231,14 @@ void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd ) { if ( !rSectNd.GetDoc() ) { - ASSERT( false, + OSL_ENSURE( false, "method <lcl_RemoveSectionLinksInSect(..)> - no Doc at SectionNode" ); return; } if ( !rSectNd.GetSection().IsConnected() ) { - ASSERT( false, + OSL_ENSURE( false, "method <lcl_RemoveSectionLinksInSect(..)> - no Link at Section of SectionNode" ); return; } @@ -1748,7 +1748,7 @@ void SwIntrnlSectRefLink::Closed() void SwSection::CreateLink( LinkCreateType eCreateType ) { SwSectionFmt* pFmt = GetFmt(); - ASSERT(pFmt, "SwSection::CreateLink: no format?"); + OSL_ENSURE(pFmt, "SwSection::CreateLink: no format?"); if (!pFmt || (CONTENT_SECTION == m_Data.GetType())) return ; @@ -1794,7 +1794,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) } break; default: - ASSERT( !this, "Was ist das fuer ein Link?" ) + OSL_ENSURE( !this, "Was ist das fuer ein Link?" ); } switch( eCreateType ) @@ -1826,7 +1826,7 @@ void SwSection::BreakLink() if (m_RefLink.Is()) { SwSectionFmt *const pFormat( GetFmt() ); - ASSERT(pFormat, "SwSection::BreakLink: no format?"); + OSL_ENSURE(pFormat, "SwSection::BreakLink: no format?"); if (pFormat) { pFormat->GetDoc()->GetLinkManager().Remove( m_RefLink ); diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index caf312f37a..2253c97a36 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -100,7 +100,7 @@ void SwBaseLink::DataChanged( const String& rMimeType, { if( !pCntntNode ) { - ASSERT(!this, "DataChanged ohne ContentNode" ); + OSL_ENSURE(!this, "DataChanged ohne ContentNode" ); return ; } @@ -417,7 +417,7 @@ BOOL SwBaseLink::SwapIn( BOOL bWaitForData, BOOL bNativFormat ) if( bWaitForData && !GetObj() ) { - ASSERT( !this, "das SvxFileObject wurde in einem GetData geloescht!" ); + OSL_ENSURE( !this, "das SvxFileObject wurde in einem GetData geloescht!" ); bRes = FALSE; } else if( 0 != ( bRes = aValue.hasValue() ) ) @@ -475,7 +475,7 @@ const SwNode* SwBaseLink::GetAnchor() const } } - ASSERT( !this, "GetAnchor nicht ueberlagert" ); + OSL_ENSURE( !this, "GetAnchor nicht ueberlagert" ); return 0; } diff --git a/sw/source/core/docnode/threadmanager.cxx b/sw/source/core/docnode/threadmanager.cxx index e33c9049df..c42f476b4b 100644 --- a/sw/source/core/docnode/threadmanager.cxx +++ b/sw/source/core/docnode/threadmanager.cxx @@ -148,7 +148,7 @@ void ThreadManager::RemoveThread( const oslInterlockedCount nThreadID, } else { - ASSERT( false, "<ThreadManager::RemoveThread(..)> - ThreadJoiner already gone!" ); + OSL_ENSURE( false, "<ThreadManager::RemoveThread(..)> - ThreadJoiner already gone!" ); } } @@ -201,7 +201,7 @@ bool ThreadManager::StartThread( const tThreadData& rThreadData ) } else { - ASSERT( false, "<ThreadManager::StartThread(..)> - ThreadJoiner already gone!" ); + OSL_ENSURE( false, "<ThreadManager::StartThread(..)> - ThreadJoiner already gone!" ); } } else diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index a3adae57d9..86bd6de94d 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -170,7 +170,7 @@ SwContact* GetUserCall( const SdrObject* pObj ) SdrObject *pTmp; while ( !pObj->GetUserCall() && 0 != (pTmp = pObj->GetUpGroup()) ) pObj = pTmp; - ASSERT( !pObj->GetUserCall() || pObj->GetUserCall()->ISA(SwContact), + OSL_ENSURE( !pObj->GetUserCall() || pObj->GetUserCall()->ISA(SwContact), "<::GetUserCall(..)> - wrong type of found object user call." ); return static_cast<SwContact*>(pObj->GetUserCall()); } @@ -237,7 +237,7 @@ void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) if ( bNotify ) { SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj ); - ASSERT( pAnchoredObj, + OSL_ENSURE( pAnchoredObj, "<SwContact::MoveObjToInvisibleLayer(..)> - missing anchored object" ); if ( pAnchoredObj ) { @@ -274,7 +274,7 @@ void SwContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) if ( bNotify ) { SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj ); - ASSERT( pAnchoredObj, + OSL_ENSURE( pAnchoredObj, "<SwContact::MoveObjToInvisibleLayer(..)> - missing anchored object" ); // Note: as-character anchored objects aren't registered at a page frame and // a notification of its background isn't needed. @@ -300,20 +300,20 @@ void SwContact::_MoveObjToLayer( const bool _bToVisible, { if ( !_pDrawObj ) { - ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing object!" ); + OSL_ENSURE( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing object!" ); return; } if ( !pRegisteredIn ) { - ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing frame format!" ); + OSL_ENSURE( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing frame format!" ); return; } const IDocumentDrawModelAccess* pIDDMA = static_cast<SwFrmFmt*>(pRegisteredIn)->getIDocumentDrawModelAccess(); if ( !pIDDMA ) { - ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no writer document!" ); + OSL_ENSURE( false, "SwDrawContact::_MoveObjToLayer(..) - no writer document!" ); return; } @@ -418,7 +418,7 @@ sal_uInt32 SwContact::GetMinOrdNum() const aObjs.pop_back(); } - ASSERT( nMinOrdNum != SAL_MAX_UINT32, + OSL_ENSURE( nMinOrdNum != SAL_MAX_UINT32, "<SwContact::GetMinOrdNum()> - no order number found." ); return nMinOrdNum; } @@ -485,11 +485,11 @@ SwFlyDrawContact::~SwFlyDrawContact() // OD 2004-03-29 #i26791# const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj ) const { - ASSERT( _pSdrObj, + OSL_ENSURE( _pSdrObj, "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" ); - ASSERT( _pSdrObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( _pSdrObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type object provided" ); - ASSERT( GetUserCall( _pSdrObj ) == const_cast<SwFlyDrawContact*>(this), + OSL_ENSURE( GetUserCall( _pSdrObj ) == const_cast<SwFlyDrawContact*>(this), "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" ); const SwAnchoredObject* pRetAnchoredObj = 0L; @@ -504,11 +504,11 @@ const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdr SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( SdrObject* _pSdrObj ) { - ASSERT( _pSdrObj, + OSL_ENSURE( _pSdrObj, "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" ); - ASSERT( _pSdrObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( _pSdrObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type provided" ); - ASSERT( GetUserCall( _pSdrObj ) == this, + OSL_ENSURE( GetUserCall( _pSdrObj ) == this, "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" ); SwAnchoredObject* pRetAnchoredObj = 0L; @@ -533,7 +533,7 @@ SdrObject* SwFlyDrawContact::GetMaster() void SwFlyDrawContact::SetMaster( SdrObject* _pNewMaster ) { - ASSERT( _pNewMaster->ISA(SwFlyDrawObj), + OSL_ENSURE( _pNewMaster->ISA(SwFlyDrawObj), "<SwFlyDrawContact::SetMaster(..)> - wrong type of new master object" ); mpMasterObj = static_cast<SwFlyDrawObj *>(_pNewMaster); } @@ -638,7 +638,7 @@ void SwFlyDrawContact::Modify( SfxPoolItem *, SfxPoolItem * ) // Writer fly frame are also made visible. void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) { - ASSERT( _pDrawObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::MoveObjToVisibleLayer(..)> - wrong SdrObject type -> crash" ); if ( GetFmt()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ) @@ -677,7 +677,7 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) // Writer fly frame are also made invisible. void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) { - ASSERT( _pDrawObj->ISA(SwVirtFlyDrawObj), + OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::MoveObjToInvisibleLayer(..)> - wrong SdrObject type -> crash" ); if ( !GetFmt()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ) @@ -822,12 +822,12 @@ const SwAnchoredObject* SwDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj _pSdrObj = GetMaster(); } - ASSERT( _pSdrObj, + OSL_ENSURE( _pSdrObj, "<SwDrawContact::GetAnchoredObj(..)> - no object provided" ); - ASSERT( _pSdrObj->ISA(SwDrawVirtObj) || + OSL_ENSURE( _pSdrObj->ISA(SwDrawVirtObj) || ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ), "<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" ); - ASSERT( GetUserCall( _pSdrObj ) == const_cast<SwDrawContact*>(this) || + OSL_ENSURE( GetUserCall( _pSdrObj ) == const_cast<SwDrawContact*>(this) || _pSdrObj == GetMaster(), "<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" ); @@ -856,12 +856,12 @@ SwAnchoredObject* SwDrawContact::GetAnchoredObj( SdrObject* _pSdrObj ) _pSdrObj = GetMaster(); } - ASSERT( _pSdrObj, + OSL_ENSURE( _pSdrObj, "<SwDrawContact::GetAnchoredObj(..)> - no object provided" ); - ASSERT( _pSdrObj->ISA(SwDrawVirtObj) || + OSL_ENSURE( _pSdrObj->ISA(SwDrawVirtObj) || ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ), "<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" ); - ASSERT( GetUserCall( _pSdrObj ) == this || _pSdrObj == GetMaster(), + OSL_ENSURE( GetUserCall( _pSdrObj ) == this || _pSdrObj == GetMaster(), "<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" ); SwAnchoredObject* pRetAnchoredObj = 0L; @@ -905,7 +905,7 @@ void SwDrawContact::SetMaster( SdrObject* _pNewMaster ) if ( _pNewMaster ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "debug notification - master replaced!" ); + OSL_ENSURE( false, "debug notification - master replaced!" ); #endif maAnchoredDrawObj.SetDrawObj( *_pNewMaster ); } @@ -931,8 +931,8 @@ const SwFrm* SwDrawContact::GetAnchorFrm( const SdrObject* _pDrawObj ) const } else { - ASSERT( false, - "<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." ) + OSL_ENSURE( false, + "<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." ); } return pAnchorFrm; @@ -949,8 +949,8 @@ SwFrm* SwDrawContact::GetAnchorFrm( SdrObject* _pDrawObj ) } else { - ASSERT( _pDrawObj->ISA(SwDrawVirtObj), - "<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." ) + OSL_ENSURE( _pDrawObj->ISA(SwDrawVirtObj), + "<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." ); pAnchorFrm = static_cast<SwDrawVirtObj*>(_pDrawObj)->AnchorFrm(); } @@ -1309,7 +1309,7 @@ class NestedUserCallHdl if ( bTmpAssert ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawContact::_Changed(..)> - unknown nested <UserCall> event. This is serious, please inform OD." ); } } @@ -1369,7 +1369,7 @@ void SwDrawContact::_Changed( const SdrObject& rObj, // OD 10.10.2003 #112299# if ( mbDisconnectInProgress ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawContact::_Changed(..)> - Insert event during disconnection from layout is invalid." ); } else @@ -1506,7 +1506,7 @@ void SwDrawContact::_Changed( const SdrObject& rObj, break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawContact::_Changed(..)> - unsupported layout direction" ); } } @@ -1603,7 +1603,7 @@ namespace void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { // OD 10.10.2003 #112299# - ASSERT( !mbDisconnectInProgress, + OSL_ENSURE( !mbDisconnectInProgress, "<SwDrawContact::Modify(..)> called during disconnection."); USHORT nWhich = pNew ? pNew->Which() : 0; @@ -1639,7 +1639,7 @@ void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) const SwFmtAnchor* pOldAnchorFmt = pOld ? lcl_getAnchorFmt( *pOld ) : NULL; if ( !pOldAnchorFmt || ( pOldAnchorFmt->GetAnchorId() != pNewAnchorFmt->GetAnchorId() ) ) { - ASSERT( maAnchoredDrawObj.DrawObj(), "SwDrawContact::Modify: no draw object here?" ); + OSL_ENSURE( maAnchoredDrawObj.DrawObj(), "SwDrawContact::Modify: no draw object here?" ); if ( maAnchoredDrawObj.DrawObj() ) { // --> OD 2009-07-10 #i102752# @@ -1712,7 +1712,7 @@ void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) #if OSL_DEBUG_LEVEL > 1 else { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawContact::Modify(..)> - unhandled attribute? - please inform od@openoffice.org" ); } #endif @@ -1912,7 +1912,7 @@ void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch ) // layout. if ( mbDisconnectInProgress ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawContact::ConnectToLayout(..)> called during disconnection."); return; } @@ -1921,7 +1921,7 @@ void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch ) // object isn't inserted in the drawing page if ( !GetMaster()->IsInserted() ) { - ASSERT( false, "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted -> no connect to layout. Please inform od@openoffice.org" ); + OSL_ENSURE( false, "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted -> no connect to layout. Please inform od@openoffice.org" ); return; } // <-- @@ -2040,7 +2040,7 @@ void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch ) if ( FLY_AT_FLY == pAnch->GetAnchorId() && !pFrm->IsFlyFrm() ) { pFrm = pFrm->FindFlyFrm(); - ASSERT( pFrm, + OSL_ENSURE( pFrm, "<SwDrawContact::ConnectToLayout(..)> - missing fly frame -> crash." ); } @@ -2082,7 +2082,7 @@ void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch ) } break; default: - ASSERT( FALSE, "Unknown Anchor." ) + OSL_ENSURE( FALSE, "Unknown Anchor." ); break; } if ( GetAnchorFrm() ) @@ -2129,7 +2129,7 @@ void SwDrawContact::ChkPage() // OD 10.10.2003 #112299# if ( mbDisconnectInProgress ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawContact::ChkPage()> called during disconnection." ); return; } @@ -2312,7 +2312,7 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // #i101734# static bool bCheckOtherThanTranslate(false); static double fShearX(0.0); @@ -2331,7 +2331,7 @@ namespace sdr if(aLocalOffset.X() || aLocalOffset.Y()) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // #i101734# added debug code to check more complex transformations // than just a translation if(bCheckOtherThanTranslate) diff --git a/sw/source/core/draw/dobjfac.cxx b/sw/source/core/draw/dobjfac.cxx index 8aca47a14b..34311748e3 100644 --- a/sw/source/core/draw/dobjfac.cxx +++ b/sw/source/core/draw/dobjfac.cxx @@ -48,7 +48,7 @@ IMPL_LINK( SwObjectFactory, MakeObject, SdrObjFactory*, pObjFactory ) if ( pObjFactory->nInventor == SWGInventor ) { //Kein switch, derzeit gibt es nur einen. - ASSERT( pObjFactory->nIdentifier == SwFlyDrawObjIdentifier, + OSL_ENSURE( pObjFactory->nIdentifier == SwFlyDrawObjIdentifier, "Falscher Inventor oder identifier." ); pObjFactory->pNewObj = new SwFlyDrawObj(); } diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index 7376042031..1210b5a123 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -85,7 +85,7 @@ SwDPage::~SwDPage() SdrObject* SwDPage::ReplaceObject( SdrObject* pNewObj, ULONG nObjNum ) { SdrObject *pOld = GetObj( nObjNum ); - ASSERT( pOld, "Oups, Object not replaced" ); + OSL_ENSURE( pOld, "Oups, Object not replaced" ); SdrObjUserCall* pContact; if ( 0 != ( pContact = GetUserCall(pOld) ) && RES_DRAWFRMFMT == ((SwContact*)pContact)->GetFmt()->Which()) diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index bfa7a3ce82..126ab2c7ec 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -227,7 +227,7 @@ uno::Reference< uno::XInterface > SwDrawDocument::createUnoModel() } catch( uno::RuntimeException& ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawDocument::createUnoModel()> - could *not* retrieve model at <SwDocShell>" ); } diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index ef8e7d027a..910e6d5b11 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -246,7 +246,7 @@ void SwDrawView::AddCustomHdl() SwFrmFmt* pFrmFmt( ::FindFrmFmt( pObj ) ); if ( !pFrmFmt ) { - ASSERT( false, "<SwDrawView::AddCustomHdl()> - missing frame format!" ); + OSL_ENSURE( false, "<SwDrawView::AddCustomHdl()> - missing frame format!" ); return; } const SwFmtAnchor &rAnchor = pFrmFmt->GetAnchor(); @@ -405,7 +405,7 @@ sal_uInt32 SwDrawView::_GetMaxChildOrdNum( const SwFlyFrm& _rParentObj, sal_uInt32 nMaxChildOrdNum = _rParentObj.GetDrawObj()->GetOrdNum(); const SdrPage* pDrawPage = _rParentObj.GetDrawObj()->GetPage(); - ASSERT( pDrawPage, + OSL_ENSURE( pDrawPage, "<SwDrawView::_GetMaxChildOrdNum(..) - missing drawing page at parent object - crash!" ); sal_uInt32 nObjCount = pDrawPage->GetObjCount(); @@ -444,7 +444,7 @@ void SwDrawView::_MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj, std::vector<SwAnchoredObject*> aAnchoredObjs; { const SwContact* pContact = ::GetUserCall( _rMovedAnchoredObj.GetDrawObj() ); - ASSERT( pContact, + OSL_ENSURE( pContact, "SwDrawView::_MoveRepeatedObjs(..) - missing contact object -> crash." ); pContact->GetAnchoredObjs( aAnchoredObjs ); } @@ -487,7 +487,7 @@ void SwDrawView::_MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj, SdrObject* pChildObj = (*aObjIter); { const SwContact* pContact = ::GetUserCall( pChildObj ); - ASSERT( pContact, + OSL_ENSURE( pContact, "SwDrawView::_MoveRepeatedObjs(..) - missing contact object -> crash." ); pContact->GetAnchoredObjs( aAnchoredObjs ); } @@ -943,7 +943,7 @@ void SwDrawView::ModelHasChanged() void SwDrawView::MakeVisible( const Rectangle &rRect, Window & ) { - ASSERT( rImp.GetShell()->GetWin(), "MakeVisible, unknown Window"); + OSL_ENSURE( rImp.GetShell()->GetWin(), "MakeVisible, unknown Window"); rImp.GetShell()->MakeVisible( SwRect( rRect ) ); } @@ -1004,7 +1004,7 @@ void SwDrawView::CheckPossibilities() SwFrmFmt* pFrmFmt( ::FindFrmFmt( const_cast<SdrObject*>(pObj) ) ); if ( !pFrmFmt ) { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawView::CheckPossibilities()> - missing frame format" ); bProtect = TRUE; } diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 27beea64fd..02ebef05d7 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -302,7 +302,7 @@ BOOL SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPos, // Absatz-Anfang oder ein Blank gefunden, suche nach dem Wort // Kuerzel im Auto SwTxtNode* pTxtNd = rCrsr.GetNode()->GetTxtNode(); - ASSERT( pTxtNd, "wo ist denn der TextNode?" ); + OSL_ENSURE( pTxtNd, "wo ist denn der TextNode?" ); BOOL bRet = FALSE; if( nEndPos == rSttPos ) @@ -346,7 +346,7 @@ BOOL SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPos, if( ppPara ) { - ASSERT( !pIdx, "wer hat seinen Index nicht geloescht?" ); + OSL_ENSURE( !pIdx, "wer hat seinen Index nicht geloescht?" ); pIdx = new SwNodeIndex( rCrsr.GetPoint()->nNode, -1 ); } diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 595685c1a7..0b91c3b4e0 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -268,7 +268,7 @@ SwTxtFrm* SwAutoFormat::GetFrm( const SwTxtNode& rTxtNd ) const { // besorge mal den Frame const SwCntntFrm *pFrm = rTxtNd.GetFrm(); - ASSERT( pFrm, "zum Autoformat muss das Layout vorhanden sein" ); + OSL_ENSURE( pFrm, "zum Autoformat muss das Layout vorhanden sein" ); if( aFlags.bAFmtByInput && !pFrm->IsValid() ) { SwRect aTmpFrm( pFrm->Frm() ); @@ -2182,7 +2182,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, pCharClass( 0 ), nRedlAutoFmtSeqId( 0 ) { - ASSERT( (pSttNd && pEndNd) || (!pSttNd && !pEndNd), + OSL_ENSURE( (pSttNd && pEndNd) || (!pSttNd && !pEndNd), "Kein Bereich angegeben" ); if( aFlags.bSetNumRule && !aFlags.bAFmtByInput ) diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index ef86b56487..3192e22cd0 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -416,7 +416,7 @@ BOOL lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos, // --> OD 2008-03-19 #refactorlists# if ( rTNd.IsInList() ) { - ASSERT( rTNd.GetNumRule(), + OSL_ENSURE( rTNd.GetNumRule(), "<lcl_IsNoEndTxtAttrAtPos(..)> - no list style found at text node. Serious defect -> please inform OD." ); const SwNumRule* pNumRule = rTNd.GetNumRule(); const SwNumFmt &rNumFmt = pNumRule->Get( static_cast<USHORT>(rTNd.GetActualListLevel()) ); @@ -537,7 +537,7 @@ USHORT SwEditShell::GetScriptType() const ? pEnd->nContent.GetIndex() : rTxt.Len(); - ASSERT( nEndPos <= rTxt.Len(), "Index outside the range - endless loop!" ); + OSL_ENSURE( nEndPos <= rTxt.Len(), "Index outside the range - endless loop!" ); if( nEndPos > rTxt.Len() ) nEndPos = rTxt.Len(); @@ -611,7 +611,7 @@ USHORT SwEditShell::GetScalingOfSelectedText() const const SwPaM* pCrsr = GetCrsr(); const SwPosition* pStt = pCrsr->Start(); const SwTxtNode* pTNd = pStt->nNode.GetNode().GetTxtNode(); - ASSERT( pTNd, "no textnode available" ); + OSL_ENSURE( pTNd, "no textnode available" ); USHORT nScaleWidth; if( pTNd ) diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index cd180ae27e..60fe52d009 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -279,9 +279,9 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) { SwPaM* pCmp = (SwPaM*)pDestShell->GetCrsr(); // sicher den Pointer auf Cursor do { - ASSERT( pCmp->GetPoint()->nContent.GetIdxReg() + OSL_ENSURE( pCmp->GetPoint()->nContent.GetIdxReg() == pCmp->GetCntntNode(), "Point im falschen Node" ); - ASSERT( pCmp->GetMark()->nContent.GetIdxReg() + OSL_ENSURE( pCmp->GetMark()->nContent.GetIdxReg() == pCmp->GetCntntNode(FALSE), "Mark im falschen Node" ); BOOL bTst = *pCmp->GetPoint() == *pCmp->GetMark(); (void) bTst; diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index b0cce264fb..7194e39de3 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -102,7 +102,7 @@ SwTxtFmtColl* SwEditShell::MakeTxtFmtColl(const String& rFmtCollName, pParent = &GetTxtFmtColl(0); if ( (pColl=GetDoc()->MakeTxtFmtColl(rFmtCollName, pParent)) == 0 ) { - ASSERT( FALSE, "MakeTxtFmtColl failed" ) + OSL_ENSURE( FALSE, "MakeTxtFmtColl failed" ); } return pColl; diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 907f374606..0a65efdda0 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -267,7 +267,7 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints) FOREACHPAM_START(this) // fuer jeden PaM bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags)); - ASSERT( bSuccess, "Doc->Insert(Field) failed"); + OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed"); (void) bSuccess; FOREACHPAM_END() // fuer jeden PaM diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 2b46aa0fc7..38fbf54b76 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -85,7 +85,7 @@ USHORT SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const { case TOX_HEADER_SECTION: break; // ignore case TOX_CONTENT_SECTION: - ASSERT( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); + OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); pNew = new SwGlblDocContent( (SwTOXBaseSection*)pSect ); break; diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 848b903bdd..5fb1ad940c 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -182,7 +182,7 @@ USHORT SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock, BOOL SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) { - ASSERT( pInsDoc, "kein Ins.Dokument" ); + OSL_ENSURE( pInsDoc, "kein Ins.Dokument" ); SwNodes& rNds = pInsDoc->GetNodes(); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 855e497ac4..259cb19775 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -85,7 +85,7 @@ void SwEditShell::Insert( sal_Unicode c, BOOL bOnlyCurrCrsr ) FOREACHPAM_START(this) const bool bSuccess = GetDoc()->InsertString(*PCURCRSR, c); - ASSERT( bSuccess, "Doc->Insert() failed." ); + OSL_ENSURE( bSuccess, "Doc->Insert() failed." ); (void) bSuccess; SaveTblBoxCntnt( PCURCRSR->GetPoint() ); @@ -119,7 +119,7 @@ void SwEditShell::Insert2(const String &rStr, const bool bForceExpandHints ) //OPT: GetSystemCharSet const bool bSuccess = GetDoc()->InsertString(*_pStartCrsr, rStr, nInsertFlags); - ASSERT( bSuccess, "Doc->Insert() failed." ); + OSL_ENSURE( bSuccess, "Doc->Insert() failed." ); (void) bSuccess; SaveTblBoxCntnt( _pStartCrsr->GetPoint() ); @@ -187,7 +187,7 @@ void SwEditShell::Overwrite(const String &rStr) FOREACHPAM_START(this) if( !GetDoc()->Overwrite(*PCURCRSR, rStr ) ) { - ASSERT( FALSE, "Doc->Overwrite(Str) failed." ) + OSL_ENSURE( FALSE, "Doc->Overwrite(Str) failed." ); } SaveTblBoxCntnt( PCURCRSR->GetPoint() ); FOREACHPAM_END() @@ -278,8 +278,8 @@ const Graphic* SwEditShell::GetGraphic( BOOL bWait ) const if( pGrf->IsSwapOut() || ( pGrfNode->IsLinkedFile() && GRAPHIC_DEFAULT == pGrf->GetType() ) ) { -#ifdef DBG_UTIL - ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" ); #else pGrfNode->SwapIn( bWait ); #endif @@ -289,8 +289,8 @@ const Graphic* SwEditShell::GetGraphic( BOOL bWait ) const { if ( pGrf->IsSwapOut() && !pGrfNode->IsLinkedFile() ) { -#ifdef DBG_UTIL - ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" ); #else pGrfNode->SwapIn( bWait ); #endif @@ -371,7 +371,7 @@ void SwEditShell::ReRead( const String& rGrfName, const String& rFltName, void SwEditShell::GetGrfNms( String* pGrfName, String* pFltName, const SwFlyFrmFmt* pFmt ) const { - ASSERT( pGrfName || pFltName, "was wird denn nun erfragt?" ); + OSL_ENSURE( pGrfName || pFltName, "was wird denn nun erfragt?" ); if( pFmt ) GetDoc()->GetGrfNms( *pFmt, pGrfName, pFltName ); else @@ -406,7 +406,7 @@ void SwEditShell::SetGraphicPolygon( const PolyPolygon *pPoly ) void SwEditShell::ClearAutomaticContour() { SwNoTxtNode *pNd = GetCrsr()->GetNode()->GetNoTxtNode(); - ASSERT( pNd, "is no NoTxtNode!" ); + OSL_ENSURE( pNd, "is no NoTxtNode!" ); if( pNd->HasAutomaticContour() ) { StartAllAction(); @@ -430,14 +430,14 @@ void SwEditShell::ClearAutomaticContour() svt::EmbeddedObjectRef& SwEditShell::GetOLEObject() const { - ASSERT( CNT_OLE == GetCntType(), "GetOLEObj: kein OLENode." ); - ASSERT( !GetCrsr()->HasMark() || + OSL_ENSURE( CNT_OLE == GetCntType(), "GetOLEObj: kein OLENode." ); + OSL_ENSURE( !GetCrsr()->HasMark() || (GetCrsr()->HasMark() && GetCrsr()->GetPoint()->nNode == GetCrsr()->GetMark()->nNode), "GetOLEObj: kein OLENode." ); SwOLENode *pOLENode = GetCrsr()->GetNode()->GetOLENode(); - ASSERT( pOLENode, "GetOLEObj: kein OLENode." ); + OSL_ENSURE( pOLENode, "GetOLEObj: kein OLENode." ); SwOLEObj& rOObj = pOLENode->GetOLEObj(); return rOObj.GetObject(); } @@ -465,7 +465,7 @@ BOOL SwEditShell::HasOLEObj( const String &rName ) const void SwEditShell::SetChartName( const String &rName ) { SwOLENode *pONd = GetCrsr()->GetNode()->GetOLENode(); - ASSERT( pONd, "ChartNode not found" ); + OSL_ENSURE( pONd, "ChartNode not found" ); pONd->SetChartTblName( rName ); } @@ -586,7 +586,7 @@ void SwEditShell::ReplaceDropTxt( const String &rStr ) SwPaM aPam( rNd, rStr.Len(), rNd, 0 ); if( !GetDoc()->Overwrite( aPam, rStr ) ) { - ASSERT( FALSE, "Doc->Overwrite(Str) failed." ); + OSL_ENSURE( FALSE, "Doc->Overwrite(Str) failed." ); } EndAllAction(); @@ -697,8 +697,8 @@ Graphic SwEditShell::GetIMapGraphic() const if( rGrf.IsSwapOut() || ( ((SwGrfNode*)pNd)->IsLinkedFile() && GRAPHIC_DEFAULT == rGrf.GetType() ) ) { -#ifdef DBG_UTIL - ASSERT( ((SwGrfNode*)pNd)->SwapIn( TRUE ) || !TRUE, "Grafik konnte nicht geladen werden" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( ((SwGrfNode*)pNd)->SwapIn( TRUE ) || !TRUE, "Grafik konnte nicht geladen werden" ); #else ((SwGrfNode*)pNd)->SwapIn( TRUE ); #endif @@ -959,16 +959,16 @@ USHORT SwEditShell::GetLineCount( BOOL bActPos ) SwFrm* pFrm = pCntFrm; while( pFrm && !(pFrm->GetType() & nTyp) ) pFrm = pFrm->GetUpper(); - ASSERT( pFrm, "Wo bin ich?" ); + OSL_ENSURE( pFrm, "Wo bin ich?" ); if( pFrm && ( pFrm->GetType() & FRM_FOOTER ) ) pTmp = pCNd->FindFooterStartNode(); else pTmp = pCNd->FindHeaderStartNode(); } - ASSERT( pTmp, "Missing StartNode" ); + OSL_ENSURE( pTmp, "Missing StartNode" ); aStart = *pTmp; } - ASSERT( pCNd && pCntFrm, "Missing Layout-Information" ); + OSL_ENSURE( pCNd && pCntFrm, "Missing Layout-Information" ); } while( 0 != ( pCNd = GetDoc()->GetNodes().GoNextSection( diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 724541f956..a1344dd26a 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -216,7 +216,7 @@ const SwTxtNode *pLinguNode; SwLinguIter::SwLinguIter() : pSh( 0 ), pStart( 0 ), pEnd( 0 ), pCurr( 0 ), pCurrX( 0 ) { - // @@@ es fehlt: Sicherstellen der Reentrance, ASSERTs etc. + // @@@ es fehlt: Sicherstellen der Reentrance, OSL_ENSURE( etc. } /************************************************************************* @@ -238,7 +238,7 @@ void SwLinguIter::_Start( SwEditShell *pShell, SwDocPositions eStart, SET_CURR_SHELL( pSh ); - ASSERT( !pEnd, "LinguStart ohne End?"); + OSL_ENSURE( !pEnd, "LinguStart ohne End?"); SwPaM *pCrsr = pSh->GetCrsr(); @@ -297,7 +297,7 @@ void SwLinguIter::_End(bool bRestoreSelection) if( !pSh ) return; - ASSERT( pEnd, "SwEditShell::SpellEnd() ohne Start?"); + OSL_ENSURE( pEnd, "SwEditShell::SpellEnd() ohne Start?"); if(bRestoreSelection) { while( nCrsrCnt-- ) @@ -356,7 +356,7 @@ uno::Any SwSpellIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) if( !pMySh ) return aSpellRet; - ASSERT( GetEnd(), "SwEditShell::SpellContinue() ohne Start?"); + OSL_ENSURE( GetEnd(), "SwEditShell::SpellContinue() ohne Start?"); uno::Reference< uno::XInterface > xSpellRet; sal_Bool bGoOn = sal_True; @@ -430,7 +430,7 @@ uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) if( !pMySh ) return aConvRet; - ASSERT( GetEnd(), "SwConvIter::Continue() ohne Start?"); + OSL_ENSURE( GetEnd(), "SwConvIter::Continue() ohne Start?"); rtl::OUString aConvText; sal_Bool bGoOn = sal_True; @@ -517,7 +517,7 @@ void SwHyphIter::Start( SwEditShell *pShell, SwDocPositions eStart, SwDocPositio // robust if( GetSh() || GetEnd() ) { - ASSERT( !GetSh(), "+SwEditShell::HyphStart: missing HyphEnd()" ); + OSL_ENSURE( !GetSh(), "+SwEditShell::HyphStart: missing HyphEnd()" ); return; } @@ -561,7 +561,7 @@ uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) do { SwPaM *pCrsr; do { - ASSERT( GetEnd(), "SwEditShell::SpellContinue() ohne Start?" ); + OSL_ENSURE( GetEnd(), "SwEditShell::SpellContinue() ohne Start?" ); pCrsr = pMySh->GetCrsr(); if ( !pCrsr->HasMark() ) pCrsr->SetMark(); @@ -647,7 +647,7 @@ void SwHyphIter::DelSoftHyph( SwPaM &rPam ) void SwHyphIter::InsertSoftHyph( const xub_StrLen nHyphPos ) { SwEditShell *pMySh = GetSh(); - ASSERT( pMySh, "+SwEditShell::InsertSoftHyph: missing HyphStart()"); + OSL_ENSURE( pMySh, "+SwEditShell::InsertSoftHyph: missing HyphStart()"); if( !pMySh ) return; @@ -660,9 +660,9 @@ void SwHyphIter::InsertSoftHyph( const xub_StrLen nHyphPos ) if( pSttPos->nNode != pEndPos->nNode || !nLastHyphLen ) { - ASSERT( pSttPos->nNode == pEndPos->nNode, + OSL_ENSURE( pSttPos->nNode == pEndPos->nNode, "+SwEditShell::InsertSoftHyph: node warp during hyphenation" ); - ASSERT(nLastHyphLen, "+SwEditShell::InsertSoftHyph: missing HyphContinue()"); + OSL_ENSURE(nLastHyphLen, "+SwEditShell::InsertSoftHyph: missing HyphContinue()"); *pSttPos = *pEndPos; return; } @@ -747,14 +747,14 @@ void SwEditShell::SpellStart( // do not spell if interactive spelling is active elsewhere if (!pConvArgs && !pSpellIter) { - ASSERT( !pSpellIter, "wer ist da schon am spellen?" ); + OSL_ENSURE( !pSpellIter, "wer ist da schon am spellen?" ); pSpellIter = new SwSpellIter; pLinguIter = pSpellIter; } // do not do text conversion if it is active elsewhere if (pConvArgs && !pConvIter) { - ASSERT( !pConvIter, "text conversion already active!" ); + OSL_ENSURE( !pConvIter, "text conversion already active!" ); pConvIter = new SwConvIter( *pConvArgs ); pLinguIter = pConvIter; } @@ -785,13 +785,13 @@ void SwEditShell::SpellEnd( SwConversionArgs *pConvArgs, bool bRestoreSelection { if (!pConvArgs && pSpellIter && pSpellIter->GetSh() == this) { - ASSERT( pSpellIter, "wo ist mein Iterator?" ); + OSL_ENSURE( pSpellIter, "wo ist mein Iterator?" ); pSpellIter->_End(bRestoreSelection); delete pSpellIter, pSpellIter = 0; } if (pConvArgs && pConvIter && pConvIter->GetSh() == this) { - ASSERT( pConvIter, "wo ist mein Iterator?" ); + OSL_ENSURE( pConvIter, "wo ist mein Iterator?" ); pConvIter->_End(); delete pConvIter, pConvIter = 0; } @@ -822,8 +822,8 @@ uno::Any SwEditShell::SpellContinue( ::StartProgress( STR_STATSTR_SPELL, 0, nEndPage, GetDoc()->GetDocShell() ); } - ASSERT( pConvArgs || pSpellIter, "SpellIter missing" ); - ASSERT( !pConvArgs || pConvIter, "ConvIter missing" ); + OSL_ENSURE( pConvArgs || pSpellIter, "SpellIter missing" ); + OSL_ENSURE( !pConvArgs || pConvIter, "ConvIter missing" ); //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen // KEIN StartAction, da damit auch die Paints abgeschaltet // werden !!!!! @@ -888,7 +888,7 @@ void SwEditShell::HyphStart( SwDocPositions eStart, SwDocPositions eEnd ) // do not hyphenate if interactive hyphenationg is active elsewhere if (!pHyphIter) { - ASSERT( !pHyphIter, "wer ist da schon am hyphinieren?" ); + OSL_ENSURE( !pHyphIter, "wer ist da schon am hyphinieren?" ); pHyphIter = new SwHyphIter; pHyphIter->Start( this, eStart, eEnd ); } @@ -906,7 +906,7 @@ void SwEditShell::HyphEnd() { if (pHyphIter->GetSh() == this) { - ASSERT( pHyphIter, "wo ist mein Iterator?" ); + OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); pHyphIter->End(); delete pHyphIter, pHyphIter = 0; } @@ -940,7 +940,7 @@ uno::Reference< uno::XInterface > *pPageSt = 1; // das StatLineStartPercent } - ASSERT( pHyphIter, "wo ist mein Iterator?" ); + OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen // KEIN StartAction, da damit auch die Paints abgeschaltet // werden !!!!! @@ -966,7 +966,7 @@ uno::Reference< uno::XInterface > void SwEditShell::InsertSoftHyph( const xub_StrLen nHyphPos ) { - ASSERT( pHyphIter, "wo ist mein Iterator?" ); + OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); pHyphIter->InsertSoftHyph( nHyphPos ); } @@ -979,7 +979,7 @@ void SwEditShell::InsertSoftHyph( const xub_StrLen nHyphPos ) void SwEditShell::HyphIgnore() { - ASSERT( pHyphIter, "wo ist mein Iterator?" ); + OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen // KEIN StartAction, da damit auch die Paints abgeschaltet // werden !!!!! @@ -1242,7 +1242,7 @@ bool SwEditShell::GetGrammarCorrection( bool SwEditShell::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammarCheck) { - ASSERT( pSpellIter, "SpellIter missing" ); + OSL_ENSURE( pSpellIter, "SpellIter missing" ); if(!pSpellIter) return false; bool bRet = pSpellIter->SpellSentence(rPortions, bIsGrammarCheck); @@ -1258,7 +1258,7 @@ bool SwEditShell::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar -----------------------------------------------------------------------*/ void SwEditShell::PutSpellingToSentenceStart() { - ASSERT( pSpellIter, "SpellIter missing" ); + OSL_ENSURE( pSpellIter, "SpellIter missing" ); if(!pSpellIter) return; pSpellIter->ToSentenceStart(); @@ -1294,15 +1294,15 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, // Note: rNewPortions.size() == 0 is valid and happens when the whole // sentence got removed in the dialog - ASSERT( pSpellIter, "SpellIter missing" ); + OSL_ENSURE( pSpellIter, "SpellIter missing" ); if(pSpellIter && pSpellIter->GetLastPortions().size() > 0) // no portions -> no text to be changed { const SpellPortions& rLastPortions = pSpellIter->GetLastPortions(); const SpellContentPositions rLastPositions = pSpellIter->GetLastPositions(); - ASSERT(rLastPortions.size() > 0 && + OSL_ENSURE(rLastPortions.size() > 0 && rLastPortions.size() == rLastPositions.size(), - "last vectors of spelling results are not set or not equal") + "last vectors of spelling results are not set or not equal"); // iterate over the new portions, beginning at the end to take advantage of the previously // saved content positions @@ -1528,7 +1528,7 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar if( !pMySh ) return false; - ASSERT( GetEnd(), "SwEditShell::SpellSentence() ohne Start?"); + OSL_ENSURE( GetEnd(), "SwEditShell::SpellSentence() ohne Start?"); uno::Reference< XSpellAlternatives > xSpellRet; linguistic2::ProofreadingResult aGrammarResult; diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index f9564ed2b1..af58212ccf 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -557,9 +557,9 @@ BOOL SwEditShell::IsProtectedOutlinePara() const int nTmpLvl = pTmpNd->GetTxtNode()->GetAttrOutlineLevel(); - ASSERT( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL, //<-end,zhaojianwei + OSL_ENSURE( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL, "<SwEditShell::IsProtectedOutlinePara()>" ); - // <-- + if( bFirst ) { nLvl = nTmpLvl; @@ -575,10 +575,10 @@ BOOL SwEditShell::IsProtectedOutlinePara() const } } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { - ASSERT(!this, "Cursor not on an outline node" ); + OSL_ENSURE(!this, "Cursor not on an outline node" ); } #endif return bRet; @@ -656,7 +656,7 @@ BYTE SwEditShell::GetNumLevel() const const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode(); // --> FME 2005-09-12 #124972# Made code robust: - ASSERT( pTxtNd, "GetNumLevel() without text node" ) + OSL_ENSURE( pTxtNd, "GetNumLevel() without text node" ); if ( !pTxtNd ) return nLevel; // <-- diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index 5bf4ca1d0c..befa9626fe 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -115,11 +115,11 @@ const SwSection* SwEditShell::GetAnySection( BOOL bOutOfTab, const Point* pPt ) if( pFrm && pFrm->IsInSct() ) { SwSectionFrm* pSect = pFrm->FindSctFrm(); - ASSERT( pSect, "GetAnySection: Where's my Sect?" ); + OSL_ENSURE( pSect, "GetAnySection: Where's my Sect?" ); if( pSect->IsInFtn() && pSect->GetUpper()->IsInSct() ) { pSect = pSect->GetUpper()->FindSctFrm(); - ASSERT( pSect, "GetAnySection: Where's my SectFrm?" ); + OSL_ENSURE( pSect, "GetAnySection: Where's my SectFrm?" ); } return pSect->GetSection(); } diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 1995d00f55..33c2685578 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -115,17 +115,17 @@ USHORT SwEditShell::GetCurTOXMarks(SwTOXMarks& rMarks) const BOOL SwEditShell::IsTOXBaseReadonly(const SwTOXBase& rTOXBase) const { - ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; return rTOXSect.IsProtect(); } void SwEditShell::SetTOXBaseReadonly(const SwTOXBase& rTOXBase, BOOL bReadonly) { - ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); + OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; ((SwTOXBase&)rTOXBase).SetProtected(bReadonly); - ASSERT( rTOXSect.SwSection::GetType() == TOX_CONTENT_SECTION, "not a TOXContentSection" ); + OSL_ENSURE( rTOXSect.SwSection::GetType() == TOX_CONTENT_SECTION, "not a TOXContentSection" ); SwSectionData aSectionData(rTOXSect); aSectionData.SetProtectFlag(bReadonly); @@ -158,7 +158,7 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) // Einfuegen des Verzeichnisses const SwTOXBaseSection* pTOX = pDoc->InsertTableOf( *GetCrsr()->GetPoint(), rTOX, pSet, TRUE ); - ASSERT(pTOX, "Kein aktuelles Verzeichnis"); + OSL_ENSURE(pTOX, "Kein aktuelles Verzeichnis"); // Formatierung anstossen CalcLayout(); @@ -182,9 +182,9 @@ BOOL SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) { BOOL bRet = FALSE; - ASSERT( rTOX.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); + OSL_ENSURE( rTOX.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOX; - ASSERT(pTOX, "Keine aktuelles Verzeichnis"); + OSL_ENSURE(pTOX, "Keine aktuelles Verzeichnis"); const SwSectionNode* pSectNd; if( pTOX && 0 != ( pSectNd = pTOX->GetFmt()->GetSectionNode() ) ) { @@ -280,7 +280,7 @@ const SwTOXBase* SwEditShell::GetTOX( USHORT nPos ) const pSect->GetFmt()->GetSectionNode() && nCnt++ == nPos ) { - ASSERT( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); + OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); return (SwTOXBaseSection*)pSect; } } diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index f69579c3f9..15fa4dcbb1 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -261,8 +261,8 @@ void SwEditShell::SetUndoActionCount( USHORT nNew ) void lcl_SelectSdrMarkList( SwEditShell* pShell, const SdrMarkList* pSdrMarkList ) { - ASSERT( pShell != NULL, "need shell!" ); - ASSERT( pSdrMarkList != NULL, "need mark list" ); + OSL_ENSURE( pShell != NULL, "need shell!" ); + OSL_ENSURE( pSdrMarkList != NULL, "need mark list" ); if( pShell->ISA( SwFEShell ) ) { @@ -275,7 +275,7 @@ void lcl_SelectSdrMarkList( SwEditShell* pShell, // the old implementation would always unselect // objects, even if no new ones were selected. If this // is a problem, we need to re-work this a little. - ASSERT( pSdrMarkList->GetMarkCount() != 0, "empty mark list" ); + OSL_ENSURE( pSdrMarkList->GetMarkCount() != 0, "empty mark list" ); } } diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index a283f63c48..03152c903f 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -177,7 +177,7 @@ sal_uInt16 SwEditShell::GetCntType() const case ND_OLENODE: nRet = CNT_OLE; break; } - ASSERT( nRet, ERR_OUTOFSCOPE ); + ASSERT_ID( nRet, ERR_OUTOFSCOPE ); return nRet; } diff --git a/sw/source/core/except/dbgloop.cxx b/sw/source/core/except/dbgloop.cxx index 96976283b5..ddb3a7b1a4 100644 --- a/sw/source/core/except/dbgloop.cxx +++ b/sw/source/core/except/dbgloop.cxx @@ -29,8 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#ifndef DBG_UTIL -#error Wer fummelt denn an den makefiles rum? +#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 +#error Who broke the makefiles? #endif #include <tools/stream.hxx> #include "dbgloop.hxx" @@ -73,7 +73,7 @@ void DbgLoopStack::Push( const void *pThis ) if( DBG_MAX_STACK > nPtr ) { // Wenn eine loop entdeckt wird, wird der counter wieder zurueckgesetzt. - ASSERT( DBG_MAX_LOOP > aCount[nPtr], "DbgLoopStack::Push: loop detected" ); + OSL_ENSURE( DBG_MAX_LOOP > aCount[nPtr], "DbgLoopStack::Push: loop detected" ); if( DBG_MAX_LOOP > aCount[nPtr] ) ++(aCount[nPtr]); else @@ -89,9 +89,9 @@ void DbgLoopStack::Pop() { if( DBG_MAX_STACK > nPtr ) { - ASSERT( nPtr, "DbgLoopStack::Pop: can't pop the stack" ); + OSL_ENSURE( nPtr, "DbgLoopStack::Pop: can't pop the stack" ); - ASSERT( aCount[nPtr], "DbgLoopStack::Pop: can't dec the count" ); + OSL_ENSURE( aCount[nPtr], "DbgLoopStack::Pop: can't dec the count" ); if( DBG_MAX_STACK > nPtr + 1 ) aCount[nPtr + 1] = 0; } diff --git a/sw/source/core/except/errhdl.cxx b/sw/source/core/except/errhdl.cxx index 96d530defb..544f52b072 100644 --- a/sw/source/core/except/errhdl.cxx +++ b/sw/source/core/except/errhdl.cxx @@ -48,67 +48,17 @@ #define CVBREAK #endif -BOOL bAssertFail = FALSE; // ist gerade eine Assertbox oben ? -BOOL bAssert = FALSE; // TRUE, wenn mal ein ASSERT kam. - -/*------------------------------------------------------------------------ - Ausgabe einer Fehlermeldung inkl. Bedingung, Dateiname und Zeilennummer - wo der Fehler auftrat. - Die Funktion wird durch das ASSERT Makro gerufen! - Parameter: - char *pError Fehlermeldung - char *pFileName Filename in dem der Fehler auftrat - USHORT nLine Zeilennummer in dem der Fehler auftrat -------------------------------------------------------------------------*/ - -void AssertFail( const sal_Char* pError, const sal_Char* pFileName, USHORT nLine ) -{ - CVBREAK; - bAssert = TRUE; - - if( !bAssertFail && GetpApp() && GetpApp()->IsInMain() ) - { - bAssertFail = TRUE; - ByteString aErr; - aErr = "Assertion failed\n==================\nFILE : "; - aErr += pFileName; - aErr += " at line "; - aErr += ByteString::CreateFromInt32( nLine ); - aErr += "\nERROR : "; - aErr += pError; - - ByteString aTmp( getenv( "SW_NOBEEP" ) ); - if ( aTmp != "TRUE" ) - Sound::Beep(SOUND_ERROR); - -#if defined( UNX ) && !defined( DBG_UTIL ) - DBG_ERROR( aErr.GetBuffer() ); // DbgErr ist in UNIX-nicht Produkt-Versionen nicht definiert -#else - DbgError( aErr.GetBuffer() ); -#endif - bAssertFail = FALSE; - } - else - { - Sound::Beep(SOUND_ERROR); - Sound::Beep(SOUND_ERROR); - Sound::Beep(SOUND_ERROR); - if( !bAssertFail ) - *(short *)0 = 4711; // UAE ausloesen - } -} - /*------------------------------------------------------------------------ Ausgabe einer Fehlermeldung inkl. Bedingung, Dateiname und Zeilennummer wo der Fehler auftrat. - Die Funktion wird durch das ASSERT Makro gerufen! + Die Funktion wird durch das OSL_ENSURE(Makro gerufen! Parameter: USHORT nErrorId Id fuer Fehlermeldung char *pFileName Filename in dem der Fehler auftrat USHORT nLine Zeilennummer in dem der Fehler auftrat ------------------------------------------------------------------------*/ -void AssertFail( USHORT nErrorId, const sal_Char* pFileName, USHORT nLine ) +void AssertFail( USHORT nErrorId, const sal_Char* pFileName ) { // Umsetzung der ErrorId in eine Fehlermeldung static const sal_Char @@ -132,7 +82,7 @@ void AssertFail( USHORT nErrorId, const sal_Char* pFileName, USHORT nLine ) else pMsg = sERR_UNKNOWN; - AssertFail( pMsg, pFileName, nLine ); + OSL_ENSURE( pMsg, pFileName ); } diff --git a/sw/source/core/except/makefile.mk b/sw/source/core/except/makefile.mk index 19450849b5..022862b3c2 100644 --- a/sw/source/core/except/makefile.mk +++ b/sw/source/core/except/makefile.mk @@ -45,7 +45,7 @@ PRJPCH= CXXFILES = -.IF "$(dbgutil)"!="" +.IF "$(DBG_LEVEL)">="2" CXXFILES += \ errhdl.cxx \ dbgloop.cxx diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 80f9ba4be8..1a6619bdb8 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -134,7 +134,7 @@ SwFieldType* SwAuthorityFieldType::Copy() const void SwAuthorityFieldType::RemoveField(long nHandle) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL bRemoved = FALSE; #endif for(USHORT j = 0; j < m_pDataArr->Count(); j++) @@ -143,7 +143,7 @@ void SwAuthorityFieldType::RemoveField(long nHandle) long nRet = (long)(void*)pTemp; if(nRet == nHandle) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bRemoved = TRUE; #endif pTemp->RemoveRef(); @@ -156,7 +156,7 @@ void SwAuthorityFieldType::RemoveField(long nHandle) break; } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 DBG_ASSERT(bRemoved, "Field unknown" ); #endif } @@ -224,7 +224,7 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(long nHandle) const break; } } - ASSERT( pRet, "invalid Handle" ); + OSL_ENSURE( pRet, "invalid Handle" ); return pRet; } @@ -311,7 +311,7 @@ long SwAuthorityFieldType::GetHandle(USHORT nPos) USHORT SwAuthorityFieldType::GetSequencePos(long nHandle) { //find the field in a sorted array of handles, -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool bCurrentFieldWithoutTextNode = sal_False; #endif if(m_pSequArr->Count() && m_pSequArr->Count() != m_pDataArr->Count()) @@ -329,7 +329,7 @@ USHORT SwAuthorityFieldType::GetSequencePos(long nHandle) const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); if(!pTxtFld || !pTxtFld->GetpTxtNode()) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if(nHandle == ((SwAuthorityField*)pFmtFld->GetFld())->GetHandle()) bCurrentFieldWithoutTextNode = sal_True; #endif @@ -401,7 +401,9 @@ USHORT SwAuthorityFieldType::GetSequencePos(long nHandle) break; } } - ASSERT(bCurrentFieldWithoutTextNode || nRet, "Handle not found") +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE(bCurrentFieldWithoutTextNode || nRet, "Handle not found"); +#endif return nRet; } diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index e8302c39ce..d41e0296a3 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -389,7 +389,7 @@ void SwTableFormula::RelNmsToBoxNms( const SwTable& rTbl, String& rNewStr, { // relativen Namen zu Box-Namen (externe Darstellung) SwNode* pNd = (SwNode*)pPara; - ASSERT( pNd, "Feld steht in keinem TextNode" ); + OSL_ENSURE( pNd, "Feld steht in keinem TextNode" ); const SwTableBox *pRelBox, *pBox = (SwTableBox *)rTbl.GetTblBox( pNd->FindTableBoxStartNode()->GetIndex() ); @@ -419,7 +419,7 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTbl, String& rNewStr, { // relativen Namen zu Box-Pointern (interne Darstellung) SwNode* pNd = (SwNode*)pPara; - ASSERT( pNd, "Feld steht in keinem Node" ); + OSL_ENSURE( pNd, "Feld steht in keinem Node" ); const SwTableBox *pRelBox, *pBox = (SwTableBox*)rTbl.GetTblBox( pNd->FindTableBoxStartNode()->GetIndex() ); @@ -450,7 +450,7 @@ void SwTableFormula::BoxNmsToRelNm( const SwTable& rTbl, String& rNewStr, { // Box-Namen (externe Darstellung) zu relativen Namen SwNode* pNd = (SwNode*)pPara; - ASSERT( pNd, "Feld steht in keinem Node" ); + OSL_ENSURE( pNd, "Feld steht in keinem Node" ); const SwTableNode* pTblNd = pNd->FindTableNode(); String sRefBoxNm; @@ -458,7 +458,7 @@ void SwTableFormula::BoxNmsToRelNm( const SwTable& rTbl, String& rNewStr, { const SwTableBox *pBox = rTbl.GetTblBox( pNd->FindTableBoxStartNode()->GetIndex() ); - ASSERT( pBox, "Feld steht in keiner Tabelle" ); + OSL_ENSURE( pBox, "Feld steht in keiner Tabelle" ); sRefBoxNm = pBox->GetName(); } @@ -673,7 +673,7 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl, if( pFnd ) pTbl = pFnd; // ?? - ASSERT( pFnd, "Tabelle nicht gefunden, was nun?" ); + OSL_ENSURE( pFnd, "Tabelle nicht gefunden, was nun?" ); } } } @@ -727,7 +727,7 @@ const SwFrm* lcl_GetBoxFrm( const SwTableBox& rBox ) { SwNodeIndex aIdx( *rBox.GetSttNd() ); SwCntntNode* pCNd = aIdx.GetNodes().GoNext( &aIdx ); - ASSERT( pCNd, "Box hat keinen TextNode" ); + OSL_ENSURE( pCNd, "Box hat keinen TextNode" ); Point aPt; // den im Layout 1. Frame returnen - Tab.Kopfzeile !! return pCNd->GetFrm( &aPt, NULL, FALSE ); } diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx index 11c588b695..b38d6a80ac 100644 --- a/sw/source/core/fields/chpfld.cxx +++ b/sw/source/core/fields/chpfld.cxx @@ -102,11 +102,12 @@ SwField* SwChapterField::Copy() const return pTmp; } +// #i53420# void SwChapterField::ChangeExpansion(const SwFrm* pFrm, const SwCntntNode* pCntntNode, sal_Bool bSrchNum ) { - ASSERT( pFrm, "in welchem Frame stehe ich denn?" ) + OSL_ENSURE( pFrm, "in welchem Frame stehe ich denn?" ); SwDoc* pDoc = (SwDoc*)pCntntNode->GetDoc(); const SwTxtNode* pTxtNode = dynamic_cast<const SwTxtNode*>(pCntntNode); @@ -121,7 +122,6 @@ void SwChapterField::ChangeExpansion(const SwFrm* pFrm, ChangeExpansion( *pTxtNode, bSrchNum ); } } -// <-- void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum) { @@ -137,10 +137,9 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum) { BYTE nPrevLvl = nLevel; - ASSERT( pONd->GetAttrOutlineLevel() >= 0 && pONd->GetAttrOutlineLevel() <= MAXLEVEL, + OSL_ENSURE( pONd->GetAttrOutlineLevel() >= 0 && pONd->GetAttrOutlineLevel() <= MAXLEVEL, "<SwChapterField::ChangeExpansion(..)> - outline node with inconsistent outline level. Serious defect -> please inform OD." ); - nLevel = static_cast<BYTE>(pONd->GetAttrOutlineLevel()); //<-end,zhaojianwei - // <-- + nLevel = static_cast<BYTE>(pONd->GetAttrOutlineLevel()); if( nPrevLvl < nLevel ) nLevel = nPrevLvl; diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 2298577f5d..ca29acbb5f 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -111,7 +111,7 @@ const String& SwDBFieldType::GetName() const void SwDBFieldType::ReleaseRef() { - ASSERT(nRefCnt > 0, "RefCount kleiner 0!"); + OSL_ENSURE(nRefCnt > 0, "RefCount kleiner 0!"); if (--nRefCnt <= 0) { diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index a01c12b158..c23a0fa071 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -109,7 +109,7 @@ void SwIntrnlRefLink::DataChanged( const String& rMimeType, return; } - ASSERT( rFldType.GetDoc(), "Kein pDoc" ); + OSL_ENSURE( rFldType.GetDoc(), "Kein pDoc" ); // keine Abhaengigen mehr? if( rFldType.GetDepends() && !rFldType.IsModifyLocked() && !ChkNoDataFlag() ) @@ -299,7 +299,7 @@ void SwDDEFieldType::SetDoc( SwDoc* pNewDoc ) if( pDoc && refLink.Is() ) { - ASSERT( !nRefCnt, "wie kommen die Referenzen rueber?" ); + OSL_ENSURE( !nRefCnt, "wie kommen die Referenzen rueber?" ); pDoc->GetLinkManager().Remove( refLink ); } diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 1735027157..799a57e31e 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -102,12 +102,12 @@ void SwDDETable::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) void SwDDETable::ChangeContent() { - ASSERT( GetFrmFmt(), "Kein FrameFormat" ); + OSL_ENSURE( GetFrmFmt(), "Kein FrameFormat" ); // Stehen wir im richtigen NodesArray (Wegen UNDO) if( !aLines.Count() ) return; - ASSERT( GetTabSortBoxes().Count(), "Tabelle ohne Inhalt?" ); + OSL_ENSURE( GetTabSortBoxes().Count(), "Tabelle ohne Inhalt?" ); if( !GetTabSortBoxes()[0]->GetSttNd()->GetNodes().IsDocNodes() ) return; @@ -124,10 +124,10 @@ void SwDDETable::ChangeContent() for( USHORT i = 0; i < pLine->GetTabBoxes().Count(); ++i ) { SwTableBox* pBox = pLine->GetTabBoxes()[ i ]; - ASSERT( pBox->GetSttIdx(), "keine InhaltsBox" ); + OSL_ENSURE( pBox->GetSttIdx(), "keine InhaltsBox" ); SwNodeIndex aNdIdx( *pBox->GetSttNd(), 1 ); SwTxtNode* pTxtNode = aNdIdx.GetNode().GetTxtNode(); - ASSERT( pTxtNode, "Kein Node" ); + OSL_ENSURE( pTxtNode, "Kein Node" ); SwIndex aCntIdx( pTxtNode, 0 ); pTxtNode->EraseText( aCntIdx ); pTxtNode->InsertText( aLine.GetToken( i, '\t' ), aCntIdx ); @@ -153,19 +153,19 @@ SwDDEFieldType* SwDDETable::GetDDEFldType() BOOL SwDDETable::NoDDETable() { // suche den TabellenNode - ASSERT( GetFrmFmt(), "Kein FrameFormat" ); + OSL_ENSURE( GetFrmFmt(), "Kein FrameFormat" ); SwDoc* pDoc = GetFrmFmt()->GetDoc(); // Stehen wir im richtigen NodesArray (Wegen UNDO) if( !aLines.Count() ) return FALSE; - ASSERT( GetTabSortBoxes().Count(), "Tabelle ohne Inhalt?" ); + OSL_ENSURE( GetTabSortBoxes().Count(), "Tabelle ohne Inhalt?" ); SwNode* pNd = (SwNode*)GetTabSortBoxes()[0]->GetSttNd(); if( !pNd->GetNodes().IsDocNodes() ) return FALSE; SwTableNode* pTblNd = pNd->FindTableNode(); - ASSERT( pTblNd, "wo steht denn die Tabelle ?"); + OSL_ENSURE( pTblNd, "wo steht denn die Tabelle ?"); SwTable* pNewTbl = new SwTable( *this ); diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 9ad1c89594..144320a5fc 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -617,7 +617,7 @@ SwTemplNameFieldType::SwTemplNameFieldType(SwDoc *pDocument) String SwTemplNameFieldType::Expand(ULONG nFmt) const { - ASSERT( nFmt < FF_END, "Expand: kein guelt. Fmt!" ); + OSL_ENSURE( nFmt < FF_END, "Expand: kein guelt. Fmt!" ); String aRet; SwDocShell *pDocShell(pDoc->GetDocShell()); @@ -782,7 +782,7 @@ String SwDocStatFieldType::Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const nFmt = (sal_uInt32)nNumberingType; break; default: - ASSERT( sal_False, "SwDocStatFieldType::Expand: unbekannter SubType" ); + OSL_ENSURE( sal_False, "SwDocStatFieldType::Expand: unbekannter SubType" ); } String sRet; @@ -1429,7 +1429,7 @@ String SwHiddenTxtField::Expand() const void SwHiddenTxtField::Evaluate(SwDoc* pDoc) { - ASSERT(pDoc, Wo ist das Dokument Seniore); + OSL_ENSURE(pDoc, "Wo ist das Dokument Seniore"); if( TYP_CONDTXTFLD == nSubType ) { @@ -2031,7 +2031,7 @@ String SwExtUserFieldType::Expand(sal_uInt16 nSub, sal_uInt32 ) const case EU_STATE: nRet = USER_OPT_STATE; break; case EU_FATHERSNAME: nRet = USER_OPT_FATHERSNAME; break; case EU_APARTMENT: nRet = USER_OPT_APARTMENT; break; - default: ASSERT( !this, "Field unknown"); + default: OSL_ENSURE( !this, "Field unknown"); } if( USHRT_MAX != nRet ) { @@ -2308,8 +2308,8 @@ sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst ) { // einen sdbcx::Index fuers bestimmen vom TextNode anlegen SwPosition aPos( pDoc->GetNodes().GetEndOfPostIts() ); -#ifdef DBG_UTIL - ASSERT( GetBodyTxtNode( *pDoc, aPos, *pFrm ), +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( GetBodyTxtNode( *pDoc, aPos, *pFrm ), "wo steht das Feld" ); #else GetBodyTxtNode( *pDoc, aPos, *pFrm ); @@ -2418,7 +2418,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm, sTxt.Erase(); - ASSERT( !pFrm->IsInDocBody(), "Flag ist nicht richtig, Frame steht im DocBody" ); + OSL_ENSURE( !pFrm->IsInDocBody(), "Flag ist nicht richtig, Frame steht im DocBody" ); // sammel erstmal alle SetPageRefFelder ein. _SetGetExpFlds aTmpLst( 10, 5 ); diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 113b8b5fef..333f512745 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -143,7 +143,7 @@ SwTxtNode* GetFirstTxtNode( const SwDoc& rDoc, SwPosition& rPos, while( 0 != (pCNd = rNodes.GoNext( &rPos.nNode ) ) && 0 == ( pTxtNode = pCNd->GetTxtNode() ) ) ; - ASSERT( pTxtNode, "wo ist der 1.TextNode" ); + OSL_ENSURE( pTxtNode, "wo ist der 1.TextNode" ); rPos.nContent.Assign( pTxtNode, 0 ); } else if ( !pCFrm->IsValid() ) @@ -172,7 +172,7 @@ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos, { // hole das FlyFormat SwFrmFmt* pFlyFmt = ((SwFlyFrm*)pLayout)->GetFmt(); - ASSERT( pFlyFmt, "kein FlyFormat gefunden, wo steht das Feld" ); + OSL_ENSURE( pFlyFmt, "kein FlyFormat gefunden, wo steht das Feld" ); const SwFmtAnchor &rAnchor = pFlyFmt->GetAnchor(); @@ -187,7 +187,7 @@ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos, (FLY_AT_CHAR == rAnchor.GetAnchorId()) || (FLY_AS_CHAR == rAnchor.GetAnchorId())) { - ASSERT( rAnchor.GetCntntAnchor(), "keine gueltige Position" ); + OSL_ENSURE( rAnchor.GetCntntAnchor(), "keine gueltige Position" ); rPos = *rAnchor.GetCntntAnchor(); pTxtNode = rPos.nNode.GetNode().GetTxtNode(); if ( FLY_AT_PARA == rAnchor.GetAnchorId() ) @@ -340,7 +340,7 @@ void SwGetExpField::ChangeExpansion( const SwFrm& rFrm, const SwTxtFld& rFld ) if( bIsInBodyTxt ) // nur Felder in Footer, Header, FootNote, Flys return; - ASSERT( !rFrm.IsInDocBody(), "Flag ist nicht richtig, Frame steht im DocBody" ); + OSL_ENSURE( !rFrm.IsInDocBody(), "Flag ist nicht richtig, Frame steht im DocBody" ); // bestimme mal das Dokument (oder geht es noch einfacher?) const SwTxtNode* pTxtNode = &rFld.GetTxtNode(); @@ -641,7 +641,7 @@ void SwSetExpFieldType::SetChapter( SwSetExpField& rFld, const SwNode& rNd ) } else { - ASSERT( false, + OSL_ENSURE( false, "<SwSetExpFieldType::SetChapter(..)> - text node with numbering rule, but without number. This is a serious defect -> inform OD" ); } } diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index 785a1e2a49..e9623a1629 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -159,7 +159,7 @@ SwFieldType::SwFieldType( USHORT nWhichId ) DBG_CTOR( SwFieldType, 0 ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwFieldType::~SwFieldType() { @@ -193,7 +193,7 @@ SwField::SwField(SwFieldType* pTyp, sal_uInt32 nFmt, USHORT nLng) : bIsAutomaticLanguage(TRUE), nFormat(nFmt) { - ASSERT( pTyp, "SwField: ungueltiger SwFieldType" ); + OSL_ENSURE( pTyp, "SwField: ungueltiger SwFieldType" ); pType = pTyp; } @@ -205,10 +205,10 @@ SwField::~SwField() Beschreibung: Statt Umweg ueber den Typ --------------------------------------------------------------------*/ -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT SwField::Which() const { - ASSERT(pType, "Kein Typ vorhanden"); + OSL_ENSURE(pType, "Kein Typ vorhanden"); return pType->Which(); } #endif @@ -356,7 +356,7 @@ bool SwField::PutValue( const uno::Any& rVal, USHORT nWhichId ) SwFieldType* SwField::ChgTyp( SwFieldType* pNewType ) { - ASSERT( pNewType && pNewType->Which() == pType->Which(), + OSL_ENSURE( pNewType && pNewType->Which() == pType->Which(), "kein Typ oder ungleiche Typen" ); SwFieldType* pOld = pType; @@ -453,7 +453,7 @@ String FormatNumber(USHORT nNum, sal_uInt32 nFormat) return String::CreateFromInt32( nNum ); SvxNumberType aNumber; - ASSERT(nFormat != SVX_NUM_NUMBER_NONE, "Falsches Nummern-Format" ); + OSL_ENSURE(nFormat != SVX_NUM_NUMBER_NONE, "Falsches Nummern-Format" ); aNumber.SetNumberingType((sal_Int16)nFormat); return aNumber.GetNumStr(nNum); @@ -517,7 +517,7 @@ String SwValueFieldType::ExpandValue( const double& rVal, else nFmt = nNewFormat; } - ASSERT(pEntry, "Unbekanntes Zahlenformat!"); + OSL_ENSURE(pEntry, "Unbekanntes Zahlenformat!"); } if( pFormatter->IsTextFormat( nFmt ) ) @@ -672,7 +672,7 @@ void SwValueField::SetLanguage( USHORT nLng ) } SetFormat( nNewFormat ); } - ASSERT(pEntry, "Unbekanntes Zahlenformat!"); + OSL_ENSURE(pEntry, "Unbekanntes Zahlenformat!"); } } diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx index f6a3a2f159..d6827dddd9 100644 --- a/sw/source/core/fields/fldlst.cxx +++ b/sw/source/core/fields/fldlst.cxx @@ -115,7 +115,7 @@ USHORT SwInputFieldList::Count() const SwField* SwInputFieldList::GetField(USHORT nId) { const SwTxtFld* pTxtFld = (*pSrtLst)[ nId ]->GetFld(); - ASSERT( pTxtFld, "kein TextFld" ); + OSL_ENSURE( pTxtFld, "kein TextFld" ); return (SwField*)pTxtFld->GetFld().GetFld(); } diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index a2f81554f3..b7e4cdeca6 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -65,9 +65,9 @@ struct LayoutInfoOrder else { // corresponding <SwFrm> instances are in different repeating table header rows - ASSERT( rLayoutInfo.mpAnchorFrm->FindTabFrm(), + OSL_ENSURE( rLayoutInfo.mpAnchorFrm->FindTabFrm(), "<LayoutInfoOrder::operator()> - table frame not found" ); - ASSERT( rNewLayoutInfo.mpAnchorFrm->FindTabFrm(), + OSL_ENSURE( rNewLayoutInfo.mpAnchorFrm->FindTabFrm(), "<LayoutInfoOrder::operator()> - table frame not found" ); const SwTabFrm* pLayoutInfoTabFrm( rLayoutInfo.mpAnchorFrm->FindTabFrm() ); const SwTabFrm* pNewLayoutInfoTabFrm( rNewLayoutInfo.mpAnchorFrm->FindTabFrm() ); diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index f69faaf76d..23b0eec107 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -482,7 +482,7 @@ String SwGetRefField::MakeRefNumStr( const SwTxtNode& rTxtNodeOfField, if ( rTxtNodeOfReferencedItem.HasNumber() && rTxtNodeOfReferencedItem.IsCountedInList() ) { - ASSERT( rTxtNodeOfReferencedItem.GetNum(), + OSL_ENSURE( rTxtNodeOfReferencedItem.GetNum(), "<SwGetRefField::MakeRefNumStr(..)> - referenced paragraph has number, but no <SwNodeNum> instance --> please inform OD!" ); // Determine, up to which level the superior list labels have to be @@ -538,7 +538,7 @@ String SwGetRefField::MakeRefNumStr( const SwTxtNode& rTxtNodeOfField, ( nRestrictInclToThisLevel < rTxtNodeOfReferencedItem.GetActualListLevel() && ( nRefNumFormat == REF_NUMBER || nRefNumFormat == REF_NUMBER_FULL_CONTEXT ) ) ); - ASSERT( rTxtNodeOfReferencedItem.GetNumRule(), + OSL_ENSURE( rTxtNodeOfReferencedItem.GetNumRule(), "<SwGetRefField::MakeRefNumStr(..)> - referenced numbered paragraph has no numbering rule set --> please inform OD!" ); return rTxtNodeOfReferencedItem.GetNumRule()->MakeRefNumString( *(rTxtNodeOfReferencedItem.GetNum()), @@ -809,7 +809,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, USHORT nSubType, USHORT nSeqNo, USHORT* pStt, USHORT* pEnd ) { - ASSERT( pStt, "warum wird keine StartPos abgefragt?" ); + OSL_ENSURE( pStt, "warum wird keine StartPos abgefragt?" ); SwTxtNode* pTxtNd = 0; switch( nSubType ) @@ -870,7 +870,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, // --> OD 2007-10-18 #i81002# if(dynamic_cast< ::sw::mark::CrossRefBookmark const *>(pBkmk)) { - ASSERT( pTxtNd, + OSL_ENSURE( pTxtNd, "<SwGetRefFieldType::FindAnchor(..)> - node marked by cross-reference bookmark isn't a text node --> crash" ); *pEnd = pTxtNd->Len(); } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 5e4409a09e..cbf1e12bc9 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -103,7 +103,7 @@ using namespace ::com::sun::star; BOOL SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt ) { - ASSERT( pClpDoc, "kein Clipboard-Dokument" ); + OSL_ENSURE( pClpDoc, "kein Clipboard-Dokument" ); pClpDoc->DoUndo( FALSE ); // immer auf FALSE !! @@ -169,7 +169,7 @@ BOOL SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt ) if( rSpzFrmFmts[ 0 ] != pFlyFmt ) { USHORT nPos = rSpzFrmFmts.GetPos( pFlyFmt ); - ASSERT( nPos != USHRT_MAX, "Fly steht nicht im Spz-Array" ); + OSL_ENSURE( nPos != USHRT_MAX, "Fly steht nicht im Spz-Array" ); rSpzFrmFmts.Remove( nPos ); rSpzFrmFmts.Insert( pFlyFmt, 0 ); @@ -468,8 +468,8 @@ BOOL SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt, { BOOL bRet = FALSE; - ASSERT( pDestShell, "Copy ohne DestShell." ); - ASSERT( this == pDestShell || !pDestShell->IsObjSelected(), + OSL_ENSURE( pDestShell, "Copy ohne DestShell." ); + OSL_ENSURE( this == pDestShell || !pDestShell->IsObjSelected(), "Dest-Shell darf nie im Obj-Modus sein" ); SET_CURR_SHELL( pDestShell ); @@ -550,7 +550,7 @@ BOOL SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt, aNewAnch = pPg->Frm().Pos(); } else { - ASSERT( !this, "was fuer ein Anchor ist es denn?" ); + OSL_ENSURE( !this, "was fuer ein Anchor ist es denn?" ); } if( bRet ) @@ -707,7 +707,7 @@ namespace { BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) { SET_CURR_SHELL( this ); - ASSERT( pClpDoc, "kein Clipboard-Dokument" ); + OSL_ENSURE( pClpDoc, "kein Clipboard-Dokument" ); const USHORT nStartPageNumber = GetPhyPageNum(); // dann bis zum Ende vom Nodes Array SwNodeIndex aIdx( pClpDoc->GetNodes().GetEndOfExtras(), 2 ); @@ -773,7 +773,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) while( nCount ) { --nCount; - ASSERT( aIdx.GetNode().GetCntntNode(), "Who filled the clipboard?!" ) + OSL_ENSURE( aIdx.GetNode().GetCntntNode(), "Who filled the clipboard?!" ); if( aIdx.GetNode().GetCntntNode() ) // robust { Insertion aInsertion( PaMPtr( new SwPaM( aIdx ) ), @@ -874,7 +874,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) // dann die Tabelle "relativ" kopieren SwTableBox* pBox = pDestNd->GetTable().GetTblBox( pSttNd->GetIndex() ); - ASSERT( pBox, "Box steht nicht in dieser Tabelle" ); + OSL_ENSURE( pBox, "Box steht nicht in dieser Tabelle" ); aBoxes.Insert( pBox ); } @@ -1011,7 +1011,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) } else { - ASSERT( RES_DRAWFRMFMT == pNew->Which(), "Neues Format."); + OSL_ENSURE( RES_DRAWFRMFMT == pNew->Which(), "Neues Format."); // --> OD 2005-09-01 #i52780# - drawing object has // to be made visible on paste. { @@ -1220,7 +1220,7 @@ BOOL SwFEShell::PastePages( SwFEShell& rToFill, USHORT nStartPage, USHORT nEndPa BOOL SwFEShell::GetDrawObjGraphic( ULONG nFmt, Graphic& rGrf ) const { - ASSERT( Imp()->HasDrawView(), "GetDrawObjGraphic without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "GetDrawObjGraphic without DrawView?" ); const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); BOOL bConvert = TRUE; if( rMrkList.GetMarkCount() ) @@ -1435,7 +1435,7 @@ void SwFEShell::Paste( SvStream& rStrm, USHORT nAction, const Point* pPt ) const SwTxtFrm* pTmp = (SwTxtFrm*)pAnchor; do { pTmp = pTmp->FindMaster(); - ASSERT( pTmp, "Where's my Master?" ); + OSL_ENSURE( pTmp, "Where's my Master?" ); } while( pTmp->IsFollow() ); pAnchor = pTmp; } diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index f5cea0b5da..5df3a3444d 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -68,14 +68,14 @@ USHORT SwFEShell::GetPageDescCnt() const void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //Die SS veraendert keinen PageDesc, sondern setzt nur das Attribut. //Der Pagedesc muss im Dokument vorhanden sein! BOOL bFound = FALSE; for ( USHORT nTst = 0; nTst < GetPageDescCnt(); ++nTst ) if ( &rDesc == &GetPageDesc( nTst ) ) bFound = TRUE; - ASSERT( bFound, "ChgCurPageDesc mit ungueltigem Descriptor." ); + OSL_ENSURE( bFound, "ChgCurPageDesc mit ungueltigem Descriptor." ); #endif StartAllAction(); @@ -84,7 +84,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) const SwFrm *pFlow = 0; USHORT nPageNmOffset = 0; - ASSERT( !GetCrsr()->HasMark(), "ChgCurPageDesc nur ohne Selektion!"); + OSL_ENSURE( !GetCrsr()->HasMark(), "ChgCurPageDesc nur ohne Selektion!"); SET_CURR_SHELL( this ); while ( pPage ) @@ -112,7 +112,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) { pPage = (SwPageFrm*)pPage->GetNext(); pFlow = pPage->FindFirstBodyCntnt(); - ASSERT( pFlow, "Dokuemnt ohne Inhalt?!?" ); + OSL_ENSURE( pFlow, "Dokuemnt ohne Inhalt?!?" ); } } diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 11cb64961b..701d864df8 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -195,7 +195,7 @@ BOOL lcl_FindAnchorPos( SwDoc& rDoc, const Point& rPt, const SwFrm& rFrm, break; default: - ASSERT( !&rDoc, "Falsche ID fuer neuen Anker." ); + OSL_ENSURE( !&rDoc, "Falsche ID fuer neuen Anker." ); } rSet.Put( aNewAnch ); @@ -218,8 +218,8 @@ sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet ) SwDoc* pDoc = (SwDoc*)rFmt.GetDoc(); -#ifdef DBG_UTIL - ASSERT( !(nNew == FLY_AT_PAGE && +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !(nNew == FLY_AT_PAGE && (FLY_AT_PARA==nOld || FLY_AT_CHAR==nOld || FLY_AS_CHAR==nOld ) && pDoc->IsInHeaderFooter( rOldAnch.GetCntntAnchor()->nNode )), "Unerlaubter Ankerwechsel in Head/Foot." ); @@ -242,7 +242,7 @@ void SwFEShell::SelectFlyFrm( SwFlyFrm& rFrm, sal_Bool bNew ) SwViewImp *pImpl = Imp(); if( GetWin() && (bNew || !pImpl->GetDrawView()->AreObjectsMarked()) ) { - ASSERT( rFrm.IsFlyFrm(), "SelectFlyFrm will einen Fly" ); + OSL_ENSURE( rFrm.IsFlyFrm(), "SelectFlyFrm will einen Fly" ); //Wenn der Fly bereits selektiert ist gibt es hier ja wohl nichts //zu tun. @@ -330,8 +330,8 @@ const SwFrmFmt* SwFEShell::IsFlyInFly() const SwFrm* pFly = pObj->ISA(SwVirtFlyDrawObj) ? ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetAnchorFrm() : ((SwDrawContact*)GetUserCall(pObj))->GetAnchorFrm( pObj ); - ASSERT( pFly, "IsFlyInFly: Where's my anchor?" ); - ASSERT( pFly->IsFlyFrm(), "IsFlyInFly: Funny anchor!" ); + OSL_ENSURE( pFly, "IsFlyInFly: Where's my anchor?" ); + OSL_ENSURE( pFly->IsFlyFrm(), "IsFlyInFly: Funny anchor!" ); return ((SwFlyFrm*)pFly)->GetFmt(); } @@ -595,11 +595,11 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt ) SwRect aTmpRect( aRet, rAbsPos ); if( aTmpRect.HasArea() ) MakeVisible( aTmpRect ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //TODO: That doesn't seem to be intended if( Color(COL_TRANSPARENT) != GetOut()->GetLineColor() ) { - ASSERT( FALSE, "Hey, Joe: Where's my Null Pen?" ); + OSL_ENSURE( FALSE, "Hey, Joe: Where's my Null Pen?" ); GetOut()->SetLineColor( Color(COL_TRANSPARENT) ); } #endif @@ -679,7 +679,7 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali break; default: - ASSERT( !this, "Was sollte das fuer ein Fly werden?" ) + OSL_ENSURE( !this, "Was sollte das fuer ein Fly werden?" ); break; } @@ -845,7 +845,7 @@ void SwFEShell::Insert( const String& rGrfName, const String& rFltName, rFltName, pGraphic, pFlyAttrSet, pGrfAttrSet, pFrmFmt ); - ASSERT( pFmt, "Doc->Insert(notxt) failed." ); + OSL_ENSURE( pFmt, "Doc->Insert(notxt) failed." ); } while( (pCursor = dynamic_cast<SwShellCrsr*>(pCursor->GetNext())) != pStartCursor ); @@ -875,7 +875,7 @@ SwFlyFrmFmt* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj, FOREACHPAM_START( this ) pFmt = GetDoc()->Insert(*PCURCRSR, xObj, pFlyAttrSet, pGrfAttrSet, pFrmFmt ); - ASSERT( pFmt, "Doc->Insert(notxt) failed." ); + OSL_ENSURE( pFmt, "Doc->Insert(notxt) failed." ); FOREACHPAM_END() EndAllAction(); @@ -1041,7 +1041,7 @@ sal_Bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const SwFrm* pCurrFrm( GetCurrFrm() ); if ( !pCurrFrm ) { - ASSERT( false, + OSL_ENSURE( false, "<SwFEShell::GetFlyFrmAttr(..)> - missing current frame. This is a serious defect, please inform OD." ); return sal_False; } @@ -1049,7 +1049,7 @@ sal_Bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const pFly = GetCurrFrm()->FindFlyFrm(); if ( !pFly ) { - ASSERT( !this, "GetFlyFrmAttr, no Fly selected." ); + OSL_ENSURE( !this, "GetFlyFrmAttr, no Fly selected." ); return sal_False; } } @@ -1104,9 +1104,9 @@ sal_Bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet ) SwFlyFrm *pFly = FindFlyFrm(); if( !pFly ) { - ASSERT( GetCurrFrm(), "Crsr in parking zone" ); + OSL_ENSURE( GetCurrFrm(), "Crsr in parking zone" ); pFly = GetCurrFrm()->FindFlyFrm(); - ASSERT( pFly, "SetFlyFrmAttr, no Fly selected." ); + OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." ); } if( pFly ) { @@ -1193,9 +1193,9 @@ sal_Bool SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet ) SwFlyFrm *pFly = FindFlyFrm(); if( !pFly ) { - ASSERT( GetCurrFrm(), "Crsr in parking zone" ); + OSL_ENSURE( GetCurrFrm(), "Crsr in parking zone" ); pFly = GetCurrFrm()->FindFlyFrm(); - ASSERT( pFly, "SetFlyFrmAttr, no Fly selected." ); + OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." ); } if( pFly ) @@ -1263,7 +1263,7 @@ void SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocP } else pFly = FindFlyFrm(); - ASSERT( pFly, "SetFrmFmt: kein Frame" ); + OSL_ENSURE( pFly, "SetFrmFmt: kein Frame" ); if( pFly ) { StartAllAction(); @@ -1471,9 +1471,9 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < aResult = pFly->ChgSize( aSz ); //Wenn sich das Objekt aendert ist die Kontur hoechstwahrscheinlich daneben. - ASSERT( pFly->Lower()->IsNoTxtFrm(), "Request ohne NoTxt" ); + OSL_ENSURE( pFly->Lower()->IsNoTxtFrm(), "Request ohne NoTxt" ); SwNoTxtNode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetNoTxtNode(); - ASSERT( pNd, "Request ohne Node" ); + OSL_ENSURE( pNd, "Request ohne Node" ); pNd->SetContour( 0 ); ClrContourCache(); } @@ -1554,7 +1554,7 @@ void SwFEShell::SetFlyName( const String& rName ) if( pFly ) GetDoc()->SetFlyName( *(SwFlyFrmFmt*)pFly->GetFmt(), rName ); else { - ASSERT( !this, "kein FlyFrame selektiert" ) + OSL_ENSURE( !this, "kein FlyFrame selektiert" ); } } @@ -1564,7 +1564,7 @@ const String& SwFEShell::GetFlyName() const if( pFly ) return pFly->GetFmt()->GetName(); - ASSERT( !this, "kein FlyFrame selektiert" ) + OSL_ENSURE( !this, "kein FlyFrame selektiert" ); return aEmptyStr; } @@ -1788,7 +1788,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const SwDrawContact* pDrawContact( dynamic_cast<SwDrawContact*>(GetUserCall( pInvestigatedObj ) ) ); if ( !pDrawContact ) { - ASSERT( false, + OSL_ENSURE( false, "<SwFEShell::GetObjCntType(..)> - missing draw contact object" ); eType = OBJCNT_NONE; } @@ -1797,7 +1797,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const SwFrmFmt* pFrmFmt( pDrawContact->GetFmt() ); if ( !pFrmFmt ) { - ASSERT( false, + OSL_ENSURE( false, "<SwFEShell::GetObjCntType(..)> - missing frame format" ); eType = OBJCNT_NONE; } @@ -1921,7 +1921,7 @@ sal_Bool SwFEShell::ReplaceSdrObj( const String& rGrfName, const String& rFltNam static USHORT SwFmtGetPageNum(const SwFlyFrmFmt * pFmt) { - ASSERT(pFmt != NULL, "invalid argument"); + OSL_ENSURE(pFmt != NULL, "invalid argument"); SwFlyFrm * pFrm = pFmt->GetFrm(); diff --git a/sw/source/core/frmedt/feflyole.cxx b/sw/source/core/frmedt/feflyole.cxx index a730e61d33..28fb8fdf42 100644 --- a/sw/source/core/frmedt/feflyole.cxx +++ b/sw/source/core/frmedt/feflyole.cxx @@ -87,7 +87,7 @@ SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject > nSttIdx = pStNd->EndOfSectionIndex() + 1; } - ASSERT( bExist, "OLE-Object unknown and FlyFrm not found." ); + OSL_ENSURE( bExist, "OLE-Object unknown and FlyFrm not found." ); } return pFly; } diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 08ac82c210..fea7d35160 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -215,7 +215,7 @@ BOOL SwFEShell::SelectObj( const Point& rPt, BYTE nFlag, SdrObject *pObj ) if ( pObj ) { - ASSERT( !bEnterGroup, "SW_ENTER_GROUP is not supported" ); + OSL_ENSURE( !bEnterGroup, "SW_ENTER_GROUP is not supported" ); pDView->MarkObj( pObj, Imp()->GetPageView() ); } else @@ -248,7 +248,7 @@ BOOL SwFEShell::SelectObj( const Point& rPt, BYTE nFlag, SdrObject *pObj ) if ( GetCntType() & CNT_GRF ) { const SwFlyFrm *pTmp = GetFlyFromMarked( &rMrkList, this ); - ASSERT( pTmp, "Graphic without Fly" ); + OSL_ENSURE( pTmp, "Graphic without Fly" ); if ( ((SwNoTxtFrm*)pTmp->Lower())->HasAnimation() ) ((SwNoTxtFrm*)pTmp->Lower())->StopAnimation( GetOut() ); } @@ -345,7 +345,7 @@ sal_Bool SwFEShell::MoveAnchor( USHORT nDir ) switch ( nAnchorId ) { case FLY_AT_PAGE: { - ASSERT( pOld->IsPageFrm(), "Wrong anchor, page exspected." ); + OSL_ENSURE( pOld->IsPageFrm(), "Wrong anchor, page exspected." ); if( SW_MOVE_UP == nDir ) pNew = pOld->GetPrev(); else if( SW_MOVE_DOWN == nDir ) @@ -359,7 +359,7 @@ sal_Bool SwFEShell::MoveAnchor( USHORT nDir ) } case FLY_AT_CHAR: { - ASSERT( pOld->IsCntntFrm(), "Wrong anchor, page exspected." ); + OSL_ENSURE( pOld->IsCntntFrm(), "Wrong anchor, page exspected." ); if( SW_MOVE_LEFT == nDir || SW_MOVE_RIGHT == nDir ) { SwPosition *pPos = (SwPosition*)aAnch.GetCntntAnchor(); @@ -393,7 +393,7 @@ sal_Bool SwFEShell::MoveAnchor( USHORT nDir ) } // no break! case FLY_AT_PARA: { - ASSERT( pOld->IsCntntFrm(), "Wrong anchor, page exspected." ); + OSL_ENSURE( pOld->IsCntntFrm(), "Wrong anchor, page exspected." ); if( SW_MOVE_UP == nDir ) pNew = pOld->FindPrev(); else if( SW_MOVE_DOWN == nDir ) @@ -419,9 +419,9 @@ sal_Bool SwFEShell::MoveAnchor( USHORT nDir ) } case FLY_AT_FLY: { - ASSERT( pOld->IsFlyFrm(), "Wrong anchor, fly frame exspected."); + OSL_ENSURE( pOld->IsFlyFrm(), "Wrong anchor, fly frame exspected."); SwPageFrm* pPage = pOld->FindPageFrm(); - ASSERT( pPage, "Where's my page?" ); + OSL_ENSURE( pPage, "Where's my page?" ); SwFlyFrm* pNewFly = NULL; if( pPage->GetSortedObjs() ) { @@ -578,7 +578,7 @@ USHORT SwFEShell::GetSelFrmType() const eType = FRMTYPE_FLY_ATCNT; else { - ASSERT( pFly->IsFlyInCntFrm(), "Neuer Rahmentyp?" ); + OSL_ENSURE( pFly->IsFlyInCntFrm(), "Neuer Rahmentyp?" ); eType = FRMTYPE_FLY_INCNT; } } @@ -675,7 +675,7 @@ long SwFEShell::BeginDrag( const Point* pPt, BOOL ) long SwFEShell::Drag( const Point *pPt, BOOL ) { - ASSERT( Imp()->HasDrawView(), "Drag without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "Drag without DrawView?" ); if ( Imp()->GetDrawView()->IsDragObj() ) { ScrollTo( *pPt ); @@ -698,7 +698,7 @@ long SwFEShell::Drag( const Point *pPt, BOOL ) long SwFEShell::EndDrag( const Point *, BOOL ) { - ASSERT( Imp()->HasDrawView(), "EndDrag without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "EndDrag without DrawView?" ); SdrView *pView = Imp()->GetDrawView(); if ( pView->IsDragObj() ) { @@ -751,7 +751,7 @@ long SwFEShell::EndDrag( const Point *, BOOL ) void SwFEShell::BreakDrag() { - ASSERT( Imp()->HasDrawView(), "BreakDrag without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "BreakDrag without DrawView?" ); if ( Imp()->GetDrawView()->IsDragObj() ) Imp()->GetDrawView()->BrkDragObj(); SetChainMarker(); @@ -897,9 +897,9 @@ void lcl_NotifyNeighbours( const SdrMarkList *pLst ) void SwFEShell::SelectionToTop( BOOL bTop ) { - ASSERT( Imp()->HasDrawView(), "SelectionToTop without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "SelectionToTop without DrawView?" ); const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); - ASSERT( rMrkList.GetMarkCount(), "Kein Object Selektiert." ); + OSL_ENSURE( rMrkList.GetMarkCount(), "Kein Object Selektiert." ); SwFlyFrm *pFly = ::GetFlyFromMarked( &rMrkList, this ); if ( pFly && pFly->IsFlyInCntFrm() ) @@ -917,9 +917,9 @@ void SwFEShell::SelectionToTop( BOOL bTop ) void SwFEShell::SelectionToBottom( BOOL bBottom ) { - ASSERT( Imp()->HasDrawView(), "SelectionToBottom without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "SelectionToBottom without DrawView?" ); const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); - ASSERT( rMrkList.GetMarkCount(), "Kein Object Selektiert." ); + OSL_ENSURE( rMrkList.GetMarkCount(), "Kein Object Selektiert." ); SwFlyFrm *pFly = ::GetFlyFromMarked( &rMrkList, this ); if ( pFly && pFly->IsFlyInCntFrm() ) @@ -997,7 +997,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) // --> OD 2010-09-14 #i113730# // consider that a member of a drawing group has been selected. const SwContact* pContact = ::GetUserCall( pObj ); - ASSERT( pContact && pContact->GetMaster(), "<SwFEShell::ChangeOpaque(..)> - missing contact or missing master object at contact!" ); + OSL_ENSURE( pContact && pContact->GetMaster(), "<SwFEShell::ChangeOpaque(..)> - missing contact or missing master object at contact!" ); const bool bControlObj = ( pContact && pContact->GetMaster() ) ? ::CheckControlLayer( pContact->GetMaster() ) : ::CheckControlLayer( pObj ); @@ -1079,7 +1079,7 @@ void SwFEShell::EndTextEdit() //keinen Text mehr enthaelt und keine Attribute traegt) wird das //Objekt gel�scht. Alle anderen markierten Objekte bleiben erhalten. - ASSERT( Imp()->HasDrawView() && Imp()->GetDrawView()->IsTextEdit(), + OSL_ENSURE( Imp()->HasDrawView() && Imp()->GetDrawView()->IsTextEdit(), "EndTextEdit an no Object" ); StartAllAction(); @@ -1396,7 +1396,7 @@ const SdrObject* SwFEShell::GetBestObject( BOOL bNext, USHORT eType, BOOL bFlat, } - ASSERT( pList, "No object list to iterate" ) + OSL_ENSURE( pList, "No object list to iterate" ); SdrObjListIter aObjIter( *pList, bFlat ? IM_FLAT : IM_DEEPNOGROUPS ); while ( aObjIter.IsMore() ) @@ -1594,7 +1594,7 @@ BOOL SwFEShell::BeginCreate( UINT16 eSdrObjectKind, UINT32 eObjInventor, void SwFEShell::MoveCreate( const Point &rPos ) { - ASSERT( Imp()->HasDrawView(), "MoveCreate without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "MoveCreate without DrawView?" ); if ( GetPageNumber( rPos ) ) { ScrollTo( rPos ); @@ -1617,7 +1617,7 @@ BOOL SwFEShell::EndCreate( UINT16 eSdrCreateCmd ) // JP 18.08.95: Damit das Undo-Object aus der DrawEngine nicht bei uns // gespeichert wird, (wir erzeugen ein eigenes Undo-Object!) hier kurz // das Undo abschalten - ASSERT( Imp()->HasDrawView(), "EndCreate without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "EndCreate without DrawView?" ); if( !Imp()->GetDrawView()->IsGroupEntered() ) GetDoc()->SetNoDrawUndoObj( TRUE ); BOOL bCreate = Imp()->GetDrawView()->EndCreateObj( @@ -1641,7 +1641,7 @@ BOOL SwFEShell::EndCreate( UINT16 eSdrCreateCmd ) BOOL SwFEShell::ImpEndCreate() { - ASSERT( Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1, + OSL_ENSURE( Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1, "Neues Object nicht selektiert." ); SdrObject& rSdrObj = *Imp()->GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); @@ -1820,7 +1820,7 @@ BOOL SwFEShell::ImpEndCreate() SwTxtFrm* pTmp = (SwTxtFrm*)pAnch; do { pTmp = pTmp->FindMaster(); - ASSERT( pTmp, "Where's my Master?" ); + OSL_ENSURE( pTmp, "Where's my Master?" ); // OD 2004-03-30 #i26791# - correction: add frame area height // of master frames. nYOffset += pTmp->IsVertical() ? @@ -1913,7 +1913,7 @@ BOOL SwFEShell::ImpEndCreate() SwTxtFrm* pTmp = (SwTxtFrm*)pAnch; do { pTmp = pTmp->FindMaster(); - ASSERT( pTmp, "Where's my Master?" ); + OSL_ENSURE( pTmp, "Where's my Master?" ); nYOffset += pTmp->IsVertical() ? pTmp->Prt().Width() : pTmp->Prt().Height(); } while ( pTmp->IsFollow() ); @@ -1935,7 +1935,7 @@ BOOL SwFEShell::ImpEndCreate() // <-- if( bCharBound ) { - ASSERT( aAnch.GetAnchorId() == FLY_AS_CHAR, "wrong AnchorType" ); + OSL_ENSURE( aAnch.GetAnchorId() == FLY_AS_CHAR, "wrong AnchorType" ); SwTxtNode *pNd = aAnch.GetCntntAnchor()->nNode.GetNode().GetTxtNode(); SwFmtFlyCnt aFmt( pFmt ); pNd->InsertItem(aFmt, @@ -1949,7 +1949,7 @@ BOOL SwFEShell::ImpEndCreate() SwTxtFrm* pTmp = (SwTxtFrm*)pAnch; do { pTmp = pTmp->FindMaster(); - ASSERT( pTmp, "Where's my Master?" ); + OSL_ENSURE( pTmp, "Where's my Master?" ); } while( pTmp->IsFollow() ); pAnch = pTmp; } @@ -1992,7 +1992,7 @@ BOOL SwFEShell::ImpEndCreate() void SwFEShell::BreakCreate() { - ASSERT( Imp()->HasDrawView(), "BreakCreate without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "BreakCreate without DrawView?" ); Imp()->GetDrawView()->BrkCreateObj(); ::FrameNotify( this, FLY_DRAG_END ); } @@ -2049,7 +2049,7 @@ BOOL SwFEShell::BeginMark( const Point &rPos ) void SwFEShell::MoveMark( const Point &rPos ) { - ASSERT( Imp()->HasDrawView(), "MoveMark without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "MoveMark without DrawView?" ); if ( GetPageNumber( rPos ) ) { @@ -2077,7 +2077,7 @@ void SwFEShell::MoveMark( const Point &rPos ) BOOL SwFEShell::EndMark() { BOOL bRet = FALSE; - ASSERT( Imp()->HasDrawView(), "EndMark without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "EndMark without DrawView?" ); if (Imp()->GetDrawView()->IsMarkObj()) { @@ -2142,7 +2142,7 @@ BOOL SwFEShell::EndMark() void SwFEShell::BreakMark() { - ASSERT( Imp()->HasDrawView(), "BreakMark without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "BreakMark without DrawView?" ); Imp()->GetDrawView()->BrkMarkObj(); } @@ -2196,7 +2196,7 @@ short SwFEShell::GetAnchorId() const void SwFEShell::ChgAnchor( int eAnchorId, BOOL bSameOnly, BOOL bPosCorr ) { - ASSERT( Imp()->HasDrawView(), "ChgAnchor without DrawView?" ); + OSL_ENSURE( Imp()->HasDrawView(), "ChgAnchor without DrawView?" ); const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); if( rMrkList.GetMarkCount() && !rMrkList.GetMark( 0 )->GetMarkedSdrObj()->GetUpGroup() ) @@ -2223,7 +2223,7 @@ void SwFEShell::ChgAnchor( int eAnchorId, BOOL bSameOnly, BOOL bPosCorr ) void SwFEShell::DelSelectedObj() { - ASSERT( Imp()->HasDrawView(), "DelSelectedObj(), no DrawView available" ); + OSL_ENSURE( Imp()->HasDrawView(), "DelSelectedObj(), no DrawView available" ); if ( Imp()->HasDrawView() ) { StartAllAction(); @@ -2260,7 +2260,7 @@ Size SwFEShell::GetObjSize() const Point SwFEShell::GetAnchorObjDiff() const { const SdrView *pView = Imp()->GetDrawView(); - ASSERT( pView, "GetAnchorObjDiff without DrawView?" ); + OSL_ENSURE( pView, "GetAnchorObjDiff without DrawView?" ); Rectangle aRect; if ( Imp()->GetDrawView()->IsAction() ) @@ -2288,7 +2288,7 @@ Point SwFEShell::GetAnchorObjDiff() const Point SwFEShell::GetObjAbsPos() const { - ASSERT( Imp()->GetDrawView(), "GetObjAbsPos() without DrawView?" ); + OSL_ENSURE( Imp()->GetDrawView(), "GetObjAbsPos() without DrawView?" ); return Imp()->GetDrawView()->GetDragStat().GetActionRect().TopLeft(); } @@ -2353,7 +2353,7 @@ bool SwFEShell::IsGroupAllowed() const SwFrmFmt* pFrmFmt( ::FindFrmFmt( const_cast<SdrObject*>(pObj) ) ); if ( !pFrmFmt ) { - ASSERT( false, + OSL_ENSURE( false, "<SwFEShell::IsGroupAllowed()> - missing frame format" ); bIsGroupAllowed = false; } @@ -2497,7 +2497,7 @@ static BYTE __READONLY_DATA aChkArr[ 4 ] = { SwFlyFrm* pFrm = (SwFlyFrm*)aIter.First( TYPE( SwFlyFrm )); if( pFrm ) { - ASSERT( pFrm->IsFlyFrm(), "Wrong FrmType" ); + OSL_ENSURE( pFrm->IsFlyFrm(), "Wrong FrmType" ); if( bSelFrm ) { SelectObj( pFrm->Frm().Pos(), 0, ((SwFlyFrm*)pFrm)->GetVirtDrawObj() ); @@ -2621,7 +2621,7 @@ BOOL SwFEShell::GetObjAttr( SfxItemSet &rSet ) const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); // --> OD 2007-07-24 #143008# - make code robust - ASSERT( pContact, "<SwFEShell::GetObjAttr(..)> - missing <pContact> - please inform OD." ); + OSL_ENSURE( pContact, "<SwFEShell::GetObjAttr(..)> - missing <pContact> - please inform OD." ); if ( pContact ) { if ( i ) @@ -2639,7 +2639,7 @@ BOOL SwFEShell::SetObjAttr( const SfxItemSet& rSet ) SET_CURR_SHELL( this ); if ( !rSet.Count() ) - { ASSERT( !this, "SetObjAttr, empty set." ); + { OSL_ENSURE( !this, "SetObjAttr, empty set." ); return FALSE; } @@ -2703,7 +2703,7 @@ void SwFEShell::CheckUnboundObjects() } if ( !pPage ) pPage = pLast; - ASSERT( pPage, "Page not found." ); + OSL_ENSURE( pPage, "Page not found." ); //Fremde Identifier sollen in den Default laufen. //Ueberschneidungen sind moeglich!! @@ -3122,29 +3122,29 @@ const Color SwFEShell::GetShapeBackgrd() const Color aRetColor; // check, if a draw view exists - ASSERT( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackgrd - no draw view!"); + OSL_ENSURE( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackgrd - no draw view!"); if( Imp()->GetDrawView() ) { // determine list of selected objects const SdrMarkList* pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList(); // check, if exactly one object is selected. - ASSERT( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackgrd - no selected object!"); + OSL_ENSURE( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackgrd - no selected object!"); if ( pMrkList->GetMarkCount() == 1) { // get selected object const SdrObject *pSdrObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj(); // check, if selected object is a shape (drawing object) - ASSERT( !pSdrObj->ISA(SwVirtFlyDrawObj), "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); + OSL_ENSURE( !pSdrObj->ISA(SwVirtFlyDrawObj), "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); if ( !pSdrObj->ISA(SwVirtFlyDrawObj) ) { // determine page frame of the frame the shape is anchored. const SwFrm* pAnchorFrm = static_cast<SwDrawContact*>(GetUserCall(pSdrObj))->GetAnchorFrm( pSdrObj ); - ASSERT( pAnchorFrm, "inconsistent modell - no anchor at shape!"); + OSL_ENSURE( pAnchorFrm, "inconsistent modell - no anchor at shape!"); if ( pAnchorFrm ) { const SwPageFrm* pPageFrm = pAnchorFrm->FindPageFrm(); - ASSERT( pPageFrm, "inconsistent modell - no page!"); + OSL_ENSURE( pPageFrm, "inconsistent modell - no page!"); if ( pPageFrm ) { aRetColor = pPageFrm->GetDrawBackgrdColor(); @@ -3174,29 +3174,29 @@ bool SwFEShell::IsShapeDefaultHoriTextDirR2L() const bool bRet = false; // check, if a draw view exists - ASSERT( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackgrd - no draw view!"); + OSL_ENSURE( Imp()->GetDrawView(), "wrong usage of SwFEShell::GetShapeBackgrd - no draw view!"); if( Imp()->GetDrawView() ) { // determine list of selected objects const SdrMarkList* pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList(); // check, if exactly one object is selected. - ASSERT( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackgrd - no selected object!"); + OSL_ENSURE( pMrkList->GetMarkCount() == 1, "wrong usage of SwFEShell::GetShapeBackgrd - no selected object!"); if ( pMrkList->GetMarkCount() == 1) { // get selected object const SdrObject *pSdrObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj(); // check, if selected object is a shape (drawing object) - ASSERT( !pSdrObj->ISA(SwVirtFlyDrawObj), "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); + OSL_ENSURE( !pSdrObj->ISA(SwVirtFlyDrawObj), "wrong usage of SwFEShell::GetShapeBackgrd - selected object is not a drawing object!"); if ( !pSdrObj->ISA(SwVirtFlyDrawObj) ) { // determine page frame of the frame the shape is anchored. const SwFrm* pAnchorFrm = static_cast<SwDrawContact*>(GetUserCall(pSdrObj))->GetAnchorFrm( pSdrObj ); - ASSERT( pAnchorFrm, "inconsistent modell - no anchor at shape!"); + OSL_ENSURE( pAnchorFrm, "inconsistent modell - no anchor at shape!"); if ( pAnchorFrm ) { const SwPageFrm* pPageFrm = pAnchorFrm->FindPageFrm(); - ASSERT( pPageFrm, "inconsistent modell - no page!"); + OSL_ENSURE( pPageFrm, "inconsistent modell - no page!"); if ( pPageFrm ) { bRet = pPageFrm->IsRightToLeft() ? true : false; diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 797b2813a9..407dcfb540 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -117,7 +117,7 @@ void SwFEShell::ParkCursorInTab() { SwCursor * pSwCrsr = GetSwCrsr(); - ASSERT(pSwCrsr, "no SwCursor"); + OSL_ENSURE(pSwCrsr, "no SwCursor"); SwPosition aStartPos = *pSwCrsr->GetPoint(), aEndPos = aStartPos; @@ -1005,7 +1005,7 @@ BOOL SwFEShell::HasBoxSelection() const if( !pCNd ) { pCNd = GetDoc()->GetNodes().GoPrevious( &aIdx ); - ASSERT( pCNd, "kein ContentNode in der Box ??" ); + OSL_ENSURE( pCNd, "kein ContentNode in der Box ??" ); } if( pPam->GetMark()->nContent == pCNd->Len() ) { @@ -1430,7 +1430,7 @@ USHORT SwFEShell::GetCurTabColNum() const USHORT nRet = 0; SwFrm *pFrm = GetCurrFrm(); - ASSERT( pFrm, "Crsr geparkt?" ); + OSL_ENSURE( pFrm, "Crsr geparkt?" ); // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen if( pFrm && pFrm->IsInTab() ) @@ -1554,7 +1554,7 @@ const SwCellFrm *lcl_FindFrm( const SwLayoutFrm *pLay, const Point &rPt, // We first check if the given point is 'close' to the left or top // border of the table frame: - ASSERT( pFrm, "Nested table frame without outer table" ) + OSL_ENSURE( pFrm, "Nested table frame without outer table" ); SWRECTFN( pFrm ) const bool bRTL = pFrm->IsRightToLeft(); @@ -1652,7 +1652,7 @@ const SwCellFrm *lcl_FindFrm( const SwLayoutFrm *pLay, const Point &rPt, if ( !bMouseMoveRowCols ) { - ASSERT( pbCol && pbRow, "pbCol or pbRow missing" ) + OSL_ENSURE( pbCol && pbRow, "pbCol or pbRow missing" ); if ( bCloseToRow || bCloseToCol ) { @@ -1701,7 +1701,7 @@ const SwCellFrm *lcl_FindFrm( const SwLayoutFrm *pLay, const Point &rPt, } // robust: - ASSERT( !pRet || pRet->IsCellFrm(), "lcl_FindFrm() is supposed to find a cell frame!" ) + OSL_ENSURE( !pRet || pRet->IsCellFrm(), "lcl_FindFrm() is supposed to find a cell frame!" ); return pRet && pRet->IsCellFrm() ? static_cast<const SwCellFrm*>(pRet) : 0; } @@ -2201,7 +2201,7 @@ USHORT SwFEShell::GetCurMouseTabColNum( const Point &rPt ) const USHORT nRet = 0; const SwFrm *pFrm = GetBox( rPt ); - ASSERT( pFrm, "Table not found" ); + OSL_ENSURE( pFrm, "Table not found" ); if( pFrm ) { const long nX = pFrm->Frm().Left(); @@ -2268,13 +2268,13 @@ void SwFEShell::SetTblAttr( const SfxItemSet &rNew ) */ bool lcl_GoTableRow( SwCrsrShell* pShell, bool bUp ) { - ASSERT( pShell != NULL, "need shell" ); + OSL_ENSURE( pShell != NULL, "need shell" ); bool bRet = false; SwPaM* pPam = pShell->GetCrsr(); const SwStartNode* pTableBox = pPam->GetNode()->FindTableBoxStartNode(); - ASSERT( pTableBox != NULL, "I'm living in a box... NOT!" ); + OSL_ENSURE( pTableBox != NULL, "I'm living in a box... NOT!" ); // move cursor to start node of table box pPam->GetPoint()->nNode = pTableBox->GetIndex(); @@ -2542,7 +2542,7 @@ BOOL SwFEShell::IsMouseTableRightToLeft(const Point &rPt) const { SwFrm *pFrm = (SwFrm *)GetBox( rPt ); const SwTabFrm* pTabFrm = pFrm ? pFrm->ImplFindTabFrm() : 0; - ASSERT( pTabFrm, "Table not found" ); + OSL_ENSURE( pTabFrm, "Table not found" ); return pTabFrm ? pTabFrm->IsRightToLeft() : FALSE; } diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 8bf691a992..c32e40c46e 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -157,14 +157,14 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, const Point* pPt, case RECT_OUTTABSECTION : if( pFrm->IsInTab() ) pFrm = pFrm->FindTabFrm(); else { - ASSERT( FALSE, "Missing Table" ); + OSL_ENSURE( FALSE, "Missing Table" ); } /* KEIN BREAK */ case RECT_SECTION_PRT: case RECT_SECTION: if( pFrm->IsInSct() ) pFrm = pFrm->FindSctFrm(); else { - ASSERT( FALSE, "Missing section" ); + OSL_ENSURE( FALSE, "Missing section" ); } if( RECT_OUTTABSECTION_PRT == eType || @@ -301,7 +301,7 @@ USHORT SwFEShell::GetFrmType( const Point *pPt, BOOL bStopAtFly ) const nReturn |= FRMTYPE_FLY_ATCNT; else { - ASSERT( ((SwFlyFrm*)pFrm)->IsFlyInCntFrm(), + OSL_ENSURE( ((SwFlyFrm*)pFrm)->IsFlyInCntFrm(), "Neuer Rahmentyp?" ); nReturn |= FRMTYPE_FLY_INCNT; } @@ -396,7 +396,7 @@ USHORT SwFEShell::GetVirtPageNum( const BOOL bCalcFrm ) void lcl_SetAPageOffset( USHORT nOffset, SwPageFrm* pPage, SwFEShell* pThis ) { pThis->StartAllAction(); - ASSERT( pPage->FindFirstBodyCntnt(), + OSL_ENSURE( pPage->FindFirstBodyCntnt(), "SwFEShell _SetAPageOffset() ohne CntntFrm" ); SwFmtPageDesc aDesc( pPage->GetPageDesc() ); @@ -543,7 +543,7 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const String &rTxt, const } break; default: - ASSERT( !this, "Crsr weder in Tabelle noch in Fly." ); + OSL_ENSURE( !this, "Crsr weder in Tabelle noch in Fly." ); } if( nIdx ) @@ -580,7 +580,7 @@ BOOL SwFEShell::Sort(const SwSortOptions& rOpt) // Tabelle sortieren // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen SwFrm *pFrm = GetCurrFrm( FALSE ); - ASSERT( pFrm->FindTabFrm(), "Crsr nicht in Tabelle." ); + OSL_ENSURE( pFrm->FindTabFrm(), "Crsr nicht in Tabelle." ); // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; @@ -691,7 +691,7 @@ USHORT SwFEShell::_GetCurColNum( const SwFrm *pFrm, USHORT SwFEShell::GetCurColNum( SwGetCurColNumPara* pPara ) const { - ASSERT( GetCurrFrm(), "Crsr geparkt?" ); + OSL_ENSURE( GetCurrFrm(), "Crsr geparkt?" ); return _GetCurColNum( GetCurrFrm(), pPara ); } @@ -699,12 +699,12 @@ USHORT SwFEShell::GetCurOutColNum( SwGetCurColNumPara* pPara ) const { USHORT nRet = 0; SwFrm* pFrm = GetCurrFrm(); - ASSERT( pFrm, "Crsr geparkt?" ); + OSL_ENSURE( pFrm, "Crsr geparkt?" ); if( pFrm ) { pFrm = pFrm->IsInTab() ? (SwFrm*)pFrm->FindTabFrm() : (SwFrm*)pFrm->FindSctFrm(); - ASSERT( pFrm, "No Tab, no Sect" ); + OSL_ENSURE( pFrm, "No Tab, no Sect" ); if( pFrm ) nRet = _GetCurColNum( pFrm, pPara ); } @@ -937,7 +937,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, } else { - ASSERT( rVertEnvironLayFrm.IsPageFrm(), + OSL_ENSURE( rVertEnvironLayFrm.IsPageFrm(), "<SwFEShell::CalcBoundRect(..)> - not following text flow, but vertical environment *not* page!" ); aVertEnvironRect = rVertEnvironLayFrm.Frm(); // OD 19.09.2003 #i18732# - adjustment vertical 'virtual' anchor position @@ -1251,7 +1251,7 @@ BOOL SwFEShell::IsFrmVertical(BOOL bEnvironment, BOOL& bRTL) const // --> OD 2006-01-06 #123831# - make code robust: if ( !pObj ) { - ASSERT( false, + OSL_ENSURE( false, "<SwFEShell::IsFrmVertical(..)> - missing SdrObject instance in marked object list -> This is a serious situation, please inform OD" ); return bVert; } @@ -1261,7 +1261,7 @@ BOOL SwFEShell::IsFrmVertical(BOOL bEnvironment, BOOL& bRTL) const // --> OD 2006-01-06 #123831# - make code robust: if ( !pContact ) { - ASSERT( false, + OSL_ENSURE( false, "<SwFEShell::IsFrmVertical(..)> - missing SwContact instance at marked object -> This is a serious situation, please inform OD" ); return bVert; } @@ -1270,7 +1270,7 @@ BOOL SwFEShell::IsFrmVertical(BOOL bEnvironment, BOOL& bRTL) const // --> OD 2006-01-06 #123831# - make code robust: if ( !pRef ) { - ASSERT( false, + OSL_ENSURE( false, "<SwFEShell::IsFrmVertical(..)> - missing anchor frame at marked object -> This is a serious situation, please inform OD" ); return bVert; } diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 2b1fbea55c..633d354ad2 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -216,7 +216,7 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes, const SwTblSearchType eSearchType ) { //Start- und Endzelle besorgen und den naechsten fragen. - ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ), + OSL_ENSURE( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ), "Tabselection nicht auf Cnt." ); // Zeilen-Selektion: @@ -248,14 +248,14 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes, const ULONG nMarkSectionStart = pMarkNode->StartOfSectionIndex(); const SwTableBox* pMarkBox = rTbl.GetTblBox( nMarkSectionStart ); - ASSERT( pMarkBox, "Point in table, mark outside?" ) + OSL_ENSURE( pMarkBox, "Point in table, mark outside?" ); const SwTableLine* pLine = pMarkBox ? pMarkBox->GetUpper() : 0; USHORT nSttPos = rLines.GetPos( pLine ); - ASSERT( USHRT_MAX != nSttPos, "Wo ist meine Zeile in der Tabelle?" ); + OSL_ENSURE( USHRT_MAX != nSttPos, "Wo ist meine Zeile in der Tabelle?" ); pLine = rTbl.GetTblBox( rCrsr.GetNode( TRUE )->StartOfSectionIndex() )->GetUpper(); USHORT nEndPos = rLines.GetPos( pLine ); - ASSERT( USHRT_MAX != nEndPos, "Wo ist meine Zeile in der Tabelle?" ); + OSL_ENSURE( USHRT_MAX != nEndPos, "Wo ist meine Zeile in der Tabelle?" ); // pb: #i20193# if tableintable then nSttPos == nEndPos == USHRT_MAX if ( nSttPos != USHRT_MAX && nEndPos != USHRT_MAX ) { @@ -307,7 +307,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, const SwTabFrm* pStartTab = pStart->FindTabFrm(); if ( !pStartTab ) { - ASSERT( false, "GetTblSel without start table" ) + OSL_ENSURE( false, "GetTblSel without start table" ); return; } @@ -371,7 +371,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, break; } - ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" ); if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) { SwTableBox* pBox = (SwTableBox*) @@ -468,7 +468,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, // been deleted due to the formatting of the table: if ( aDelCheck.HasBeenDeleted() ) { - ASSERT( false, "Current box has been deleted during GetTblSel()" ) + OSL_ENSURE( false, "Current box has been deleted during GetTblSel()" ); break; } // <-- @@ -478,7 +478,7 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd, --nLoopMax; } while( TRUE ); - ASSERT( nLoopMax, "das Layout der Tabelle wurde nicht valide!" ); + OSL_ENSURE( nLoopMax, "das Layout der Tabelle wurde nicht valide!" ); } @@ -506,7 +506,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, return FALSE; const SwLayoutFrm *pStart = pCNd ? pCNd->GetFrm( &aNullPos )->GetUpper() : 0; - ASSERT( pStart, "ohne Frame geht gar nichts" ); + OSL_ENSURE( pStart, "ohne Frame geht gar nichts" ); aIdx = rEndNd; pCNd = aIdx.GetNode().GetCntntNode(); @@ -520,7 +520,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, } const SwLayoutFrm *pEnd = pCNd ? pCNd->GetFrm( &aNullPos )->GetUpper() : 0; - ASSERT( pEnd, "ohne Frame geht gar nichts" ); + OSL_ENSURE( pEnd, "ohne Frame geht gar nichts" ); BOOL bTblIsValid, bValidChartSel; @@ -583,7 +583,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, break; } - ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" ); const SwRect& rUnion = pUnion->GetUnion(), & rFrmRect = pCell->Frm(); @@ -737,7 +737,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, pGetCLines->DeleteAndDestroy( 0, pGetCLines->Count() ); } while( TRUE ); - ASSERT( nLoopMax, "das Layout der Tabelle wurde nicht valide!" ); + OSL_ENSURE( nLoopMax, "das Layout der Tabelle wurde nicht valide!" ); if( !bValidChartSel && pGetCLines ) pGetCLines->DeleteAndDestroy( 0, pGetCLines->Count() ); @@ -748,7 +748,7 @@ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd, BOOL IsFrmInTblSel( const SwRect& rUnion, const SwFrm* pCell ) { - ASSERT( pCell->IsCellFrm(), "Frame ohne Gazelle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Gazelle" ); if( pCell->FindTabFrm()->IsVertical() ) return ( rUnion.Right() >= pCell->Frm().Right() && @@ -828,7 +828,7 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) break; } - ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" ); if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) pUpperCell = (SwCellFrm*)pCell; @@ -897,7 +897,7 @@ BOOL GetAutoSumSel( const SwCrsrShell& rShell, SwCellFrms& rBoxes ) break; } - ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" ); if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) { const SwCellFrm* pC = (SwCellFrm*)pCell; @@ -947,7 +947,7 @@ _CmpLPt::_CmpLPt( const Point& rPt, const SwTableBox* pBox, BOOL bVertical ) void lcl_InsTblBox( SwTableNode* pTblNd, SwDoc* pDoc, SwTableBox* pBox, USHORT nInsPos, USHORT nCnt = 1 ) { - ASSERT( pBox->GetSttNd(), "Box ohne Start-Node" ); + OSL_ENSURE( pBox->GetSttNd(), "Box ohne Start-Node" ); SwCntntNode* pCNd = pDoc->GetNodes()[ pBox->GetSttIdx() + 1 ] ->GetCntntNode(); if( pCNd && pCNd->IsTxtNode() ) @@ -1007,7 +1007,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, rBoxes.Remove( USHORT(0), rBoxes.Count() ); //Zuerst lassen wir uns die Tabellen und die Rechtecke heraussuchen. - ASSERT( rPam.GetCntntNode() && rPam.GetCntntNode( FALSE ), + OSL_ENSURE( rPam.GetCntntNode() && rPam.GetCntntNode( FALSE ), "Tabselection nicht auf Cnt." ); //JP 24.09.96: Merge mit wiederholenden TabellenHeadline funktioniert nicht @@ -1054,7 +1054,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, while ( pCell && pRow->IsAnLower( pCell ) ) { - ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" ); // in der vollen Breite ueberlappend ? if( rUnion.Top() <= pCell->Frm().Top() && rUnion.Bottom() >= pCell->Frm().Bottom() ) @@ -1479,7 +1479,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, // in der MergeBox sollte jetzt der gesamte Text stehen // loesche jetzt noch den initialen TextNode - ASSERT( (*ppMergeBox)->GetSttIdx()+2 < + OSL_ENSURE( (*ppMergeBox)->GetSttIdx()+2 < (*ppMergeBox)->GetSttNd()->EndOfSectionIndex(), "leere Box" ); SwNodeIndex aIdx( *(*ppMergeBox)->GetSttNd()->EndOfSectionNode(), -1 ); @@ -1697,7 +1697,7 @@ void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, while ( pTab->IsFollow() ) { const SwFrm *pTmp = pTab->FindPrev(); - ASSERT( pTmp->IsTabFrm(), "Vorgaenger vom Follow nicht der Master." ); + OSL_ENSURE( pTmp->IsTabFrm(), "Vorgaenger vom Follow nicht der Master." ); pTab = (const SwTabFrm*)pTmp; } @@ -1820,7 +1820,7 @@ void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, if ( !pTmpLeaf || !pTmpTab->IsAnLower( pTmpLeaf ) ) { pTmpTab = (const SwTabFrm*)pTmpTab->FindPrev(); - ASSERT( pTmpTab->IsTabFrm(), "Vorgaenger vom Follow nicht der Master."); + OSL_ENSURE( pTmpTab->IsTabFrm(), "Vorgaenger vom Follow nicht der Master."); rpEnd = pTmpTab->FindLastCntnt()->GetUpper(); while( !rpEnd->IsCellFrm() ) rpEnd = rpEnd->GetUpper(); @@ -1844,7 +1844,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, // #112697# Robust: if ( !pStart || !pEnd ) { - ASSERT( false, "MakeSelUnions with pStart or pEnd not in CellFrm" ) + OSL_ENSURE( false, "MakeSelUnions with pStart or pEnd not in CellFrm" ); return; } @@ -1858,7 +1858,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, { if ( !pTable->IsAnFollow( pEndTable ) ) { - ASSERT( pEndTable->IsAnFollow( pTable ), "Tabkette verknotet." ); + OSL_ENSURE( pEndTable->IsAnFollow( pTable ), "Tabkette verknotet." ); bExchange = TRUE; } } @@ -1982,7 +1982,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart, pTmpCell = static_cast<const SwRowFrm*>(pTmpRow)->Lower(); pTmpRow = static_cast<const SwCellFrm*>(pTmpCell)->Lower(); } - ASSERT( !pTmpCell || pTmpCell->IsCellFrm(), "Lower of rowframe != cellframe?!" ) + OSL_ENSURE( !pTmpCell || pTmpCell->IsCellFrm(), "Lower of rowframe != cellframe?!" ); } // <-- @@ -2088,7 +2088,7 @@ BOOL CheckSplitCells( const SwCursor& rCrsr, USHORT nDiv, while ( pCell && pRow->IsAnLower( pCell ) ) { - ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" ); if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) ) { if( (pCell->Frm().*fnRect->fnGetWidth)() < nMinValue ) @@ -2200,7 +2200,7 @@ void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable ) const USHORT nPos = rTable.GetTabLines().GetPos( (const SwTableLine*&)pLine ) + 1; - ASSERT( nPos != USHRT_MAX, "TableLine not found." ); + OSL_ENSURE( nPos != USHRT_MAX, "TableLine not found." ); if( nStPos > nPos ) nStPos = nPos; @@ -2228,13 +2228,13 @@ void _FndBox::SetTableLines( const SwTable &rTable ) SwTableLine* pTmpLine = GetLines()[0]->GetLine(); USHORT nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pTmpLine ); - ASSERT( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" ); + OSL_ENSURE( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" ); if( nPos ) pLineBefore = rTable.GetTabLines()[ nPos - 1 ]; pTmpLine = GetLines()[GetLines().Count()-1]->GetLine(); nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pTmpLine ); - ASSERT( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" ); + OSL_ENSURE( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" ); if( ++nPos < rTable.GetTabLines().Count() ) pLineBehind = rTable.GetTabLines()[nPos]; } @@ -2260,7 +2260,7 @@ void _FndBox::DelFrms( SwTable &rTable ) { nStPos = rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBefore ); - ASSERT( nStPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); + OSL_ENSURE( nStPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); ++nStPos; } if( rTable.IsNewModel() && pLineBehind ) @@ -2269,7 +2269,7 @@ void _FndBox::DelFrms( SwTable &rTable ) { nEndPos = rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBehind ); - ASSERT( nEndPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); + OSL_ENSURE( nEndPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); --nEndPos; } @@ -2313,7 +2313,7 @@ void _FndBox::DelFrms( SwTable &rTable ) if ( pPrev ) { SwFrm *pTmp = pPrev->FindPrev(); - ASSERT( pTmp->IsTabFrm(), + OSL_ENSURE( pTmp->IsTabFrm(), "Vorgaenger vom Follow kein Master."); pPrev = (SwTabFrm*)pTmp; } @@ -2389,7 +2389,7 @@ BOOL lcl_IsLineOfTblFrm( const SwTabFrm& rTable, const SwFrm& rChk ) */ void lcl_UpdateRepeatedHeadlines( SwTabFrm& rTabFrm, bool bCalcLowers ) { - ASSERT( rTabFrm.IsFollow(), "lcl_UpdateRepeatedHeadlines called for non-follow tab" ) + OSL_ENSURE( rTabFrm.IsFollow(), "lcl_UpdateRepeatedHeadlines called for non-follow tab" ); // Delete remaining headlines: SwRowFrm* pLower = 0; @@ -2428,7 +2428,7 @@ void _FndBox::MakeFrms( SwTable &rTable ) { nStPos = rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBefore ); - ASSERT( nStPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); + OSL_ENSURE( nStPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); ++nStPos; } @@ -2436,7 +2436,7 @@ void _FndBox::MakeFrms( SwTable &rTable ) { nEndPos = rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBehind ); - ASSERT( nEndPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); + OSL_ENSURE( nEndPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" ); --nEndPos; } //Jetzt die grosse Einfuegeoperation fuer alle Tabllen. @@ -2629,8 +2629,8 @@ void _FndBox::MakeNewFrms( SwTable &rTable, const USHORT nNumber, lcl_UpdateRepeatedHeadlines( *pTable, true ); } - ASSERT( ((SwRowFrm*)pTable->Lower())->GetTabLine() == - rTable.GetTabLines()[0], "MakeNewFrms: Table corruption!" ) + OSL_ENSURE( ((SwRowFrm*)pTable->Lower())->GetTabLine() == + rTable.GetTabLines()[0], "MakeNewFrms: Table corruption!" ); } } } @@ -2663,7 +2663,7 @@ BOOL _FndBox::AreLinesToRestore( const SwTable &rTable ) const if ( nBfPos == nBhPos ) //Duerfte eigentlich nie vorkommen. { - ASSERT( FALSE, "Table, Loeschen auf keinem Bereich !?!" ); + OSL_ENSURE( FALSE, "Table, Loeschen auf keinem Bereich !?!" ); return FALSE; } diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx index ce11878871..de75a32361 100644 --- a/sw/source/core/graphic/grfatr.cxx +++ b/sw/source/core/graphic/grfatr.cxx @@ -107,7 +107,7 @@ bool SwMirrorGrf::QueryValue( uno::Any& rVal, BYTE nMemberId ) const GetValue() == RES_MIRROR_GRAPH_BOTH; break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } rVal.setValue( &bVal, ::getBooleanCppuType() ); @@ -156,7 +156,7 @@ bool SwMirrorGrf::PutValue( const uno::Any& rVal, BYTE nMemberId ) } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 8fc9450a02..166699734a 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -150,13 +150,13 @@ BOOL SwGrfNode::ReRead( { BOOL bReadGrf = FALSE, bSetTwipSize = TRUE; - ASSERT( pGraphic || pGrfObj || rGrfName.Len(), + OSL_ENSURE( pGraphic || pGrfObj || rGrfName.Len(), "GraphicNode without a name, Graphic or GraphicObject" ); // ReadRead mit Namen if( refLink.Is() ) { - ASSERT( !bInSwapIn, "ReRead: stehe noch im SwapIn" ); + OSL_ENSURE( !bInSwapIn, "ReRead: stehe noch im SwapIn" ); if( rGrfName.Len() ) { @@ -322,7 +322,7 @@ SwGrfNode::~SwGrfNode() SwDoc* pDoc = GetDoc(); if( refLink.Is() ) { - ASSERT( !bInSwapIn, "DTOR: stehe noch im SwapIn" ); + OSL_ENSURE( !bInSwapIn, "DTOR: stehe noch im SwapIn" ); pDoc->GetLinkManager().Remove( refLink ); refLink->Disconnect(); } @@ -362,7 +362,7 @@ SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere, SwAttrSet* pAutoAttr, BOOL bDelayed ) { - ASSERT( pGrfColl, "MakeGrfNode: Formatpointer ist 0." ); + OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer ist 0." ); SwGrfNode *pNode; // Delayed erzeugen nur aus dem SW/G-Reader if( bDelayed ) @@ -379,7 +379,7 @@ SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere, SwGrfFmtColl* pGrfColl, SwAttrSet* pAutoAttr ) { - ASSERT( pGrfColl, "MakeGrfNode: Formatpointer ist 0." ); + OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer ist 0." ); return new SwGrfNode( rWhere, rGrfObj, pGrfColl, pAutoAttr ); } @@ -472,7 +472,7 @@ short SwGrfNode::SwapIn( BOOL bWaitForData ) catch ( uno::Exception& ) { // --> OD 2005-04-25 #i48434# - ASSERT( false, "<SwGrfNode::SwapIn(..)> - unhandled exception!" ); + OSL_ENSURE( false, "<SwGrfNode::SwapIn(..)> - unhandled exception!" ); // <-- } // <-- @@ -555,7 +555,7 @@ BOOL SwGrfNode::SavePersistentData() { if( refLink.Is() ) { - ASSERT( !bInSwapIn, "SavePersistentData: stehe noch im SwapIn" ); + OSL_ENSURE( !bInSwapIn, "SavePersistentData: stehe noch im SwapIn" ); GetDoc()->GetLinkManager().Remove( refLink ); return TRUE; } @@ -690,7 +690,7 @@ void SwGrfNode::ScaleImageMap() nWidth -= rBox.CalcLineSpace(BOX_LINE_LEFT) + rBox.CalcLineSpace(BOX_LINE_RIGHT); - ASSERT( nWidth>0, "Gibt es 0 twip breite Grafiken!?" ); + OSL_ENSURE( nWidth>0, "Gibt es 0 twip breite Grafiken!?" ); if( nGrfSize.Width() != nWidth ) { @@ -705,7 +705,7 @@ void SwGrfNode::ScaleImageMap() nHeight -= rBox.CalcLineSpace(BOX_LINE_TOP) + rBox.CalcLineSpace(BOX_LINE_BOTTOM); - ASSERT( nHeight>0, "Gibt es 0 twip hohe Grafiken!?" ); + OSL_ENSURE( nHeight>0, "Gibt es 0 twip hohe Grafiken!?" ); if( nGrfSize.Height() != nHeight ) { @@ -745,7 +745,7 @@ void SwGrfNode::DelStreamName() catch ( uno::Exception& ) { // --> OD 2005-04-25 #i48434# - ASSERT( false, "<SwGrfNode::DelStreamName()> - unhandled exception!" ); + OSL_ENSURE( false, "<SwGrfNode::DelStreamName()> - unhandled exception!" ); // <-- } } @@ -764,7 +764,7 @@ uno::Reference< embed::XStorage > SwGrfNode::_GetDocSubstorageOrRoot( const Stri { uno::Reference < embed::XStorage > refStor = const_cast<SwGrfNode*>(this)->GetDoc()->GetDocStorage(); - ASSERT( refStor.is(), "Kein Storage am Doc" ); + OSL_ENSURE( refStor.is(), "Kein Storage am Doc" ); if ( aStgName.Len() ) { @@ -829,7 +829,7 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf( } else { - ASSERT( false, "<SwGrfNode::_GetStreamForEmbedGrf(..)> - embedded graphic file not found!" ); + OSL_ENSURE( false, "<SwGrfNode::_GetStreamForEmbedGrf(..)> - embedded graphic file not found!" ); } } @@ -873,10 +873,10 @@ void SwGrfNode::_GetStreamStorageNames( String& rStrmName, } else { - ASSERT( false, + OSL_ENSURE( false, "<SwGrfNode::_GetStreamStorageNames(..)> - unknown graphic URL type. Code for handling 3.1 - 5.2 storages has been deleted by issue i53025." ); } - ASSERT( STRING_NOTFOUND == rStrmName.Search( '/' ), + OSL_ENSURE( STRING_NOTFOUND == rStrmName.Search( '/' ), "invalid graphic stream name" ); } // <-- @@ -908,7 +908,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const catch ( uno::Exception& ) { // --> OD 2005-04-25 #i48434# - ASSERT( false, "<SwGrfNode::MakeCopy(..)> - unhandled exception!" ); + OSL_ENSURE( false, "<SwGrfNode::MakeCopy(..)> - unhandled exception!" ); // <-- } // <-- @@ -1000,7 +1000,7 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj ) catch ( uno::Exception& ) { // --> OD 2005-04-25 #i48434# - ASSERT( false, "<SwapGraphic> - unhandled exception!" ); + OSL_ENSURE( false, "<SwapGraphic> - unhandled exception!" ); // <-- } // <-- @@ -1132,7 +1132,7 @@ void SwGrfNode::TriggerAsyncRetrieveInputStream() { if ( !IsLinkedFile() ) { - ASSERT( false, + OSL_ENSURE( false, "<SwGrfNode::TriggerAsyncLoad()> - Method is misused. Method call is only valid for graphic nodes, which refer a linked graphic file" ); return; } diff --git a/sw/source/core/inc/dbg_lay.hxx b/sw/source/core/inc/dbg_lay.hxx index 15eabedf64..cda2de7179 100644 --- a/sw/source/core/inc/dbg_lay.hxx +++ b/sw/source/core/inc/dbg_lay.hxx @@ -64,7 +64,7 @@ #define SNAP_FLYFRAMES 0x00000002 #define SNAP_TABLECONT 0x00000004 -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include "swtypes.hxx" diff --git a/sw/source/core/inc/dbgloop.hxx b/sw/source/core/inc/dbgloop.hxx index 26e02bb89f..c15eda62a7 100644 --- a/sw/source/core/inc/dbgloop.hxx +++ b/sw/source/core/inc/dbgloop.hxx @@ -29,7 +29,7 @@ #ifndef _DBGLOOP_HXX #define _DBGLOOP_HXX -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include <tools/solar.h> diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx index 1743c5e1d3..bcbcf35e43 100644 --- a/sw/source/core/inc/drawfont.hxx +++ b/sw/source/core/inc/drawfont.hxx @@ -95,7 +95,7 @@ class SwDrawTextInfo SwDrawTextInfo(); // nicht zulaessig public: -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL bPos : 1; // These flags should control, that the appropriate BOOL bWrong : 1; // Set-function has been called before calling BOOL bGrammarCheck : 1; // the Get-function of a member @@ -158,7 +158,7 @@ public: bUpper = FALSE; bDrawSpace = FALSE; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // these flags control, whether the matching member variables have // been set by using the Set-function before they may be accessed // by their Get-function: @@ -199,13 +199,17 @@ public: const Point &GetPos() const { - ASSERT( bPos, "DrawTextInfo: Undefined Position" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bPos, "DrawTextInfo: Undefined Position" ); +#endif return *pPos; } xub_StrLen *GetHyphPos() const { - ASSERT( bHyph, "DrawTextInfo: Undefined Hyph Position" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bHyph, "DrawTextInfo: Undefined Hyph Position" ); +#endif return pHyphPos; } @@ -216,13 +220,17 @@ public: const SwWrongList* GetWrong() const { - ASSERT( bWrong, "DrawTextInfo: Undefined WrongList" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bWrong, "DrawTextInfo: Undefined WrongList" ); +#endif return pWrong; } const SwWrongList* GetGrammarCheck() const { - ASSERT( bGrammarCheck, "DrawTextInfo: Undefined GrammarCheck List" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bGrammarCheck, "DrawTextInfo: Undefined GrammarCheck List" ); +#endif return pGrammarCheck; } @@ -233,13 +241,17 @@ public: const Size &GetSize() const { - ASSERT( bSize, "DrawTextInfo: Undefined Size" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bSize, "DrawTextInfo: Undefined Size" ); +#endif return *pSize; } SwFont* GetFont() const { - ASSERT( bFnt, "DrawTextInfo: Undefined Font" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bFnt, "DrawTextInfo: Undefined Font" ); +#endif return pFnt; } @@ -260,7 +272,9 @@ public: xub_StrLen GetOfst() const { - ASSERT( bOfst, "DrawTextInfo: Undefined Offset" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bOfst, "DrawTextInfo: Undefined Offset" ); +#endif return nOfst; } @@ -271,19 +285,25 @@ public: long GetLeft() const { - ASSERT( bLeft, "DrawTextInfo: Undefined left range" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bLeft, "DrawTextInfo: Undefined left range" ); +#endif return nLeft; } long GetRight() const { - ASSERT( bRight, "DrawTextInfo: Undefined right range" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bRight, "DrawTextInfo: Undefined right range" ); +#endif return nRight; } long GetKanaDiff() const { - ASSERT( bKana, "DrawTextInfo: Undefined kana difference" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bKana, "DrawTextInfo: Undefined kana difference" ); +#endif return nKanaDiff; } @@ -294,7 +314,9 @@ public: USHORT GetAscent() const { - ASSERT( bAscent, "DrawTextInfo: Undefined Ascent" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bAscent, "DrawTextInfo: Undefined Ascent" ); +#endif return nAscent; } @@ -305,7 +327,9 @@ public: long GetSperren() const { - ASSERT( bSperr, "DrawTextInfo: Undefined >Sperren<" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bSperr, "DrawTextInfo: Undefined >Sperren<" ); +#endif return nSperren; } @@ -316,13 +340,17 @@ public: long GetSpace() const { - ASSERT( bSpace, "DrawTextInfo: Undefined Spacing" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bSpace, "DrawTextInfo: Undefined Spacing" ); +#endif return nSpace; } xub_StrLen GetNumberOfBlanks() const { - ASSERT( bNumberOfBlanks, "DrawTextInfo::Undefined NumberOfBlanks" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bNumberOfBlanks, "DrawTextInfo::Undefined NumberOfBlanks" ); +#endif return nNumberOfBlanks; } @@ -338,13 +366,17 @@ public: BOOL GetUpper() const { - ASSERT( bUppr, "DrawTextInfo: Undefined Upperflag" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bUppr, "DrawTextInfo: Undefined Upperflag" ); +#endif return bUpper; } BOOL GetDrawSpace() const { - ASSERT( bDrawSp, "DrawTextInfo: Undefined DrawSpaceflag" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bDrawSp, "DrawTextInfo: Undefined DrawSpaceflag" ); +#endif return bDrawSpace; } @@ -381,7 +413,7 @@ public: void SetPos( const Point &rNew ) { pPos = &rNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bPos = TRUE; #endif } @@ -389,7 +421,7 @@ public: void SetHyphPos( xub_StrLen *pNew ) { pHyphPos = pNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bHyph = TRUE; #endif } @@ -402,7 +434,7 @@ public: void SetWrong( const SwWrongList* pNew ) { pWrong = pNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bWrong = TRUE; #endif } @@ -410,7 +442,7 @@ public: void SetGrammarCheck( const SwWrongList* pNew ) { pGrammarCheck = pNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bGrammarCheck = TRUE; #endif } @@ -423,7 +455,7 @@ public: void SetSize( const Size &rNew ) { pSize = &rNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bSize = TRUE; #endif } @@ -431,7 +463,7 @@ public: void SetFont( SwFont* pNew ) { pFnt = pNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bFnt = TRUE; #endif } @@ -449,7 +481,7 @@ public: void SetOfst( xub_StrLen nNew ) { nOfst = nNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bOfst = TRUE; #endif } @@ -457,7 +489,7 @@ public: void SetLeft( long nNew ) { nLeft = nNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bLeft = TRUE; #endif } @@ -465,7 +497,7 @@ public: void SetRight( long nNew ) { nRight = nNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bRight = TRUE; #endif } @@ -473,7 +505,7 @@ public: void SetKanaDiff( long nNew ) { nKanaDiff = nNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bKana = TRUE; #endif } @@ -486,7 +518,7 @@ public: void SetAscent( USHORT nNew ) { nAscent = nNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bAscent = TRUE; #endif } @@ -508,7 +540,7 @@ public: nSpace = nNew; nSperren = 0; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bSpace = TRUE; bSperr = TRUE; #endif @@ -516,7 +548,7 @@ public: void SetNumberOfBlanks( xub_StrLen nNew ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bNumberOfBlanks = TRUE; #endif nNumberOfBlanks = nNew; @@ -545,7 +577,7 @@ public: void SetUpper( BOOL bNew ) { bUpper = bNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bUppr = TRUE; #endif } @@ -553,7 +585,7 @@ public: void SetDrawSpace( BOOL bNew ) { bDrawSpace = bNew; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bDrawSp = TRUE; #endif } diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 6212dbc9db..0a5cad49bc 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -166,7 +166,7 @@ public: virtual void CheckDirection( BOOL bVert ); virtual void Cut(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); #endif diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index 8b8e2c1eb2..9df70d757c 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -52,7 +52,7 @@ class SwFntCache : public SwCache public: inline SwFntCache() : SwCache(50,50 -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 , ByteString( RTL_CONSTASCII_STRINGPARAM( "Globaler Font-Cache pFntCache" )) #endif diff --git a/sw/source/core/inc/ftnfrm.hxx b/sw/source/core/inc/ftnfrm.hxx index 38fc429023..b171dce38c 100644 --- a/sw/source/core/inc/ftnfrm.hxx +++ b/sw/source/core/inc/ftnfrm.hxx @@ -72,7 +72,7 @@ class SwFtnFrm: public SwLayoutFrm // --> OD 2005-05-18 #i49383# - control unlock of position of lower anchored objects. bool mbUnlockPosOfLowerObjs : 1; // <-- -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 protected: virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); @@ -87,14 +87,14 @@ public: BOOL operator<( const SwTxtFtn* pTxtFtn ) const; -#ifndef DBG_UTIL - const SwCntntFrm *GetRef() const { return pRef; } - SwCntntFrm *GetRef() { return pRef; } -#else - //JP 15.10.2001: in a non pro version test if the attribute has the same - // meaning which his reference is +#if OSL_DEBUG_LEVEL > 1 + // in a non pro version test if the attribute has the same + // meaning which his reference is const SwCntntFrm *GetRef() const; SwCntntFrm *GetRef(); +#else + const SwCntntFrm *GetRef() const { return pRef; } + SwCntntFrm *GetRef() { return pRef; } #endif const SwCntntFrm *GetRefFromAttr() const; SwCntntFrm *GetRefFromAttr(); diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index 6cbb2b0b40..65247852f9 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -210,13 +210,13 @@ class SwLayIdle BOOL bPageValid; // Konnte die Seite alles validiert werden? BOOL bAllValid; // Konnte alles validiert werden? -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL bIndicator; #endif #ifdef _LAYACT_CXX -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void ShowIdle( ColorData eName ); #endif diff --git a/sw/source/core/inc/laycache.hxx b/sw/source/core/inc/laycache.hxx index 71a8b36ba4..894550be3e 100644 --- a/sw/source/core/inc/laycache.hxx +++ b/sw/source/core/inc/laycache.hxx @@ -70,7 +70,7 @@ public: return pImpl; } void UnlockImpl() { --nLockCount; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool CompareLayout( const SwDoc& rDoc ) const; #endif }; diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index 6875a0348e..2d85886f09 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -201,7 +201,7 @@ public: virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 virtual void Cut(); virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); #endif @@ -311,8 +311,8 @@ public: void InsertEmptySct( SwSectionFrm* pDel ); void DeleteEmptySct() { if( pDestroy ) _DeleteEmptySct(); } void RemoveFromList( SwSectionFrm* pSct ) { if( pDestroy ) _RemoveFromList( pSct ); } -#ifdef DBG_UTIL - // Wird zur Zeit nur fuer ASSERTs benutzt: +#if OSL_DEBUG_LEVEL > 1 + // Wird zur Zeit nur fuer OSL_ENSURE( benutzt: BOOL IsInDelList( SwSectionFrm* pSct ) const; // Ist der SectionFrm in der Liste enthalten? #endif diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx index 7b786b3feb..5b46b8d078 100644 --- a/sw/source/core/inc/scriptinfo.hxx +++ b/sw/source/core/inc/scriptinfo.hxx @@ -360,56 +360,56 @@ inline void SwScriptInfo::SetInvalidity( const xub_StrLen nPos ) inline USHORT SwScriptInfo::CountScriptChg() const { return aScriptChg.Count(); } inline xub_StrLen SwScriptInfo::GetScriptChg( const USHORT nCnt ) const { - ASSERT( nCnt < aScriptChg.Count(),"No ScriptChange today!"); + OSL_ENSURE( nCnt < aScriptChg.Count(),"No ScriptChange today!"); return aScriptChg[ nCnt ]; } inline BYTE SwScriptInfo::GetScriptType( const xub_StrLen nCnt ) const { - ASSERT( nCnt < aScriptChg.Count(),"No ScriptType today!"); + OSL_ENSURE( nCnt < aScriptChg.Count(),"No ScriptType today!"); return aScriptType[ nCnt ]; } inline USHORT SwScriptInfo::CountDirChg() const { return aDirChg.Count(); } inline xub_StrLen SwScriptInfo::GetDirChg( const USHORT nCnt ) const { - ASSERT( nCnt < aDirChg.Count(),"No DirChange today!"); + OSL_ENSURE( nCnt < aDirChg.Count(),"No DirChange today!"); return aDirChg[ nCnt ]; } inline BYTE SwScriptInfo::GetDirType( const xub_StrLen nCnt ) const { - ASSERT( nCnt < aDirChg.Count(),"No DirType today!"); + OSL_ENSURE( nCnt < aDirChg.Count(),"No DirType today!"); return aDirType[ nCnt ]; } inline USHORT SwScriptInfo::CountKashida() const { return aKashida.Count(); } inline xub_StrLen SwScriptInfo::GetKashida( const USHORT nCnt ) const { - ASSERT( nCnt < aKashida.Count(),"No Kashidas today!"); + OSL_ENSURE( nCnt < aKashida.Count(),"No Kashidas today!"); return aKashida[ nCnt ]; } inline USHORT SwScriptInfo::CountCompChg() const { return aCompChg.Count(); }; inline xub_StrLen SwScriptInfo::GetCompStart( const USHORT nCnt ) const { - ASSERT( nCnt < aCompChg.Count(),"No CompressionStart today!"); + OSL_ENSURE( nCnt < aCompChg.Count(),"No CompressionStart today!"); return aCompChg[ nCnt ]; } inline xub_StrLen SwScriptInfo::GetCompLen( const USHORT nCnt ) const { - ASSERT( nCnt < aCompChg.Count(),"No CompressionLen today!"); + OSL_ENSURE( nCnt < aCompChg.Count(),"No CompressionLen today!"); return aCompLen[ nCnt ]; } inline BYTE SwScriptInfo::GetCompType( const USHORT nCnt ) const { - ASSERT( nCnt < aCompChg.Count(),"No CompressionType today!"); + OSL_ENSURE( nCnt < aCompChg.Count(),"No CompressionType today!"); return aCompType[ nCnt ]; } inline USHORT SwScriptInfo::CountHiddenChg() const { return aHiddenChg.Count(); }; inline xub_StrLen SwScriptInfo::GetHiddenChg( const USHORT nCnt ) const { - ASSERT( nCnt < aHiddenChg.Count(),"No HiddenChg today!"); + OSL_ENSURE( nCnt < aHiddenChg.Count(),"No HiddenChg today!"); return aHiddenChg[ nCnt ]; } diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx index 9899a480e7..56e3b20ead 100644 --- a/sw/source/core/inc/swcache.hxx +++ b/sw/source/core/inc/swcache.hxx @@ -58,7 +58,7 @@ * */ -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include <tools/string.hxx> #endif @@ -90,7 +90,7 @@ class SwCache : public SwCacheObjArr void DeleteObj( SwCacheObj *pObj ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ByteString aName; long nAppend; //Anzahl der Eintragungen durch Erweiterung. long nInsertFree; //Anzahl der Eintragungen auf freie Plaetze. @@ -112,7 +112,7 @@ class SwCache : public SwCacheObjArr public: //nur BYTE hineinstecken!!! -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwCache( const USHORT nInitSize, const USHORT nGrowSize, const ByteString &rNm ); ~SwCache(); @@ -193,12 +193,12 @@ public: inline BOOL IsLocked() const { return 0 != nLock; } -#ifndef DBG_UTIL - inline void Lock() { ++nLock; } - inline void Unlock() { --nLock; } -#else +#if OSL_DEBUG_LEVEL > 1 void Lock(); void Unlock(); +#else + inline void Lock() { ++nLock; } + inline void Unlock() { --nLock; } #endif SwCacheObj *Next() { return pNext; } @@ -245,7 +245,7 @@ public: inline void SwCache::IncreaseMax( const USHORT nAdd ) { nCurMax = nCurMax + sal::static_int_cast< USHORT >(nAdd); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ++nIncreaseMax; #endif } @@ -253,7 +253,7 @@ inline void SwCache::DecreaseMax( const USHORT nSub ) { if ( nCurMax > nSub ) nCurMax = nCurMax - sal::static_int_cast< USHORT >(nSub); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ++nDecreaseMax; #endif } diff --git a/sw/source/core/inc/swfntcch.hxx b/sw/source/core/inc/swfntcch.hxx index be40ec4aa7..beb5f640f1 100644 --- a/sw/source/core/inc/swfntcch.hxx +++ b/sw/source/core/inc/swfntcch.hxx @@ -47,7 +47,7 @@ class SwFontCache : public SwCache public: inline SwFontCache() : SwCache(50,50 -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 , "Globaler AttributSet/Font-Cache pSwFontCache" #endif ) {} diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index c779f57447..898f2fbe0a 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -831,7 +831,7 @@ public: SwFont& GetFont() { - ASSERT( pFnt, "No underline font" ) + OSL_ENSURE( pFnt, "No underline font" ); return *pFnt; } const Point& GetPos() const { return aPos; } @@ -844,9 +844,7 @@ public: * class SvStatistics *************************************************************************/ -#ifndef DBG_UTIL -#define SV_STAT(nWhich) -#else +#if OSL_DEBUG_LEVEL > 1 class SvStatistics { @@ -892,7 +890,9 @@ inline void SvStatistics::PrintOn( SvStream &rOS ) const //$ ostream rOS << "\tnDrawStretchText: " << nDrawStretchText << '\n'; if( nChangeFont ) rOS << "\tnChangeFont: " << nChangeFont << '\n'; if( nGetFontMetric ) rOS << "\tnGetFontMetric: " << nGetFontMetric << '\n'; rOS << "}" << '\n'; } -#endif /* PRODUCT */ +#else +#define SV_STAT(nWhich) +#endif /* DEBUG */ #endif diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx index ae69428a0e..d558c1547e 100644 --- a/sw/source/core/inc/tblrwcl.hxx +++ b/sw/source/core/inc/tblrwcl.hxx @@ -67,7 +67,7 @@ BOOL lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara ); BOOL lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); #endif diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index a6daab79c1..984be9d700 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -402,10 +402,10 @@ public: inline sal_Bool IsSwapped() const { return bIsSwapped; } // Hat der Frm eine lokale Fussnote (in diesem Frm bzw. Follow)? -#ifndef DBG_UTIL - void CalcFtnFlag(); +#if OSL_DEBUG_LEVEL > 1 + void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//For testing SplitFrm #else - void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//Fuer den Test von SplitFrm + void CalcFtnFlag(); #endif // Hidden diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index cdeed013ea..1bb6a90b6b 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -304,7 +304,7 @@ void SwAnchoredDrawObject::MakeObjPos() // to anchor frame if ( mbNotYetAttachedToAnchorFrame ) { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredDrawObject::MakeObjPos() - drawing object not yet attached to anchor frame -> no positioning" ); return; } @@ -377,7 +377,7 @@ void SwAnchoredDrawObject::MakeObjPos() break; default: { - ASSERT( false, "<SwAnchoredDrawObject::MakeObjPos()> - unknown anchor type - please inform OD." ); + OSL_ENSURE( false, "<SwAnchoredDrawObject::MakeObjPos()> - unknown anchor type - please inform OD." ); } } @@ -680,13 +680,13 @@ void SwAnchoredDrawObject::InvalidateObjPos() SwFrmFmt& SwAnchoredDrawObject::GetFrmFmt() { - ASSERT( static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFmt(), + OSL_ENSURE( static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFmt(), "<SwAnchoredDrawObject::GetFrmFmt()> - missing frame format -> crash." ); return *(static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFmt()); } const SwFrmFmt& SwAnchoredDrawObject::GetFrmFmt() const { - ASSERT( static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFmt(), + OSL_ENSURE( static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFmt(), "<SwAnchoredDrawObject::GetFrmFmt()> - missing frame format -> crash." ); return *(static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFmt()); } @@ -838,7 +838,7 @@ void SwAnchoredDrawObject::_SetPositioningAttr() break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredDrawObject::_SetPositioningAttr()> - unsupported layout direction" ); } } diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index 85ba3b2617..9370ed7625 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -646,7 +646,7 @@ bool SwAnchoredObject::HasClearedEnvironment() const bool bHasClearedEnvironment( false ); // --> OD 2005-03-03 #i43913# - layout frame, vertical position is orient at, has to be set. - ASSERT( GetVertPosOrientFrm(), + OSL_ENSURE( GetVertPosOrientFrm(), "<SwAnchoredObject::HasClearedEnvironment()> - layout frame missing, at which the vertical position is oriented at." ); if ( GetVertPosOrientFrm() && GetAnchorFrm()->IsTxtFrm() && @@ -691,7 +691,7 @@ const SwRect& SwAnchoredObject::GetObjRectWithSpaces() const if ( mbObjRectWithSpacesValid && maLastObjRect != GetObjRect() ) { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredObject::GetObjRectWithSpaces> - cache for object rectangle inclusive spaces marked as valid, but it couldn't be. Missing invalidation of cache. Please inform OD." ); InvalidateObjRectWithSpaces(); } @@ -966,7 +966,7 @@ Point SwAnchoredObject::GetRelPosToAnchorFrm() const { Point aRelPos; - ASSERT( GetAnchorFrm(), + OSL_ENSURE( GetAnchorFrm(), "<SwAnchoredObject::GetRelPosToAnchorFrm()> - missing anchor frame." ); aRelPos = GetObjRect().Pos(); aRelPos -= GetAnchorFrm()->Frm().Pos(); @@ -993,9 +993,9 @@ Point SwAnchoredObject::GetRelPosToPageFrm( const bool _bFollowTextFlow, Point aRelPos; _obRelToTableCell = false; - ASSERT( GetAnchorFrm(), + OSL_ENSURE( GetAnchorFrm(), "<SwAnchoredObject::GetRelPosToPageFrm()> - missing anchor frame." ); - ASSERT( GetAnchorFrm()->FindPageFrm(), + OSL_ENSURE( GetAnchorFrm()->FindPageFrm(), "<SwAnchoredObject::GetRelPosToPageFrm()> - missing page frame." ); aRelPos = GetObjRect().Pos(); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 30824eb8fe..8ee6617ff3 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -246,7 +246,7 @@ void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt ) sal_Bool bDoesUndo = pDoc->DoesUndo(); pDoc->DoUndo( sal_False ); - ASSERT( pNode, "Ein grosses Problem." ); + OSL_ENSURE( pNode, "Ein grosses Problem." ); pDoc->DeleteSection( pNode ); if( bDoesUndo ) @@ -280,7 +280,7 @@ SwFmtFrmSize& SwFmtFrmSize::operator=( const SwFmtFrmSize& rCpy ) int SwFmtFrmSize::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return( eFrmHeightType == ((SwFmtFrmSize&)rAttr).eFrmHeightType && eFrmWidthType == ((SwFmtFrmSize&)rAttr).eFrmWidthType && aSize == ((SwFmtFrmSize&)rAttr).GetSize()&& @@ -529,7 +529,7 @@ SwFmtHeader::SwFmtHeader( sal_Bool bOn ) int SwFmtHeader::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( pRegisteredIn == ((SwFmtHeader&)rAttr).GetRegisteredIn() && bActive == ((SwFmtHeader&)rAttr).IsActive() ); } @@ -571,7 +571,7 @@ SwFmtFooter::SwFmtFooter( sal_Bool bOn ) int SwFmtFooter::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( pRegisteredIn == ((SwFmtFooter&)rAttr).GetRegisteredIn() && bActive == ((SwFmtFooter&)rAttr).IsActive() ); } @@ -610,7 +610,7 @@ void SwFmtCntnt::SetNewCntntIdx( const SwNodeIndex *pIdx ) int SwFmtCntnt::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); if( (long)pStartNode ^ (long)((SwFmtCntnt&)rAttr).pStartNode ) return 0; if( pStartNode ) @@ -648,7 +648,7 @@ SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc ) int SwFmtPageDesc::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( pDefinedIn == ((SwFmtPageDesc&)rAttr).pDefinedIn ) && ( nNumOffset == ((SwFmtPageDesc&)rAttr).nNumOffset ) && ( GetPageDesc() == ((SwFmtPageDesc&)rAttr).GetPageDesc() ); @@ -672,19 +672,19 @@ void SwFmtPageDesc::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) //mich also bei meinem Format aus. //Dabei werden ich Deletet!!! if( IS_TYPE( SwFmt, pDefinedIn )) -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { sal_Bool bDel = ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC ); - ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." ); + OSL_ENSURE( bDel, ";-) FmtPageDesc nicht zerstoert." ); } #else ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC ); #endif else if( IS_TYPE( SwCntntNode, pDefinedIn )) -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { sal_Bool bDel = ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC ); - ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." ); + OSL_ENSURE( bDel, ";-) FmtPageDesc nicht zerstoert." ); } #else ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC ); @@ -721,7 +721,7 @@ bool SwFmtPageDesc::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -750,7 +750,7 @@ bool SwFmtPageDesc::PutValue( const uno::Any& rVal, BYTE nMemberId ) * Der Pointer waere aber ueber den Namen nur vom Dokument zu erfragen. */ default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -828,7 +828,7 @@ SwFmtCol::SwFmtCol() int SwFmtCol::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); const SwFmtCol &rCmp = (const SwFmtCol&)rAttr; if( !(nLineWidth == rCmp.nLineWidth && aLineColor == rCmp.aLineColor && @@ -926,7 +926,7 @@ void SwFmtCol::SetOrtho( sal_Bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct sal_uInt16 SwFmtCol::CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const { - ASSERT( nCol < aColumns.Count(), ":-( ColumnsArr ueberindiziert." ); + OSL_ENSURE( nCol < aColumns.Count(), ":-( ColumnsArr ueberindiziert." ); if ( nWidth != nAct ) { long nW = aColumns[nCol]->GetWishWidth(); @@ -940,7 +940,7 @@ sal_uInt16 SwFmtCol::CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const sal_uInt16 SwFmtCol::CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const { - ASSERT( nCol < aColumns.Count(), ":-( ColumnsArr ueberindiziert." ); + OSL_ENSURE( nCol < aColumns.Count(), ":-( ColumnsArr ueberindiziert." ); sal_uInt16 nRet = CalcColWidth( nCol, nAct ); SwColumn *pCol = aColumns[nCol]; nRet = nRet - pCol->GetLeft(); @@ -1077,7 +1077,7 @@ bool SwFmtCol::PutValue( const uno::Any& rVal, BYTE nMemberId ) case 0: eAdj = COLADJ_TOP; break; //VerticalAlignment_TOP case 1: eAdj = COLADJ_CENTER;break; //VerticalAlignment_MIDDLE case 2: eAdj = COLADJ_BOTTOM;break; //VerticalAlignment_BOTTOM - default: ASSERT( !this, "unknown alignment" ); break; + default: OSL_ENSURE( !this, "unknown alignment" ); break; } } } @@ -1105,7 +1105,7 @@ SwFmtSurround::SwFmtSurround( const SwFmtSurround &rCpy ) : int SwFmtSurround::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( GetValue() == ((SwFmtSurround&)rAttr).GetValue() && bAnchorOnly== ((SwFmtSurround&)rAttr).bAnchorOnly && bContour== ((SwFmtSurround&)rAttr).bContour && @@ -1152,7 +1152,7 @@ bool SwFmtSurround::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1187,7 +1187,7 @@ bool SwFmtSurround::PutValue( const uno::Any& rVal, BYTE nMemberId ) SetOutside( *(sal_Bool*)rVal.getValue() ); break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1206,7 +1206,7 @@ SwFmtVertOrient::SwFmtVertOrient( SwTwips nY, sal_Int16 eVert, int SwFmtVertOrient::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( nYPos == ((SwFmtVertOrient&)rAttr).nYPos && eOrient == ((SwFmtVertOrient&)rAttr).eOrient && eRelation == ((SwFmtVertOrient&)rAttr).eRelation ); @@ -1250,7 +1250,7 @@ bool SwFmtVertOrient::QueryValue( uno::Any& rVal, BYTE nMemberId ) const rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos()); break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1297,7 +1297,7 @@ bool SwFmtVertOrient::PutValue( const uno::Any& rVal, BYTE nMemberId ) } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1319,7 +1319,7 @@ SwFmtHoriOrient::SwFmtHoriOrient( SwTwips nX, sal_Int16 eHori, int SwFmtHoriOrient::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( nXPos == ((SwFmtHoriOrient&)rAttr).nXPos && eOrient == ((SwFmtHoriOrient&)rAttr).eOrient && eRelation == ((SwFmtHoriOrient&)rAttr).eRelation && @@ -1372,7 +1372,7 @@ bool SwFmtHoriOrient::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1423,7 +1423,7 @@ bool SwFmtHoriOrient::PutValue( const uno::Any& rVal, BYTE nMemberId ) SetPosToggle( *(sal_Bool*)rVal.getValue()); break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1487,7 +1487,7 @@ SwFmtAnchor& SwFmtAnchor::operator=(const SwFmtAnchor& rAnchor) int SwFmtAnchor::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); // OD 2004-05-05 #i28701# - Note: <mnOrder> hasn't to be considered. return ( nAnchorId == ((SwFmtAnchor&)rAttr).GetAnchorId() && nPageNum == ((SwFmtAnchor&)rAttr).GetPageNum() && @@ -1561,7 +1561,7 @@ bool SwFmtAnchor::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1631,7 +1631,7 @@ bool SwFmtAnchor::PutValue( const uno::Any& rVal, BYTE nMemberId ) case MID_ANCHOR_ANCHORFRAME: //no break here!; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1665,7 +1665,7 @@ SwFmtURL::~SwFmtURL() int SwFmtURL::operator==( const SfxPoolItem &rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); const SwFmtURL &rCmp = (SwFmtURL&)rAttr; sal_Bool bRet = bIsServerMap == rCmp.IsServerMap() && sURL == rCmp.GetURL() && @@ -1745,7 +1745,7 @@ bool SwFmtURL::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1798,7 +1798,7 @@ bool SwFmtURL::PutValue( const uno::Any& rVal, BYTE nMemberId ) bIsServerMap = *(sal_Bool*)rVal.getValue(); break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -1991,7 +1991,7 @@ SfxPoolItem* SwFmtEndAtTxtEnd::Clone( SfxItemPool* ) const int SwFmtChain::operator==( const SfxPoolItem &rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return GetPrev() == ((SwFmtChain&)rAttr).GetPrev() && GetNext() == ((SwFmtChain&)rAttr).GetNext(); @@ -2045,7 +2045,7 @@ bool SwFmtChain::QueryValue( uno::Any& rVal, BYTE nMemberId ) const aRet = GetNext()->GetName(); break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } rVal <<= OUString(aRet); @@ -2070,7 +2070,7 @@ SwFmtLineNumber::~SwFmtLineNumber() int SwFmtLineNumber::operator==( const SfxPoolItem &rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return nStartValue == ((SwFmtLineNumber&)rAttr).GetStartValue() && bCountLines == ((SwFmtLineNumber&)rAttr).IsCount(); @@ -2098,7 +2098,7 @@ bool SwFmtLineNumber::QueryValue( uno::Any& rVal, BYTE nMemberId ) const rVal <<= (sal_Int32)GetStartValue(); break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -2124,7 +2124,7 @@ bool SwFmtLineNumber::PutValue( const uno::Any& rVal, BYTE nMemberId ) } break; default: - ASSERT( !this, "unknown MemberId" ); + OSL_ENSURE( !this, "unknown MemberId" ); bRet = false; } return bRet; @@ -2148,7 +2148,7 @@ SwTextGridItem::~SwTextGridItem() int SwTextGridItem::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return eGridType == ((SwTextGridItem&)rAttr).GetGridType() && nLines == ((SwTextGridItem&)rAttr).GetLines() && nBaseHeight == ((SwTextGridItem&)rAttr).GetBaseHeight() && @@ -2492,7 +2492,7 @@ void SwFrmFmt::DelFrms() void SwFrmFmt::MakeFrms() { - ASSERT( !this, "Sorry not implemented." ); + OSL_ENSURE( !this, "Sorry not implemented." ); } @@ -2623,7 +2623,7 @@ sal_Bool SwFrmFmt::IsLowerOf( const SwFrmFmt& rFmt ) const } if( n >= rFmts.Count() ) { - ASSERT( !this, "Fly-Section aber kein Format gefunden" ); + OSL_ENSURE( !this, "Fly-Section aber kein Format gefunden" ); return sal_False; } } @@ -2859,7 +2859,7 @@ void SwFlyFrmFmt::MakeFrms() pFly = new SwFlyInCntFrm( this, pFrm ); break; default: - ASSERT( !this, "Neuer Ankertyp" ) + OSL_ENSURE( !this, "Neuer Ankertyp" ); break; } pFrm->AppendFly( pFly ); @@ -2912,7 +2912,7 @@ sal_Bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const void SwFlyFrmFmt::SetObjTitle( const String& rTitle, bool bBroadcast ) { SdrObject* pMasterObject = FindSdrObject(); - ASSERT( pMasterObject, + OSL_ENSURE( pMasterObject, "<SwNoTxtNode::SetObjTitle(..)> - missing <SdrObject> instance" ); if ( !pMasterObject ) { @@ -2935,7 +2935,7 @@ void SwFlyFrmFmt::SetObjTitle( const String& rTitle, bool bBroadcast ) const String SwFlyFrmFmt::GetObjTitle() const { const SdrObject* pMasterObject = FindSdrObject(); - ASSERT( pMasterObject, + OSL_ENSURE( pMasterObject, "<SwFlyFrmFmt::GetObjTitle(..)> - missing <SdrObject> instance" ); if ( !pMasterObject ) { @@ -2948,7 +2948,7 @@ const String SwFlyFrmFmt::GetObjTitle() const void SwFlyFrmFmt::SetObjDescription( const String& rDescription, bool bBroadcast ) { SdrObject* pMasterObject = FindSdrObject(); - ASSERT( pMasterObject, + OSL_ENSURE( pMasterObject, "<SwFlyFrmFmt::SetDescription(..)> - missing <SdrObject> instance" ); if ( !pMasterObject ) { @@ -2971,7 +2971,7 @@ void SwFlyFrmFmt::SetObjDescription( const String& rDescription, bool bBroadcast const String SwFlyFrmFmt::GetObjDescription() const { const SdrObject* pMasterObject = FindSdrObject(); - ASSERT( pMasterObject, + OSL_ENSURE( pMasterObject, "<SwNoTxtNode::GetDescription(..)> - missing <SdrObject> instance" ); if ( !pMasterObject ) { @@ -3166,7 +3166,7 @@ void SwDrawFrmFmt::SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ) break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwDrawFrmFmt::SetPositionLayoutDir(..)> - invalid attribute value." ); } } diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 3c1b37c283..cd8b10c083 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -122,7 +122,7 @@ BOOL SwCntntFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL & ) SwSectionFrm *pSect = pNewUpper->FindSctFrm(); while( pSect && pSect->IsInFtn() ) pSect = pSect->GetUpper()->FindSctFrm(); - ASSERT( pSect, "Escaping footnote" ); + OSL_ENSURE( pSect, "Escaping footnote" ); if( pSect != pMySect ) return FALSE; } @@ -293,7 +293,7 @@ void SwFrm::PrepareMake() { if ( lcl_IsCalcUpperAllowed( *this ) ) GetUpper()->Calc(); - ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." ); + OSL_ENSURE( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." ); if ( !GetUpper() ) return; @@ -338,7 +338,7 @@ void SwFrm::PrepareMake() SwFrm *pFrm = GetUpper()->Lower(); while ( pFrm != this ) { - ASSERT( pFrm, ":-( Layoutgeruest wackelig (this not found)." ); + OSL_ENSURE( pFrm, ":-( Layoutgeruest wackelig (this not found)." ); if ( !pFrm ) return; //Oioioioi ... @@ -378,14 +378,14 @@ void SwFrm::PrepareMake() pFrm = pCnt; } } - ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech II)." ); + OSL_ENSURE( GetUpper(), "Layoutgeruest wackelig (Upper wech II)." ); if ( !GetUpper() ) return; if ( lcl_IsCalcUpperAllowed( *this ) ) GetUpper()->Calc(); - ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech III)." ); + OSL_ENSURE( GetUpper(), "Layoutgeruest wackelig (Upper wech III)." ); } if ( bTab && !bOldTabLock ) @@ -402,7 +402,7 @@ void SwFrm::OptPrepareMake() // <-- { GetUpper()->Calc(); - ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." ); + OSL_ENSURE( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." ); if ( !GetUpper() ) return; } @@ -425,7 +425,7 @@ void SwFrm::PrepareCrsr() GetUpper()->PrepareCrsr(); GetUpper()->Calc(); - ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." ); + OSL_ENSURE( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." ); if ( !GetUpper() ) return; @@ -452,7 +452,7 @@ void SwFrm::PrepareCrsr() SwFrm *pFrm = GetUpper()->Lower(); while ( pFrm != this ) { - ASSERT( pFrm, ":-( Layoutgeruest wackelig (this not found)." ); + OSL_ENSURE( pFrm, ":-( Layoutgeruest wackelig (this not found)." ); if ( !pFrm ) return; //Oioioioi ... @@ -482,13 +482,13 @@ void SwFrm::PrepareCrsr() pFrm = pCnt; } } - ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech II)." ); + OSL_ENSURE( GetUpper(), "Layoutgeruest wackelig (Upper wech II)." ); if ( !GetUpper() ) return; GetUpper()->Calc(); - ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech III)." ); + OSL_ENSURE( GetUpper(), "Layoutgeruest wackelig (Upper wech III)." ); if ( bTab && !bOldTabLock ) ::PrepareUnlock( (SwTabFrm*)this ); @@ -795,7 +795,7 @@ void SwPageFrm::MakeAll() else { // OD 30.10.2002 #97265# - assert invalid lower property - ASSERT( !(pFrm->Frm().Height() < pFrm->Prt().Height()), + OSL_ENSURE( !(pFrm->Frm().Height() < pFrm->Prt().Height()), "SwPageFrm::MakeAll(): Lower with frame height < printing height" ); nTmp += pFrm->Frm().Height() - pFrm->Prt().Height(); } @@ -849,12 +849,12 @@ void SwPageFrm::MakeAll() if ( Frm() != aOldRect && GetUpper() ) static_cast<SwRootFrm*>(GetUpper())->CheckViewLayout( 0, 0 ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //Der Upper (Root) muss mindestens so breit //sein, dass er die breiteste Seite aufnehmen kann. if ( GetUpper() ) { - ASSERT( GetUpper()->Prt().Width() >= aFrm.Width(), "Rootsize" ); + OSL_ENSURE( GetUpper()->Prt().Width() >= aFrm.Width(), "Rootsize" ); } #endif } @@ -1153,8 +1153,8 @@ inline void ValidateSz( SwFrm *pFrm ) void SwCntntFrm::MakeAll() { - ASSERT( GetUpper(), "keinen Upper?" ); - ASSERT( IsTxtFrm(), "MakeAll(), NoTxt" ); + OSL_ENSURE( GetUpper(), "keinen Upper?" ); + OSL_ENSURE( IsTxtFrm(), "MakeAll(), NoTxt" ); if ( !IsFollow() && StackHack::IsLocked() ) return; @@ -1162,13 +1162,13 @@ void SwCntntFrm::MakeAll() if ( IsJoinLocked() ) return; - ASSERT( !((SwTxtFrm*)this)->IsSwapped(), "Calculation of a swapped frame" ); + OSL_ENSURE( !((SwTxtFrm*)this)->IsSwapped(), "Calculation of a swapped frame" ); StackHack aHack; if ( ((SwTxtFrm*)this)->IsLocked() ) { - ASSERT( FALSE, "Format fuer gelockten TxtFrm." ); + OSL_ENSURE( FALSE, "Format fuer gelockten TxtFrm." ); return; } @@ -1179,14 +1179,14 @@ void SwCntntFrm::MakeAll() // <-- PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 ) -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const SwDoc *pDoc = GetAttrSet()->GetDoc(); if( pDoc ) { static sal_Bool bWarn = sal_False; if( pDoc->InXMLExport() ) { - ASSERT( bWarn, "Formatting during XML-export!" ); + OSL_ENSURE( bWarn, "Formatting during XML-export!" ); bWarn = sal_True; } else @@ -1346,7 +1346,7 @@ void SwCntntFrm::MakeAll() //nach dem hin und her fliessen sparen. GetUpper()->ResetCompletePaint(); //Der Vorgaenger wurde Invalidiert, das ist jetzt auch obsolete. - ASSERT( pPre, "missing old Prev" ); + OSL_ENSURE( pPre, "missing old Prev" ); if( !pPre->IsSctFrm() ) ::ValidateSz( pPre ); } @@ -1466,7 +1466,7 @@ void SwCntntFrm::MakeAll() #if OSL_DEBUG_LEVEL > 1 else { - ASSERT( false, "debug assertion: <SwCntntFrm::MakeAll()> - format of text frame suppressed by fix b6448963" ); + OSL_ENSURE( false, "debug assertion: <SwCntntFrm::MakeAll()> - format of text frame suppressed by fix b6448963" ); } #endif // <-- @@ -1714,10 +1714,10 @@ void SwCntntFrm::MakeAll() ( !bSct || !FindSctFrm()->IsColLocked() ) ) bMoveOrFit = TRUE; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { - ASSERT( FALSE, "+TxtFrm hat WouldFit-Versprechen nicht eingehalten." ); + OSL_ENSURE( FALSE, "+TxtFrm hat WouldFit-Versprechen nicht eingehalten." ); } #endif } @@ -1770,7 +1770,7 @@ void SwCntntFrm::MakeAll() } #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl in SwCntntFrm::MakeAll" ) + OSL_ENSURE( false, "LoopControl in SwCntntFrm::MakeAll" ); #endif } if ( bMovedBwd && GetUpper() ) @@ -1882,7 +1882,7 @@ void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ) BOOL lcl_IsNextFtnBoss( const SwFrm *pFrm, const SwFrm* pNxt ) { - ASSERT( pFrm && pNxt, "lcl_IsNextFtnBoss: No Frames?" ); + OSL_ENSURE( pFrm && pNxt, "lcl_IsNextFtnBoss: No Frames?" ); pFrm = pFrm->FindFtnBossFrm(); pNxt = pNxt->FindFtnBossFrm(); // Falls pFrm eine letzte Spalte ist, wird stattdessen die Seite genommen @@ -2077,7 +2077,7 @@ BOOL SwCntntFrm::_WouldFit( SwTwips nSpace, // doesn't makes sense. Thus, return TRUE. if ( IsAnFollow( pFrm ) && !pFrm->IsValid() ) { - ASSERT( false, "Only a warning for task 108824:/n<SwCntntFrm::_WouldFit(..) - follow not valid!" ); + OSL_ENSURE( false, "Only a warning for task 108824:/n<SwCntntFrm::_WouldFit(..) - follow not valid!" ); return TRUE; } } diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index 23dfd29530..9ae58a45aa 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -92,14 +92,14 @@ SwColumnFrm::~SwColumnFrm() void MA_FASTCALL lcl_RemoveColumns( SwLayoutFrm *pCont, USHORT nCnt ) { - ASSERT( pCont && pCont->Lower() && pCont->Lower()->IsColumnFrm(), + OSL_ENSURE( pCont && pCont->Lower() && pCont->Lower()->IsColumnFrm(), "Keine Spalten zu entfernen." ); SwColumnFrm *pColumn = (SwColumnFrm*)pCont->Lower(); ::lcl_RemoveFtns( pColumn, TRUE, TRUE ); while ( pColumn->GetNext() ) { - ASSERT( pColumn->GetNext()->IsColumnFrm(), + OSL_ENSURE( pColumn->GetNext()->IsColumnFrm(), "Nachbar von ColFrm kein ColFrm." ); pColumn = (SwColumnFrm*)pColumn->GetNext(); } @@ -245,7 +245,7 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, if( nOldNum != nNewNum || bChgFtn ) { SwDoc *pDoc = GetFmt()->GetDoc(); - ASSERT( pDoc, "FrmFmt gibt kein Dokument her." ); + OSL_ENSURE( pDoc, "FrmFmt gibt kein Dokument her." ); // SaveCntnt wuerde auch den Inhalt der Fussnotencontainer aufsaugen // und im normalen Textfluss unterbringen. if( IsPageBodyFrm() ) @@ -311,7 +311,7 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, //unnuetzte Aktionen beim Einstellen zur Folge haben. if ( pSave ) { - ASSERT( Lower() && Lower()->IsLayoutFrm() && + OSL_ENSURE( Lower() && Lower()->IsLayoutFrm() && ((SwLayoutFrm*)Lower())->Lower() && ((SwLayoutFrm*)Lower())->Lower()->IsLayoutFrm(), "Gesucht: Spaltenbody (Tod oder Lebend)." ); // ColumnFrms jetzt mit BodyFrm diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 1bce2be06d..eeff8a954e 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -104,8 +104,8 @@ * * --------------------------------------------------*/ -#ifndef DBG_UTIL -#error Wer fummelt denn an den makefiles rum? +#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 +#error Who broken the makefiles? #endif @@ -137,7 +137,7 @@ SwImplProtocol* SwProtocol::pImpl = NULL; ULONG lcl_GetFrameId( const SwFrm* pFrm ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static BOOL bFrameId = FALSE; if( bFrameId ) return pFrm->GetFrmId(); diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 6ff95bd058..34a715952c 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -270,8 +270,8 @@ BOOL SwLayoutFrm::IsAnLower( const SwFrm *pAssumed ) const */ bool SwLayoutFrm::IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const { - ASSERT( !IsRootFrm() , "<IsBefore> called at a <SwRootFrm>."); - ASSERT( !_pCheckRefLayFrm->IsRootFrm() , "<IsBefore> called with a <SwRootFrm>."); + OSL_ENSURE( !IsRootFrm() , "<IsBefore> called at a <SwRootFrm>."); + OSL_ENSURE( !_pCheckRefLayFrm->IsRootFrm() , "<IsBefore> called with a <SwRootFrm>."); bool bReturn; @@ -477,8 +477,8 @@ SwRootFrm* SwFrm::FindRootFrm() // Casting the GetDep() result instead of the frame itself (that has // been done before) makes it save to use that method in constructors // and destructors. - ASSERT( GetDep(), "frame is not registered any longer" ); - ASSERT( IsLayoutFrm() || IsCntntFrm(), "invalid frame type" ); + OSL_ENSURE( GetDep(), "frame is not registered any longer" ); + OSL_ENSURE( IsLayoutFrm() || IsCntntFrm(), "invalid frame type" ); SwDoc *pDoc = IsLayoutFrm() ? static_cast < SwFrmFmt * >( GetDep() )->GetDoc() : static_cast < SwCntntNode * >( GetDep() )->GetDoc(); @@ -532,7 +532,7 @@ SwFtnBossFrm* SwFrm::FindFtnBossFrm( BOOL bFootnotes ) !pRet->GetNext() && !pRet->GetPrev() ) { SwSectionFrm* pSct = pRet->FindSctFrm(); - ASSERT( pSct, "FindFtnBossFrm: Single column outside section?" ); + OSL_ENSURE( pSct, "FindFtnBossFrm: Single column outside section?" ); if( !pSct->IsFtnAtEnd() ) return pSct->FindFtnBossFrm( TRUE ); } @@ -653,7 +653,7 @@ const SwPageFrm* SwRootFrm::GetPageAtPos( const Point& rPt, const Size* pSize, b pPage = pPage->GetNext(); } - ASSERT( GetPageNum() <= maPageRects.size(), "number of pages differes from page rect array size" ) + OSL_ENSURE( GetPageNum() <= maPageRects.size(), "number of pages differes from page rect array size" ); USHORT nPageIdx = 0; while ( pPage && !pRet ) @@ -793,7 +793,7 @@ SwFrm *SwFrm::_FindNext() SwLayoutFrm *pUp = pThis->GetUpper(); while ( !pUp->IsCellFrm() ) pUp = pUp->GetUpper(); - ASSERT( pUp, "Cntnt in Tabelle aber nicht in Zelle." ); + OSL_ENSURE( pUp, "Cntnt in Tabelle aber nicht in Zelle." ); SwFrm* pNxt = ((SwCellFrm*)pUp)->GetFollowCell(); if ( pNxt ) pNxt = ((SwCellFrm*)pNxt)->ContainsCntnt(); @@ -932,7 +932,7 @@ SwCntntFrm *SwFrm::_FindNextCnt( const bool _bInSameFtn ) // Assure that found next content frame belongs to the same footnotes const SwFtnFrm* pFtnFrmOfNext( pNxtCnt->FindFtnFrm() ); const SwFtnFrm* pFtnFrmOfCurr( pThis->FindFtnFrm() ); - ASSERT( pFtnFrmOfCurr, + OSL_ENSURE( pFtnFrmOfCurr, "<SwFrm::_FindNextCnt() - unknown layout situation: current frame has to have an upper footnote frame." ); if ( pFtnFrmOfNext == pFtnFrmOfCurr ) { @@ -1113,9 +1113,9 @@ SwCntntFrm* SwFrm::_FindPrevCnt( const bool _bInSameFtn ) // neither <pCurrCntntFrm> nor <pPrevCntntFrm> are // inside a fly frame. // Thus, method <FindFooterOrHeader()> can be used. - ASSERT( pCurrCntntFrm->FindFooterOrHeader(), + OSL_ENSURE( pCurrCntntFrm->FindFooterOrHeader(), "<SwFrm::_FindPrevCnt()> - unknown layout situation: current frame should be in page header or page footer" ); - ASSERT( !pPrevCntntFrm->IsInFly(), + OSL_ENSURE( !pPrevCntntFrm->IsInFly(), "<SwFrm::_FindPrevCnt()> - unknown layout situation: found previous frame should *not* be inside a fly frame." ); if ( pPrevCntntFrm->FindFooterOrHeader() != pCurrCntntFrm->FindFooterOrHeader() ) @@ -1157,7 +1157,7 @@ SwFrm *SwFrm::_FindPrev() SwLayoutFrm *pUp = pThis->GetUpper(); while ( !pUp->IsCellFrm() ) pUp = pUp->GetUpper(); - ASSERT( pUp, "Cntnt in Tabelle aber nicht in Zelle." ); + OSL_ENSURE( pUp, "Cntnt in Tabelle aber nicht in Zelle." ); if ( pUp->IsAnLower( pPrvCnt ) ) return pPrvCnt; } @@ -1464,7 +1464,7 @@ void SwFrm::SetDirFlags( BOOL bVert ) const SwFrm* pAsk = IsFlyFrm() ? ((SwFlyFrm*)this)->GetAnchorFrm() : GetUpper(); - ASSERT( pAsk != this, "Autsch! Stack overflow is about to happen" ) + OSL_ENSURE( pAsk != this, "Autsch! Stack overflow is about to happen" ); if( pAsk ) { @@ -1487,7 +1487,7 @@ void SwFrm::SetDirFlags( BOOL bVert ) const SwFrm* pAsk = IsFlyFrm() ? ((SwFlyFrm*)this)->GetAnchorFrm() : GetUpper(); - ASSERT( pAsk != this, "Autsch! Stack overflow is about to happen" ) + OSL_ENSURE( pAsk != this, "Autsch! Stack overflow is about to happen" ); if( pAsk ) bRightToLeft = pAsk->IsRightToLeft() ? 1 : 0; @@ -1504,7 +1504,7 @@ SwLayoutFrm* SwFrm::GetNextCellLeaf( MakePageType ) while ( !pTmpFrm->IsCellFrm() ) pTmpFrm = pTmpFrm->GetUpper(); - ASSERT( pTmpFrm, "SwFrm::GetNextCellLeaf() without cell" ) + OSL_ENSURE( pTmpFrm, "SwFrm::GetNextCellLeaf() without cell" ); return ((SwCellFrm*)pTmpFrm)->GetFollowCell(); } @@ -1514,7 +1514,7 @@ SwLayoutFrm* SwFrm::GetPrevCellLeaf( MakePageType ) while ( !pTmpFrm->IsCellFrm() ) pTmpFrm = pTmpFrm->GetUpper(); - ASSERT( pTmpFrm, "SwFrm::GetNextPreviousLeaf() without cell" ) + OSL_ENSURE( pTmpFrm, "SwFrm::GetNextPreviousLeaf() without cell" ); return ((SwCellFrm*)pTmpFrm)->GetPreviousCell(); } @@ -1533,13 +1533,13 @@ SwCellFrm* lcl_FindCorrespondingCellFrm( const SwRowFrm& rOrigRow, pCorrCell = (SwCellFrm*)pCorrCell->GetNext(); } - ASSERT( pCell && pCorrCell, "lcl_FindCorrespondingCellFrm does not work" ) + OSL_ENSURE( pCell && pCorrCell, "lcl_FindCorrespondingCellFrm does not work" ); if ( pCell != &rOrigCell ) { // rOrigCell must be a lower of pCell. We need to recurse into the rows: - ASSERT( pCell->Lower() && pCell->Lower()->IsRowFrm(), - "lcl_FindCorrespondingCellFrm does not work" ) + OSL_ENSURE( pCell->Lower() && pCell->Lower()->IsRowFrm(), + "lcl_FindCorrespondingCellFrm does not work" ); SwRowFrm* pRow = (SwRowFrm*)pCell->Lower(); while ( !pRow->IsAnLower( &rOrigCell ) ) @@ -1629,7 +1629,7 @@ SwCellFrm* SwCellFrm::GetPreviousCell() const while( !pRow->IsRowFrm() || !pRow->GetUpper()->IsTabFrm() ) pRow = pRow->GetUpper(); - ASSERT( pRow->GetUpper() && pRow->GetUpper()->IsTabFrm(), "GetPreviousCell without Table" ); + OSL_ENSURE( pRow->GetUpper() && pRow->GetUpper()->IsTabFrm(), "GetPreviousCell without Table" ); SwTabFrm* pTab = (SwTabFrm*)pRow->GetUpper(); @@ -1665,10 +1665,10 @@ const SwCellFrm& SwCellFrm::FindStartEndOfRowSpanCell( bool bStart, bool bCurren if ( !bStart && pTableFrm->IsFollow() && pTableFrm->IsInHeadline( *this ) ) return *this; - ASSERT( pTableFrm && + OSL_ENSURE( pTableFrm && ( bStart && GetTabBox()->getRowSpan() < 1 || !bStart && GetLayoutRowSpan() > 1 ), - "SwCellFrm::FindStartRowSpanCell: No rowspan, no table, no cookies" ) + "SwCellFrm::FindStartRowSpanCell: No rowspan, no table, no cookies" ); if ( pTableFrm ) { @@ -1713,7 +1713,7 @@ const SwCellFrm& SwCellFrm::FindStartEndOfRowSpanCell( bool bStart, bool bCurren for ( SwClient* pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() ) { - ASSERT( ((SwFrm*)pLast)->IsCellFrm(), "Non-row frame registered in table line" ) + OSL_ENSURE( ((SwFrm*)pLast)->IsCellFrm(), "Non-row frame registered in table line" ); const SwCellFrm* pMasterCell = static_cast<const SwCellFrm*>(pLast); if ( pMasterCell->GetTabBox() == &rMasterBox ) @@ -1742,7 +1742,7 @@ const SwCellFrm& SwCellFrm::FindStartEndOfRowSpanCell( bool bStart, bool bCurren } } - ASSERT( pRet, "SwCellFrm::FindStartRowSpanCell: No result" ) + OSL_ENSURE( pRet, "SwCellFrm::FindStartRowSpanCell: No result" ); return *pRet; } @@ -1750,7 +1750,7 @@ const SwCellFrm& SwCellFrm::FindStartEndOfRowSpanCell( bool bStart, bool bCurren const SwRowFrm* SwFrm::IsInSplitTableRow() const { - ASSERT( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" ) + OSL_ENSURE( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" ); const SwFrm* pRow = this; @@ -1760,7 +1760,7 @@ const SwRowFrm* SwFrm::IsInSplitTableRow() const if ( !pRow ) return NULL; - ASSERT( pRow->GetUpper()->IsTabFrm(), "Confusion in table layout" ) + OSL_ENSURE( pRow->GetUpper()->IsTabFrm(), "Confusion in table layout" ); const SwTabFrm* pTab = (SwTabFrm*)pRow->GetUpper(); // --> OD 2006-06-28 #b6443897# @@ -1777,14 +1777,14 @@ const SwRowFrm* SwFrm::IsInSplitTableRow() const // skip headline const SwRowFrm* pFollowRow = pTab->GetFollow()->GetFirstNonHeadlineRow(); - ASSERT( pFollowRow, "SwFrm::IsInSplitTableRow() does not work" ) + OSL_ENSURE( pFollowRow, "SwFrm::IsInSplitTableRow() does not work" ); return pFollowRow; } const SwRowFrm* SwFrm::IsInFollowFlowRow() const { - ASSERT( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" ) + OSL_ENSURE( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" ); // find most upper row frame const SwFrm* pRow = this; @@ -1793,7 +1793,7 @@ const SwRowFrm* SwFrm::IsInFollowFlowRow() const if ( !pRow ) return NULL; - ASSERT( pRow->GetUpper()->IsTabFrm(), "Confusion in table layout" ) + OSL_ENSURE( pRow->GetUpper()->IsTabFrm(), "Confusion in table layout" ); const SwTabFrm* pTab = (SwTabFrm*)pRow->GetUpper(); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 49327bde46..aefff7ebe3 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -209,8 +209,8 @@ BOOL SwFlowFrm::IsKeep( const SwAttrSet& rAttrs, bool bCheckIfLastRowShouldKeep ( !rThis.IsInTab() || rThis.IsTabFrm() ) && rAttrs.GetKeep().GetValue() ); - ASSERT( !bCheckIfLastRowShouldKeep || rThis.IsTabFrm(), - "IsKeep with bCheckIfLastRowShouldKeep should only be used for tabfrms" ) + OSL_ENSURE( !bCheckIfLastRowShouldKeep || rThis.IsTabFrm(), + "IsKeep with bCheckIfLastRowShouldKeep should only be used for tabfrms" ); // Ignore keep attribute if there are break situations: if ( bKeep ) @@ -267,7 +267,7 @@ BOOL SwFlowFrm::IsKeep( const SwAttrSet& rAttrs, bool bCheckIfLastRowShouldKeep if ( ! pSet ) pSet = pNxt->GetAttrSet(); - ASSERT( pSet, "No AttrSet to check keep attribute" ) + OSL_ENSURE( pSet, "No AttrSet to check keep attribute" ); if ( pSet->GetPageDesc().GetPageDesc() ) bKeep = FALSE; @@ -383,7 +383,7 @@ BYTE SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRect ) GetFmt())->GetSectionNode(); else { - ASSERT( rThis.IsTabFrm(), "new FowFrm?" ); + OSL_ENSURE( rThis.IsTabFrm(), "new FowFrm?" ); pNode = ((SwTabFrm&)rThis).GetTable()-> GetTabSortBoxes()[0]->GetSttNd()->FindTableNode(); } @@ -467,7 +467,7 @@ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart ) //Kann sein, dass der CntFrm gelockt ist, wir wollen hier nicht //in eine endlose Seitenwanderung hineinlaufen und rufen das //Calc garnicht erst! - ASSERT( pCnt->IsTxtFrm(), "Die Graphic ist gelandet." ); + OSL_ENSURE( pCnt->IsTxtFrm(), "Die Graphic ist gelandet." ); if ( ((SwTxtFrm*)pCnt)->IsLocked() || ((SwTxtFrm*)pCnt)->GetFollow() == pStart ) break; @@ -601,8 +601,8 @@ BOOL SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, void SwFlowFrm::MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling ) { - ASSERT( pParent, "Kein Parent uebergeben." ); - ASSERT( rThis.GetUpper(), "Wo kommen wir denn her?" ); + OSL_ENSURE( pParent, "Kein Parent uebergeben." ); + OSL_ENSURE( rThis.GetUpper(), "Wo kommen wir denn her?" ); //Sparsamer benachrichtigen wenn eine Action laeuft. ViewShell *pSh = rThis.GetShell(); @@ -716,7 +716,7 @@ BOOL SwFlowFrm::IsAnFollow( const SwFlowFrm *pAssumed ) const SwTxtFrm* SwCntntFrm::FindMaster() const { - ASSERT( IsFollow(), "SwCntntFrm::FindMaster(): !IsFollow" ); + OSL_ENSURE( IsFollow(), "SwCntntFrm::FindMaster(): !IsFollow" ); const SwCntntFrm* pCnt = GetPrevCntntFrm(); @@ -724,19 +724,19 @@ SwTxtFrm* SwCntntFrm::FindMaster() const { if ( pCnt->HasFollow() && pCnt->GetFollow() == this ) { - ASSERT( pCnt->IsTxtFrm(), "NoTxtFrm with follow found" ) + OSL_ENSURE( pCnt->IsTxtFrm(), "NoTxtFrm with follow found" ); return (SwTxtFrm*)pCnt; } pCnt = pCnt->GetPrevCntntFrm(); } - ASSERT( FALSE, "Follow ist lost in Space." ); + OSL_ENSURE( FALSE, "Follow ist lost in Space." ); return 0; } SwSectionFrm* SwSectionFrm::FindMaster() const { - ASSERT( IsFollow(), "SwSectionFrm::FindMaster(): !IsFollow" ); + OSL_ENSURE( IsFollow(), "SwSectionFrm::FindMaster(): !IsFollow" ); SwClientIter aIter( *pSection->GetFmt() ); SwClient *pLast = aIter.GoStart(); @@ -745,8 +745,8 @@ SwSectionFrm* SwSectionFrm::FindMaster() const { if ( pLast->ISA( SwFrm ) ) { - ASSERT( ((SwFrm*)pLast)->IsSctFrm(), - "Non-section frame registered in section format" ) + OSL_ENSURE( ((SwFrm*)pLast)->IsSctFrm(), + "Non-section frame registered in section format" ); SwSectionFrm* pSect = (SwSectionFrm*)pLast; if( pSect->GetFollow() == this ) return pSect; @@ -754,13 +754,13 @@ SwSectionFrm* SwSectionFrm::FindMaster() const pLast = aIter++; } - ASSERT( FALSE, "Follow ist lost in Space." ); + OSL_ENSURE( FALSE, "Follow ist lost in Space." ); return 0; } SwTabFrm* SwTabFrm::FindMaster( bool bFirstMaster ) const { - ASSERT( IsFollow(), "SwTabFrm::FindMaster(): !IsFollow" ); + OSL_ENSURE( IsFollow(), "SwTabFrm::FindMaster(): !IsFollow" ); SwClientIter aIter( *GetTable()->GetFrmFmt() ); SwClient* pLast = aIter.GoStart(); @@ -769,8 +769,8 @@ SwTabFrm* SwTabFrm::FindMaster( bool bFirstMaster ) const { if ( pLast->ISA( SwFrm ) ) { - ASSERT( ((SwFrm*)pLast)->IsTabFrm(), - "Non-table frame registered in table format" ) + OSL_ENSURE( ((SwFrm*)pLast)->IsTabFrm(), + "Non-table frame registered in table format" ); SwTabFrm* pTab = (SwTabFrm*)pLast; if ( bFirstMaster ) @@ -800,7 +800,7 @@ SwTabFrm* SwTabFrm::FindMaster( bool bFirstMaster ) const pLast = aIter++; } - ASSERT( FALSE, "Follow ist lost in Space." ); + OSL_ENSURE( FALSE, "Follow ist lost in Space." ); return 0; } @@ -983,8 +983,8 @@ BOOL SwFrm::WrongPageDesc( SwPageFrm* pNew ) SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage ) { - ASSERT( !IsInFtn(), "GetNextLeaf(), don't call me for Ftn." ); - ASSERT( !IsInSct(), "GetNextLeaf(), don't call me for Sections." ); + OSL_ENSURE( !IsInFtn(), "GetNextLeaf(), don't call me for Ftn." ); + OSL_ENSURE( !IsInSct(), "GetNextLeaf(), don't call me for Sections." ); const BOOL bBody = IsInDocBody(); //Wenn ich aus dem DocBody komme //Will ich auch im Body landen. @@ -1127,7 +1127,7 @@ SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage ) SwLayoutFrm *SwFrm::GetPrevLeaf( MakePageType ) { - ASSERT( !IsInFtn(), "GetPrevLeaf(), don't call me for Ftn." ); + OSL_ENSURE( !IsInFtn(), "GetPrevLeaf(), don't call me for Ftn." ); const BOOL bBody = IsInDocBody(); //Wenn ich aus dem DocBody komme //will ich auch im Body landen. @@ -1181,7 +1181,7 @@ BOOL SwFlowFrm::IsPrevObjMove() const if ( pPre && pPre->GetDrawObjs() ) { - ASSERT( SwFlowFrm::CastFlowFrm( pPre ), "new flowfrm?" ); + OSL_ENSURE( SwFlowFrm::CastFlowFrm( pPre ), "new flowfrm?" ); if( SwFlowFrm::CastFlowFrm( pPre )->IsAnFollow( this ) ) return FALSE; SwLayoutFrm* pPreUp = pPre->GetUpper(); @@ -1266,7 +1266,7 @@ BOOL SwFlowFrm::IsPageBreak( BOOL bAct ) const if ( pPrev ) { - ASSERT( pPrev->IsInDocBody(), "IsPageBreak: Not in DocBody?" ); + OSL_ENSURE( pPrev->IsInDocBody(), "IsPageBreak: Not in DocBody?" ); if ( bAct ) { if ( rThis.FindPageFrm() == pPrev->FindPageFrm() ) return FALSE; @@ -1373,7 +1373,7 @@ BOOL SwFlowFrm::HasParaSpaceAtPages( BOOL bSct ) const return FALSE; pTmp = pTmp->GetUpper(); } - ASSERT( FALSE, "HasParaSpaceAtPages: Where's my page?" ); + OSL_ENSURE( FALSE, "HasParaSpaceAtPages: Where's my page?" ); return FALSE; } if( !rThis.IsInDocBody() || ( rThis.IsInTab() && !rThis.IsTabFrm()) || @@ -1684,7 +1684,7 @@ SwTwips SwFlowFrm::_GetUpperSpaceAmountConsideredForPageGrid( nUpperSpaceAmountConsideredForPageGrid = nNewUpperSpace - _nUpperSpaceWithoutGrid; - ASSERT( nUpperSpaceAmountConsideredForPageGrid >= 0, + OSL_ENSURE( nUpperSpaceAmountConsideredForPageGrid >= 0, "<SwFlowFrm::GetUpperSpaceAmountConsideredForPageGrid(..)> - negative space considered for page grid!" ); } } @@ -2057,7 +2057,7 @@ BOOL SwFlowFrm::MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways ) (pOldBoss->Frm().*fnRect->fnGetBottom)() ); SwCntntFrm* pStart = rThis.IsCntntFrm() ? (SwCntntFrm*)&rThis : ((SwLayoutFrm&)rThis).ContainsCntnt(); - ASSERT( pStart || ( rThis.IsTabFrm() && !((SwTabFrm&)rThis).Lower() ), + OSL_ENSURE( pStart || ( rThis.IsTabFrm() && !((SwTabFrm&)rThis).Lower() ), "MoveFwd: Missing Content" ); SwLayoutFrm* pBody = pStart ? ( pStart->IsTxtFrm() ? (SwLayoutFrm*)((SwTxtFrm*)pStart)->FindBodyFrm() : 0 ) : 0; @@ -2209,7 +2209,7 @@ BOOL SwFlowFrm::MoveBwd( BOOL &rbReformat ) pRef = pFtn->GetRef(); // <-- - ASSERT( pRef, "MoveBwd: Endnote for an empty section?" ); + OSL_ENSURE( pRef, "MoveBwd: Endnote for an empty section?" ); if( !bEndnote ) pOldBoss = pOldBoss->FindFtnBossFrm( TRUE ); @@ -2545,7 +2545,7 @@ BOOL SwFlowFrm::MoveBwd( BOOL &rbReformat ) } pIndNext = pIndNext->GetIndNext(); } - ASSERT( !pIndNext || pIndNext->ISA(SwTxtFrm), + OSL_ENSURE( !pIndNext || pIndNext->ISA(SwTxtFrm), "<SwFlowFrm::MovedBwd(..)> - incorrect next found." ); if ( pIndNext && pIndNext->IsFlowFrm() && SwFlowFrm::CastFlowFrm(pIndNext)->IsJoinLocked() ) @@ -2570,7 +2570,7 @@ BOOL SwFlowFrm::MoveBwd( BOOL &rbReformat ) : MAKEPAGE_NONE, TRUE ); // --> OD 2007-01-10 #i73194# - make code robust - ASSERT( pNextNewUpper, "<SwFlowFrm::MoveBwd(..)> - missing next new upper" ); + OSL_ENSURE( pNextNewUpper, "<SwFlowFrm::MoveBwd(..)> - missing next new upper" ); if ( pNextNewUpper && ( pNextNewUpper == rThis.GetUpper() || pNextNewUpper->GetType() != rThis.GetUpper()->GetType() ) ) @@ -2578,14 +2578,14 @@ BOOL SwFlowFrm::MoveBwd( BOOL &rbReformat ) { pNewUpper = 0L; #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, + OSL_ENSURE( false, "<SwFlowFrm::MoveBwd(..)> - layout loop control for layout action <Move Backward> applied!" ); #endif } } // <-- - ASSERT( pNewUpper != rThis.GetUpper(), + OSL_ENSURE( pNewUpper != rThis.GetUpper(), "<SwFlowFrm::MoveBwd(..)> - moving backward to the current upper frame!? -> Please inform OD." ); if ( pNewUpper ) { diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 6edb53a193..7543804483 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -207,7 +207,7 @@ void SwFlyFrm::Chain( SwFrm* _pAnch ) SwFlyFrm* pFollow = FindChainNeighbour( *rChain.GetNext(), _pAnch ); if ( pFollow ) { - ASSERT( !pFollow->GetPrevLink(), "wrong chain detected" ); + OSL_ENSURE( !pFollow->GetPrevLink(), "wrong chain detected" ); if ( !pFollow->GetPrevLink() ) SwFlyFrm::ChainFrames( this, pFollow ); } @@ -217,7 +217,7 @@ void SwFlyFrm::Chain( SwFrm* _pAnch ) SwFlyFrm *pMaster = FindChainNeighbour( *rChain.GetPrev(), _pAnch ); if ( pMaster ) { - ASSERT( !pMaster->GetNextLink(), "wrong chain detected" ); + OSL_ENSURE( !pMaster->GetNextLink(), "wrong chain detected" ); if ( !pMaster->GetNextLink() ) SwFlyFrm::ChainFrames( pMaster, this ); } @@ -231,7 +231,7 @@ void SwFlyFrm::InsertCnt() if ( !GetPrevLink() ) { const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt(); - ASSERT( rCntnt.GetCntntIdx(), ":-( no content prepared." ); + OSL_ENSURE( rCntnt.GetCntntIdx(), ":-( no content prepared." ); ULONG nIndex = rCntnt.GetCntntIdx()->GetIndex(); // Lower() bedeutet SwColumnFrm, eingefuegt werden muss der Inhalt dann in den (Column)BodyFrm ::_InsertCnt( Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower() : (SwLayoutFrm*)this, @@ -253,7 +253,7 @@ void SwFlyFrm::InsertCnt() // Check, if column are allowed. // Columns are not allowed for fly frames, which represent graphics or embedded objects. const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt(); - ASSERT( rCntnt.GetCntntIdx(), "<SwFlyFrm::InsertColumns()> - no content prepared." ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "<SwFlyFrm::InsertColumns()> - no content prepared." ); SwNodeIndex aFirstCntnt( *(rCntnt.GetCntntIdx()), 1 ); if ( aFirstCntnt.GetNode().IsNoTxtNode() ) { @@ -399,7 +399,7 @@ void SwFlyFrm::InitDrawObj( BOOL bNotify ) pIDDMA->GetOrCreateDrawModel() ); // <-- } - ASSERT( pContact, "InitDrawObj failed" ); + OSL_ENSURE( pContact, "InitDrawObj failed" ); // OD 2004-03-22 #i26791# SetDrawObj( *(pContact->CreateNewRef( this )) ); @@ -491,9 +491,9 @@ void SwFlyFrm::FinitDrawObj() void SwFlyFrm::ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) { - ASSERT( pMaster && pFollow, "uncomplete chain" ); - ASSERT( !pMaster->GetNextLink(), "link can not be changed" ); - ASSERT( !pFollow->GetPrevLink(), "link can not be changed" ); + OSL_ENSURE( pMaster && pFollow, "uncomplete chain" ); + OSL_ENSURE( !pMaster->GetNextLink(), "link can not be changed" ); + OSL_ENSURE( !pFollow->GetPrevLink(), "link can not be changed" ); pMaster->pNextLink = pFollow; pFollow->pPrevLink = pMaster; @@ -522,7 +522,7 @@ void SwFlyFrm::ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) //Es gibt nur noch den Inhalt des Masters, der Inhalt vom Follow //hat keine Frames mehr (sollte immer nur genau ein leerer TxtNode sein). SwFrm *pFrm = pFollow->ContainsCntnt(); - ASSERT( !pFrm->IsTabFrm() && !pFrm->FindNext(), "follow in chain contains content" ); + OSL_ENSURE( !pFrm->IsTabFrm() && !pFrm->FindNext(), "follow in chain contains content" ); pFrm->Cut(); delete pFrm; } @@ -547,7 +547,7 @@ void SwFlyFrm::UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) { pUpper = static_cast<SwLayoutFrm*>(pUpper->GetLastLower()); pUpper = static_cast<SwLayoutFrm*>(pUpper->Lower()); // der (Column)BodyFrm - ASSERT( pUpper && pUpper->IsColBodyFrm(), "Missing ColumnBody" ); + OSL_ENSURE( pUpper && pUpper->IsColBodyFrm(), "Missing ColumnBody" ); } SwFlyFrm *pFoll = pFollow; while ( pFoll ) @@ -563,7 +563,7 @@ void SwFlyFrm::UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ) //Der Follow muss mit seinem eigenen Inhalt versorgt werden. const SwFmtCntnt &rCntnt = pFollow->GetFmt()->GetCntnt(); - ASSERT( rCntnt.GetCntntIdx(), ":-( Kein Inhalt vorbereitet." ); + OSL_ENSURE( rCntnt.GetCntntIdx(), ":-( Kein Inhalt vorbereitet." ); ULONG nIndex = rCntnt.GetCntntIdx()->GetIndex(); // Lower() bedeutet SwColumnFrm, dieser beinhaltet wieder einen SwBodyFrm ::_InsertCnt( pFollow->Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)pFollow->Lower())->Lower() @@ -626,7 +626,7 @@ SwFlyFrm *SwFlyFrm::FindChainNeighbour( SwFrmFmt &rChain, SwFrm *pAnch ) } else if ( pFly ) { - ASSERT( !aIter.Next(), "chain with more than one inkarnation" ); + OSL_ENSURE( !aIter.Next(), "chain with more than one inkarnation" ); } return pFly; } @@ -1201,7 +1201,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) aVert.SetVertOrient( text::VertOrientation::NONE ); xub_StrLen nOfs = pFmt->GetAnchor().GetCntntAnchor()->nContent.GetIndex(); - ASSERT( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected" ); + OSL_ENSURE( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected" ); pAutoFrm = (SwTxtFrm*)GetAnchorFrm(); while( pAutoFrm->GetFollow() && pAutoFrm->GetFollow()->GetOfst() <= nOfs ) @@ -1258,7 +1258,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) { xub_StrLen nOfs = pFmt->GetAnchor().GetCntntAnchor() ->nContent.GetIndex(); - ASSERT( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected"); + OSL_ENSURE( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected"); pAutoFrm = (SwTxtFrm*)GetAnchorFrm(); while( pAutoFrm->GetFollow() && pAutoFrm->GetFollow()->GetOfst() <= nOfs ) @@ -1290,7 +1290,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) void SwFlyFrm::Format( const SwBorderAttrs *pAttrs ) { - ASSERT( pAttrs, "FlyFrm::Format, pAttrs ist 0." ); + OSL_ENSURE( pAttrs, "FlyFrm::Format, pAttrs ist 0." ); ColLock(); @@ -1316,8 +1316,8 @@ void SwFlyFrm::Format( const SwBorderAttrs *pAttrs ) const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize(); Size aRelSize( CalcRel( rFrmSz ) ); - ASSERT( pAttrs->GetSize().Height() != 0 || rFrmSz.GetHeightPercent(), "Hoehe des RahmenAttr ist 0." ); - ASSERT( pAttrs->GetSize().Width() != 0 || rFrmSz.GetWidthPercent(), "Breite des RahmenAttr ist 0." ); + OSL_ENSURE( pAttrs->GetSize().Height() != 0 || rFrmSz.GetHeightPercent(), "Hoehe des RahmenAttr ist 0." ); + OSL_ENSURE( pAttrs->GetSize().Width() != 0 || rFrmSz.GetWidthPercent(), "Breite des RahmenAttr ist 0." ); SWRECTFN( this ) if( !HasFixSize() ) @@ -1428,7 +1428,7 @@ void SwFlyFrm::Format( const SwBorderAttrs *pAttrs ) if ( !bFormatHeightOnly ) { - ASSERT( aRelSize == CalcRel( rFrmSz ), "SwFlyFrm::Format CalcRel problem" ) + OSL_ENSURE( aRelSize == CalcRel( rFrmSz ), "SwFlyFrm::Format CalcRel problem" ); SwTwips nNewSize = bVert ? aRelSize.Height() : aRelSize.Width(); if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE ) @@ -1635,7 +1635,7 @@ void CalcCntnt( SwLayoutFrm *pLay, bAgain = true; if ( pAgainObj2 == pAnchoredObj ) { - ASSERT( false, + OSL_ENSURE( false, "::CalcCntnt(..) - loop detected, perform attribute changes to avoid the loop" ); //Oszillation unterbinden. SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt(); @@ -1720,7 +1720,7 @@ void CalcCntnt( SwLayoutFrm *pLay, continue; #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl in CalcCntnt" ) + OSL_ENSURE( false, "LoopControl in CalcCntnt" ); #endif } } @@ -2103,7 +2103,7 @@ Size SwFlyFrm::ChgSize( const Size& aNewSize ) BOOL SwFlyFrm::IsLowerOf( const SwLayoutFrm* pUpperFrm ) const { - ASSERT( GetAnchorFrm(), "8-( Fly is lost in Space." ); + OSL_ENSURE( GetAnchorFrm(), "8-( Fly is lost in Space." ); const SwFrm* pFrm = GetAnchorFrm(); do { @@ -2232,7 +2232,7 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) { if ( !_rNewObj.ISA(SwAnchoredDrawObject) ) { - ASSERT( false, + OSL_ENSURE( false, "SwFrm::AppendDrawObj(..) - anchored object of unexcepted type -> object not appended" ); return; } @@ -2462,7 +2462,7 @@ void SwLayoutFrm::NotifyLowerObjs( const bool _bUnlockPosOfObjs ) } else { - ASSERT( pObj->ISA(SwAnchoredDrawObject), + OSL_ENSURE( pObj->ISA(SwAnchoredDrawObject), "<SwLayoutFrm::NotifyFlys() - anchored object of unexcepted type" ); // --> OD 2004-10-08 #i26945# - use <pAnchorFrm> to check, if // fly frame is lower of layout frame resp. if fly frame is @@ -2683,7 +2683,7 @@ BOOL SwFlyFrm::GetContour( PolyPolygon& rContour, pGrfObj = new GraphicObject( pNd->GetGraphic() ); bGrfObjCreated = sal_True; } - ASSERT( pGrfObj, "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." ); + OSL_ENSURE( pGrfObj, "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." ); if ( pGrfObj && pGrfObj->GetType() != GRAPHIC_NONE ) { if( !pNd->HasContour() ) @@ -2692,7 +2692,7 @@ BOOL SwFlyFrm::GetContour( PolyPolygon& rContour, // during paint. Thus, return (value of <bRet> should be <FALSE>). if ( pGrfNd && _bForPaint ) { - ASSERT( false, "SwFlyFrm::GetContour() - No Contour found at <SwNoTxtNode> during paint." ); + OSL_ENSURE( false, "SwFlyFrm::GetContour() - No Contour found at <SwNoTxtNode> during paint." ); return bRet; } pNd->CreateContour(); @@ -2786,13 +2786,13 @@ void SwFlyFrm::InvalidateObjPos() SwFrmFmt& SwFlyFrm::GetFrmFmt() { - ASSERT( GetFmt(), + OSL_ENSURE( GetFmt(), "<SwFlyFrm::GetFrmFmt()> - missing frame format -> crash." ); return *GetFmt(); } const SwFrmFmt& SwFlyFrm::GetFrmFmt() const { - ASSERT( GetFmt(), + OSL_ENSURE( GetFmt(), "<SwFlyFrm::GetFrmFmt()> - missing frame format -> crash." ); return *GetFmt(); } diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 997f4d1156..6626ebee33 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -123,7 +123,7 @@ void SwFlyAtCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) if( pAnch ) { - ASSERT( pAnch->GetAnchorId() == GetFmt()->GetAnchor().GetAnchorId(), + OSL_ENSURE( pAnch->GetAnchorId() == GetFmt()->GetAnchor().GetAnchorId(), "Unzulaessiger Wechsel des Ankertyps." ); //Abmelden, neuen Anker besorgen und 'dranhaengen. @@ -196,7 +196,7 @@ void SwFlyAtCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { SwCntntNode *pNode = aNewIdx.GetNode().GetCntntNode(); pCntnt = pNode->GetFrm( &pOldAnchor->Frm().Pos(), 0, FALSE ); - ASSERT( pCntnt, "Neuen Anker nicht gefunden" ); + OSL_ENSURE( pCntnt, "Neuen Anker nicht gefunden" ); } //Flys haengen niemals an einem Follow sondern immer am //Master, den suchen wir uns jetzt. @@ -457,7 +457,7 @@ void SwFlyAtCntFrm::MakeAll() { SwTxtFrm* pAnchPosAnchorFrm = dynamic_cast<SwTxtFrm*>(GetAnchorFrmContainingAnchPos()); - ASSERT( pAnchPosAnchorFrm, + OSL_ENSURE( pAnchPosAnchorFrm, "<SwFlyAtCntFrm::MakeAll()> - anchor frame of wrong type -> crash" ); // --> OD 2006-01-27 #i58182# - For the usage of new method // <SwObjectFormatterTxtFrm::CheckMovedFwdCondition(..)> @@ -534,7 +534,7 @@ void SwFlyAtCntFrm::MakeAll() pFmt->UnlockModify(); bOsz = false; #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, + OSL_ENSURE( false, "<SwFlyAtCntFrm::MakeAll()> - special loop prevention for dedicated document of b6403541 applied" ); #endif } diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index d73ca593cb..fba14fdef2 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -93,7 +93,7 @@ void SwFlyInCntFrm::SetRefPoint( const Point& rPoint, const Point& rRelPos ) { // OD 2004-05-27 #i26791# - member <aRelPos> moved to <SwAnchoredObject> - ASSERT( rPoint != aRef || rRelAttr != GetCurrRelPos(), "SetRefPoint: no change" ); + OSL_ENSURE( rPoint != aRef || rRelAttr != GetCurrRelPos(), "SetRefPoint: no change" ); SwFlyNotify *pNotify = NULL; // No notify at a locked fly frame, if a fly frame is locked, there's // already a SwFlyNotify object on the stack (MakeAll). @@ -275,7 +275,7 @@ void SwFlyInCntFrm::RegistFlys() { // vgl. SwRowFrm::RegistFlys() SwPageFrm *pPage = FindPageFrm(); - ASSERT( pPage, "Flys ohne Seite anmelden?" ); + OSL_ENSURE( pPage, "Flys ohne Seite anmelden?" ); ::RegistFlys( pPage, this ); } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 6ec4ed2860..120bc4427a 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -249,7 +249,7 @@ void SwFlyFreeFrm::MakeAll() ++nLoopControlRuns; #if OSL_DEBUG_LEVEL > 1 - ASSERT( nLoopControlRuns < nLoopControlMax, "LoopControl in SwFlyFreeFrm::MakeAll" ) + OSL_ENSURE( nLoopControlRuns < nLoopControlMax, "LoopControl in SwFlyFreeFrm::MakeAll" ); #endif if ( nLoopControlRuns < nLoopControlMax ) @@ -260,9 +260,9 @@ void SwFlyFreeFrm::MakeAll() } Unlock(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SWRECTFN( this ) - ASSERT( bHeightClipped || ( (Frm().*fnRect->fnGetHeight)() > 0 && + OSL_ENSURE( bHeightClipped || ( (Frm().*fnRect->fnGetHeight)() > 0 && (Prt().*fnRect->fnGetHeight)() > 0), "SwFlyFreeFrm::Format(), flipping Fly." ); @@ -507,7 +507,7 @@ void SwFlyFreeFrm::CheckClip( const SwFmtFrmSize &rSz ) } // --> OD 2004-10-14 #i26945# - ASSERT( Frm().Height() >= 0, + OSL_ENSURE( Frm().Height() >= 0, "<SwFlyFreeFrm::CheckClip(..)> - fly frame has negative height now." ); // <-- } @@ -572,7 +572,7 @@ void SwFlyLayFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) if( pAnch ) { - ASSERT( pAnch->GetAnchorId() == + OSL_ENSURE( pAnch->GetAnchorId() == GetFmt()->GetAnchor().GetAnchorId(), "8-) Unzulaessiger Wechsel des Ankertyps." ); @@ -655,7 +655,7 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew ) } SdrObject* pObj = pNew->GetVirtDrawObj(); - ASSERT( pNew->GetAnchorFrm(), "Fly without Anchor" ); + OSL_ENSURE( pNew->GetAnchorFrm(), "Fly without Anchor" ); const SwFlyFrm* pFly = pNew->GetAnchorFrm()->FindFlyFrm(); if ( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() ) { @@ -681,12 +681,12 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew ) #endif pSortedObjs->Insert( *pNew ); #if OSL_DEBUG_LEVEL > 1 - ASSERT( bSucessInserted, "Fly nicht in Sorted eingetragen." ) + OSL_ENSURE( bSucessInserted, "Fly nicht in Sorted eingetragen." ); (void) bSucessInserted; #endif // --> OD 2008-04-22 #i87493# - ASSERT( pNew->GetPageFrm() == 0 || pNew->GetPageFrm() == this, + OSL_ENSURE( pNew->GetPageFrm() == 0 || pNew->GetPageFrm() == this, "<SwPageFrm::AppendFlyToPage(..)> - anchored fly frame seems to be registered at another page frame. Serious defect -> please inform OD." ); // <-- // --> OD 2004-06-30 #i28701# - use new method <SetPageFrm(..)> @@ -852,7 +852,7 @@ void SwPageFrm::MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest ) #endif pDest->GetSortedObjs()->Insert( *pToMove ); #if OSL_DEBUG_LEVEL > 1 - ASSERT( bSucessInserted, "Fly nicht in Sorted eingetragen." ) + OSL_ENSURE( bSucessInserted, "Fly nicht in Sorted eingetragen." ); (void) bSucessInserted; #endif @@ -915,7 +915,7 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj ) { if ( !_rNewObj.ISA(SwAnchoredDrawObject) ) { - ASSERT( false, + OSL_ENSURE( false, "SwPageFrm::AppendDrawObjToPage(..) - anchored object of unexcepted type -> object not appended" ); return; } @@ -925,7 +925,7 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj ) ((SwRootFrm*)GetUpper())->InvalidateBrowseWidth(); } - ASSERT( _rNewObj.GetAnchorFrm(), "anchored draw object without anchor" ); + OSL_ENSURE( _rNewObj.GetAnchorFrm(), "anchored draw object without anchor" ); const SwFlyFrm* pFlyFrm = _rNewObj.GetAnchorFrm()->FindFlyFrm(); if ( pFlyFrm && _rNewObj.GetDrawObj()->GetOrdNum() < pFlyFrm->GetVirtDrawObj()->GetOrdNum() ) @@ -949,13 +949,13 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj ) } if ( !pSortedObjs->Insert( _rNewObj ) ) { -#ifdef DBG_UTIL - ASSERT( pSortedObjs->Contains( _rNewObj ), +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pSortedObjs->Contains( _rNewObj ), "Drawing object not appended into list <pSortedObjs>." ); #endif } // --> OD 2008-04-22 #i87493# - ASSERT( _rNewObj.GetPageFrm() == 0 || _rNewObj.GetPageFrm() == this, + OSL_ENSURE( _rNewObj.GetPageFrm() == 0 || _rNewObj.GetPageFrm() == this, "<SwPageFrm::AppendDrawObjToPage(..)> - anchored draw object seems to be registered at another page frame. Serious defect -> please inform OD." ); // <-- _rNewObj.SetPageFrm( this ); @@ -968,7 +968,7 @@ void SwPageFrm::RemoveDrawObjFromPage( SwAnchoredObject& _rToRemoveObj ) { if ( !_rToRemoveObj.ISA(SwAnchoredDrawObject) ) { - ASSERT( false, + OSL_ENSURE( false, "SwPageFrm::RemoveDrawObjFromPage(..) - anchored object of unexcepted type -> object not removed" ); return; } @@ -1008,7 +1008,7 @@ void SwPageFrm::PlaceFly( SwFlyFrm* pFly, SwFlyFrmFmt* pFmt ) { // --> OD 2005-06-09 #i50432# - consider the case that page is an empty page: // In this case append the fly frame at the next page - ASSERT( !IsEmptyPage() || GetNext(), + OSL_ENSURE( !IsEmptyPage() || GetNext(), "<SwPageFrm::PlaceFly(..)> - empty page with no next page! -> fly frame appended at empty page" ); if ( IsEmptyPage() && GetNext() ) { @@ -1021,7 +1021,7 @@ void SwPageFrm::PlaceFly( SwFlyFrm* pFly, SwFlyFrmFmt* pFmt ) if ( pFly ) AppendFly( pFly ); else - { ASSERT( pFmt, ":-( kein Format fuer Fly uebergeben." ); + { OSL_ENSURE( pFmt, ":-( kein Format fuer Fly uebergeben." ); pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, this ); AppendFly( pFly ); ::RegistFlys( this, pFly ); @@ -1101,7 +1101,7 @@ BOOL CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, BOOL bMove ) const SwFrm* pVertPosOrientFrm = pFly->GetVertPosOrientFrm(); if ( !pVertPosOrientFrm ) { - ASSERT( false, + OSL_ENSURE( false, "::CalcClipRect(..) - frame, vertical position is oriented at, is missing ."); pVertPosOrientFrm = pFly->GetAnchorFrm(); } @@ -1322,7 +1322,7 @@ BOOL CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, BOOL bMove ) const SwFrm* pAnchorFrm = pC->GetAnchorFrm( pSdrObj ); if( !pAnchorFrm ) { - ASSERT( false, "<::CalcClipRect(..)> - missing anchor frame." ); + OSL_ENSURE( false, "<::CalcClipRect(..)> - missing anchor frame." ); ((SwDrawContact*)pC)->ConnectToLayout(); pAnchorFrm = pC->GetAnchorFrm(); } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index f6e00ba5aa..94ca3ac8e1 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -330,7 +330,7 @@ SwFrmNotify::~SwFrmNotify() } if ( pPageFrm != pFlyPageFrm ) { - ASSERT( pFlyPageFrm, "~SwFrmNotify: Fly from Nowhere" ); + OSL_ENSURE( pFlyPageFrm, "~SwFrmNotify: Fly from Nowhere" ); if( pFlyPageFrm ) pFlyPageFrm->MoveFly( pFlyFrm, pPageFrm ); else @@ -402,7 +402,7 @@ SwFrmNotify::~SwFrmNotify() } else { - ASSERT( false, + OSL_ENSURE( false, "<SwCntntNotify::~SwCntntNotify()> - unknown anchored object type. Please inform OD." ); } } @@ -888,7 +888,7 @@ SwCntntNotify::~SwCntntNotify() SwLayoutFrm* pCell = pCnt->GetUpper(); while( !pCell->IsCellFrm() && pCell->GetUpper() ) pCell = pCell->GetUpper(); - ASSERT( pCell->IsCellFrm(), "Where's my cell?" ); + OSL_ENSURE( pCell->IsCellFrm(), "Where's my cell?" ); if ( text::VertOrientation::NONE != pCell->GetFmt()->GetVertOrient().GetVertOrient() ) pCell->InvalidatePrt(); //fuer vertikale Ausrichtung. } @@ -954,7 +954,7 @@ SwCntntNotify::~SwCntntNotify() (pNd->GetOLEObj().IsOleRef() || pNd->IsOLESizeInvalid()) ) { - ASSERT( pCnt->IsInFly(), "OLE not in FlyFrm" ); + OSL_ENSURE( pCnt->IsInFly(), "OLE not in FlyFrm" ); SwFlyFrm *pFly = pCnt->FindFlyFrm(); svt::EmbeddedObjectRef& xObj = pNd->GetOLEObj().GetObject(); SwFEShell *pFESh = 0; @@ -1049,7 +1049,7 @@ SwCntntNotify::~SwCntntNotify() bCheckPos = TRUE; if (FLY_AT_PAGE == rAnch.GetAnchorId()) { - ASSERT( false, "<SwCntntNotify::~SwCntntNotify()> - to page anchored object with content position. Please inform OD." ); + OSL_ENSURE( false, "<SwCntntNotify::~SwCntntNotify()> - to page anchored object with content position. Please inform OD." ); SwFmtAnchor aAnch( rAnch ); aAnch.SetAnchor( 0 ); aAnch.SetPageNum( pPage->GetPhyPageNum() ); @@ -1145,7 +1145,7 @@ void AppendObjs( const SwSpzFrmFmts *pTbl, ULONG nIndex, SdrObject* pSdrObj = 0; if ( bSdrObj && 0 == (pSdrObj = pFmt->FindSdrObject()) ) { - ASSERT( !bSdrObj, "DrawObject not found." ); + OSL_ENSURE( !bSdrObj, "DrawObject not found." ); pFmt->GetDoc()->DelFrmFmt( pFmt ); --i; continue; @@ -1220,7 +1220,7 @@ BOOL MA_FASTCALL lcl_ObjConnected( SwFrmFmt *pFmt ) */ bool lcl_InHeaderOrFooter( SwFrmFmt& _rFmt ) { - ASSERT( lcl_ObjConnected( &_rFmt ), + OSL_ENSURE( lcl_ObjConnected( &_rFmt ), "::lcl_InHeaderOrFooter(..) - <SwFrmFmt> has no connected object" ); bool bRetVal = false; @@ -1374,7 +1374,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, ( !pLay->IsInTab() || pSct->IsInTab() ) ) { pActualSection = new SwActualSection( 0, pSct, 0 ); - ASSERT( !pLay->Lower() || !pLay->Lower()->IsColumnFrm(), + OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrm(), "_InsertCnt: Wrong Call" ); } } @@ -1577,8 +1577,8 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, } else if ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() ) { - ASSERT( pActualSection, "Sectionende ohne Anfang?" ); - ASSERT( pActualSection->GetSectionNode() == pNd->StartOfSectionNode(), + OSL_ENSURE( pActualSection, "Sectionende ohne Anfang?" ); + OSL_ENSURE( pActualSection->GetSectionNode() == pNd->StartOfSectionNode(), "Sectionende mit falschen Start Node?" ); //Section schliessen, ggf. die umgebende Section wieder @@ -1693,7 +1693,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, delete pPageMaker; if( pDoc->GetLayoutCache() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1 pDoc->GetLayoutCache()->CompareLayout( *pDoc ); #endif @@ -1761,14 +1761,14 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, SwFrm *pMove = pFrm; SwFrm *pPrev = pFrm->GetPrev(); SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pMove ); - ASSERT( pTmp, "Missing FlowFrm" ); + OSL_ENSURE( pTmp, "Missing FlowFrm" ); if ( bApres ) { // Wir wollen, dass der Rest der Seite leer ist, d.h. // der naechste muss auf die naechste Seite wandern. // Dieser kann auch in der naechsten Spalte stehen! - ASSERT( !pTmp->HasFollow(), "Follows forbidden" ); + OSL_ENSURE( !pTmp->HasFollow(), "Follows forbidden" ); pPrev = pFrm; // Wenn unser umgebender SectionFrm einen Next besitzt, // so soll dieser ebenfalls gemoved werden! @@ -1823,7 +1823,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, } else { - ASSERT( !pTmp->IsFollow(), "Follows really forbidden" ); + OSL_ENSURE( !pTmp->IsFollow(), "Follows really forbidden" ); // Bei Bereichen muss natuerlich der Inhalt auf die Reise // geschickt werden. if( pMove->IsSctFrm() ) @@ -2543,7 +2543,7 @@ const SdrObject *SwOrderIter::Prev() // at-fly anchored objects from page void MA_FASTCALL lcl_RemoveObjsFromPage( SwFrm* _pFrm ) { - ASSERT( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_RemoveFlysFromPage." ); + OSL_ENSURE( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_RemoveFlysFromPage." ); SwSortedObjs &rObjs = *_pFrm->GetDrawObjs(); for ( USHORT i = 0; i < rObjs.Count(); ++i ) { @@ -2663,7 +2663,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart ) } } else { - ASSERT( !pFloat, "Neuer Float-Frame?" ); + OSL_ENSURE( !pFloat, "Neuer Float-Frame?" ); } } if ( pFloat->GetNext() ) @@ -2711,7 +2711,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart ) // anchored objects to page void MA_FASTCALL lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage ) { - ASSERT( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_AddFlysToPage." ); + OSL_ENSURE( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_AddFlysToPage." ); SwSortedObjs &rObjs = *_pFrm->GetDrawObjs(); for ( USHORT i = 0; i < rObjs.Count(); ++i ) { @@ -2767,7 +2767,7 @@ void MA_FASTCALL lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage ) void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow ) { - ASSERT( pSav && pParent, "Kein Save oder Parent fuer Restore." ); + OSL_ENSURE( pSav && pParent, "Kein Save oder Parent fuer Restore." ); SWRECTFN( pParent ) //Wenn es bereits FlowFrms unterhalb des neuen Parent gibt, so wird die @@ -2902,7 +2902,7 @@ SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, if ( !pFmt ) { pFmt = bOdd ? rDesc.GetLeftFmt() : rDesc.GetRightFmt(); - ASSERT( pFmt, "Descriptor without any format?!" ); + OSL_ENSURE( pFmt, "Descriptor without any format?!" ); bInsertEmpty = !bInsertEmpty; } if( bInsertEmpty ) @@ -3391,7 +3391,7 @@ BOOL Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ) pFrm = ( (SwDrawContact*)GetUserCall(pObj) )->GetAnchorFrm(); aPos = pObj->GetCurrentBoundRect().TopLeft(); } - ASSERT( pFrm, "8-( Fly is lost in Space." ); + OSL_ENSURE( pFrm, "8-( Fly is lost in Space." ); pFrm = GetVirtualUpper( pFrm, aPos ); do { if ( pFrm == pCurrFrm ) @@ -3693,7 +3693,7 @@ void GetSpacingValuesOfFrm( const SwFrm& rFrm, static_cast<const SwTxtFrm&>(rFrm).GetLineSpace( true ) == 0; } - ASSERT( onLowerSpacing >= 0 && onLineSpacing >= 0, + OSL_ENSURE( onLowerSpacing >= 0 && onLineSpacing >= 0, "<GetSpacingValuesOfFrm(..)> - spacing values aren't positive!" ); } } diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index c5f7551555..bb7675091f 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -81,13 +81,13 @@ ULONG MA_FASTCALL lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr ) rFtnIdxs[k+1]->pFtn->GetTxtNode().GetIndex(aIdx2); if ( aIdx1.GetIndex() > aIdx2.GetIndex() ) { - ASSERT( !rFtnIdxs.Count(), "FtnIdxs not up to date" ); + OSL_ENSURE( !rFtnIdxs.Count(), "FtnIdxs not up to date" ); } else if ( aIdx1.GetIndex() == aIdx2.GetIndex() ) { SwTxtFtn *p1 = rFtnIdxs[k]; SwTxtFtn *p2 = rFtnIdxs[k+1]; - ASSERT( *p1->GetStart() < *p2->GetStart(), + OSL_ENSURE( *p1->GetStart() < *p2->GetStart(), "FtnIdxs not up to date" ); } } @@ -101,14 +101,14 @@ ULONG MA_FASTCALL lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr ) return ULONG(nRet) + ENDNOTE; return nRet; } - ASSERT( !pDoc, "FtnPos not found." ); + OSL_ENSURE( !pDoc, "FtnPos not found." ); return 0; } BOOL SwFtnFrm::operator<( const SwTxtFtn* pTxtFtn ) const { const SwDoc* pDoc = GetFmt()->GetDoc(); - ASSERT( pDoc, "SwFtnFrm: Missing doc!" ); + OSL_ENSURE( pDoc, "SwFtnFrm: Missing doc!" ); return lcl_FindFtnPos( pDoc, GetAttr() ) < lcl_FindFtnPos( pDoc, pTxtFtn ); } @@ -140,7 +140,7 @@ BOOL lcl_NextFtnBoss( SwFtnBossFrm* &rpBoss, SwPageFrm* &rpPage, SwSectionFrm* pSct = rpBoss->FindSctFrm()->GetFollow(); if( pSct ) { - ASSERT( pSct->Lower() && pSct->Lower()->IsColumnFrm(), + OSL_ENSURE( pSct->Lower() && pSct->Lower()->IsColumnFrm(), "Where's the column?" ); rpBoss = (SwColumnFrm*)pSct->Lower(); SwPageFrm* pOld = rpPage; @@ -354,9 +354,9 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL ) //moeglich. //Wenn die Seite eine spezielle Fussnotenseite ist, so nehmen wir uns auch //soviel Platz wie eben moeglich. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( !GetUpper() || !GetUpper()->IsFtnBossFrm() ) - { ASSERT( !this, "Keine FtnBoss." ); + { OSL_ENSURE( !this, "Keine FtnBoss." ); return 0; } #endif @@ -370,7 +370,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL ) if( IsInSct() ) { SwSectionFrm* pSect = FindSctFrm(); - ASSERT( pSect, "GrowFrm: Missing SectFrm" ); + OSL_ENSURE( pSect, "GrowFrm: Missing SectFrm" ); // In a section, which has to maximize, a footnotecontainer is allowed // to grow, when the section can't grow anymore. if( !bTst && !pSect->IsColLocked() && @@ -560,7 +560,7 @@ void SwFtnFrm::InvalidateNxtFtnCnts( SwPageFrm *pPage ) } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) { @@ -669,11 +669,11 @@ void SwFtnFrm::Cut() void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) { - ASSERT( pParent, "Kein Parent fuer Paste." ); - ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); - ASSERT( pParent != this, "Bin selbst der Parent." ); - ASSERT( pSibling != this, "Bin mein eigener Nachbar." ); - ASSERT( !GetPrev() && !GetNext() && !GetUpper(), + OSL_ENSURE( pParent, "Kein Parent fuer Paste." ); + OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); + OSL_ENSURE( pParent != this, "Bin selbst der Parent." ); + OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." ); + OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(), "Bin noch irgendwo angemeldet." ); //In den Baum einhaengen. @@ -693,7 +693,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) //Wenn mein Vorgaenger mein Master ist und/oder wenn mein Nachfolger mein //Follow ist so kann ich deren Inhalt uebernehmen und sie vernichten. if ( GetPrev() && GetPrev() == GetMaster() ) - { ASSERT( SwFlowFrm::CastFlowFrm( GetPrev()->GetLower() ), + { OSL_ENSURE( SwFlowFrm::CastFlowFrm( GetPrev()->GetLower() ), "Fussnote ohne Inhalt?" ); (SwFlowFrm::CastFlowFrm( GetPrev()->GetLower()))-> MoveSubTree( this, GetLower() ); @@ -702,23 +702,23 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) delete pDel; } if ( GetNext() && GetNext() == GetFollow() ) - { ASSERT( SwFlowFrm::CastFlowFrm( GetNext()->GetLower() ), + { OSL_ENSURE( SwFlowFrm::CastFlowFrm( GetNext()->GetLower() ), "Fussnote ohne Inhalt?" ); (SwFlowFrm::CastFlowFrm( GetNext()->GetLower()))->MoveSubTree( this ); SwFrm *pDel = GetNext(); pDel->Cut(); delete pDel; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwDoc *pDoc = GetFmt()->GetDoc(); if ( GetPrev() ) { - ASSERT( lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetPrev())->GetAttr() ) <= + OSL_ENSURE( lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetPrev())->GetAttr() ) <= lcl_FindFtnPos( pDoc, GetAttr() ), "Prev ist not FtnPrev" ); } if ( GetNext() ) { - ASSERT( lcl_FindFtnPos( pDoc, GetAttr() ) <= + OSL_ENSURE( lcl_FindFtnPos( pDoc, GetAttr() ) <= lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetNext())->GetAttr() ), "Next is not FtnNext" ); } @@ -755,7 +755,7 @@ SwLayoutFrm *SwFrm::GetNextFtnLeaf( MakePageType eMakePage ) SwLayoutFrm* pNxt = pOldBoss->GetNextSctLeaf( eMakePage ); if( pNxt ) { - ASSERT( pNxt->IsColBodyFrm(), "GetNextFtnLeaf: Funny Leaf" ); + OSL_ENSURE( pNxt->IsColBodyFrm(), "GetNextFtnLeaf: Funny Leaf" ); pBoss = (SwFtnBossFrm*)pNxt->GetUpper(); pPage = pBoss->FindPageFrm(); } @@ -893,7 +893,7 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn ) pSect = (SwSectionFrm*)pSect->FindMaster(); if( !pSect || !pSect->Lower() ) return 0; - ASSERT( pSect->Lower()->IsColumnFrm(), + OSL_ENSURE( pSect->Lower()->IsColumnFrm(), "GetPrevFtnLeaf: Where's the column?" ); pNxtBoss = (SwFtnBossFrm*)pSect->Lower(); pBody = pSect; @@ -1024,7 +1024,7 @@ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, BOOL bPageOnly, BOOL bEndNotes ) if ( pCont ) { SwFtnFrm *pFtn = (SwFtnFrm*)pCont->Lower(); - ASSERT( pFtn, "FtnCont ohne Ftn." ); + OSL_ENSURE( pFtn, "FtnCont ohne Ftn." ); if ( bPageOnly ) while ( pFtn->GetMaster() ) pFtn = pFtn->GetMaster(); @@ -1140,9 +1140,9 @@ SwFtnContFrm *SwFtnBossFrm::MakeFtnCont() //immer direkt hinter dem Bodytext. //Sein FrmFmt ist immer das DefaultFrmFmt. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( FindFtnCont() ) - { ASSERT( !this, "Fussnotencontainer bereits vorhanden." ); + { OSL_ENSURE( !this, "Fussnotencontainer bereits vorhanden." ); return 0; } #endif @@ -1169,14 +1169,14 @@ SwFtnContFrm *SwFtnBossFrm::FindFtnCont() while( pFrm && !pFrm->IsFtnContFrm() ) pFrm = pFrm->GetNext(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( pFrm ) { SwFrm *pFtn = pFrm->GetLower(); - ASSERT( pFtn, "Cont ohne Fussnote." ); + OSL_ENSURE( pFtn, "Cont ohne Fussnote." ); while ( pFtn ) { - ASSERT( pFtn->IsFtnFrm(), "Nachbar von Fussnote keine Fussnote." ); + OSL_ENSURE( pFtn->IsFtnFrm(), "Nachbar von Fussnote keine Fussnote." ); pFtn = pFtn->GetNext(); } } @@ -1249,7 +1249,7 @@ SwFtnFrm *SwFtnBossFrm::FindFirstFtn() if( pRet ) { pBoss = pRet->GetRef()->FindFtnBossFrm(); - ASSERT( pBoss, "FindFirstFtn: No boss found" ); + OSL_ENSURE( pBoss, "FindFirstFtn: No boss found" ); if( !pBoss ) return FALSE; // ?There must be a bug, but no GPF pPage = pBoss->FindPageFrm(); @@ -1366,7 +1366,7 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) { //Vernichten der Inkarnationen von Fussnoten zum Attribut, wenn sie nicht //zu pAssumed gehoeren. - ASSERT( !pCheck->GetMaster(), "Master not an Master." ); + OSL_ENSURE( !pCheck->GetMaster(), "Master not an Master." ); SwNodeIndex aIdx( *pCheck->GetAttr()->GetStartNode(), 1 ); SwCntntNode *pNd = aIdx.GetNode().GetCntntNode(); @@ -1414,14 +1414,6 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) { -#if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL) - static USHORT nStop = 0; - if ( nStop == pNew->GetFrmId() ) - { - int bla = 5; - (void)bla; - } -#endif //Die Fussnote haben wir, sie muss jetzt nur noch irgendwo //hin und zwar vor die Fussnote, deren Attribut vor das //der neuen zeigt (Position wird ueber das Doc ermittelt) @@ -1527,7 +1519,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) //werden. pSibling = (SwFtnFrm*)pParent->Lower(); if ( !pSibling ) - { ASSERT( !this, "Keinen Platz fuer Fussnote gefunden."); + { OSL_ENSURE( !this, "Keinen Platz fuer Fussnote gefunden."); return; } nCmpPos = ::lcl_FindFtnPos( pDoc, pSibling->GetAttr() ); @@ -1546,7 +1538,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) if ( pSibling->GetNext() ) { pSibling = (SwFtnFrm*)pSibling->GetNext(); - ASSERT( !pSibling->GetMaster() || ( ENDNOTE > nStPos && + OSL_ENSURE( !pSibling->GetMaster() || ( ENDNOTE > nStPos && pSibling->GetAttr()->GetFtn().IsEndNote() ), "InsertFtn: Master expected I" ); } @@ -1568,7 +1560,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) if ( pSibling ) { nCmpPos = ::lcl_FindFtnPos( pDoc, pSibling->GetAttr() ); - ASSERT( nCmpPos > nLastPos, "InsertFtn: Order of FtnFrm's buggy" ); + OSL_ENSURE( nCmpPos > nLastPos, "InsertFtn: Order of FtnFrm's buggy" ); } } // pLastSib ist jetzt die letzte Fussnote vor uns, @@ -1588,7 +1580,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) pSibling = pLastSib; while( pSibling->GetFollow() ) pSibling = pSibling->GetFollow(); - ASSERT( !pSibling->GetNext(), "InsertFtn: Who's that guy?" ); + OSL_ENSURE( !pSibling->GetNext(), "InsertFtn: Who's that guy?" ); } } } @@ -1667,7 +1659,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) { if( ENDNOTE > nCmpPos || nStPos >= ENDNOTE ) { - ASSERT( FALSE, "InsertFtn: Master expected II" ); + OSL_ENSURE( FALSE, "InsertFtn: Master expected II" ); do pSibling = pSibling->GetMaster(); while ( pSibling->GetMaster() ); @@ -1676,7 +1668,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) pParent = (SwFtnContFrm*)pSibling->GetUpper(); } } - ASSERT( pParent, "paste in space?" ); + OSL_ENSURE( pParent, "paste in space?" ); pNew->Paste( pParent, pSibling ); } @@ -1748,7 +1740,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) SwFtnContFrm *pCont = pNxt->FindFtnCont(); if ( pCont && pCont->Lower() ) { - ASSERT( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); + OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); if ( nStPos > ::lcl_FindFtnPos( pDoc, ((SwFtnFrm*)pCont->Lower())->GetAttr())) { @@ -1791,7 +1783,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) SwFtnContFrm *pCont = pNxt->FindFtnCont(); if ( pCont && pCont->Lower() ) { - ASSERT( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); + OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" ); if ( nStPos > ::lcl_FindFtnPos( pDoc, ((SwFtnFrm*)pCont->Lower())->GetAttr())) { @@ -1807,7 +1799,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) //Erstmal eine Fussnote und die benoetigten CntntFrms anlegen. if ( !pAttr->GetStartNode() ) - { ASSERT( !this, "Kein Fussnoteninhalt." ); + { OSL_ENSURE( !this, "Kein Fussnoteninhalt." ); return; } @@ -1841,7 +1833,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) if( bChgPage ) { SwLayoutFrm* pBody = pPage->FindBodyCont(); - ASSERT( pBody, "AppendFtn: NoPageBody?" ); + OSL_ENSURE( pBody, "AppendFtn: NoPageBody?" ); if( pBody->Lower() && pBody->Lower()->IsColumnFrm() ) pBoss = (SwFtnBossFrm*)pBody->Lower(); else @@ -1928,7 +1920,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr ) SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr ) { //Der einfachste und sicherste Weg geht ueber das Attribut. - ASSERT( pAttr->GetStartNode(), "FtnAtr ohne StartNode." ); + OSL_ENSURE( pAttr->GetStartNode(), "FtnAtr ohne StartNode." ); SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 ); SwCntntNode *pNd = aIdx.GetNode().GetCntntNode(); if ( !pNd ) @@ -1991,7 +1983,7 @@ void SwFtnBossFrm::RemoveFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr, } while ( pFtn ); if( bPrep && pRef->IsFollow() ) { - ASSERT( pRef->IsTxtFrm(), "NoTxtFrm has Footnote?" ); + OSL_ENSURE( pRef->IsTxtFrm(), "NoTxtFrm has Footnote?" ); SwTxtFrm* pMaster = (SwTxtFrm*)pRef->FindMaster(); if( !pMaster->IsLocked() ) pMaster->Prepare( PREP_FTN_GONE ); @@ -2118,7 +2110,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, // OD 03.04.2003 #108446# - assert, that no reference footnote boss frame // is set, in spite of the order, that only previous footnotes has to be // collected. - ASSERT( !_bCollectOnlyPreviousFtns || _pRefFtnBossFrm, + OSL_ENSURE( !_bCollectOnlyPreviousFtns || _pRefFtnBossFrm, "<SwFtnBossFrm::_CollectFtns(..)> - No reference footnote boss frame for collecting only previous footnotes set.\nCrash will be caused!" ); //Alle Fussnoten die von pRef referenziert werden nacheinander @@ -2137,7 +2129,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, //Hier sollte keiner mit einer Follow-Ftn ankommen, es sei denn er hat //ernste Absichten (:-)); spricht er kommt mit einer Ftn an die vor der //ersten der Referenz liegt. - ASSERT( !_pFtn->GetMaster() || _pFtn->GetRef() != _pRef, "FollowFtn moven?" ); + OSL_ENSURE( !_pFtn->GetMaster() || _pFtn->GetRef() != _pRef, "FollowFtn moven?" ); while ( _pFtn->GetMaster() ) _pFtn = _pFtn->GetMaster(); @@ -2177,13 +2169,13 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, } while( !pNxtFtn && pBoss ); } else if( !pNxtFtn->GetAttr()->GetFtn().IsEndNote() ) - { ASSERT( !pNxtFtn->GetMaster(), "_CollectFtn: Master exspected" ); + { OSL_ENSURE( !pNxtFtn->GetMaster(), "_CollectFtn: Master exspected" ); while ( pNxtFtn->GetMaster() ) pNxtFtn = pNxtFtn->GetMaster(); } if ( pNxtFtn == _pFtn ) { - ASSERT( FALSE, "_CollectFtn: Devil's circle" ); + OSL_ENSURE( FALSE, "_CollectFtn: Devil's circle" ); pNxtFtn = 0; } @@ -2194,7 +2186,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, if ( _bCollectOnlyPreviousFtns ) { SwFtnBossFrm* pBossOfFoundFtn = _pFtn->FindFtnBossFrm( sal_True ); - ASSERT( pBossOfFoundFtn, + OSL_ENSURE( pBossOfFoundFtn, "<SwFtnBossFrm::_CollectFtns(..)> - footnote boss frame of found footnote frame missing.\nWrong layout!" ); if ( !pBossOfFoundFtn || // don't crash, if no footnote boss is found. pBossOfFoundFtn->IsBefore( _pRefFtnBossFrm ) @@ -2211,7 +2203,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, if ( bCollectFoundFtn ) { - ASSERT( !_pFtn->GetMaster(), "FollowFtn moven?" ); + OSL_ENSURE( !_pFtn->GetMaster(), "FollowFtn moven?" ); SwFtnFrm *pNxt = _pFtn->GetFollow(); while ( pNxt ) { @@ -2226,7 +2218,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef, } while ( pCnt ); } else - { ASSERT( !pNxt, "Fussnote ohne Inhalt?" ); + { OSL_ENSURE( !pNxt, "Fussnote ohne Inhalt?" ); pNxt->Cut(); delete pNxt; } @@ -2392,7 +2384,7 @@ void SwFtnBossFrm::_MoveFtns( SvPtrarr &rFtnArr, BOOL bCalc ) } } else - { ASSERT( !pFtn->GetMaster() && !pFtn->GetFollow(), + { OSL_ENSURE( !pFtn->GetMaster() && !pFtn->GetFollow(), "DelFtn und Master/Follow?" ); delete pFtn; // --> OD 2004-06-10 #i21478# @@ -2487,7 +2479,7 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest, || pAttr->GetFtn().IsEndNote() ) return; - ASSERT( this == pSrc->FindFtnBossFrm( TRUE ), + OSL_ENSURE( this == pSrc->FindFtnBossFrm( TRUE ), "SwPageFrm::MoveFtns: source frame isn't on that FtnBoss" ); SwFtnFrm *pFtn = FindFirstFtn(); @@ -2495,7 +2487,7 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest, { ChangeFtnRef( pSrc, pAttr, pDest ); SwFtnBossFrm *pDestBoss = pDest->FindFtnBossFrm( TRUE ); - ASSERT( pDestBoss, "+SwPageFrm::MoveFtns: no destination boss" ); + OSL_ENSURE( pDestBoss, "+SwPageFrm::MoveFtns: no destination boss" ); if( pDestBoss ) // robust { SvPtrarr aFtnArr( 5, 5 ); @@ -2661,7 +2653,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const BOOL bLock, !pFtnFrm->IsColLocked() ) { // --> OD 2005-08-10 #i49383# - ASSERT( pLastFtnFrm == pFtnFrm, + OSL_ENSURE( pLastFtnFrm == pFtnFrm, "<SwFtnBossFrm::RearrangeFtns(..)> - <pLastFtnFrm> != <pFtnFrm>" ); pLastFtnFrm = 0L; // --> OD 2006-02-02 #i57914# - adjust fix #i49383# @@ -2879,7 +2871,7 @@ SwTwips SwFtnBossFrm::GetVarSpace() const // die ganze Seite/Spalte ein. const SwPageFrm* pPg = FindPageFrm(); - ASSERT( pPg || IsInSct(), "Footnote lost page" ); + OSL_ENSURE( pPg || IsInSct(), "Footnote lost page" ); const SwFrm *pBody = FindBodyCont(); SwTwips nRet; @@ -2896,7 +2888,7 @@ SwTwips SwFtnBossFrm::GetVarSpace() const // the bottom of the last contentfrm if( pSect->IsEndnAtEnd() ) // endnotes allowed? { - ASSERT( !Lower() || !Lower()->GetNext() || Lower()->GetNext()-> + OSL_ENSURE( !Lower() || !Lower()->GetNext() || Lower()->GetNext()-> IsFtnContFrm(), "FtnContainer exspected" ); const SwFtnContFrm* pCont = Lower() ? (SwFtnContFrm*)Lower()->GetNext() : 0; @@ -2966,18 +2958,18 @@ BYTE SwFtnBossFrm::_NeighbourhoodAdjustment( const SwFrm* ) const nRet = NA_GROW_SHRINK; else { - ASSERT( GetUpper()->IsSctFrm(), "NeighbourhoodAdjustment: Unexspected Upper" ); + OSL_ENSURE( GetUpper()->IsSctFrm(), "NeighbourhoodAdjustment: Unexspected Upper" ); if( !GetNext() && !GetPrev() ) nRet = NA_GROW_ADJUST; // section with a single column (FtnAtEnd) else { const SwFrm* pTmp = Lower(); - ASSERT( pTmp, "NeighbourhoodAdjustment: Missing Lower()" ); + OSL_ENSURE( pTmp, "NeighbourhoodAdjustment: Missing Lower()" ); if( !pTmp->GetNext() ) nRet = NA_GROW_SHRINK; else if( !GetUpper()->IsColLocked() ) nRet = NA_ADJUST_GROW; - ASSERT( !pTmp->GetNext() || pTmp->GetNext()->IsFtnContFrm(), + OSL_ENSURE( !pTmp->GetNext() || pTmp->GetNext()->IsFtnContFrm(), "NeighbourhoodAdjustment: Who's that guy?" ); } } @@ -3052,7 +3044,7 @@ BOOL SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, pStart = pStart->GetNextCntntFrm(); } - ASSERT( pOldBoss->IsInSct() == pNewBoss->IsInSct(), + OSL_ENSURE( pOldBoss->IsInSct() == pNewBoss->IsInSct(), "MoveLowerFtns: Section confusion" ); SvPtrarr *pFtnArr; SwLayoutFrm* pNewChief = 0; @@ -3117,7 +3109,7 @@ BOOL SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, BOOL SwCntntFrm::MoveFtnCntFwd( BOOL bMakePage, SwFtnBossFrm *pOldBoss ) { - ASSERT( IsInFtn(), "Keine Ftn." ); + OSL_ENSURE( IsInFtn(), "Keine Ftn." ); SwLayoutFrm *pFtn = FindFtnFrm(); // The first paragraph in the first footnote in the first column in the @@ -3176,7 +3168,7 @@ BOOL SwCntntFrm::MoveFtnCntFwd( BOOL bMakePage, SwFtnBossFrm *pOldBoss ) SwFtnFrm* pTmpFtn = pNewUpper->IsFtnFrm() ? ((SwFtnFrm*)pNewUpper) : 0; if( !pTmpFtn ) { - ASSERT( pNewUpper->IsFtnContFrm(), "Neuer Upper kein FtnCont."); + OSL_ENSURE( pNewUpper->IsFtnContFrm(), "Neuer Upper kein FtnCont."); SwFtnContFrm *pCont = (SwFtnContFrm*)pNewUpper; //Fussnote erzeugen. @@ -3198,7 +3190,7 @@ BOOL SwCntntFrm::MoveFtnCntFwd( BOOL bMakePage, SwFtnBossFrm *pOldBoss ) pTmpFtn->Paste( pCont, pNx ); pTmpFtn->Calc(); } - ASSERT( pTmpFtn->GetAttr() == FindFtnFrm()->GetAttr(), "Wrong Footnote!" ); + OSL_ENSURE( pTmpFtn->GetAttr() == FindFtnFrm()->GetAttr(), "Wrong Footnote!" ); // Bereiche in Fussnoten beduerfen besonderer Behandlung SwLayoutFrm *pNewUp = pTmpFtn; if( IsInSct() ) @@ -3230,7 +3222,7 @@ BOOL SwCntntFrm::MoveFtnCntFwd( BOOL bMakePage, SwFtnBossFrm *pOldBoss ) pTmpNxt = (SwSectionFrm*)pTmp; else { - ASSERT( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" ); + OSL_ENSURE( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" ); pTmpNxt = (SwTabFrm*)pTmp; } pTmpNxt->MoveSubTree( pTmpFtn, pNewUp->GetNext() ); @@ -3276,7 +3268,7 @@ SwSaveFtnHeight::~SwSaveFtnHeight() } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //JP 15.10.2001: in a non pro version test if the attribute has the same // meaning which his reference is @@ -3288,7 +3280,7 @@ SwSaveFtnHeight::~SwSaveFtnHeight() const SwCntntFrm* SwFtnFrm::GetRef() const { const SwCntntFrm* pRefAttr = GetRefFromAttr(); - ASSERT( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) + OSL_ENSURE( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) || pRefAttr->IsAnFollow( pRef ), "access to deleted Frame? pRef != pAttr->GetRef()" ); return pRef; @@ -3297,7 +3289,7 @@ const SwCntntFrm* SwFtnFrm::GetRef() const SwCntntFrm* SwFtnFrm::GetRef() { const SwCntntFrm* pRefAttr = GetRefFromAttr(); - ASSERT( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) + OSL_ENSURE( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr ) || pRefAttr->IsAnFollow( pRef ), "access to deleted Frame? pRef != pAttr->GetRef()" ); return pRef; @@ -3313,7 +3305,7 @@ const SwCntntFrm* SwFtnFrm::GetRefFromAttr() const SwCntntFrm* SwFtnFrm::GetRefFromAttr() { - ASSERT( pAttr, "invalid Attribute" ); + OSL_ENSURE( pAttr, "invalid Attribute" ); SwTxtNode& rTNd = (SwTxtNode&)pAttr->GetTxtNode(); SwPosition aPos( rTNd, SwIndex( &rTNd, *pAttr->GetStart() )); SwCntntFrm* pCFrm = rTNd.GetFrm( 0, &aPos, FALSE ); diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 8c0613b15b..f962c0ffdd 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -126,7 +126,7 @@ SwHeadFootFrm::SwHeadFootFrm( SwFrmFmt * pFmt, USHORT nTypeIn) const SwFmtCntnt &rCnt = pFmt->GetCntnt(); - ASSERT( rCnt.GetCntntIdx(), "Kein Inhalt fuer Header." ); + OSL_ENSURE( rCnt.GetCntntIdx(), "Kein Inhalt fuer Header." ); //Fuer Header Footer die Objekte gleich erzeugen lassen. BOOL bOld = bObjsDirect; @@ -282,7 +282,7 @@ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs) // --> OD 2005-05-03 #i46941# - frame has to be valid. // Note: frame could be invalid after calling its format, // if it's locked - ASSERT( StackHack::IsLocked() || !pFrm->IsTxtFrm() || + OSL_ENSURE( StackHack::IsLocked() || !pFrm->IsTxtFrm() || pFrm->IsValid() || static_cast<SwTxtFrm*>(pFrm)->IsJoinLocked(), "<SwHeadFootFrm::FormatSize(..)> - text frame invalid and not locked." ); @@ -418,7 +418,7 @@ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs) void SwHeadFootFrm::Format(const SwBorderAttrs * pAttrs) { - ASSERT( pAttrs, "SwFooterFrm::Format, pAttrs ist 0." ); + OSL_ENSURE( pAttrs, "SwFooterFrm::Format, pAttrs ist 0." ); if ( bValidPrtArea && bValidSize ) return; @@ -459,7 +459,7 @@ SwTwips SwHeadFootFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) SwBorderAttrAccess * pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this ); - ASSERT(pAccess, "no border attributes"); + OSL_ENSURE(pAccess, "no border attributes"); SwBorderAttrs * pAttrs = pAccess->Get(); @@ -592,7 +592,7 @@ SwTwips SwHeadFootFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) SwBorderAttrAccess * pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this ); - ASSERT(pAccess, "no border attributes"); + OSL_ENSURE(pAccess, "no border attributes"); SwBorderAttrs * pAttrs = pAccess->Get(); @@ -662,7 +662,7 @@ SwTwips SwHeadFootFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) BOOL SwHeadFootFrm::GetEatSpacing() const { const SwFrmFmt * pFmt = GetFmt(); - ASSERT(pFmt, "SwHeadFootFrm: no format?"); + OSL_ENSURE(pFmt, "SwHeadFootFrm: no format?"); if (pFmt->GetHeaderAndFooterEatSpacing().GetValue()) return TRUE; @@ -715,7 +715,7 @@ void SwPageFrm::PrepareHeader() if ( bOn && rH.IsActive() ) { //Header einsetzen, vorher entfernen falls vorhanden. - ASSERT( rH.GetHeaderFmt(), "FrmFmt fuer Header nicht gefunden." ); + OSL_ENSURE( rH.GetHeaderFmt(), "FrmFmt fuer Header nicht gefunden." ); if ( pLay->GetFmt() == (SwFrmFmt*)rH.GetHeaderFmt() ) return; //Der Footer ist bereits der richtige @@ -727,7 +727,7 @@ void SwPageFrm::PrepareHeader() pDel->Cut(); delete pDel; } - ASSERT( pLay, "Wohin mit dem Header?" ); + OSL_ENSURE( pLay, "Wohin mit dem Header?" ); SwHeaderFrm *pH = new SwHeaderFrm( (SwFrmFmt*)rH.GetHeaderFmt() ); pH->Paste( this, pLay ); if ( GetUpper() ) @@ -765,7 +765,7 @@ void SwPageFrm::PrepareFooter() if ( bOn && rF.IsActive() ) { //Footer einsetzen, vorher entfernen falls vorhanden. - ASSERT( rF.GetFooterFmt(), "FrmFmt fuer Footer nicht gefunden." ); + OSL_ENSURE( rF.GetFooterFmt(), "FrmFmt fuer Footer nicht gefunden." ); if ( pLay->GetFmt() == (SwFrmFmt*)rF.GetFooterFmt() ) return; //Der Footer ist bereits der richtige. diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index dbe5161770..5099e9c239 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -112,7 +112,7 @@ //Sparen von Schreibarbeit um den Zugriff auf zerstoerte Seiten zu vermeiden. -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static void BreakPoint() { @@ -400,7 +400,7 @@ SwLayAction::SwLayAction( SwRootFrm *pRt, SwViewImp *pI ) : SwLayAction::~SwLayAction() { - ASSERT( !pWait, "Wait object not destroyed" ); + OSL_ENSURE( !pWait, "Wait object not destroyed" ); pImp->pLayAct = 0; //Abmelden } @@ -589,7 +589,7 @@ class NotifyLayoutOfPageInProgress void SwLayAction::InternalAction() { - ASSERT( pRoot->Lower()->IsPageFrm(), ":-( Keine Seite unterhalb der Root."); + OSL_ENSURE( pRoot->Lower()->IsPageFrm(), ":-( Keine Seite unterhalb der Root."); pRoot->Calc(); @@ -720,7 +720,8 @@ void SwLayAction::InternalAction() if ( ++nLoopControlRuns_1 > nLoopControlMax ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl_1 in SwLayAction::InternalAction" ) + OSL_ENSURE( false, "LoopControl_1 in SwLayAction::InternalAction" ); + #endif break; } @@ -914,7 +915,7 @@ void SwLayAction::InternalAction() if ( ++nLoopControlRuns_3 > nLoopControlMax ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl_3 in Interrupt formatting in SwLayAction::InternalAction" ) + OSL_ENSURE( false, "LoopControl_3 in Interrupt formatting in SwLayAction::InternalAction" ); #endif break; } @@ -939,7 +940,7 @@ void SwLayAction::InternalAction() if ( ++nLoopControlRuns_2 > nLoopControlMax ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl_2 in Interrupt formatting in SwLayAction::InternalAction" ) + OSL_ENSURE( false, "LoopControl_2 in Interrupt formatting in SwLayAction::InternalAction" ); #endif break; } @@ -1086,7 +1087,7 @@ static bool lcl_IsInvaLay( const SwFrm *pFrm, long nBottom ) static const SwFrm *lcl_FindFirstInvaLay( const SwFrm *pFrm, long nBottom ) { - ASSERT( pFrm->IsLayoutFrm(), "FindFirstInvaLay, no LayFrm" ); + OSL_ENSURE( pFrm->IsLayoutFrm(), "FindFirstInvaLay, no LayFrm" ); if (lcl_IsInvaLay(pFrm, nBottom)) return pFrm; @@ -1156,7 +1157,7 @@ static const SwFrm *lcl_FindFirstInvaCntnt( const SwLayoutFrm *pLay, long nBotto static const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrm* _pPage, long _nBottom ) { - ASSERT( _pPage->GetSortedObjs(), "FindFirstInvaObj, no Objs" ) + OSL_ENSURE( _pPage->GetSortedObjs(), "FindFirstInvaObj, no Objs" ); for ( USHORT i = 0; i < _pPage->GetSortedObjs()->Count(); ++i ) { @@ -1417,7 +1418,7 @@ BOOL SwLayAction::IsShortCut( SwPageFrm *&prPage ) // OD 15.11.2002 #105155# - introduce support for vertical layout BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect ) { - ASSERT( !IsAgain(), "Ungueltige Seite beachten." ); + OSL_ENSURE( !IsAgain(), "Ungueltige Seite beachten." ); if ( IsAgain() ) return FALSE; @@ -1632,7 +1633,7 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect ) BOOL SwLayAction::FormatLayoutFly( SwFlyFrm* pFly ) { - ASSERT( !IsAgain(), "Ungueltige Seite beachten." ); + OSL_ENSURE( !IsAgain(), "Ungueltige Seite beachten." ); if ( IsAgain() ) return FALSE; @@ -1682,7 +1683,7 @@ BOOL SwLayAction::FormatLayoutFly( SwFlyFrm* pFly ) // Implement vertical layout support BOOL SwLayAction::FormatLayoutTab( SwTabFrm *pTab, BOOL bAddRect ) { - ASSERT( !IsAgain(), "8-) Ungueltige Seite beachten." ); + OSL_ENSURE( !IsAgain(), "8-) Ungueltige Seite beachten." ); if ( IsAgain() || !pTab->Lower() ) return FALSE; @@ -2142,7 +2143,7 @@ BOOL SwLayAction::IsStopPrt() const |*************************************************************************/ BOOL SwLayIdle::_DoIdleJob( const SwCntntFrm *pCnt, IdleJobType eJob ) { - ASSERT( pCnt->IsTxtFrm(), "NoTxt neighbour of Txt" ); + OSL_ENSURE( pCnt->IsTxtFrm(), "NoTxt neighbour of Txt" ); // robust against misuse by e.g. #i52542# if( !pCnt->IsTxtFrm() ) return FALSE; @@ -2280,7 +2281,7 @@ BOOL SwLayIdle::DoIdleJob( IdleJobType eJob, BOOL bVisAreaOnly ) !SwSmartTagMgr::Get().IsSmartTagsEnabled() ) return FALSE; break; - default: ASSERT( false, "Unknown idle job type" ) + default: OSL_ENSURE( false, "Unknown idle job type" ); } SwPageFrm *pPage; @@ -2345,7 +2346,7 @@ BOOL SwLayIdle::DoIdleJob( IdleJobType eJob, BOOL bVisAreaOnly ) } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1 /************************************************************************* @@ -2394,7 +2395,7 @@ void SwLayIdle::ShowIdle( ColorData eColorData ) SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : pRoot( pRt ), pImp( pI ) -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1 , bIndicator( FALSE ) #endif @@ -2578,7 +2579,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : if( pImp->IsAccessible() ) pImp->FireAccessibleEvents(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1 if ( bIndicator && pImp->GetShell()->GetWin() ) { diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 496650ba39..a2ec1d26dc 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -252,7 +252,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) pSub = pSub->GetNext(); } pTab = pTab->GetFollow(); - ASSERT( pTab, "Table follow without master" ); + OSL_ENSURE( pTab, "Table follow without master" ); } } do @@ -290,7 +290,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) SwPageFrm *pTabPage = pTab->FindPageFrm(); if( pTabPage != pPage ) { - ASSERT( pPage->GetPhyPageNum() < + OSL_ENSURE( pPage->GetPhyPageNum() < pTabPage->GetPhyPageNum(), "Looping Tableframes" ); pPage = pTabPage; @@ -345,7 +345,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const { sal_Bool bRet = sal_True; @@ -472,7 +472,7 @@ void SwLayoutCache::ClearImpl() SwLayoutCache::~SwLayoutCache() { - ASSERT( !nLockCount, "Deleting a locked SwLayoutCache!?" ); + OSL_ENSURE( !nLockCount, "Deleting a locked SwLayoutCache!?" ); delete pImpl; } @@ -541,7 +541,7 @@ SwLayHelper::~SwLayHelper() { if( pImpl ) { - ASSERT( pDoc && pDoc->GetLayoutCache(), "Missing layoutcache" ); + OSL_ENSURE( pDoc && pDoc->GetLayoutCache(), "Missing layoutcache" ); pDoc->GetLayoutCache()->UnlockImpl(); } } @@ -659,18 +659,18 @@ BOOL SwLayHelper::CheckInsertPage() bNextPageOdd, bInsertEmpty, FALSE, rpPage->GetNext() ); if ( bEnd ) { - ASSERT( rpPage->GetNext(), "Keine neue Seite?" ); + OSL_ENSURE( rpPage->GetNext(), "Keine neue Seite?" ); do { rpPage = (SwPageFrm*)rpPage->GetNext(); } while ( rpPage->GetNext() ); } else { - ASSERT( rpPage->GetNext(), "Keine neue Seite?" ); + OSL_ENSURE( rpPage->GetNext(), "Keine neue Seite?" ); rpPage = (SwPageFrm*)rpPage->GetNext(); if ( rpPage->IsEmptyPage() ) { - ASSERT( rpPage->GetNext(), "Keine neue Seite?" ); + OSL_ENSURE( rpPage->GetNext(), "Keine neue Seite?" ); rpPage = (SwPageFrm*)rpPage->GetNext(); } } @@ -892,7 +892,7 @@ BOOL SwLayHelper::CheckInsert( ULONG nNodeIndex ) SwRowFrm* pHeadline = 0; while( nRowIdx < nRepeat ) { - ASSERT( pTab->GetTable()->GetTabLines()[ nRowIdx ], "Table ohne Zeilen?" ); + OSL_ENSURE( pTab->GetTable()->GetTabLines()[ nRowIdx ], "Table ohne Zeilen?" ); pHeadline = new SwRowFrm( *pTab->GetTable()->GetTabLines()[ nRowIdx ] ); pHeadline->SetRepeatedHeadline( true ); @@ -1187,7 +1187,7 @@ BOOL SwLayCacheIoImpl::OpenRec( BYTE cType ) { BOOL bRes = TRUE; UINT16 nLvl = aRecTypes.Count(); - ASSERT( nLvl == aRecSizes.Count(), "OpenRec: Level" ); + OSL_ENSURE( nLvl == aRecSizes.Count(), "OpenRec: Level" ); UINT32 nPos = pStream->Tell(); if( bWriteMode ) { @@ -1206,8 +1206,8 @@ BOOL SwLayCacheIoImpl::OpenRec( BYTE cType ) if( !nVal || cRecTyp != cType || pStream->GetErrorCode() != SVSTREAM_OK || pStream->IsEof() ) { - ASSERT( nVal, "OpenRec: Record-Header is 0" ); - ASSERT( cRecTyp == cType, + OSL_ENSURE( nVal, "OpenRec: Record-Header is 0" ); + OSL_ENSURE( cRecTyp == cType, "OpenRec: Wrong Record Type" ); aRecTypes[nLvl] = 0; aRecSizes[nLvl] = pStream->Tell(); @@ -1224,8 +1224,8 @@ BOOL SwLayCacheIoImpl::CloseRec( BYTE ) { BOOL bRes = TRUE; UINT16 nLvl = aRecTypes.Count(); - ASSERT( nLvl == aRecSizes.Count(), "CloseRec: wrong Level" ); - ASSERT( nLvl, "CloseRec: no levels" ); + OSL_ENSURE( nLvl == aRecSizes.Count(), "CloseRec: wrong Level" ); + OSL_ENSURE( nLvl, "CloseRec: no levels" ); if( nLvl ) { nLvl--; @@ -1244,7 +1244,7 @@ BOOL SwLayCacheIoImpl::CloseRec( BYTE ) else { UINT32 n = aRecSizes[nLvl]; - ASSERT( n >= nPos, "CloseRec: to much data read" ); + OSL_ENSURE( n >= nPos, "CloseRec: to much data read" ); if( n != nPos ) { pStream->Seek( n ); @@ -1307,7 +1307,7 @@ void SwLayCacheIoImpl::SkipRec() BYTE SwLayCacheIoImpl::OpenFlagRec() { - ASSERT( !bWriteMode, "OpenFlagRec illegal in write mode" ); + OSL_ENSURE( !bWriteMode, "OpenFlagRec illegal in write mode" ); BYTE cFlags; *pStream >> cFlags; nFlagRecEnd = pStream->Tell() + ( cFlags & 0x0F ); @@ -1316,9 +1316,9 @@ BYTE SwLayCacheIoImpl::OpenFlagRec() void SwLayCacheIoImpl::OpenFlagRec( BYTE nFlags, BYTE nLen ) { - ASSERT( bWriteMode, "OpenFlagRec illegal in read mode" ); - ASSERT( (nFlags & 0xF0) == 0, "illegal flags set" ); - ASSERT( nLen < 16, "wrong flag record length" ); + OSL_ENSURE( bWriteMode, "OpenFlagRec illegal in read mode" ); + OSL_ENSURE( (nFlags & 0xF0) == 0, "illegal flags set" ); + OSL_ENSURE( nLen < 16, "wrong flag record length" ); BYTE cFlags = (nFlags << 4) + nLen; *pStream << cFlags; nFlagRecEnd = pStream->Tell() + nLen; @@ -1328,11 +1328,11 @@ void SwLayCacheIoImpl::CloseFlagRec() { if( bWriteMode ) { - ASSERT( pStream->Tell() == nFlagRecEnd, "Wrong amount of data written" ); + OSL_ENSURE( pStream->Tell() == nFlagRecEnd, "Wrong amount of data written" ); } else { - ASSERT( pStream->Tell() <= nFlagRecEnd, "To many data read" ); + OSL_ENSURE( pStream->Tell() <= nFlagRecEnd, "To many data read" ); if( pStream->Tell() != nFlagRecEnd ) pStream->Seek( nFlagRecEnd ); } diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx index cf00b3dda1..9ae1482b45 100644 --- a/sw/source/core/layout/layouter.cxx +++ b/sw/source/core/layout/layouter.cxx @@ -80,7 +80,7 @@ public: void SwEndnoter::CollectEndnotes( SwSectionFrm* pSct ) { - ASSERT( pSct, "CollectEndnotes: Which section?" ); + OSL_ENSURE( pSct, "CollectEndnotes: Which section?" ); if( !pSect ) pSect = pSct; else if( pSct != pSect ) @@ -110,7 +110,7 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn ) } while ( pCnt ); } else - { ASSERT( pNxt->Lower() && pNxt->Lower()->IsSctFrm(), + { OSL_ENSURE( pNxt->Lower() && pNxt->Lower()->IsSctFrm(), "Endnote without content?" ); pNxt->Cut(); delete pNxt; @@ -147,7 +147,7 @@ void SwEndnoter::InsertEndnotes() pSect = NULL; return; } - ASSERT( pSect->Lower() && pSect->Lower()->IsFtnBossFrm(), + OSL_ENSURE( pSect->Lower() && pSect->Lower()->IsFtnBossFrm(), "InsertEndnotes: Where's my column?" ); SwFrm* pRef = pSect->FindLastCntnt( FINDMODE_MYLAST ); SwFtnBossFrm *pBoss = pRef ? pRef->FindFtnBossFrm() @@ -160,7 +160,7 @@ void SwEndnoter::InsertEndnotes() SwLooping::SwLooping( SwPageFrm* pPage ) { - ASSERT( pPage, "Where's my page?" ); + OSL_ENSURE( pPage, "Where's my page?" ); nMinPage = pPage->GetPhyPageNum(); nMaxPage = nMinPage; nCount = 0; @@ -199,7 +199,7 @@ void SwLooping::Control( SwPageFrm* pPage ) } else if( ++nCount > LOOP_DETECT ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1 static BOOL bNoLouie = FALSE; if( bNoLouie ) @@ -209,9 +209,9 @@ void SwLooping::Control( SwPageFrm* pPage ) // FME 2007-08-30 #i81146# new loop control #if OSL_DEBUG_LEVEL > 1 - ASSERT( 0 != mnLoopControlStage, "Looping Louie: Stage 1!" ); - ASSERT( 1 != mnLoopControlStage, "Looping Louie: Stage 2!!" ); - ASSERT( 2 > mnLoopControlStage, "Looping Louie: Stage 3!!!" ); + OSL_ENSURE( 0 != mnLoopControlStage, "Looping Louie: Stage 1!" ); + OSL_ENSURE( 1 != mnLoopControlStage, "Looping Louie: Stage 2!!" ); + OSL_ENSURE( 2 > mnLoopControlStage, "Looping Louie: Stage 3!!!" ); #endif Drastic( pPage->Lower() ); @@ -286,7 +286,7 @@ void SwLayouter::InsertEndnotes( SwSectionFrm* pSect ) void SwLayouter::LoopControl( SwPageFrm* pPage, BYTE ) { - ASSERT( pLooping, "Looping: Lost control" ); + OSL_ENSURE( pLooping, "Looping: Lost control" ); pLooping->Control( pPage ); } @@ -295,7 +295,7 @@ void SwLayouter::LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm ) if ( pLooping && pLooping->IsLoopingLouieLight() ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "Looping Louie (Light): Fixating fractious frame" ) + OSL_ENSURE( false, "Looping Louie (Light): Fixating fractious frame" ); #endif SwLayouter::InsertMovedFwdFrm( rDoc, rFrm, rFrm.FindPageFrm()->GetPhyPageNum() ); } @@ -317,7 +317,7 @@ void SwLayouter::EndLoopControl() void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect ) { - ASSERT( pDoc, "No doc, no fun" ); + OSL_ENSURE( pDoc, "No doc, no fun" ); if( !pDoc->GetLayouter() ) pDoc->SetLayouter( new SwLayouter() ); pDoc->GetLayouter()->_CollectEndnotes( pSect ); @@ -341,7 +341,7 @@ BOOL SwLayouter::Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn ) BOOL SwLayouter::StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage ) { - ASSERT( pDoc, "No doc, no fun" ); + OSL_ENSURE( pDoc, "No doc, no fun" ); if( !pDoc->GetLayouter() ) pDoc->SetLayouter( new SwLayouter() ); return !pDoc->GetLayouter()->pLooping && diff --git a/sw/source/core/layout/makefile.mk b/sw/source/core/layout/makefile.mk index 408fea47b7..e986ec8cf4 100644 --- a/sw/source/core/layout/makefile.mk +++ b/sw/source/core/layout/makefile.mk @@ -89,7 +89,7 @@ SLOFILES = \ $(SLO)$/swselectionlist.obj \ $(SLO)$/unusedf.obj -.IF "$(dbgutil)"!="" +.IF "$(DBG_LEVEL)">="2" SLOFILES += \ $(SLO)$/dbg_lay.obj .ENDIF diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index f58cb6d015..48d422f2bd 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -309,7 +309,7 @@ void _FrmInit() { SwRootFrm::pVout = new SwLayVout(); SwCache *pNew = new SwCache( 100, 100 -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 , "static SwBorderAttrs::pCache" #endif ); @@ -320,13 +320,13 @@ void _FrmInit() void _FrmFinit() { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // im Chache duerfen nur noch 0-Pointer stehen for( USHORT n = SwFrm::GetCachePtr()->Count(); n; ) if( (*SwFrm::GetCachePtr())[ --n ] ) { SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ]; - ASSERT( !pObj, "Wer hat sich nicht ausgetragen?") + OSL_ENSURE( !pObj, "Wer hat sich nicht ausgetragen?"); } #endif delete SwRootFrm::pVout; @@ -348,7 +348,7 @@ SV_IMPL_PTRARR_SORT(SwCurrShells,CurrShellPtr) CurrShell::CurrShell( ViewShell *pNew ) { - ASSERT( pNew, "0-Shell einsetzen?" ); + OSL_ENSURE( pNew, "0-Shell einsetzen?" ); pRoot = pNew->GetLayout(); if ( pRoot ) { @@ -561,7 +561,7 @@ SwRootFrm::~SwRootFrm() delete pCurrShells; - ASSERT( 0==nAccessibleShells, "Some accessible shells are left" ); + OSL_ENSURE( 0==nAccessibleShells, "Some accessible shells are left" ); } /************************************************************************* diff --git a/sw/source/core/layout/objectformatter.cxx b/sw/source/core/layout/objectformatter.cxx index aebb5dcd49..a393127c08 100644 --- a/sw/source/core/layout/objectformatter.cxx +++ b/sw/source/core/layout/objectformatter.cxx @@ -191,7 +191,7 @@ SwObjectFormatter* SwObjectFormatter::CreateObjFormatter( } else { - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatter::CreateObjFormatter(..)> - unexcepted type of anchor frame" ); } @@ -233,11 +233,11 @@ bool SwObjectFormatter::FormatObj( SwAnchoredObject& _rAnchoredObj, { bool bSuccess( true ); - ASSERT( _pAnchorFrm || _rAnchoredObj.GetAnchorFrm(), + OSL_ENSURE( _pAnchorFrm || _rAnchoredObj.GetAnchorFrm(), "<SwObjectFormatter::FormatObj(..)> - missing anchor frame" ); SwFrm& rAnchorFrm = _pAnchorFrm ? *(_pAnchorFrm) : *(_rAnchoredObj.AnchorFrm()); - ASSERT( _pPageFrm || rAnchorFrm.FindPageFrm(), + OSL_ENSURE( _pPageFrm || rAnchorFrm.FindPageFrm(), "<SwObjectFormatter::FormatObj(..)> - missing page frame" ); const SwPageFrm& rPageFrm = _pPageFrm ? *(_pPageFrm) : *(rAnchorFrm.FindPageFrm()); @@ -409,7 +409,7 @@ void SwObjectFormatter::_FormatObj( SwAnchoredObject& _rAnchoredObj ) if ( ++nLoopControlRuns >= nLoopControlMax ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl in SwObjectFormatter::_FormatObj: Stage 3!!!" ); + OSL_ENSURE( false, "LoopControl in SwObjectFormatter::_FormatObj: Stage 3!!!" ); #endif rFlyFrm.ValidateThisAndAllLowers( 2 ); nLoopControlRuns = 0; @@ -491,7 +491,7 @@ bool SwObjectFormatter::_FormatObjsAtFrm( SwTxtFrm* _pMasterTxtFrm ) // is replaced by method <FindPageFrmOfAnchor()>. It's return value // have to be checked. SwPageFrm* pPageFrmOfAnchor = pAnchoredObj->FindPageFrmOfAnchor(); - ASSERT( pPageFrmOfAnchor, + OSL_ENSURE( pPageFrmOfAnchor, "<SwObjectFormatter::_FormatObjsAtFrm()> - missing page frame." ); // --> OD 2004-10-08 #i26945# if ( pPageFrmOfAnchor && pPageFrmOfAnchor == &mrPageFrm ) diff --git a/sw/source/core/layout/objectformatterlayfrm.cxx b/sw/source/core/layout/objectformatterlayfrm.cxx index a695fb2a3e..f147fb2576 100644 --- a/sw/source/core/layout/objectformatterlayfrm.cxx +++ b/sw/source/core/layout/objectformatterlayfrm.cxx @@ -61,7 +61,7 @@ SwObjectFormatterLayFrm* SwObjectFormatterLayFrm::CreateObjFormatter( if ( !_rAnchorLayFrm.IsPageFrm() && !_rAnchorLayFrm.IsFlyFrm() ) { - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatterLayFrm::CreateObjFormatter(..)> - unexcepted type of anchor frame " ); return 0L; } @@ -130,7 +130,7 @@ bool SwObjectFormatterLayFrm::_AdditionalFormatObjsOnPage() { if ( !GetAnchorFrm().IsPageFrm() ) { - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatterLayFrm::_AdditionalFormatObjsOnPage()> - mis-usage of method, call only for anchor frames of type page frame" ); return true; } @@ -172,8 +172,8 @@ bool SwObjectFormatterLayFrm::_AdditionalFormatObjsOnPage() SwPageFrm* pPageFrmOfAnchor = pAnchoredObj->FindPageFrmOfAnchor(); // --> OD 2004-10-08 #i26945# - check, if the page frame of the // object's anchor frame isn't the given page frame - ASSERT( pPageFrmOfAnchor, - "<SwObjectFormatterLayFrm::_AdditionalFormatObjsOnPage()> - missing page frame" ) + OSL_ENSURE( pPageFrmOfAnchor, + "<SwObjectFormatterLayFrm::_AdditionalFormatObjsOnPage()> - missing page frame" ); if ( pPageFrmOfAnchor && // --> OD 2004-10-22 #i35911# pPageFrmOfAnchor->GetPhyPageNum() < rPageFrm.GetPhyPageNum() ) diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index c303a8e22a..472db36318 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -240,7 +240,7 @@ bool SwObjectFormatterTxtFrm::DoFormatObj( SwAnchoredObject& _rAnchoredObj, } else { - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatterTxtFrm::DoFormatObj(..)> - anchor frame not marked to move forward" ); } } @@ -252,7 +252,7 @@ bool SwObjectFormatterTxtFrm::DoFormatObj( SwAnchoredObject& _rAnchoredObj, // index of anchored object in collection of page numbers and // anchor types sal_uInt32 nIdx( CountOfCollected() ); - ASSERT( nIdx > 0, + OSL_ENSURE( nIdx > 0, "<SwObjectFormatterTxtFrm::DoFormatObj(..)> - anchored object not collected!?" ); --nIdx; @@ -300,7 +300,7 @@ bool SwObjectFormatterTxtFrm::DoFormatObj( SwAnchoredObject& _rAnchoredObj, } else { - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatterTxtFrm::DoFormatObj(..)> - anchor frame not marked to move forward" ); } // <-- @@ -341,7 +341,7 @@ bool SwObjectFormatterTxtFrm::DoFormatObjs() else { // the anchor text frame has to be valid, thus assert. - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatterTxtFrm::DoFormatObjs()> called for invalidate anchor text frame." ); } @@ -357,7 +357,7 @@ bool SwObjectFormatterTxtFrm::DoFormatObjs() // are registered at the 'master' anchor text frame. // Thus, format the other floating screen objects through the 'master' // anchor text frame - ASSERT( mpMasterAnchorTxtFrm, + OSL_ENSURE( mpMasterAnchorTxtFrm, "SwObjectFormatterTxtFrm::DoFormatObjs() - missing 'master' anchor text frame" ); bSuccess = _FormatObjsAtFrm( mpMasterAnchorTxtFrm ); @@ -442,7 +442,7 @@ bool SwObjectFormatterTxtFrm::DoFormatObjs() } else { - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatterTxtFrm::DoFormatObjs(..)> - anchor frame not marked to move forward" ); } } @@ -485,7 +485,7 @@ bool SwObjectFormatterTxtFrm::DoFormatObjs() } else { - ASSERT( false, + OSL_ENSURE( false, "<SwObjectFormatterTxtFrm::DoFormatObjs(..)> - anchor frame not marked to move forward" ); } // <-- @@ -573,7 +573,7 @@ SwAnchoredObject* SwObjectFormatterTxtFrm::_GetFirstObjWithMovedFwdAnchor( bool& _boInFollow ) { // --> OD 2004-10-18 #i35017# - constant names have changed - ASSERT( _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE || + OSL_ENSURE( _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE || _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_CONCURRENT, "<SwObjectFormatterTxtFrm::_GetFirstObjWithMovedFwdAnchor(..)> - invalid value for parameter <_nWrapInfluenceOnPosition>" ); // <-- @@ -658,7 +658,7 @@ bool SwObjectFormatterTxtFrm::CheckMovedFwdCondition( (_rAnchoredObj.GetFrmFmt().GetAnchor().GetAnchorId() == FLY_AT_PARA))) { SwFrm* pAnchorFrm = _rAnchoredObj.GetAnchorFrmContainingAnchPos(); - ASSERT( pAnchorFrm->IsTxtFrm(), + OSL_ENSURE( pAnchorFrm->IsTxtFrm(), "<SwObjectFormatterTxtFrm::CheckMovedFwdCondition(..) - wrong type of anchor frame>" ); SwTxtFrm* pAnchorTxtFrm = static_cast<SwTxtFrm*>(pAnchorFrm); bool bCheck( false ); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index b8ca66dc45..4950ef7a61 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -415,7 +415,7 @@ void MA_FASTCALL lcl_MakeObjs( const SwSpzFrmFmts &rTbl, SwPageFrm *pPage ) pSdrObj = 0; if ( bSdrObj && 0 == (pSdrObj = pFmt->FindSdrObject()) ) { - ASSERT( FALSE, "DrawObject not found." ); + OSL_ENSURE( FALSE, "DrawObject not found." ); pFmt->GetDoc()->DelFrmFmt( pFmt ); --i; continue; @@ -588,17 +588,17 @@ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, //Abgesehen von den Grossenverhaeltnissen sind noch andere //Dinge betroffen. //1. Spaltigkeit. - ASSERT( pOld && pNew, "FMT_CHG Missing Format." ); + OSL_ENSURE( pOld && pNew, "FMT_CHG Missing Format." ); const SwFmt* pOldFmt = ((SwFmtChg*)pOld)->pChangedFmt; const SwFmt* pNewFmt = ((SwFmtChg*)pNew)->pChangedFmt; - ASSERT( pOldFmt && pNewFmt, "FMT_CHG Missing Format." ); + OSL_ENSURE( pOldFmt && pNewFmt, "FMT_CHG Missing Format." ); const SwFmtCol &rOldCol = pOldFmt->GetCol(); const SwFmtCol &rNewCol = pNewFmt->GetCol(); if( rOldCol != rNewCol ) { SwLayoutFrm *pB = FindBodyCont(); - ASSERT( pB, "Seite ohne Body." ); + OSL_ENSURE( pB, "Seite ohne Body." ); pB->ChgColumns( rOldCol, rNewCol ); rInvFlags |= 0x20; } @@ -666,7 +666,7 @@ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, case RES_COL: { SwLayoutFrm *pB = FindBodyCont(); - ASSERT( pB, "Seite ohne Body." ); + OSL_ENSURE( pB, "Seite ohne Body." ); pB->ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew ); rInvFlags |= 0x22; } @@ -832,7 +832,7 @@ SwPageDesc *SwPageFrm::FindPageDesc() ->GetPageDesc( 0 )); - ASSERT( pRet, "Kein Descriptor gefunden." ); + OSL_ENSURE( pRet, "Kein Descriptor gefunden." ); return pRet; } @@ -944,11 +944,11 @@ void SwPageFrm::Cut() |*************************************************************************/ void SwPageFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) { - ASSERT( pParent->IsRootFrm(), "Parent ist keine Root." ); - ASSERT( pParent, "Kein Parent fuer Paste." ); - ASSERT( pParent != this, "Bin selbst der Parent." ); - ASSERT( pSibling != this, "Bin mein eigener Nachbar." ); - ASSERT( !GetPrev() && !GetNext() && !GetUpper(), + OSL_ENSURE( pParent->IsRootFrm(), "Parent ist keine Root." ); + OSL_ENSURE( pParent, "Kein Parent fuer Paste." ); + OSL_ENSURE( pParent != this, "Bin selbst der Parent." ); + OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." ); + OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(), "Bin noch irgendwo angemeldet." ); //In den Baum einhaengen. @@ -1061,7 +1061,7 @@ void SwPageFrm::PrepareRegisterChg() |*************************************************************************/ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields ) { - ASSERT( pStart, "Keine Startpage." ); + OSL_ENSURE( pStart, "Keine Startpage." ); ViewShell *pSh = pStart->GetShell(); SwViewImp *pImp = pSh ? pSh->Imp() : 0; @@ -1188,10 +1188,10 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields ) if ( pPage->GetFmt() != pFmtWish ) pPage->SetFrmFmt( pFmtWish ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { - ASSERT( FALSE, "CheckPageDescs, missing solution" ); + OSL_ENSURE( FALSE, "CheckPageDescs, missing solution" ); } #endif } @@ -1231,7 +1231,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields ) pDoc->UpdatePageFlds( &aMsgHnt ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //Ein paar Pruefungen muessen schon erlaubt sein. //1. Keine zwei EmptyPages hintereinander. @@ -1244,7 +1244,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields ) { if ( bEmpty ) { - ASSERT( FALSE, "Doppelte Leerseiten." ); + OSL_ENSURE( FALSE, "Doppelte Leerseiten." ); break; //Einmal reicht. } bEmpty = TRUE; @@ -1256,7 +1256,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields ) //moeglich: Ein paar Seiten, auf der ersten 'erste Seite' anwenden, //rechte als folge der ersten, linke als folge der rechten, rechte als //folge der linken. -// ASSERT( pPg->GetPageDesc() == pPg->FindPageDesc(), +// OSL_ENSURE( pPg->GetPageDesc() == pPg->FindPageDesc(), // "Seite mit falschem Descriptor." ); pPg = (SwPageFrm*)pPg->GetNext(); @@ -1301,7 +1301,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn ) if ( !pDesc ) pDesc = pPrevPage->GetPageDesc()->GetFollow(); - ASSERT( pDesc, "Missing PageDesc" ); + OSL_ENSURE( pDesc, "Missing PageDesc" ); if( !(bWishedOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt()) ) bWishedOdd = !bWishedOdd; @@ -1332,7 +1332,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn ) bCheckPages = TRUE; } pFmt = bWishedOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt(); - ASSERT( pFmt, "Descriptor without format." ); + OSL_ENSURE( pFmt, "Descriptor without format." ); SwPageFrm *pPage = new SwPageFrm( pFmt, pDesc ); pPage->Paste( pRoot, pSibling ); pPage->PreparePage( bFtn ); @@ -1428,8 +1428,8 @@ SwTwips SwRootFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL ) |*************************************************************************/ SwTwips SwRootFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL ) { - ASSERT( nDist >= 0, "nDist < 0." ); - ASSERT( nDist <= Frm().Height(), "nDist > als aktuelle Groesse." ); + OSL_ENSURE( nDist >= 0, "nDist < 0." ); + OSL_ENSURE( nDist <= Frm().Height(), "nDist > als aktuelle Groesse." ); if ( !bTst ) Frm().SSize().Height() -= nDist; @@ -1515,7 +1515,7 @@ void SwRootFrm::RemoveSuperfluous() while ( pPage->IsFtnPage() ) { pPage = (SwPageFrm*)pPage->GetPrev(); - ASSERT( pPage, "Nur noch Endnotenseiten uebrig." ); + OSL_ENSURE( pPage, "Nur noch Endnotenseiten uebrig." ); } continue; } @@ -1668,14 +1668,14 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage ) { //Umhaengen kann er sich selbst, indem wir ihm //einfach ein Modify mit seinem AnkerAttr schicken. -#ifndef DBG_UTIL - rFmt.SwModify::Modify( 0, (SwFmtAnchor*)&rAnch ); -#else +#if OSL_DEBUG_LEVEL > 1 const sal_uInt32 nCnt = pPage->GetSortedObjs()->Count(); rFmt.SwModify::Modify( 0, (SwFmtAnchor*)&rAnch ); - ASSERT( !pPage->GetSortedObjs() || + OSL_ENSURE( !pPage->GetSortedObjs() || nCnt != pPage->GetSortedObjs()->Count(), "Kann das Obj nicht umhaengen." ); +#else + rFmt.SwModify::Modify( 0, (SwFmtAnchor*)&rAnch ); #endif --i; } @@ -1755,7 +1755,7 @@ void SwRootFrm::ImplInvalidateBrowseWidth() |*************************************************************************/ void SwRootFrm::ImplCalcBrowseWidth() { - ASSERT( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE), + OSL_ENSURE( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE), "CalcBrowseWidth and not in BrowseView" ); //Die (minimale) Breite wird von Rahmen, Tabellen und Zeichenobjekten @@ -2123,7 +2123,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi } else { - ASSERT( pViewOpt, "CheckViewLayout required ViewOptions" ) + OSL_ENSURE( pViewOpt, "CheckViewLayout required ViewOptions" ); const USHORT nColumns = pViewOpt->GetViewLayoutColumns(); const bool bBookMode = pViewOpt->IsViewLayoutBookMode(); @@ -2471,7 +2471,7 @@ const SwPageFrm& SwPageFrm::GetFormatPage() const pRet = static_cast<const SwPageFrm*>( GetNext() ); } } - ASSERT( pRet, + OSL_ENSURE( pRet, "<SwPageFrm::GetFormatPage()> - inconsistent layout: empty page without previous and next page frame --> crash." ); // <-- } diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 374dc48c0c..60ff05b819 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -339,13 +339,13 @@ const SwFrmFmt* SwPageDesc::GetPageFmtOfNode( const SwNode& rNd, const SwPageDesc* pPd = bCheckForThisPgDc ? this : ((SwPageFrm*)pChkFrm)->GetPageDesc(); pRet = &pPd->GetMaster(); - ASSERT( ((SwPageFrm*)pChkFrm)->GetPageDesc() == pPd, + OSL_ENSURE( ((SwPageFrm*)pChkFrm)->GetPageDesc() == pPd, "Falcher Node fuers erkennen des Seitenformats" ); // an welchem Format haengt diese Seite? if( pRet != pChkFrm->GetRegisteredIn() ) { pRet = &pPd->GetLeft(); - ASSERT( pRet == pChkFrm->GetRegisteredIn(), + OSL_ENSURE( pRet == pChkFrm->GetRegisteredIn(), "Falcher Node fuers erkennen des Seitenformats" ); } } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 5d9e44fdc2..50ac552ca5 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1400,12 +1400,12 @@ void MA_FASTCALL lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, continue; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //Flys, die innerhalb des eigenen verankert sind, muessen eine //groessere OrdNum haben oder Zeichengebunden sein. if ( pSelfFly && bLowerOfSelf ) { - ASSERT( pFly->IsFlyInCntFrm() || + OSL_ENSURE( pFly->IsFlyInCntFrm() || pSdrObj->GetOrdNumDirect() > pSelfFly->GetVirtDrawObj()->GetOrdNumDirect(), "Fly with wrong z-Order" ); } @@ -1863,7 +1863,7 @@ void MA_FASTCALL DrawGraphic( const SvxBrushItem *pBrush, bDraw = FALSE; break; - default: ASSERT( !pOutDev, "new Graphic position?" ); + default: OSL_ENSURE( !pOutDev, "new Graphic position?" ); } /// OD 02.09.2002 #99657# @@ -2084,35 +2084,35 @@ void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const OutputDevice &aOut ) io_aSwRect = SwRect( aSizedRect ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 Rectangle aTestOrgPxRect = aOut.LogicToPixel( io_aSwRect.SVRect() ); Rectangle aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect == aTestNewPxRect, + OSL_ENSURE( aTestOrgPxRect == aTestNewPxRect, "Error in lcl_AlignRectToPixelSize(..): Adjusted rectangle has incorrect position or size"); #if OSL_DEBUG_LEVEL > 1 Rectangle aTestNewRect( aSizedRect ); /// check Left() --aSizedRect.Left(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Left() >= (aTestNewPxRect.Left()+1), + OSL_ENSURE( aTestOrgPxRect.Left() >= (aTestNewPxRect.Left()+1), "Error in lcl_AlignRectToPixelSize(..): Left() not correct adjusted"); ++aSizedRect.Left(); /// check Right() ++aSizedRect.Right(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Right() <= (aTestNewPxRect.Right()-1), + OSL_ENSURE( aTestOrgPxRect.Right() <= (aTestNewPxRect.Right()-1), "Error in lcl_AlignRectToPixelSize(..): Right() not correct adjusted"); --aSizedRect.Right(); /// check Top() --aSizedRect.Top(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Top() >= (aTestNewPxRect.Top()+1), + OSL_ENSURE( aTestOrgPxRect.Top() >= (aTestNewPxRect.Top()+1), "Error in lcl_AlignRectToPixelSize(..): Top() not correct adjusted"); ++aSizedRect.Top(); /// check Bottom() ++aSizedRect.Bottom(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Bottom() <= (aTestNewPxRect.Bottom()-1), + OSL_ENSURE( aTestOrgPxRect.Bottom() <= (aTestNewPxRect.Bottom()-1), "Error in lcl_AlignRectToPixelSize(..): Bottom() not correct adjusted"); --aSizedRect.Bottom(); #endif @@ -2505,7 +2505,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, // pStyles[ 6 ] = bHori ? aRFromB : BFromR, SwLineEntryMapConstIter aMapIter = maVertLines.find( rStartPoint.X() ); - ASSERT( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rVertSet = (*aMapIter).second; SwLineEntrySetConstIter aIter = rVertSet.begin(); @@ -2530,7 +2530,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, } aMapIter = maHoriLines.find( rStartPoint.Y() ); - ASSERT( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rHoriSet = (*aMapIter).second; aIter = rHoriSet.begin(); @@ -2557,7 +2557,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, if ( bHori ) { aMapIter = maVertLines.find( rEndPoint.X() ); - ASSERT( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rVertSet2 = (*aMapIter).second; aIter = rVertSet2.begin(); @@ -2574,7 +2574,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, else { aMapIter = maHoriLines.find( rEndPoint.Y() ); - ASSERT( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rHoriSet2 = (*aMapIter).second; aIter = rHoriSet2.begin(); @@ -2680,7 +2680,7 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) if ( SwLineEntry::OVERLAP1 == nOverlapType ) { - ASSERT( rNew.mnStartPos >= rOld.mnStartPos, "Overlap type 3? How this?" ) + OSL_ENSURE( rNew.mnStartPos >= rOld.mnStartPos, "Overlap type 3? How this?" ); // new left segment const SwLineEntry aLeft( nKey, rOld.mnStartPos, rNew.mnStartPos, rOldAttr ); @@ -2774,7 +2774,7 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) const { - ASSERT( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); + OSL_ENSURE( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); PROTOCOL( this, PROT_FILE_INIT, 0, 0) @@ -3081,7 +3081,7 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con } } - ASSERT( !pPage->GetNext() || pPage->GetNext()->IsPageFrm(), + OSL_ENSURE( !pPage->GetNext() || pPage->GetNext()->IsPageFrm(), "Nachbar von Seite keine Seite." ); pPage = (SwPageFrm*)pPage->GetNext(); } @@ -3128,9 +3128,9 @@ void SwRootFrm::HackPrepareLongTblPaint( int nMode ) { switch ( nMode ) { - case HACK_TABLEMODE_INIT : ASSERT( !pLines, "HackPrepare: already prepared" ); + case HACK_TABLEMODE_INIT : OSL_ENSURE( !pLines, "HackPrepare: already prepared" ); pLines = new SwLineRects; - ASSERT( !pGlobalShell, "old GlobalShell lost" ); + OSL_ENSURE( !pGlobalShell, "old GlobalShell lost" ); pGlobalShell = GetShell(); bTableHack = TRUE; break; @@ -3475,7 +3475,7 @@ BOOL SwFlyFrm::IsPaint( SdrObject *pObj, const ViewShell *pSh ) // OD 02.07.2003 #108784# - debug assert if ( !pObj->ISA(SdrObjGroup) ) { - ASSERT( false, "<SwFlyFrm::IsPaint(..)> - paint of drawing object without anchor frame!?" ); + OSL_ENSURE( false, "<SwFlyFrm::IsPaint(..)> - paint of drawing object without anchor frame!?" ); } } } @@ -3958,7 +3958,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect, } break; default: - ASSERT( !this, "new ShadowLocation() ?" ) + OSL_ENSURE( !this, "new ShadowLocation() ?" ); break; } @@ -4496,8 +4496,8 @@ void lcl_PaintTopBottomLine( const sal_Bool _bTop, const SwFrm* lcl_HasNextCell( const SwFrm& rFrm ) { - ASSERT( rFrm.IsCellFrm(), - "lcl_HasNextCell( const SwFrm& rFrm ) should be called with SwCellFrm" ) + OSL_ENSURE( rFrm.IsCellFrm(), + "lcl_HasNextCell( const SwFrm& rFrm ) should be called with SwCellFrm" ); const SwFrm* pTmpFrm = &rFrm; do @@ -4550,7 +4550,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, const SwBorderAttrs& _rCellBorderAttrs, const bool _bTop ) { - ASSERT( _pCellFrm, "No cell frame available, dying soon" ) + OSL_ENSURE( _pCellFrm, "No cell frame available, dying soon" ); // determine, if cell frame is at bottom/top border of a table frame and // the table frame has/is a follow. @@ -4579,7 +4579,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, } } } - ASSERT( pTmpFrm && pTmpFrm->IsRowFrm(), "No RowFrm available" ); + OSL_ENSURE( pTmpFrm && pTmpFrm->IsRowFrm(), "No RowFrm available" ); const SwLayoutFrm* pParentRowFrm = static_cast<const SwLayoutFrm*>(pTmpFrm); const SwTabFrm* pParentTabFrm = @@ -4645,7 +4645,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, { pLowerCell = pLowerCell->GetLower(); } - ASSERT( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); + OSL_ENSURE( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); pRet = pLowerCell; } else if ( !_bTop && !_rCellBorderAttrs.GetBox().GetBottom() ) @@ -4677,7 +4677,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, } pLowerCell = pLowerCell->GetLower(); } - ASSERT( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); + OSL_ENSURE( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); pRet = pLowerCell; } } @@ -4891,7 +4891,7 @@ void SwFtnContFrm::PaintLine( const SwRect& rRect, case FTNADJ_LEFT: /* do nothing */; break; default: - ASSERT( !this, "Neues Adjustment fuer Fussnotenlinie?" ); + OSL_ENSURE( !this, "Neues Adjustment fuer Fussnotenlinie?" ); } SwTwips nLineWidth = rInf.GetLineWidth(); const SwRect aLineRect = bVert ? @@ -4938,7 +4938,7 @@ void SwLayoutFrm::PaintColLines( const SwRect &rRect, const SwFmtCol &rFmtCol, case COLADJ_BOTTOM: break; default: - ASSERT( !this, "Neues Adjustment fuer Spaltenlinie?" ); + OSL_ENSURE( !this, "Neues Adjustment fuer Spaltenlinie?" ); } if( nTop ) @@ -6026,7 +6026,7 @@ void MA_FASTCALL lcl_RefreshLine( const SwLayoutFrm *pLay, SwLineRects* _pSubsLines ) { //In welche Richtung gehts? Kann nur Horizontal oder Vertikal sein. - ASSERT( ((rP1.X() == rP2.X()) || (rP1.Y() == rP2.Y())), + OSL_ENSURE( ((rP1.X() == rP2.X()) || (rP1.Y() == rP2.Y())), "Schraege Hilfslinien sind nicht erlaubt." ); const PointPtr pDirPt = rP1.X() == rP2.X() ? pY : pX; const PointPtr pOthPt = pDirPt == pX ? pY : pX; @@ -6420,8 +6420,8 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const if ( bFlyMetafile ) return; - ASSERT( GetUpper(), "Retoucheversuch ohne Upper." ); - ASSERT( GetShell() && pGlobalShell->GetWin(), "Retouche auf dem Drucker?" ); + OSL_ENSURE( GetUpper(), "Retoucheversuch ohne Upper." ); + OSL_ENSURE( GetShell() && pGlobalShell->GetWin(), "Retouche auf dem Drucker?" ); SwRect aRetouche( GetUpper()->PaintArea() ); aRetouche.Top( Frm().Top() + Frm().Height() ); @@ -6660,7 +6660,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) SFX_ITEM_SET != GetAttrSet().GetItemState( RES_URL, TRUE ); if( bNoteURL ) { - ASSERT( !pNoteURL, "MakeGraphic: pNoteURL already used? " ); + OSL_ENSURE( !pNoteURL, "MakeGraphic: pNoteURL already used? " ); pNoteURL = new SwNoteURL; } SwFlyFrm *pFly = (SwFlyFrm*)pFirst; @@ -6740,7 +6740,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) if( bNoteURL ) { - ASSERT( pNoteURL, "MakeGraphic: Good Bye, NoteURL." ); + OSL_ENSURE( pNoteURL, "MakeGraphic: Good Bye, NoteURL." ); pNoteURL->FillImageMap( pMap, pFly->Frm().Pos(), aMap ); delete pNoteURL; pNoteURL = NULL; diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 54d708840c..a3a5f2528c 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -126,7 +126,7 @@ SwSectionFrm::SwSectionFrm( SwSectionFrm &rSect, BOOL bMaster ) : // frame and its insert in the layout. void SwSectionFrm::Init() { - ASSERT( GetUpper(), "SwSectionFrm::Init before insertion?!" ); + OSL_ENSURE( GetUpper(), "SwSectionFrm::Init before insertion?!" ); SWRECTFN( this ) long nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)(); (Frm().*fnRect->fnSetWidth)( nWidth ); @@ -191,7 +191,7 @@ void SwSectionFrm::DelEmpty( BOOL bRemove ) { if( IsColLocked() ) { - ASSERT( !bRemove, "Don't delete locked SectionFrms" ); + OSL_ENSURE( !bRemove, "Don't delete locked SectionFrms" ); return; } SwFrm* pUp = GetUpper(); @@ -262,7 +262,7 @@ void SwSectionFrm::Cut() void SwSectionFrm::_Cut( BOOL bRemove ) { - ASSERT( GetUpper(), "Cut ohne Upper()." ); + OSL_ENSURE( GetUpper(), "Cut ohne Upper()." ); PROTOCOL( this, PROT_CUT, 0, GetUpper() ) @@ -347,11 +347,11 @@ void SwSectionFrm::_Cut( BOOL bRemove ) void SwSectionFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) { - ASSERT( pParent, "Kein Parent fuer Paste." ); - ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); - ASSERT( pParent != this, "Bin selbst der Parent." ); - ASSERT( pSibling != this, "Bin mein eigener Nachbar." ); - ASSERT( !GetPrev() && !GetUpper(), + OSL_ENSURE( pParent, "Kein Parent fuer Paste." ); + OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); + OSL_ENSURE( pParent != this, "Bin selbst der Parent." ); + OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." ); + OSL_ENSURE( !GetPrev() && !GetUpper(), "Bin noch irgendwo angemeldet." ); PROTOCOL( this, PROT_PASTE, 0, GetUpper() ) @@ -547,7 +547,7 @@ void SwSectionFrm::MergeNext( SwSectionFrm* pNxt ) BOOL SwSectionFrm::SplitSect( SwFrm* pFrm, BOOL bApres ) { - ASSERT( pFrm, "SplitSect: Why?" ); + OSL_ENSURE( pFrm, "SplitSect: Why?" ); SwFrm* pOther = bApres ? pFrm->FindNext() : pFrm->FindPrev(); if( !pOther ) return FALSE; @@ -556,7 +556,7 @@ BOOL SwSectionFrm::SplitSect( SwFrm* pFrm, BOOL bApres ) return FALSE; // Den Inhalt zur Seite stellen SwFrm* pSav = ::SaveCntnt( this, bApres ? pOther : pFrm ); - ASSERT( pSav, "SplitSect: What's on?" ); + OSL_ENSURE( pSav, "SplitSect: What's on?" ); if( pSav ) // Robust { // Einen neuen SctFrm anlegen, nicht als Follow/Master SwSectionFrm* pNew = new SwSectionFrm( *pSect->GetSection() ); @@ -776,7 +776,7 @@ void SwSectionFrm::MoveCntntAndDelete( SwSectionFrm* pDel, BOOL bSave ) // jetzt koennen eventuell zwei Teile des uebergeordneten Bereich verschmelzen if( pPrvSct && !pPrvSct->IsJoinLocked() ) { - ASSERT( pNxtSct, "MoveCntnt: No Merge" ); + OSL_ENSURE( pNxtSct, "MoveCntnt: No Merge" ); pPrvSct->MergeNext( pNxtSct ); } } @@ -787,7 +787,9 @@ void SwSectionFrm::MakeAll() return; if( !pSection ) // Durch DelEmpty { - ASSERT( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ), "SectionFrm without Section" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ), "SectionFrm without Section" ); +#endif if( !bValidPos ) { if( GetUpper() ) @@ -840,7 +842,7 @@ void SwSectionFrm::MakeAll() BOOL SwSectionFrm::ShouldBwdMoved( SwLayoutFrm *, BOOL , BOOL & ) { - ASSERT( FALSE, "Hups, wo ist meine Tarnkappe?" ); + OSL_ENSURE( FALSE, "Hups, wo ist meine Tarnkappe?" ); return FALSE; } @@ -957,7 +959,7 @@ SwFtnFrm* lcl_FindEndnote( SwSectionFrm* &rpSect, BOOL &rbEmpty, SwSectionFrm* pSect = rbEmpty ? rpSect->GetFollow() : rpSect; while( pSect ) { - ASSERT( (pSect->Lower() && pSect->Lower()->IsColumnFrm()) || pSect->GetUpper()->IsFtnFrm(), + OSL_ENSURE( (pSect->Lower() && pSect->Lower()->IsColumnFrm()) || pSect->GetUpper()->IsFtnFrm(), "InsertEndnotes: Where's my column?" ); // i73332: Columned section in endnote @@ -1026,9 +1028,9 @@ void lcl_ColumnRefresh( SwSectionFrm* pSect, BOOL bFollow ) void SwSectionFrm::CollectEndnotes( SwLayouter* pLayouter ) { - ASSERT( IsColLocked(), "CollectEndnotes: You love the risk?" ); + OSL_ENSURE( IsColLocked(), "CollectEndnotes: You love the risk?" ); // i73332: Section in footnode does not have columns! - ASSERT( (Lower() && Lower()->IsColumnFrm()) || GetUpper()->IsFtnFrm(), "Where's my column?" ); + OSL_ENSURE( (Lower() && Lower()->IsColumnFrm()) || GetUpper()->IsFtnFrm(), "Where's my column?" ); SwSectionFrm* pSect = this; SwFtnFrm* pFtn; @@ -1153,7 +1155,7 @@ void SwSectionFrm::SimpleFormat() { if ( IsJoinLocked() || IsColLocked() ) return; - // ASSERT( pFollow, "SimpleFormat: Follow required" ); + // OSL_ENSURE( pFollow, "SimpleFormat: Follow required" ); LockJoin(); SWRECTFN( this ) if( GetPrev() || GetUpper() ) @@ -1333,8 +1335,10 @@ void SwSectionFrm::Format( const SwBorderAttrs *pAttr ) { if( !pSection ) // Durch DelEmpty { - ASSERT( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ), +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ), "SectionFrm without Section" ); +#endif bValidSize = bValidPos = bValidPrtArea = TRUE; return; } @@ -1584,7 +1588,7 @@ SwLayoutFrm *SwFrm::GetNextSctLeaf( MakePageType eMakePage ) // SwSectionFrm *pSect = GetUpper()->FindSctFrm(); SwSectionFrm *pSect = FindSctFrm(); BOOL bWrongPage = FALSE; - ASSERT( pSect, "GetNextSctLeaf: Missing SectionFrm" ); + OSL_ENSURE( pSect, "GetNextSctLeaf: Missing SectionFrm" ); // Hier eine Abkuerzung fuer Bereiche mit Follows, // dieser kann akzeptiert werden, wenn keine Spalten oder Seiten (ausser Dummyseiten) @@ -1753,7 +1757,7 @@ SwLayoutFrm *SwFrm::GetNextSctLeaf( MakePageType eMakePage ) pNxt = (SwSectionFrm*)pTmp; else { - ASSERT( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" ); + OSL_ENSURE( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" ); pNxt = (SwTabFrm*)pTmp; } while( !pNxtCntnt && 0 != ( pTmp = pTmp->GetNext() ) ) @@ -1843,7 +1847,7 @@ SwLayoutFrm *SwFrm::GetPrevSctLeaf( MakePageType ) // nur ein Spaltenwechsel erfolgen, eine der oberen Abkuerzungen haette // zuschlagen muessen, ebenso wenn der Bereich einen pPrev hat. // Jetzt ziehen wir sogar eine leere Spalte in Betracht... - ASSERT( FindSctFrm(), "GetNextSctLeaf: Missing SectionFrm" ); + OSL_ENSURE( FindSctFrm(), "GetNextSctLeaf: Missing SectionFrm" ); if( ( IsInTab() && !IsTabFrm() ) || FindFooterOrHeader() ) return pCol; @@ -2314,7 +2318,7 @@ SwFrm* SwFrm::_GetIndPrev() const // could be an empty section frame. The caller has to assure, that the // frame has no direct previous frame or only empty section frames as // previous frames. - ASSERT( /*!pPrev &&*/ IsInSct(), "Why?" ); + OSL_ENSURE( /*!pPrev &&*/ IsInSct(), "Why?" ); // <-- const SwFrm* pSct = GetUpper(); if( !pSct ) @@ -2328,8 +2332,8 @@ SwFrm* SwFrm::_GetIndPrev() const const SwFrm* pCol = GetUpper()->GetUpper()->GetPrev(); while( pCol ) { - ASSERT( pCol->IsColumnFrm(), "GetIndPrev(): ColumnFrm expected" ); - ASSERT( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(), + OSL_ENSURE( pCol->IsColumnFrm(), "GetIndPrev(): ColumnFrm expected" ); + OSL_ENSURE( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(), "GetIndPrev(): Where's the body?"); if( ((SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower())->Lower() ) return NULL; @@ -2346,7 +2350,7 @@ SwFrm* SwFrm::_GetIndPrev() const SwFrm* SwFrm::_GetIndNext() { - ASSERT( !pNext && IsInSct(), "Why?" ); + OSL_ENSURE( !pNext && IsInSct(), "Why?" ); SwFrm* pSct = GetUpper(); if( !pSct ) return NULL; @@ -2358,8 +2362,8 @@ SwFrm* SwFrm::_GetIndNext() SwFrm* pCol = GetUpper()->GetUpper()->GetNext(); while( pCol ) { - ASSERT( pCol->IsColumnFrm(), "GetIndNext(): ColumnFrm expected" ); - ASSERT( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(), + OSL_ENSURE( pCol->IsColumnFrm(), "GetIndNext(): ColumnFrm expected" ); + OSL_ENSURE( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(), "GetIndNext(): Where's the body?"); if( ((SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower())->Lower() ) return NULL; @@ -2630,7 +2634,7 @@ SwFtnContFrm* SwSectionFrm::ContainsFtnCont( const SwFtnContFrm* pCont ) const if( pCont ) { pLay = pCont->FindFtnBossFrm( 0 ); - ASSERT( IsAnLower( pLay ), "ConatainsFtnCont: Wrong FtnContainer" ); + OSL_ENSURE( IsAnLower( pLay ), "ConatainsFtnCont: Wrong FtnContainer" ); pLay = (SwLayoutFrm*)pLay->GetNext(); } else if( Lower() && Lower()->IsColumnFrm() ) @@ -2641,11 +2645,11 @@ SwFtnContFrm* SwSectionFrm::ContainsFtnCont( const SwFtnContFrm* pCont ) const { if( pLay->Lower() && pLay->Lower()->GetNext() ) { - ASSERT( pLay->Lower()->GetNext()->IsFtnContFrm(), + OSL_ENSURE( pLay->Lower()->GetNext()->IsFtnContFrm(), "ToMaximize: Unexspected Frame" ); pRet = (SwFtnContFrm*)pLay->Lower()->GetNext(); } - ASSERT( !pLay->GetNext() || pLay->GetNext()->IsLayoutFrm(), + OSL_ENSURE( !pLay->GetNext() || pLay->GetNext()->IsLayoutFrm(), "ToMaximize: ColFrm exspected" ); pLay = (SwLayoutFrm*)pLay->GetNext(); } @@ -2741,12 +2745,12 @@ void SwRootFrm::InsertEmptySct( SwSectionFrm* pDel ) void SwRootFrm::_DeleteEmptySct() { - ASSERT( pDestroy, "Keine Liste, keine Kekse" ); + OSL_ENSURE( pDestroy, "Keine Liste, keine Kekse" ); while( pDestroy->Count() ) { SwSectionFrm* pSect = (*pDestroy)[0]; pDestroy->Remove( USHORT(0) ); - ASSERT( !pSect->IsColLocked() && !pSect->IsJoinLocked(), + OSL_ENSURE( !pSect->IsColLocked() && !pSect->IsJoinLocked(), "DeleteEmptySct: Locked SectionFrm" ); if( !pSect->Frm().HasArea() && !pSect->ContainsCntnt() ) { @@ -2766,20 +2770,20 @@ void SwRootFrm::_DeleteEmptySct() } } else { - ASSERT( pSect->GetSection(), "DeleteEmptySct: Halbtoter SectionFrm?!" ); + OSL_ENSURE( pSect->GetSection(), "DeleteEmptySct: Halbtoter SectionFrm?!" ); } } } void SwRootFrm::_RemoveFromList( SwSectionFrm* pSct ) { - ASSERT( pDestroy, "Where's my list?" ); + OSL_ENSURE( pDestroy, "Where's my list?" ); USHORT nPos; if( pDestroy->Seek_Entry( pSct, &nPos ) ) pDestroy->Remove( nPos ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL SwRootFrm::IsInDelList( SwSectionFrm* pSct ) const { diff --git a/sw/source/core/layout/sortedobjsimpl.cxx b/sw/source/core/layout/sortedobjsimpl.cxx index 6b1674cea7..25b1968fd8 100644 --- a/sw/source/core/layout/sortedobjsimpl.cxx +++ b/sw/source/core/layout/sortedobjsimpl.cxx @@ -67,7 +67,7 @@ SwAnchoredObject* SwSortedObjsImpl::operator[]( sal_uInt32 _nIndex ) if ( _nIndex >= Count() ) { - ASSERT( false, "<SwSortedObjsImpl::operator[]> - index out of range" ); + OSL_ENSURE( false, "<SwSortedObjsImpl::operator[]> - index out of range" ); } else { @@ -220,7 +220,7 @@ bool SwSortedObjsImpl::Insert( SwAnchoredObject& _rAnchoredObj ) { // list already contains object #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, + OSL_ENSURE( false, "<SwSortedObjsImpl::Insert()> - already contains object" ); #endif return true; @@ -250,7 +250,7 @@ bool SwSortedObjsImpl::Remove( SwAnchoredObject& _rAnchoredObj ) // object not found. bRet = false; #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, + OSL_ENSURE( false, "<SwSortedObjsImpl::Remove()> - object not found" ); #endif } @@ -275,7 +275,7 @@ bool SwSortedObjsImpl::Update( SwAnchoredObject& _rAnchoredObj ) if ( !Contains( _rAnchoredObj ) ) { // given anchored object not found in list - ASSERT( false, + OSL_ENSURE( false, "<SwSortedObjsImpl::Update(..) - sorted list doesn't contain given anchored object" ); return false; } diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 1145b61ed8..d801beffd7 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -379,7 +379,7 @@ SwFrm::~SwFrm() ViewShell *pVSh = pRootFrm->GetCurrShell(); if( pVSh && pVSh->Imp() ) { - ASSERT( !GetLower(), "Lowers should be dispose already!" ); + OSL_ENSURE( !GetLower(), "Lowers should be dispose already!" ); pVSh->Imp()->DisposeAccessibleFrm( this ); } } @@ -397,7 +397,7 @@ SwFrm::~SwFrm() SdrObject* pSdrObj = pAnchoredObj->DrawObj(); SwDrawContact* pContact = static_cast<SwDrawContact*>(pSdrObj->GetUserCall()); - ASSERT( pContact, + OSL_ENSURE( pContact, "<SwFrm::~SwFrm> - missing contact for drawing object" ); if ( pContact ) { @@ -409,7 +409,7 @@ SwFrm::~SwFrm() delete pDrawObjs; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // JP 15.10.2001: for detection of access to deleted frames pDrawObjs = (SwSortedObjs*)0x33333333; #endif @@ -523,7 +523,7 @@ SwLayoutFrm::~SwLayoutFrm() SdrObject* pSdrObj = pAnchoredObj->DrawObj(); SwDrawContact* pContact = static_cast<SwDrawContact*>(pSdrObj->GetUserCall()); - ASSERT( pContact, + OSL_ENSURE( pContact, "<SwFrm::~SwFrm> - missing contact for drawing object" ); if ( pContact ) { @@ -556,7 +556,7 @@ SwLayoutFrm::~SwLayoutFrm() SdrObject* pSdrObj = pAnchoredObj->DrawObj(); SwDrawContact* pContact = static_cast<SwDrawContact*>(pSdrObj->GetUserCall()); - ASSERT( pContact, + OSL_ENSURE( pContact, "<SwFrm::~SwFrm> - missing contact for drawing object" ); if ( pContact ) { @@ -624,7 +624,7 @@ const SwRect SwFrm::PaintArea() const else nTmpRight = (pNxt->Frm().*fnRect->fnGetRight)(); } - ASSERT( pTmp, "PaintArea lost in time and space" ); + OSL_ENSURE( pTmp, "PaintArea lost in time and space" ); if( pTmp->IsPageFrm() || pTmp->IsFlyFrm() || pTmp->IsCellFrm() || pTmp->IsRowFrm() || //nobody leaves a table! pTmp->IsRootFrm() ) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 6a61f4210e..c8526332db 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -125,7 +125,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab ): else delete pNew; } - ASSERT( Lower() && Lower()->IsRowFrm(), "SwTabFrm::SwTabFrm: No rows." ); + OSL_ENSURE( Lower() && Lower()->IsRowFrm(), "SwTabFrm::SwTabFrm: No rows." ); } SwTabFrm::SwTabFrm( SwTabFrm &rTab ) : @@ -200,7 +200,7 @@ void SwTabFrm::JoinAndDelFollows() |*************************************************************************/ void SwTabFrm::RegistFlys() { - ASSERT( Lower() && Lower()->IsRowFrm(), "Keine Zeilen." ); + OSL_ENSURE( Lower() && Lower()->IsRowFrm(), "Keine Zeilen." ); SwPageFrm *pPage = FindPageFrm(); if ( pPage ) @@ -271,7 +271,7 @@ SwTwips lcl_GetHeightOfRows( const SwFrm* pStart, long nCount ) // SwRowFrm* lcl_InsertNewFollowFlowLine( SwTabFrm& rTab, const SwFrm& rTmpRow, bool bRowSpanLine ) { - ASSERT( rTmpRow.IsRowFrm(), "No row frame to copy for FollowFlowLine" ) + OSL_ENSURE( rTmpRow.IsRowFrm(), "No row frame to copy for FollowFlowLine" ); const SwRowFrm& rRow = (SwRowFrm&)rTmpRow; rTab.SetFollowFlowLine( TRUE ); @@ -293,7 +293,7 @@ void lcl_InvalidateLowerObjs( SwLayoutFrm& _rLayoutFrm, if ( !_pPageFrm ) { _pPageFrm = _rLayoutFrm.FindPageFrm(); - ASSERT( _pPageFrm, + OSL_ENSURE( _pPageFrm, "<lcl_InvalidateLowerObjs(..)> - missing page frame -> no move of lower objects out of range" ); if ( !_pPageFrm ) { @@ -460,7 +460,7 @@ void lcl_MoveRowContent( SwRowFrm& rSourceLine, SwRowFrm& rDestLine ) while ( pTmpDestRow->GetNext() ) pTmpDestRow = (SwRowFrm*)pTmpDestRow->GetNext(); - ASSERT( pTmpDestRow->GetFollowRow() == pTmpSourceRow, "Knoten in der Tabelle" ) + OSL_ENSURE( pTmpDestRow->GetFollowRow() == pTmpSourceRow, "Knoten in der Tabelle" ); lcl_MoveRowContent( *pTmpSourceRow, *pTmpDestRow ); pTmpDestRow->SetFollowRow( pTmpSourceRow->GetFollowRow() ); @@ -650,7 +650,7 @@ void lcl_PostprocessRowsInCells( SwTabFrm& rTab, SwRowFrm& rLastLine ) if ( NULL != pRowFrm->GetPrev() && !pRowFrm->ContainsCntnt() ) { - ASSERT( pRowFrm->GetFollowRow(), "Deleting row frame without follow" ) + OSL_ENSURE( pRowFrm->GetFollowRow(), "Deleting row frame without follow" ); // The footnotes have to be moved: lcl_MoveFootnotes( rTab, *rTab.GetFollow(), *pRowFrm ); @@ -918,9 +918,9 @@ bool SwTabFrm::RemoveFollowFlowLine() // find last row in master SwFrm* pLastLine = GetLastLower(); - ASSERT( HasFollowFlowLine() && + OSL_ENSURE( HasFollowFlowLine() && pFollowFlowLine && - pLastLine, "There should be a flowline in the follow" ) + pLastLine, "There should be a flowline in the follow" ); // We have to reset the flag here, because lcl_MoveRowContent // calls a GrowFrm(), which has a different bahavior if @@ -1103,7 +1103,7 @@ bool SwTabFrm::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKee // At least one more non-heading row has to stay in this table in // order to avoid loops: // - ASSERT( !GetIndPrev(), "Table is supposed to be at beginning" ) + OSL_ENSURE( !GetIndPrev(), "Table is supposed to be at beginning" ); bKeepNextRow = true; } else if ( !GetIndPrev() && nRepeat == nRowCount ) @@ -1381,7 +1381,7 @@ bool SwTabFrm::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKee bool SwTabFrm::Join() { - ASSERT( !HasFollowFlowLine(), "Joining follow flow line" ) + OSL_ENSURE( !HasFollowFlowLine(), "Joining follow flow line" ); SwTabFrm *pFoll = GetFollow(); SwTwips nHeight = 0; //Gesamthoehe der eingefuegten Zeilen als Return. @@ -1563,7 +1563,7 @@ bool MA_FASTCALL lcl_CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeav // to format the floating screen objects // --> OD 2005-05-03 #i46941# - frame has to be valid // Note: frame could be invalid after calling its format, if it's locked. - ASSERT( !pCnt->IsTxtFrm() || + OSL_ENSURE( !pCnt->IsTxtFrm() || pCnt->IsValid() || static_cast<SwTxtFrm*>(pCnt)->IsJoinLocked(), "<lcl_CalcLowers(..)> - text frame invalid and not locked." ); @@ -1591,7 +1591,7 @@ bool MA_FASTCALL lcl_CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeav } #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "LoopControl in lcl_CalcLowers" ) + OSL_ENSURE( false, "LoopControl in lcl_CalcLowers" ); #endif } } @@ -1681,9 +1681,9 @@ void MA_FASTCALL lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) if ( ++nLoopControlRuns_2 > nLoopControlMax ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( 0 != nLoopControlStage_2, "LoopControl_2 in lcl_RecalcRow: Stage 1!" ); - ASSERT( 1 != nLoopControlStage_2, "LoopControl_2 in lcl_RecalcRow: Stage 2!!" ); - ASSERT( 2 > nLoopControlStage_2, "LoopControl_2 in lcl_RecalcRow: Stage 3!!!" ); + OSL_ENSURE( 0 != nLoopControlStage_2, "LoopControl_2 in lcl_RecalcRow: Stage 1!" ); + OSL_ENSURE( 1 != nLoopControlStage_2, "LoopControl_2 in lcl_RecalcRow: Stage 2!!" ); + OSL_ENSURE( 2 > nLoopControlStage_2, "LoopControl_2 in lcl_RecalcRow: Stage 3!!!" ); #endif rRow.ValidateThisAndAllLowers( nLoopControlStage_2++ ); nLoopControlRuns_2 = 0; @@ -1730,9 +1730,9 @@ void MA_FASTCALL lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) if ( ++nLoopControlRuns_1 > nLoopControlMax ) { #if OSL_DEBUG_LEVEL > 1 - ASSERT( 0 != nLoopControlStage_1, "LoopControl_1 in lcl_RecalcRow: Stage 1!" ); - ASSERT( 1 != nLoopControlStage_1, "LoopControl_1 in lcl_RecalcRow: Stage 2!!" ); - ASSERT( 2 > nLoopControlStage_1, "LoopControl_1 in lcl_RecalcRow: Stage 3!!!" ); + OSL_ENSURE( 0 != nLoopControlStage_1, "LoopControl_1 in lcl_RecalcRow: Stage 1!" ); + OSL_ENSURE( 1 != nLoopControlStage_1, "LoopControl_1 in lcl_RecalcRow: Stage 2!!" ); + OSL_ENSURE( 2 > nLoopControlStage_1, "LoopControl_1 in lcl_RecalcRow: Stage 3!!!" ); #endif rRow.ValidateThisAndAllLowers( nLoopControlStage_1++ ); nLoopControlRuns_1 = 0; @@ -1867,8 +1867,8 @@ void SwTabFrm::MakeAll() if ( HasFollow() ) { SwTabFrm* pFollowFrm = (SwTabFrm*)GetFollow(); - ASSERT( !pFollowFrm->IsJoinLocked() || !pFollowFrm->IsRebuildLastLine(), - "SwTabFrm::MakeAll for master while follow is in RebuildLastLine()" ) + OSL_ENSURE( !pFollowFrm->IsJoinLocked() || !pFollowFrm->IsRebuildLastLine(), + "SwTabFrm::MakeAll for master while follow is in RebuildLastLine()" ); if ( pFollowFrm->IsJoinLocked() && pFollowFrm->IsRebuildLastLine() ) return; } @@ -2691,7 +2691,7 @@ void SwTabFrm::MakeAll() #if OSL_DEBUG_LEVEL > 1 else { - ASSERT( false, "debug assertion: <SwTabFrm::MakeAll()> - format of table lowers suppressed by fix i44910" ); + OSL_ENSURE( false, "debug assertion: <SwTabFrm::MakeAll()> - format of table lowers suppressed by fix i44910" ); } #endif // <-- @@ -2887,7 +2887,7 @@ BOOL SwTabFrm::CalcFlyOffsets( SwTwips& rUpper, |*************************************************************************/ void SwTabFrm::Format( const SwBorderAttrs *pAttrs ) { - ASSERT( pAttrs, "TabFrm::Format, pAttrs ist 0." ); + OSL_ENSURE( pAttrs, "TabFrm::Format, pAttrs ist 0." ); SWRECTFN( this ) if ( !bValidSize ) @@ -3092,7 +3092,7 @@ void SwTabFrm::Format( const SwBorderAttrs *pAttrs ) } break; default: - ASSERT( FALSE, "Ungueltige orientation fuer Table." ); + OSL_ENSURE( FALSE, "Ungueltige orientation fuer Table." ); } // --> OD 2004-07-15 #i26250# - extend bottom printing area, if table @@ -3467,10 +3467,10 @@ SwCntntFrm *SwTabFrm::FindLastCntnt() // Spalten abklappern, dies erledigt SwSectionFrm::FindLastCntnt if( pRet->IsColBodyFrm() ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwSectionFrm* pSect = pRet->FindSctFrm(); - ASSERT( pSect, "Wo kommt denn die Spalte her?") - ASSERT( IsAnLower( pSect ), "Gespaltene Zelle?" ); + OSL_ENSURE( pSect, "Wo kommt denn die Spalte her?"); + OSL_ENSURE( IsAnLower( pSect ), "Gespaltene Zelle?" ); #endif return pRet->FindSctFrm()->FindLastCntnt(); } @@ -3479,7 +3479,7 @@ SwCntntFrm *SwTabFrm::FindLastCntnt() // pRet may be a cell frame without a lower (cell has been split). // We have to find the last content the hard way: // - ASSERT( pRet->IsCellFrm(), "SwTabFrm::FindLastCntnt failed" ) + OSL_ENSURE( pRet->IsCellFrm(), "SwTabFrm::FindLastCntnt failed" ); const SwFrm* pRow = pRet->GetUpper(); while ( pRow && !pRow->GetUpper()->IsTabFrm() ) pRow = pRow->GetUpper(); @@ -3656,7 +3656,7 @@ BOOL SwTabFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL &rReformat ) |*************************************************************************/ void SwTabFrm::Cut() { - ASSERT( GetUpper(), "Cut ohne Upper()." ); + OSL_ENSURE( GetUpper(), "Cut ohne Upper()." ); SwPageFrm *pPage = FindPageFrm(); InvalidatePage( pPage ); @@ -3714,7 +3714,7 @@ void SwTabFrm::Cut() Remove(); if ( pUp ) { - ASSERT( !pUp->IsFtnFrm(), "Tabelle in Fussnote." ); + OSL_ENSURE( !pUp->IsFtnFrm(), "Tabelle in Fussnote." ); SwSectionFrm *pSct = 0; // --> OD 2006-01-04 #126020# - adjust check for empty section // --> OD 2006-02-01 #130797# - correct fix #126020# @@ -3751,11 +3751,11 @@ void SwTabFrm::Cut() |*************************************************************************/ void SwTabFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) { - ASSERT( pParent, "Kein Parent fuer Paste." ); - ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); - ASSERT( pParent != this, "Bin selbst der Parent." ); - ASSERT( pSibling != this, "Bin mein eigener Nachbar." ); - ASSERT( !GetPrev() && !GetNext() && !GetUpper(), + OSL_ENSURE( pParent, "Kein Parent fuer Paste." ); + OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); + OSL_ENSURE( pParent != this, "Bin selbst der Parent." ); + OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." ); + OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(), "Bin noch irgendwo angemeldet." ); //In den Baum einhaengen. @@ -4164,7 +4164,7 @@ SwTwips MA_FASTCALL lcl_CalcMinRowHeight( const SwRowFrm* _pRow, if ( _pRow->HasFixSize() && !_pRow->IsRowSpanLine() ) { - ASSERT( ATT_FIX_SIZE == rSz.GetHeightSizeType(), "pRow claims to have fixed size" ) + OSL_ENSURE( ATT_FIX_SIZE == rSz.GetHeightSizeType(), "pRow claims to have fixed size" ); return rSz.GetHeight(); } @@ -4308,7 +4308,7 @@ USHORT lcl_GetBottomLineDist( const SwRowFrm& rRow ) void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) { SWRECTFN( this ) - ASSERT( pAttrs, "SwRowFrm::Format ohne Attrs." ); + OSL_ENSURE( pAttrs, "SwRowFrm::Format ohne Attrs." ); const BOOL bFix = bFixSize; @@ -4378,8 +4378,8 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) SwClient* pLast; for ( pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() ) { - ASSERT( ((SwFrm*)pLast)->IsRowFrm(), - "Non-row frame registered in table line" ) + OSL_ENSURE( ((SwFrm*)pLast)->IsRowFrm(), + "Non-row frame registered in table line" ); SwRowFrm* pRow = (SwRowFrm*)pLast; // --> OD 2004-11-23 #115759# - do *not* take repeated // headlines, because during split of table it can be @@ -4434,11 +4434,11 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) { bValidSize = TRUE; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( HasFixSize() ) { const SwFmtFrmSize &rFrmSize = GetFmt()->GetFrmSize(); - ASSERT( rFrmSize.GetSize().Height() > 0, "Hat ihn" ); + OSL_ENSURE( rFrmSize.GetSize().Height() > 0, "Hat ihn" ); } #endif const SwTwips nDiff = (Frm().*fnRect->fnGetHeight)() - @@ -4611,7 +4611,7 @@ void SwRowFrm::Cut() SwFrm* pCellFrm( GetLower() ); while ( pCellFrm ) { - ASSERT( pCellFrm->IsCellFrm(), + OSL_ENSURE( pCellFrm->IsCellFrm(), "<SwRowFrm::Cut()> - unexpected type of SwRowFrm lower." ); pVSh->Imp()->DisposeAccessibleFrm( pCellFrm ); @@ -4652,10 +4652,10 @@ SwTwips SwRowFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) } else { - ASSERT( GetUpper()->IsCellFrm(), "RowFrm->GetUpper neither table nor cell" ) + OSL_ENSURE( GetUpper()->IsCellFrm(), "RowFrm->GetUpper neither table nor cell" ); bRestrictTableGrowth = GetFollowRow() && bHasFollowFlowLine; - ASSERT( !bRestrictTableGrowth || !GetNext(), - "GetFollowRow for row frame that has a Next" ) + OSL_ENSURE( !bRestrictTableGrowth || !GetNext(), + "GetFollowRow for row frame that has a Next" ); // // There may still be some space left in my direct upper: @@ -4736,7 +4736,7 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) if( nMinHeight < (Frm().*fnRect->fnGetHeight)() ) { // --> OD 2004-10-04 #i26945# - ASSERT( FindTabFrm(), "<SwRowFrm::ShrinkFrm(..)> - no table frame -> crash." ); + OSL_ENSURE( FindTabFrm(), "<SwRowFrm::ShrinkFrm(..)> - no table frame -> crash." ); const bool bConsiderObjs( FindTabFrm()->IsConsiderObjsForMinCellHeight() ); // <-- nMinHeight = lcl_CalcMinRowHeight( this, bConsiderObjs ); @@ -4810,7 +4810,7 @@ bool SwRowFrm::IsRowSplitAllowed() const // Fixed size rows are never allowed to split: if ( HasFixSize() ) { - ASSERT( ATT_FIX_SIZE == GetFmt()->GetFrmSize().GetHeightSizeType(), "pRow claims to have fixed size" ) + OSL_ENSURE( ATT_FIX_SIZE == GetFmt()->GetFrmSize().GetHeightSizeType(), "pRow claims to have fixed size" ); return false; } @@ -5107,7 +5107,7 @@ BOOL lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, BOOL bInva ) } else { - ASSERT( false, + OSL_ENSURE( false, "<lcl_ArrangeLowers(..)> - unknown type of anchored object!" ); } } @@ -5145,7 +5145,7 @@ BOOL lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, BOOL bInva ) void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) { - ASSERT( pAttrs, "CellFrm::Format, pAttrs ist 0." ); + OSL_ENSURE( pAttrs, "CellFrm::Format, pAttrs ist 0." ); const SwTabFrm* pTab = FindTabFrm(); SWRECTFN( pTab ) @@ -5204,9 +5204,9 @@ void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) const SwTwips nWish = pTab->GetFmt()->GetFrmSize().GetWidth(); nWidth = pAttrs->GetSize().Width(); - ASSERT( nWish, "Tabelle ohne Breite?" ); - ASSERT( nWidth <= nWish, "Zelle breiter als Tabelle." ); - ASSERT( nWidth > 0, "Box without width" ); + OSL_ENSURE( nWish, "Tabelle ohne Breite?" ); + OSL_ENSURE( nWidth <= nWish, "Zelle breiter als Tabelle." ); + OSL_ENSURE( nWidth > 0, "Box without width" ); const long nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)(); if ( nWish != nPrtWidth ) @@ -5258,7 +5258,7 @@ void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) } else { - ASSERT( pAttrs->GetSize().Width() > 0, "Box without width" ); + OSL_ENSURE( pAttrs->GetSize().Width() > 0, "Box without width" ); nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)(); SwFrm *pPre = GetUpper()->Lower(); while ( pPre != this ) @@ -5315,8 +5315,8 @@ void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) { if ( !Lower()->IsCntntFrm() && !Lower()->IsSctFrm() && !Lower()->IsTabFrm() ) { - //ASSERT fuer HTML-Import! - ASSERT( !this, "VAlign an Zelle ohne Inhalt" ); + // OSL_ENSURE(fuer HTML-Import! + OSL_ENSURE( !this, "VAlign an Zelle ohne Inhalt" ); return; } BOOL bVertDir = TRUE; @@ -5530,8 +5530,8 @@ void SwCellFrm::Cut() */ bool SwTabFrm::IsInHeadline( const SwFrm& rFrm ) const { - ASSERT( IsAnLower( &rFrm ) && rFrm.IsInTab(), - "SwTabFrm::IsInHeadline called for frame not lower of table" ) + OSL_ENSURE( IsAnLower( &rFrm ) && rFrm.IsInTab(), + "SwTabFrm::IsInHeadline called for frame not lower of table" ); const SwFrm* pTmp = &rFrm; while ( !pTmp->GetUpper()->IsTabFrm() ) @@ -5594,10 +5594,10 @@ bool SwTabFrm::IsLayoutSplitAllowed() const USHORT SwTabFrm::GetBottomLineSize() const { - ASSERT( IsCollapsingBorders(), - "BottomLineSize only required for collapsing borders" ) + OSL_ENSURE( IsCollapsingBorders(), + "BottomLineSize only required for collapsing borders" ); - ASSERT( Lower(), "Warning! Trying to prevent a crash, please inform FME" ) + OSL_ENSURE( Lower(), "Warning! Trying to prevent a crash, please inform FME" ); const SwFrm* pTmp = GetLastLower(); @@ -5783,7 +5783,7 @@ SwTwips SwTabFrm::CalcHeightOfFirstContentLine() const SwTwips nTmpHeight = 0; pFirstRow = GetFirstNonHeadlineRow(); - ASSERT( !IsFollow() || pFirstRow, "FollowTable without Lower" ) + OSL_ENSURE( !IsFollow() || pFirstRow, "FollowTable without Lower" ); // NEW TABLES if ( pFirstRow && pFirstRow->IsRowSpanLine() && pFirstRow->GetNext() ) diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 17e8944a90..99f392bf77 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -211,7 +211,7 @@ BOOL SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, if ( pCMS && pCMS->bStop ) return FALSE; - ASSERT( pCnt, "Crsr is gone to a Black hole" ); + OSL_ENSURE( pCnt, "Crsr is gone to a Black hole" ); if( pCMS && pCMS->pFill && pCnt->IsTxtFrm() ) bRet = pCnt->GetCrsrOfst( pPos, rPoint, pCMS ); else @@ -305,7 +305,7 @@ BOOL SwRootFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, { sal_Bool bOldAction = IsCallbackActionEnabled(); ((SwRootFrm*)this)->SetCallbackActionEnabled( FALSE ); - ASSERT( (Lower() && Lower()->IsPageFrm()), "Keinen PageFrm gefunden." ); + OSL_ENSURE( (Lower() && Lower()->IsPageFrm()), "Keinen PageFrm gefunden." ); if( pCMS && pCMS->pFill ) ((SwCrsrMoveState*)pCMS)->bFillRet = FALSE; Point aOldPoint = rPoint; @@ -599,7 +599,7 @@ const SwCntntFrm * MA_FASTCALL lcl_MissProtectedFrames( const SwCntntFrm *pCnt, BOOL MA_FASTCALL lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart, GetNxtPrvCnt fnNxtPrv, BOOL bInReadOnly ) { - ASSERT( pPam->GetNode() == (SwCntntNode*)pStart->GetNode(), + OSL_ENSURE( pPam->GetNode() == (SwCntntNode*)pStart->GetNode(), "lcl_UpDown arbeitet nicht fuer andere." ); const SwCntntFrm *pCnt = 0; @@ -678,7 +678,7 @@ BOOL MA_FASTCALL lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart, const SwFrm *pCell = pStart->GetUpper(); while ( pCell && !pCell->IsCellFrm() ) pCell = pCell->GetUpper(); - ASSERT( pCell, "Zelle nicht gefunden." ); + OSL_ENSURE( pCell, "Zelle nicht gefunden." ); nX = (pCell->Frm().*fnRect->fnGetLeft)() + (pCell->Frm().*fnRect->fnGetWidth)() / 2; @@ -892,7 +892,7 @@ BOOL SwCntntFrm::UnitDown( SwPaM* pPam, const SwTwips, BOOL bInReadOnly ) const |*************************************************************************/ USHORT SwRootFrm::GetCurrPage( const SwPaM *pActualCrsr ) const { - ASSERT( pActualCrsr, "Welche Seite soll's denn sein?" ); + OSL_ENSURE( pActualCrsr, "Welche Seite soll's denn sein?" ); const SwFrm *pActFrm = GetFmt()->GetDoc()->GetNodes()[pActualCrsr->GetPoint()->nNode]-> GetCntntNode()->GetFrm( 0, pActualCrsr->GetPoint(), @@ -916,7 +916,7 @@ USHORT SwRootFrm::GetCurrPage( const SwPaM *pActualCrsr ) const |*************************************************************************/ USHORT SwRootFrm::SetCurrPage( SwCursor* pToSet, USHORT nPageNum ) { - ASSERT( Lower() && Lower()->IsPageFrm(), "Keine Seite vorhanden." ); + OSL_ENSURE( Lower() && Lower()->IsPageFrm(), "Keine Seite vorhanden." ); SwPageFrm *pPage = (SwPageFrm*)Lower(); BOOL bEnd =FALSE; @@ -1284,10 +1284,10 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint, break; } -#ifdef DBG_UTIL - ASSERT( pActual, "Keinen Cntnt gefunden." ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pActual, "Keinen Cntnt gefunden." ); if ( bBodyOnly ) - ASSERT( pActual->IsInDocBody(), "Cnt nicht im Body." ); + OSL_ENSURE( pActual->IsInDocBody(), "Cnt nicht im Body." ); #endif //Spezialfall fuer das selektieren von Tabellen, nicht in wiederholte @@ -1433,7 +1433,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const { // CntntFrm nicht formatiert -> immer auf Node-Anfang SwCntntNode* pCNd = (SwCntntNode*)pAct->GetNode(); - ASSERT( pCNd, "Wo ist mein CntntNode?" ); + OSL_ENSURE( pCNd, "Wo ist mein CntntNode?" ); rPos.nNode = *pCNd; rPos.nContent.Assign( pCNd, 0 ); } @@ -1578,7 +1578,7 @@ Point SwRootFrm::GetNextPrevCntntPos( const Point& rPoint, BOOL bNext ) const |*************************************************************************/ Point SwRootFrm::GetPagePos( USHORT nPageNum ) const { - ASSERT( Lower() && Lower()->IsPageFrm(), "Keine Seite vorhanden." ); + OSL_ENSURE( Lower() && Lower()->IsPageFrm(), "Keine Seite vorhanden." ); const SwPageFrm *pPage = (const SwPageFrm*)Lower(); while ( TRUE ) @@ -1764,7 +1764,7 @@ BOOL SwFrm::WannaRightPage() const pDesc = (SwPageDesc*)&pDoc->GetPageDesc( 0 ); } } - ASSERT( pDesc, "No pagedescriptor" ); + OSL_ENSURE( pDesc, "No pagedescriptor" ); BOOL bOdd; if( nPgNum ) bOdd = nPgNum % 2 ? TRUE : FALSE; @@ -1855,7 +1855,7 @@ USHORT SwFrm::GetVirtPageNum() const bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) { //Union-Rects und Tabellen (Follows) der Selektion besorgen. - ASSERT( rTblCrsr.GetCntntNode() && rTblCrsr.GetCntntNode( FALSE ), + OSL_ENSURE( rTblCrsr.GetCntntNode() && rTblCrsr.GetCntntNode( FALSE ), "Tabselection nicht auf Cnt." ); bool bRet = false; @@ -1885,7 +1885,7 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) const SwLayoutFrm* pStart = pTmpStartFrm ? pTmpStartFrm->GetUpper() : 0; const SwLayoutFrm* pEnd = pTmpEndFrm ? pTmpEndFrm->GetUpper() : 0; - ASSERT( pStart && pEnd, "MakeTblCrsrs: Good to have the code robust here!" ) + OSL_ENSURE( pStart && pEnd, "MakeTblCrsrs: Good to have the code robust here!" ); // <-- /* #109590# Only change table boxes if the frames are @@ -1918,7 +1918,7 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) while ( pCell && pRow->IsAnLower( pCell ) ) { - ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" ); + OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" ); if( IsFrmInTblSel( pUnion->GetUnion(), pCell ) && (bReadOnlyAvailable || !pCell->GetFmt()->GetProtect().IsCntntProtected())) @@ -1946,7 +1946,7 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr ) while( !pCell->IsCellFrm() ) { pCell = pCell->GetUpper(); - ASSERT( pCell, "Where's my cell?" ); + OSL_ENSURE( pCell, "Where's my cell?" ); } } } @@ -2041,7 +2041,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) const SwCntntFrm *pEndFrm = rNds[ pEndPos->nNode ]-> GetCntntNode()->GetFrm( &rCrsr.GetEndPos(), pEndPos ); - ASSERT( (pStartFrm && pEndFrm), "Keine CntntFrms gefunden." ); + OSL_ENSURE( (pStartFrm && pEndFrm), "Keine CntntFrms gefunden." ); //Damit die FlyFrms, in denen selektierte Frames stecken, nicht //abgezogen werden @@ -2049,10 +2049,10 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) if ( pStartFrm->IsInFly() ) { const SwAnchoredObject* pObj = pStartFrm->FindFlyFrm(); - ASSERT( pObj, "No Start Object." ); + OSL_ENSURE( pObj, "No Start Object." ); if (pObj) aSortObjs.Insert( *(const_cast<SwAnchoredObject*>(pObj)) ); const SwAnchoredObject* pObj2 = pEndFrm->FindFlyFrm(); - ASSERT( pObj2, "No Start Object." ); + OSL_ENSURE( pObj2, "No Start Object." ); if (pObj2) aSortObjs.Insert( *(const_cast<SwAnchoredObject*>(pObj2)) ); } @@ -2087,7 +2087,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) if( !pEndLFrm ) break; - ASSERT( pEndLFrm->GetType() == pSttLFrm->GetType(), + OSL_ENSURE( pEndLFrm->GetType() == pSttLFrm->GetType(), "Selection ueber unterschiedliche Inhalte" ); switch( pSttLFrm->GetType() ) { @@ -2504,7 +2504,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) // --> OD 2006-01-24 #123908# - introduce robust code: // The stacktrace issue reveals that <pCntnt> could be NULL. // One root cause found by AMA - see #130650# - ASSERT( pCntnt, + OSL_ENSURE( pCntnt, "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" ); while ( pCntnt && pCntnt != pEndFrm ) // <-- @@ -2545,7 +2545,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) } pCntnt = pCntnt->GetNextCntntFrm(); // --> OD 2006-01-24 #123908# - ASSERT( pCntnt, + OSL_ENSURE( pCntnt, "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" ); // <-- } @@ -2610,7 +2610,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) const UINT32 nPos = pObj->GetOrdNum(); for ( USHORT k = 0; bSub && k < aSortObjs.Count(); ++k ) { - ASSERT( aSortObjs[k]->ISA(SwFlyFrm), + OSL_ENSURE( aSortObjs[k]->ISA(SwFlyFrm), "<SwRootFrm::CalcFrmRects(..)> - object in <aSortObjs> of unexcepted type" ); const SwFlyFrm* pTmp = static_cast<SwFlyFrm*>(aSortObjs[k]); do diff --git a/sw/source/core/layout/unusedf.cxx b/sw/source/core/layout/unusedf.cxx index 3e88d19a94..db056e5edf 100644 --- a/sw/source/core/layout/unusedf.cxx +++ b/sw/source/core/layout/unusedf.cxx @@ -39,47 +39,47 @@ void SwFrm::Format( const SwBorderAttrs * ) { - ASSERT( FALSE, "Format() der Basisklasse gerufen." ); + OSL_ENSURE( FALSE, "Format() der Basisklasse gerufen." ); } void SwFrm::Paint(const SwRect &, const SwPrtOptions * ) const { - ASSERT( FALSE, "Paint() der Basisklasse gerufen." ); + OSL_ENSURE( FALSE, "Paint() der Basisklasse gerufen." ); } sal_Bool SwCntntFrm::WouldFit( SwTwips &, sal_Bool&, sal_Bool ) { - ASSERT( FALSE, "WouldFit des CntntFrm gerufen." ); + OSL_ENSURE( FALSE, "WouldFit des CntntFrm gerufen." ); return FALSE; } bool SwFrm::FillSelection( SwSelectionList& , const SwRect& ) const { - ASSERT( false, "Don't call this function at the base class!" ); + OSL_ENSURE( false, "Don't call this function at the base class!" ); return false; } BOOL SwFrm::GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* ) const { - ASSERT( FALSE, "GetCrsrOfst der Basisklasse, hi!" ); + OSL_ENSURE( FALSE, "GetCrsrOfst der Basisklasse, hi!" ); return FALSE; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 void SwRootFrm::Cut() { - ASSERT( FALSE, "Cut() des RootFrm gerufen." ); + OSL_ENSURE( FALSE, "Cut() des RootFrm gerufen." ); } void SwRootFrm::Paste( SwFrm *, SwFrm * ) { - ASSERT( FALSE, "Paste() des RootFrm gerufen." ); + OSL_ENSURE( FALSE, "Paste() des RootFrm gerufen." ); } void SwFlyFrm::Paste( SwFrm *, SwFrm * ) { - ASSERT( FALSE, "Paste() des FlyFrm gerufen." ); + OSL_ENSURE( FALSE, "Paste() des FlyFrm gerufen." ); } #endif @@ -87,7 +87,7 @@ void SwFlyFrm::Paste( SwFrm *, SwFrm * ) BOOL SwFrm::GetCharRect( SwRect&, const SwPosition&, SwCrsrMoveState* ) const { - ASSERT( FALSE, "GetCharRect() der Basis gerufen." ); + OSL_ENSURE( FALSE, "GetCharRect() der Basis gerufen." ); return FALSE; } diff --git a/sw/source/core/layout/virtoutp.cxx b/sw/source/core/layout/virtoutp.cxx index 994d0a4a3c..3bb6231e4e 100644 --- a/sw/source/core/layout/virtoutp.cxx +++ b/sw/source/core/layout/virtoutp.cxx @@ -40,7 +40,7 @@ // OD 12.11.2002 #96272# - include declaration for <SetMappingForVirtDev> #include "setmapvirtdev.hxx" -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 /************************************************************************* * class DbgRect @@ -210,7 +210,7 @@ void SwLayVout::Enter( ViewShell *pShell, SwRect &rRect, BOOL bOn ) aTmp.SSize().Height()+= aPixSz.Height()/2 + 1; Rectangle aTmpRect( pO->LogicToPixel( aTmp.SVRect() ) ); - ASSERT( !pSh->GetWin()->IsReallyVisible() || + OSL_ENSURE( !pSh->GetWin()->IsReallyVisible() || aTmpRect.GetWidth() <= pSh->GetWin()->GetOutputSizePixel().Width() + 2, "Paintwidth bigger than visarea?" ); // Passt das Rechteck in unseren Buffer ? @@ -246,7 +246,7 @@ void SwLayVout::Enter( ViewShell *pShell, SwRect &rRect, BOOL bOn ) void SwLayVout::_Flush() { - ASSERT( pVirDev, "SwLayVout::DrawOut: nothing left Toulouse" ); + OSL_ENSURE( pVirDev, "SwLayVout::DrawOut: nothing left Toulouse" ); Rectangle aTmp( aRect.SVRect() ); pOut->DrawOutDev( aRect.Pos(), aRect.SSize(), aRect.Pos(), aRect.SSize(), *pVirDev ); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index a367cc4b09..2517d939a4 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -103,11 +103,11 @@ SwFrm::SwFrm( SwModify *pMod ) : , bInfFtn ( FALSE ) , bInfSct ( FALSE ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bFlag01 = bFlag02 = bFlag03 = bFlag04 = bFlag05 = 0; #endif - ASSERT( pMod, "Kein Frameformat uebergeben." ); + OSL_ENSURE( pMod, "Kein Frameformat uebergeben." ); bInvalidR2L = bInvalidVert = 1; bDerivedR2L = bDerivedVert = bRightToLeft = bVertical = bReverse = 0; bValidPos = bValidPrtArea = bValidSize = bValidLineNum = bRetouche = @@ -337,7 +337,7 @@ void SwFrm::_UpdateAttrFrm( SfxPoolItem *pOld, SfxPoolItem *pNew, break; } case RES_COL: - ASSERT( FALSE, "Spalten fuer neuen FrmTyp?" ); + OSL_ENSURE( FALSE, "Spalten fuer neuen FrmTyp?" ); break; default: @@ -571,8 +571,8 @@ Size SwFrm::ChgSize( const Size& aNewSize ) |*************************************************************************/ void SwFrm::InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind ) { - ASSERT( pParent, "Kein Parent fuer Insert." ); - ASSERT( (!pBehind || (pBehind && pParent == pBehind->GetUpper())), + OSL_ENSURE( pParent, "Kein Parent fuer Insert." ); + OSL_ENSURE( (!pBehind || (pBehind && pParent == pBehind->GetUpper())), "Framebaum inkonsistent." ); pUpper = pParent; @@ -612,8 +612,8 @@ void SwFrm::InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind ) |*************************************************************************/ void SwFrm::InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore ) { - ASSERT( pParent, "Kein Parent fuer Insert." ); - ASSERT( (!pBefore || (pBefore && pParent == pBefore->GetUpper())), + OSL_ENSURE( pParent, "Kein Parent fuer Insert." ); + OSL_ENSURE( (!pBefore || (pBefore && pParent == pBefore->GetUpper())), "Framebaum inkonsistent." ); pUpper = pParent; @@ -661,8 +661,8 @@ void SwFrm::InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore ) |*************************************************************************/ void SwFrm::InsertGroupBefore( SwFrm* pParent, SwFrm* pBehind, SwFrm* pSct ) { - ASSERT( pParent, "Kein Parent fuer Insert." ); - ASSERT( (!pBehind || (pBehind && ( pParent == pBehind->GetUpper()) + OSL_ENSURE( pParent, "Kein Parent fuer Insert." ); + OSL_ENSURE( (!pBehind || (pBehind && ( pParent == pBehind->GetUpper()) || ( pParent->IsSctFrm() && pBehind->GetUpper()->IsColBodyFrm() ) ) ), "Framebaum inkonsistent." ); if( pSct ) @@ -705,9 +705,9 @@ void SwFrm::InsertGroupBefore( SwFrm* pParent, SwFrm* pBehind, SwFrm* pSct ) SwLayoutFrm* pTmp = (SwLayoutFrm*)pSct; if( pTmp->Lower() ) { - ASSERT( pTmp->Lower()->IsColumnFrm(), "InsertGrp: Used SectionFrm" ); + OSL_ENSURE( pTmp->Lower()->IsColumnFrm(), "InsertGrp: Used SectionFrm" ); pTmp = (SwLayoutFrm*)((SwLayoutFrm*)pTmp->Lower())->Lower(); - ASSERT( pTmp, "InsertGrp: Missing ColBody" ); + OSL_ENSURE( pTmp, "InsertGrp: Missing ColBody" ); } pBehind->pUpper = pTmp; pBehind->GetUpper()->pLower = pBehind; @@ -720,7 +720,7 @@ void SwFrm::InsertGroupBefore( SwFrm* pParent, SwFrm* pBehind, SwFrm* pSct ) } else { - ASSERT( pSct->IsSctFrm(), "InsertGroup: For SectionFrms only" ); + OSL_ENSURE( pSct->IsSctFrm(), "InsertGroup: For SectionFrms only" ); delete ((SwSectionFrm*)pSct); } } @@ -767,14 +767,14 @@ void SwFrm::InsertGroupBefore( SwFrm* pParent, SwFrm* pBehind, SwFrm* pSct ) |*************************************************************************/ void SwFrm::Remove() { - ASSERT( pUpper, "Removen ohne Upper?" ); + OSL_ENSURE( pUpper, "Removen ohne Upper?" ); if( pPrev ) // einer aus der Mitte wird removed pPrev->pNext = pNext; else { // der erste in einer Folge wird removed - ASSERT( pUpper->pLower == this, "Layout inkonsistent." ); + OSL_ENSURE( pUpper->pLower == this, "Layout inkonsistent." ); pUpper->pLower = pNext; } if( pNext ) @@ -794,14 +794,14 @@ void SwFrm::Remove() |*************************************************************************/ void SwCntntFrm::Paste( SwFrm* pParent, SwFrm* pSibling) { - ASSERT( pParent, "Kein Parent fuer Paste." ); - ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); - ASSERT( pParent != this, "Bin selbst der Parent." ); - ASSERT( pSibling != this, "Bin mein eigener Nachbar." ); - ASSERT( !GetPrev() && !GetNext() && !GetUpper(), + OSL_ENSURE( pParent, "Kein Parent fuer Paste." ); + OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); + OSL_ENSURE( pParent != this, "Bin selbst der Parent." ); + OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." ); + OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(), "Bin noch irgendwo angemeldet." ); - ASSERT( !pSibling || pSibling->IsFlowFrm(), - "<SwCntntFrm::Paste(..)> - sibling not of expected type." ) + OSL_ENSURE( !pSibling || pSibling->IsFlowFrm(), + "<SwCntntFrm::Paste(..)> - sibling not of expected type." ); //In den Baum einhaengen. InsertBefore( (SwLayoutFrm*)pParent, pSibling ); @@ -902,7 +902,7 @@ void SwCntntFrm::Paste( SwFrm* pParent, SwFrm* pSibling) |*************************************************************************/ void SwCntntFrm::Cut() { - ASSERT( GetUpper(), "Cut ohne Upper()." ); + OSL_ENSURE( GetUpper(), "Cut ohne Upper()." ); SwPageFrm *pPage = FindPageFrm(); InvalidatePage( pPage ); @@ -1095,11 +1095,11 @@ void SwCntntFrm::Cut() |*************************************************************************/ void SwLayoutFrm::Paste( SwFrm* pParent, SwFrm* pSibling) { - ASSERT( pParent, "Kein Parent fuer Paste." ); - ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); - ASSERT( pParent != this, "Bin selbst der Parent." ); - ASSERT( pSibling != this, "Bin mein eigener Nachbar." ); - ASSERT( !GetPrev() && !GetNext() && !GetUpper(), + OSL_ENSURE( pParent, "Kein Parent fuer Paste." ); + OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." ); + OSL_ENSURE( pParent != this, "Bin selbst der Parent." ); + OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." ); + OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(), "Bin noch irgendwo angemeldet." ); //In den Baum einhaengen. @@ -1265,7 +1265,7 @@ void SwLayoutFrm::Cut() |*************************************************************************/ SwTwips SwFrm::Grow( SwTwips nDist, BOOL bTst, BOOL bInfo ) { - ASSERT( nDist >= 0, "Negatives Wachstum?" ); + OSL_ENSURE( nDist >= 0, "Negatives Wachstum?" ); PROTOCOL_ENTER( this, bTst ? PROT_GROW_TST : PROT_GROW, 0, &nDist ) @@ -1317,7 +1317,7 @@ SwTwips SwFrm::Grow( SwTwips nDist, BOOL bTst, BOOL bInfo ) |*************************************************************************/ SwTwips SwFrm::Shrink( SwTwips nDist, BOOL bTst, BOOL bInfo ) { - ASSERT( nDist >= 0, "Negative Verkleinerung?" ); + OSL_ENSURE( nDist >= 0, "Negative Verkleinerung?" ); PROTOCOL_ENTER( this, bTst ? PROT_SHRINK_TST : PROT_SHRINK, 0, &nDist ) @@ -1651,14 +1651,14 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, BOOL bTst ) if( ( IsHeaderFrm() || IsFooterFrm() ) && pBoss->GetDrawObjs() ) { const SwSortedObjs &rObjs = *pBoss->GetDrawObjs(); - ASSERT( pBoss->IsPageFrm(), "Header/Footer out of page?" ); + OSL_ENSURE( pBoss->IsPageFrm(), "Header/Footer out of page?" ); for ( USHORT i = 0; i < rObjs.Count(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; if ( pAnchoredObj->ISA(SwFlyFrm) ) { SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj); - ASSERT( !pFly->IsFlyInCntFrm(), "FlyInCnt at Page?" ); + OSL_ENSURE( !pFly->IsFlyInCntFrm(), "FlyInCnt at Page?" ); const SwFmtVertOrient &rVert = pFly->GetFmt()->GetVertOrient(); // Wann muss invalidiert werden? @@ -1768,7 +1768,7 @@ void SwFrm::ImplInvalidateLineNum() if ( _InvalidationAllowed( INVALID_LINENUM ) ) { bValidLineNum = FALSE; - ASSERT( IsTxtFrm(), "line numbers are implemented for text only" ); + OSL_ENSURE( IsTxtFrm(), "line numbers are implemented for text only" ); InvalidatePage(); // OD 2004-05-19 #i28701# @@ -1996,8 +1996,8 @@ SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) SwTwips SwCntntFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) { SWRECTFN( this ) - ASSERT( nDist >= 0, "nDist < 0" ); - ASSERT( nDist <= (Frm().*fnRect->fnGetHeight)(), + OSL_ENSURE( nDist >= 0, "nDist < 0" ); + OSL_ENSURE( nDist <= (Frm().*fnRect->fnGetHeight)(), "nDist > als aktuelle Grosse." ); if ( !bTst ) @@ -2583,7 +2583,7 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) if( !(GetType() & nTmpType) && HasFixSize() ) return 0; - ASSERT( nDist >= 0, "nDist < 0" ); + OSL_ENSURE( nDist >= 0, "nDist < 0" ); SWRECTFN( this ) SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)(); if ( nDist > nFrmHeight ) @@ -2639,7 +2639,7 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) + nRealDist - nReal ); if( bChgPos ) Frm().Pos().X() += nRealDist - nReal; - ASSERT( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" ); + OSL_ENSURE( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" ); } } } @@ -2652,7 +2652,7 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) + nReal - nTmp ); if( bChgPos ) Frm().Pos().X() += nTmp - nReal; - ASSERT( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" ); + OSL_ENSURE( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" ); nReal = nTmp; } } @@ -3041,7 +3041,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize ) ( IsColumnFrm() && IsInSct() ) ) { - ASSERT( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm(), + OSL_ENSURE( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm(), "ChgLowersProp - only for body or foot note container" ); if ( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm() ) { @@ -3053,7 +3053,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize ) if ( nNewHeight < 0) { // OD 01.04.2003 #108446# - adjust assertion condition and text - ASSERT( !( IsPageFrm() && + OSL_ENSURE( !( IsPageFrm() && (pLowerFrm->Frm().Height()>0) && (pLowerFrm->IsValid()) ), "ChgLowersProg - negative height for lower."); @@ -3133,12 +3133,12 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize ) const SwFmtCol* pColAttr = NULL; if ( IsPageBodyFrm() ) { - ASSERT( GetUpper()->IsPageFrm(), "Upper is not page frame" ) + OSL_ENSURE( GetUpper()->IsPageFrm(), "Upper is not page frame" ); pColAttr = &GetUpper()->GetFmt()->GetCol(); } else { - ASSERT( IsFlyFrm() || IsSctFrm(), "Columns not in fly or section" ) + OSL_ENSURE( IsFlyFrm() || IsSctFrm(), "Columns not in fly or section" ); pColAttr = &GetFmt()->GetCol(); } @@ -3159,7 +3159,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize ) |*************************************************************************/ void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs ) { - ASSERT( pAttrs, "LayoutFrm::Format, pAttrs ist 0." ); + OSL_ENSURE( pAttrs, "LayoutFrm::Format, pAttrs ist 0." ); if ( bValidPrtArea && bValidSize ) return; @@ -3251,7 +3251,7 @@ void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs ) |*************************************************************************/ static void InvaPercentFlys( SwFrm *pFrm, SwTwips nDiff ) { - ASSERT( pFrm->GetDrawObjs(), "Can't find any Objects" ); + OSL_ENSURE( pFrm->GetDrawObjs(), "Can't find any Objects" ); for ( USHORT i = 0; i < pFrm->GetDrawObjs()->Count(); ++i ) { SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; @@ -3297,7 +3297,7 @@ void SwLayoutFrm::InvaPercentLowers( SwTwips nDiff ) if ( pFrm->IsInTab() && !IsTabFrm() ) { SwFrm *pTmp = pFrm->FindTabFrm(); - ASSERT( pTmp, "Where's my TabFrm?" ); + OSL_ENSURE( pTmp, "Where's my TabFrm?" ); if( IsAnLower( pTmp ) ) pFrm = pTmp; } @@ -3354,7 +3354,7 @@ long MA_FASTCALL lcl_CalcMinColDiff( SwLayoutFrm *pLayFrm ) { long nDiff = 0, nFirstDiff = 0; SwLayoutFrm *pCol = (SwLayoutFrm*)pLayFrm->Lower(); - ASSERT( pCol, "Where's the columnframe?" ); + OSL_ENSURE( pCol, "Where's the columnframe?" ); SwFrm *pFrm = pCol->Lower(); do { @@ -3569,7 +3569,7 @@ void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs, ::CalcCntnt( this ); pCol = (SwLayoutFrm*)Lower(); - ASSERT( pCol && pCol->GetNext(), ":-( Spalten auf Urlaub?"); + OSL_ENSURE( pCol && pCol->GetNext(), ":-( Spalten auf Urlaub?"); // bMinDiff wird gesetzt, wenn es keine leere Spalte gibt BOOL bMinDiff = TRUE; // OD 28.03.2003 #108446# - check for all column content and all columns @@ -3603,7 +3603,7 @@ void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs, { bFoundLower = TRUE; pLay = (SwLayoutFrm*)pLay->GetNext(); - ASSERT( pLay->IsFtnContFrm(),"FtnContainer exspected" ); + OSL_ENSURE( pLay->IsFtnContFrm(),"FtnContainer exspected" ); nInnerHeight += pLay->InnerHeight(); nInnerHeight += (pLay->Frm().*fnRect->fnGetHeight)() - (pLay->Prt().*fnRect->fnGetHeight)(); @@ -3845,9 +3845,9 @@ void lcl_InvalidateCntnt( SwCntntFrm *pCnt, BYTE nInv ) if( pLastSctCnt == pCnt ) pLastSctCnt = NULL; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else - ASSERT( !pLastSctCnt, "Where's the last SctCntnt?" ); + OSL_ENSURE( !pLastSctCnt, "Where's the last SctCntnt?" ); #endif } if( nInv & INV_TABLE ) @@ -3873,9 +3873,9 @@ void lcl_InvalidateCntnt( SwCntntFrm *pCnt, BYTE nInv ) pLastSctCnt = NULL; } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else - ASSERT( !pLastTabCnt, "Where's the last TabCntnt?" ); + OSL_ENSURE( !pLastTabCnt, "Where's the last TabCntnt?" ); #endif } diff --git a/sw/source/core/makefile.mk b/sw/source/core/makefile.mk index 2701445fb8..04022c30cb 100644 --- a/sw/source/core/makefile.mk +++ b/sw/source/core/makefile.mk @@ -69,7 +69,7 @@ SUBLIBS3= \ $(SLB)$/SwNumberTree.lib \ $(SLB)$/tablecore.lib -.IF "$(dbgutil)"!="" +.IF "$(DBG_LEVEL)">="2" SUBLIBS3+= \ $(SLB)$/except.lib .ENDIF diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index c0cbe6a0e7..61028b57bd 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -75,7 +75,7 @@ SwAnchoredObjectPosition::SwAnchoredObjectPosition( SdrObject& _rDrawObj ) ( !mrDrawObj.ISA(SdrVirtObj) && // 'master' drawing object !mrDrawObj.ISA(SwFlyDrawObj) ); // - indirectly checked (void) bObjOfExceptedType; - ASSERT( bObjOfExceptedType, + OSL_ENSURE( bObjOfExceptedType, "SwAnchoredObjectPosition(..) - object of unexcepted type!" ); #endif @@ -100,7 +100,7 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() // determine contact object { mpContact = static_cast<SwContact*>(GetUserCall( &mrDrawObj )); - ASSERT( mpContact, + OSL_ENSURE( mpContact, "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing SwContact-object." ); } @@ -108,7 +108,7 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() { // OD 2004-03-30 #i26791# mpAnchoredObj = mpContact->GetAnchoredObj( &mrDrawObj ); - ASSERT( mpAnchoredObj, + OSL_ENSURE( mpAnchoredObj, "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing anchored object." ); } @@ -116,7 +116,7 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() { // OD 2004-03-23 #i26791# mpAnchorFrm = mpAnchoredObj->AnchorFrm(); - ASSERT( mpAnchorFrm, + OSL_ENSURE( mpAnchorFrm, "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing anchor frame." ); } @@ -124,7 +124,7 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() { // --> OD 2004-07-01 #i28701# mpFrmFmt = &mpAnchoredObj->GetFrmFmt(); - ASSERT( mpFrmFmt, + OSL_ENSURE( mpFrmFmt, "<SwAnchoredObjectPosition::_GetInfoAboutObj() - missing frame format." ); } @@ -305,7 +305,7 @@ void SwAnchoredObjectPosition::_GetVertAlignmentValues( } else { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredObjectPosition::_GetVertAlignmentValues(..)> - invalid relative alignment" ); } } @@ -320,7 +320,7 @@ void SwAnchoredObjectPosition::_GetVertAlignmentValues( } else { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredObjectPosition::_GetVertAlignmentValues(..)> - invalid relative alignment" ); } } @@ -328,7 +328,7 @@ void SwAnchoredObjectPosition::_GetVertAlignmentValues( // no break here, because text::RelOrientation::CHAR is invalid, if !mbAnchorToChar default: { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredObjectPosition::_GetVertAlignmentValues(..)> - invalid relative alignment" ); } } @@ -386,7 +386,7 @@ SwTwips SwAnchoredObjectPosition::_GetVertRelPos( break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredObjectPosition::_GetVertRelPos(..) - invalid vertical positioning" ); } } @@ -876,7 +876,7 @@ SwTwips SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside( if ( !GetAnchorFrm().ISA(SwTxtFrm) || !GetAnchoredObj().ISA(SwFlyAtCntFrm) ) { - ASSERT( false, + OSL_ENSURE( false, "<SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside(..) - usage for wrong anchor type" ); return _nProposedRelPosX; } diff --git a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx index a00e6be305..be6723d5ba 100644 --- a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx @@ -84,7 +84,7 @@ SwAsCharAnchoredObjectPosition::~SwAsCharAnchoredObjectPosition() */ const SwTxtFrm& SwAsCharAnchoredObjectPosition::GetAnchorTxtFrm() const { - ASSERT( GetAnchorFrm().ISA(SwTxtFrm), + OSL_ENSURE( GetAnchorFrm().ISA(SwTxtFrm), "SwAsCharAnchoredObjectPosition::GetAnchorTxtFrm() - wrong anchor frame type" ); return static_cast<const SwTxtFrm&>(GetAnchorFrm()); @@ -289,7 +289,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() rAnchorFrm.SwitchHorizontalToVertical( aAnchorPos ); // --> OD 2005-03-09 #i44347# - keep last object rectangle at anchored object - ASSERT ( GetAnchoredObj().ISA(SwAnchoredDrawObject), + OSL_ENSURE( GetAnchoredObj().ISA(SwAnchoredDrawObject), "<SwAsCharAnchoredObjectPosition::CalcPosition()> - wrong type of anchored object." ); SwAnchoredDrawObject& rAnchoredDrawObj = static_cast<SwAnchoredDrawObject&>( GetAnchoredObj() ); @@ -317,7 +317,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() aRelAttr = Point( 0, nRelPos ); // OD 2004-03-23 #i26791# - ASSERT( GetAnchoredObj().ISA(SwFlyInCntFrm), + OSL_ENSURE( GetAnchoredObj().ISA(SwFlyInCntFrm), "<SwAsCharAnchoredObjectPosition::CalcPosition()> - wrong anchored object." ); const SwFlyInCntFrm& rFlyInCntFrm = static_cast<const SwFlyInCntFrm&>(GetAnchoredObj()); @@ -338,7 +338,7 @@ void SwAsCharAnchoredObjectPosition::CalcPosition() aObjBoundRect.Height( aObjBoundRect.Height() + rULSpace.GetLower() ); } } - ASSERT( (rFlyInCntFrm.Frm().*fnRect->fnGetHeight)(), + OSL_ENSURE( (rFlyInCntFrm.Frm().*fnRect->fnGetHeight)(), "SwAnchoredObjectPosition::CalcPosition(..) - fly frame has an invalid height" ); } diff --git a/sw/source/core/objectpositioning/environmentofanchoredobject.cxx b/sw/source/core/objectpositioning/environmentofanchoredobject.cxx index cb8d14e50e..e9ad9ce594 100644 --- a/sw/source/core/objectpositioning/environmentofanchoredobject.cxx +++ b/sw/source/core/objectpositioning/environmentofanchoredobject.cxx @@ -70,12 +70,12 @@ const SwLayoutFrm& SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFrm( !pHoriEnvironmentLayFrm->IsPageFrm() ) { pHoriEnvironmentLayFrm = pHoriEnvironmentLayFrm->GetUpper(); - ASSERT( pHoriEnvironmentLayFrm, + OSL_ENSURE( pHoriEnvironmentLayFrm, "SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFrm(..) - no page|fly|cell frame found" ); } } - ASSERT( pHoriEnvironmentLayFrm->ISA(SwLayoutFrm), + OSL_ENSURE( pHoriEnvironmentLayFrm->ISA(SwLayoutFrm), "SwEnvironmentOfAnchoredObject::GetHoriEnvironmentLayoutFrm(..) - found frame isn't a layout frame" ); return static_cast<const SwLayoutFrm&>(*pHoriEnvironmentLayFrm); @@ -110,12 +110,12 @@ const SwLayoutFrm& SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrm( !pVertEnvironmentLayFrm->IsPageFrm() ) { pVertEnvironmentLayFrm = pVertEnvironmentLayFrm->GetUpper(); - ASSERT( pVertEnvironmentLayFrm, + OSL_ENSURE( pVertEnvironmentLayFrm, "SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrm(..) - proposed frame not found" ); } } - ASSERT( pVertEnvironmentLayFrm->ISA(SwLayoutFrm), + OSL_ENSURE( pVertEnvironmentLayFrm->ISA(SwLayoutFrm), "SwEnvironmentOfAnchoredObject::GetVertEnvironmentLayoutFrm(..) - found frame isn't a layout frame" ); return static_cast<const SwLayoutFrm&>(*pVertEnvironmentLayFrm); diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx index e7e47ff018..b1a96bf970 100644 --- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx @@ -94,7 +94,7 @@ SwTwips SwToCntntAnchoredObjectPosition::ToCharTopOfLine() const SwTxtFrm& SwToCntntAnchoredObjectPosition::GetAnchorTxtFrm() const { - ASSERT( GetAnchorFrm().ISA(SwTxtFrm), + OSL_ENSURE( GetAnchorFrm().ISA(SwTxtFrm), "SwToCntntAnchoredObjectPosition::GetAnchorTxtFrm() - wrong anchor frame type" ); return static_cast<SwTxtFrm&>(GetAnchorFrm()); @@ -311,7 +311,7 @@ void SwToCntntAnchoredObjectPosition::CalcPosition() } else { - ASSERT( false, + OSL_ENSURE( false, "<SwToCntntAnchoredObjectPosition::CalcPosition()> - unknown combination of vertical position and vertical alignment." ); } } @@ -331,7 +331,7 @@ void SwToCntntAnchoredObjectPosition::CalcPosition() } else { - ASSERT( false, + OSL_ENSURE( false, "<SwToCntntAnchoredObjectPosition::CalcPosition()> - unknown combination of vertical position and vertical alignment." ); } } @@ -372,7 +372,7 @@ void SwToCntntAnchoredObjectPosition::CalcPosition() } else { - ASSERT( false, + OSL_ENSURE( false, "<SwToCntntAnchoredObjectPosition::CalcPosition()> - unknown combination of vertical position and vertical alignment." ); } } @@ -697,7 +697,7 @@ void SwToCntntAnchoredObjectPosition::CalcPosition() else { #if OSL_DEBUG_LEVEL > 1 - ASSERT( false, "<SwToCntntAnchoredObjectPosition::CalcPosition()> - code under investigation by OD, please inform OD about this assertion!" ); + OSL_ENSURE( false, "<SwToCntntAnchoredObjectPosition::CalcPosition()> - code under investigation by OD, please inform OD about this assertion!" ); #endif nRelDiff = nRelPosY; nRelPosY = 0; diff --git a/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx index c302be6815..c98e773b2f 100644 --- a/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx @@ -118,7 +118,7 @@ void SwToLayoutAnchoredObjectPosition::CalcPosition() // anchor position, depending on layout-direction if( bVert ) { - ASSERT( !bRev, "<SwToLayoutAnchoredObjectPosition::CalcPosition()> - reverse layout set." ); + OSL_ENSURE( !bRev, "<SwToLayoutAnchoredObjectPosition::CalcPosition()> - reverse layout set." ); aRelPos.X() = -nRelPosY - aObjBoundRect.Width(); maOffsetToFrmAnchorPos.X() = nVertOffsetToFrmAnchorPos; } diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 8db425fd92..f4141738b2 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -281,7 +281,7 @@ Graphic* SwOLENode::GetGraphic() SwCntntNode *SwOLENode::SplitCntntNode( const SwPosition & ) { // OLE-Objecte vervielfaeltigen ?? - ASSERT( FALSE, "OleNode: can't split." ); + OSL_ENSURE( FALSE, "OleNode: can't split." ); return this; } @@ -298,7 +298,7 @@ BOOL SwOLENode::RestorePersistentData() { // TODO/LATER: reicht hier nicht ein EmbeddedObjectContainer? Was passiert mit // diesem Dokument? - ASSERT( !this, "warum wird hier eine DocShell angelegt?" ); + OSL_ENSURE( !this, "warum wird hier eine DocShell angelegt?" ); p = new SwDocShell( GetDoc(), SFX_CREATE_MODE_INTERNAL ); p->DoInitNew( NULL ); } @@ -376,7 +376,7 @@ SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere, SwGrfFmtColl* pGrfColl, SwAttrSet* pAutoAttr ) { - ASSERT( pGrfColl,"SwNodes::MakeOLENode: Formatpointer ist 0." ); + OSL_ENSURE( pGrfColl,"SwNodes::MakeOLENode: Formatpointer ist 0." ); SwOLENode *pNode = new SwOLENode( rWhere, xObj, pGrfColl, pAutoAttr ); @@ -398,7 +398,7 @@ SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere, SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere, const String &rName, sal_Int64 nAspect, SwGrfFmtColl* pGrfColl, SwAttrSet* pAutoAttr ) { - ASSERT( pGrfColl,"SwNodes::MakeOLENode: Formatpointer ist 0." ); + OSL_ENSURE( pGrfColl,"SwNodes::MakeOLENode: Formatpointer ist 0." ); SwOLENode *pNode = new SwOLENode( rWhere, rName, nAspect, pGrfColl, pAutoAttr ); @@ -430,8 +430,8 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const { // TODO/LATER: reicht hier nicht ein EmbeddedObjectContainer? Was passiert mit // diesem Dokument? - ASSERT( pDoc->GetRefForDocShell(), - "wo ist die Ref-Klasse fuer die DocShell?") + OSL_ENSURE( pDoc->GetRefForDocShell(), + "wo ist die Ref-Klasse fuer die DocShell?"); p = new SwDocShell( pDoc, SFX_CREATE_MODE_INTERNAL ); *pDoc->GetRefForDocShell() = p; p->DoInitNew( NULL ); @@ -736,7 +736,7 @@ void SwOLEObj::SetNode( SwOLENode* pNode ) { // TODO/LATER: reicht hier nicht ein EmbeddedObjectContainer? Was passiert mit // diesem Dokument? - ASSERT( !this, "warum wird hier eine DocShell angelegt?" ); + OSL_ENSURE( !this, "warum wird hier eine DocShell angelegt?" ); p = new SwDocShell( pDoc, SFX_CREATE_MODE_INTERNAL ); p->DoInitNew( NULL ); } @@ -771,10 +771,10 @@ uno::Reference < embed::XEmbeddedObject > SwOLEObj::GetOleRef() if( !xOLERef.is() ) { SfxObjectShell* p = pOLENd->GetDoc()->GetPersist(); - ASSERT( p, "kein SvPersist vorhanden" ); + OSL_ENSURE( p, "kein SvPersist vorhanden" ); uno::Reference < embed::XEmbeddedObject > xObj = p->GetEmbeddedObjectContainer().GetEmbeddedObject( aName ); - ASSERT( !xOLERef.is(), "rekursiver Aufruf von GetOleRef() ist nicht erlaubt" ) + OSL_ENSURE( !xOLERef.is(), "rekursiver Aufruf von GetOleRef() ist nicht erlaubt" ); if ( !xObj.is() ) { diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx index 206c29e4ed..e03f7701e4 100644 --- a/sw/source/core/para/paratr.cxx +++ b/sw/source/core/para/paratr.cxx @@ -145,7 +145,7 @@ sal_Bool SwFmtDrop::GetInfo( SfxPoolItem& ) const int SwFmtDrop::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( nLines == ((SwFmtDrop&)rAttr).GetLines() && nChars == ((SwFmtDrop&)rAttr).GetChars() && nDistance == ((SwFmtDrop&)rAttr).GetDistance() && @@ -258,7 +258,7 @@ SfxPoolItem* SwNumRuleItem::Clone( SfxItemPool * ) const } int SwNumRuleItem::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); // --> OD 2008-03-04 #refactorlists# - removed <pDefinedIn> return GetValue() == ((SwNumRuleItem&)rAttr).GetValue(); // <-- diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx index 76028d8751..30dc2fc5ad 100644 --- a/sw/source/core/sw3io/swacorr.cxx +++ b/sw/source/core/sw3io/swacorr.cxx @@ -59,7 +59,7 @@ BOOL SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& rStg, nRet = aBlk.GetText( rShort, rLong ); } else { - ASSERT ( rStg.is(), "Someone passed SwAutoCorrect::GetLongText a dud storage!"); + OSL_ENSURE( rStg.is(), "Someone passed SwAutoCorrect::GetLongText a dud storage!"); } return !IsError( nRet ) && rLong.Len(); } diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 0304ae98bd..4563b4a705 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -474,7 +474,7 @@ BOOL SwXMLTextBlocks::PutMuchEntries( BOOL bOn ) { if( bInPutMuchBlocks ) { - ASSERT( !this, "verschachtelte Aufrufe sind nicht erlaubt" ); + OSL_ENSURE( !this, "verschachtelte Aufrufe sind nicht erlaubt" ); } else if( !IsFileChanged() ) { diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index b58874868c..1b50c5aa8a 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -110,7 +110,7 @@ ULONG SwXMLTextBlocks::GetDoc( USHORT nIdx ) uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) { // Throw an exception ? @@ -124,7 +124,7 @@ ULONG SwXMLTextBlocks::GetDoc( USHORT nIdx ) // get parser uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))); - ASSERT( xXMLParser.is(), + OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); if( !xXMLParser.is() ) { @@ -335,7 +335,7 @@ ULONG SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText ) uno::Reference < io::XStream > xContents = xRoot->openStreamElement( aStreamName, embed::ElementModes::READ ); uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) { // Throw an exception ? @@ -348,7 +348,7 @@ ULONG SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText ) // get parser uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ); - ASSERT( xXMLParser.is(), + OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); if( !xXMLParser.is() ) { @@ -386,7 +386,7 @@ ULONG SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText ) } catch ( uno::Exception& ) { - ASSERT( sal_False, "Tried to open non-existent folder or stream!"); + OSL_ENSURE( sal_False, "Tried to open non-existent folder or stream!"); } return n; @@ -408,7 +408,7 @@ ULONG SwXMLTextBlocks::PutBlockText( const String& rShort, const String& , uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) { @@ -488,7 +488,7 @@ void SwXMLTextBlocks::ReadInfo( void ) { uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) { @@ -504,7 +504,7 @@ void SwXMLTextBlocks::ReadInfo( void ) // get parser uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))); - ASSERT( xXMLParser.is(), + OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); if( !xXMLParser.is() ) { @@ -618,7 +618,7 @@ ULONG SwXMLTextBlocks::SetMacroTable( uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XML autotext event write:: got no service manager" ); if( !xServiceFactory.is() ) return ERR_SWG_WRITE_ERROR; @@ -626,7 +626,7 @@ ULONG SwXMLTextBlocks::SetMacroTable( // Get model uno::Reference< lang::XComponent > xModelComp( pDoc->GetDocShell()->GetModel(), UNO_QUERY ); - ASSERT( xModelComp.is(), "XMLWriter::Write: got no model" ); + OSL_ENSURE( xModelComp.is(), "XMLWriter::Write: got no model" ); if( !xModelComp.is() ) return ERR_SWG_WRITE_ERROR; @@ -662,7 +662,7 @@ ULONG SwXMLTextBlocks::SetMacroTable( xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")) ), UNO_QUERY ); - ASSERT( xSaxWriter.is(), "can't instantiate XML writer" ); + OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML writer" ); if( xSaxWriter.is() ) { @@ -688,7 +688,7 @@ ULONG SwXMLTextBlocks::SetMacroTable( uno::Reference< document::XExporter > xExporter( xServiceFactory->createInstanceWithArguments( sFilterComponent, aParams), UNO_QUERY); - ASSERT( xExporter.is(), + OSL_ENSURE( xExporter.is(), "can't instantiate export filter component" ); if( xExporter.is() ) { diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 04f4f2eed1..c62555ec5e 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -522,7 +522,7 @@ USHORT SwTextBlocks::Rename( USHORT n, const String* s, const String* l ) aLong = *l; if( !aNew.Len() ) { - ASSERT( !this, "Kein Kurzname in Rename angegeben" ); + OSL_ENSURE( !this, "Kein Kurzname in Rename angegeben" ); nErr = ERR_SWG_INTERNAL_ERROR; return (USHORT) -1; } @@ -756,7 +756,7 @@ BOOL SwTextBlocks::IsOnlyTextBlock( const String& rShort ) const return IsOnlyTextBlock( nIdx ); } - ASSERT( !this, "ungueltiger Name" ); + OSL_ENSURE( !this, "ungueltiger Name" ); return FALSE; } diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index dbddf52e67..79d6f41ccb 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -48,15 +48,11 @@ #include <editeng/protitem.hxx> #include <swtblfmt.hxx> -#ifndef DBG_UTIL -#define CHECK_TABLE(t) -#else -#ifdef DEBUG +#if OSL_DEBUG_LEVEL > 1 #define CHECK_TABLE(t) (t).CheckConsistency(); #else #define CHECK_TABLE(t) #endif -#endif // --------------------------------------------------------------- @@ -134,7 +130,7 @@ void lcl_CheckMinMax( long& rMin, long& rMax, const SwTableLine& rLine, USHORT n ++nCheck; if( rLine.GetTabBoxes().Count() < nCheck ) { // robust - ASSERT( false, "Box out of table line" ); + OSL_ENSURE( false, "Box out of table line" ); nCheck = rLine.GetTabBoxes().Count(); } @@ -143,7 +139,7 @@ void lcl_CheckMinMax( long& rMin, long& rMax, const SwTableLine& rLine, USHORT n for( USHORT nCurrBox = 0; nCurrBox < nCheck; ++nCurrBox ) { SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); nWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth(); nNew += nWidth; } @@ -177,12 +173,12 @@ long lcl_Box2LeftBorder( const SwTableBox& rBox ) for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); if( pBox == &rBox ) return nLeft; nLeft += pBox->GetFrmFmt()->GetFrmSize().GetWidth(); } - ASSERT( false, "Box not found in own upper?" ); + OSL_ENSURE( false, "Box not found in own upper?" ); return nLeft; } @@ -211,15 +207,15 @@ SwTableBox* lcl_LeftBorder2Box( long nLeft, const SwTableLine* pLine ) for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); if( nCurrLeft >= nLeft && pBox->GetFrmFmt()->GetFrmSize().GetWidth() ) { - ASSERT( nCurrLeft == nLeft, "Wrong box found" ); + OSL_ENSURE( nCurrLeft == nLeft, "Wrong box found" ); return pBox; } nCurrLeft += pBox->GetFrmFmt()->GetFrmSize().GetWidth(); } - ASSERT( false, "Didn't found wished box" ); + OSL_ENSURE( false, "Didn't found wished box" ); return 0; } @@ -257,7 +253,7 @@ void lcl_ChangeRowSpan( const SwTable& rTable, const long nDiff, { if( !nDiff || nRowIdx >= rTable.GetTabLines().Count() ) return; - ASSERT( !bSingle || nDiff > 0, "Don't set bSingle when deleting lines!" ); + OSL_ENSURE( !bSingle || nDiff > 0, "Don't set bSingle when deleting lines!" ); bool bGoOn; // nDistance is the distance between the current row and the critical row, // e.g. the deleted rows or the inserted rows. @@ -326,7 +322,7 @@ void lcl_ChangeRowSpan( const SwTable& rTable, const long nDiff, SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const { - ASSERT( bNewModel, "Don't call me for old tables" ); + OSL_ENSURE( bNewModel, "Don't call me for old tables" ); if( !aLines.Count() ) return 0; const SwNode* pStartNd = rPam.Start()->nNode.GetNode().FindTableBoxStartNode(); @@ -341,12 +337,12 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const for( USHORT nRow = 0; nFound < 2 && nRow < nLines; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - ASSERT( pLine, "Missing table line" ); + OSL_ENSURE( pLine, "Missing table line" ); USHORT nCols = pLine->GetTabBoxes().Count(); for( USHORT nCol = 0; nCol < nCols; ++nCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCol]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); if( nFound ) { if( pBox->GetSttNd() == pEndNd ) @@ -381,7 +377,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const for( USHORT nRow = nTop; nRow <= nBottom && bOkay; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - ASSERT( pLine, "Missing table line" ); + OSL_ENSURE( pLine, "Missing table line" ); SwSelBoxes *pBoxes = new SwSelBoxes(); long nLeft = 0; long nRight = 0; @@ -390,7 +386,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); nLeft = nRight; nRight += pBox->GetFrmFmt()->GetFrmSize().GetWidth(); nRowSpan = pBox->getRowSpan(); @@ -624,7 +620,7 @@ long lcl_InsertPosition( SwTable &rTable, std::vector<USHORT>& rInsPos, nAddWidth += nWidth; USHORT nCurrBox = pLine->GetTabBoxes().C40_GETPOS(SwTableBox, pBox ); USHORT nCurrLine = rTable.GetTabLines().C40_GETPOS(SwTableLine, pLine ); - ASSERT( nCurrLine != USHRT_MAX, "Time to say Good-Bye.." ); + OSL_ENSURE( nCurrLine != USHRT_MAX, "Time to say Good-Bye.." ); if( rInsPos[ nCurrLine ] == USHRT_MAX ) { rInsPos[ nCurrLine ] = nCurrBox; @@ -706,7 +702,7 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, { SwTableLine* pLine = aLines[ i ]; USHORT nInsPos = aInsPos[i]; - ASSERT( nInsPos != USHRT_MAX, "Didn't found insert position" ); + OSL_ENSURE( nInsPos != USHRT_MAX, "Didn't found insert position" ); SwTableBox* pBox = pLine->GetTabBoxes()[ nInsPos ]; if( bBehind ) ++nInsPos; @@ -777,13 +773,13 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, aFndBox.MakeFrms( *this ); // aFndBox.RestoreChartData( *this ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { const SwTableBoxes &rTabBoxes = aLines[0]->GetTabBoxes(); long nNewWidth = 0; for( USHORT i = 0; i < rTabBoxes.Count(); ++i ) nNewWidth += rTabBoxes[i]->GetFrmFmt()->GetFrmSize().GetWidth(); - ASSERT( nNewWidth > 0, "Very small" ); + OSL_ENSURE( nNewWidth > 0, "Very small" ); } #endif CHECK_TABLE( *this ) @@ -985,7 +981,7 @@ void SwTable::_FindSuperfluousRows( SwSelBoxes& rBoxes, for( USHORT nRow = nFirstLn; nRow <= nLastLn; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - ASSERT( pLine, "Missing table line" ); + OSL_ENSURE( pLine, "Missing table line" ); USHORT nCols = pLine->GetTabBoxes().Count(); bool bSuperfl = true; for( USHORT nCol = 0; nCol < nCols; ++nCol ) @@ -1070,7 +1066,7 @@ SwTableBox& SwTableBox::FindEndOfRowSpan( const SwTable& rTable, USHORT nMaxStep void lcl_getAllMergedBoxes( const SwTable& rTable, SwSelBoxes& rBoxes, SwTableBox& rBox ) { SwTableBox* pBox = &rBox; - ASSERT( pBox == &rBox.FindStartOfRowSpan( rTable, USHRT_MAX ), "Not a master box" ); + OSL_ENSURE( pBox == &rBox.FindStartOfRowSpan( rTable, USHRT_MAX ), "Not a master box" ); rBoxes.Insert( pBox ); if( pBox->getRowSpan() == 1 ) return; @@ -1158,7 +1154,7 @@ void lcl_FillSelBoxes( SwSelBoxes &rBoxes, SwTableLine &rLine ) void SwTable::InsertSpannedRow( SwDoc* pDoc, USHORT nRowIdx, USHORT nCnt ) { CHECK_TABLE( *this ) - ASSERT( nCnt && nRowIdx < GetTabLines().Count(), "Wrong call of InsertSpannedRow" ); + OSL_ENSURE( nCnt && nRowIdx < GetTabLines().Count(), "Wrong call of InsertSpannedRow" ); SwSelBoxes aBoxes; SwTableLine& rLine = *GetTabLines()[ nRowIdx ]; lcl_FillSelBoxes( aBoxes, rLine ); @@ -1213,7 +1209,7 @@ void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr, for( USHORT i = 0; i < rBoxes.Count(); ++i ) { // Collect all end line indices and the row spans const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable ); - ASSERT( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" ) + OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" ); if( nCnt > rBox.getRowSpan() ) { const SwTableLine *pLine = rBox.GetUpper(); @@ -1249,7 +1245,7 @@ void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr, aLnOfs.second < pCurr->second ) aLnOfs.second = pCurr->second; // Found a smaller row span } - ASSERT( aLnOfs.second < nCnt, "Clean-up failed" ) + OSL_ENSURE( aLnOfs.second < nCnt, "Clean-up failed" ); aLnOfs.second = nCnt - aLnOfs.second; // the number of rows to insert rArr.insert( rArr.end(), SwLineOffset( aLnOfs.first - nSum, aLnOfs.second ) ); @@ -1312,7 +1308,7 @@ USHORT lcl_CalculateSplitLineHeights( SwSplitLines &rCurr, SwSplitLines &rNew, for( USHORT i = 0; i < rBoxes.Count(); ++i ) { // Collect all pairs (start+end) of line indices to split const SwTableBox &rBox = rBoxes[ i ]->FindStartOfRowSpan( rTable ); - ASSERT( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" ) + OSL_ENSURE( rBox.getRowSpan() > 0, "Didn't I say 'StartOfRowSpan' ??" ); const SwTableLine *pLine = rBox.GetUpper(); const USHORT nStart = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine ); const USHORT nEnd = USHORT( rBox.getRowSpan() + nStart - 1 ); @@ -1465,7 +1461,7 @@ BOOL SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, std::set< USHORT> aIndices; for( USHORT i = 0; i < rBoxes.Count(); ++i ) { - ASSERT( rBoxes[i]->getRowSpan() != 1, "Forgot to split?" ) + OSL_ENSURE( rBoxes[i]->getRowSpan() != 1, "Forgot to split?" ); if( rBoxes[i]->getRowSpan() > 1 ) aIndices.insert( i ); } @@ -1562,14 +1558,14 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes ) long nLeft = lcl_Box2LeftBorder( *pBox ); SwTableLine *pLine = pBox->GetUpper(); USHORT nLinePos = GetTabLines().C40_GETPOS(SwTableLine, pLine); - ASSERT( nLinePos < USHRT_MAX, "Box/table mismatch" ) + OSL_ENSURE( nLinePos < USHRT_MAX, "Box/table mismatch" ); if( nRowSpan > 1 ) { if( ++nLinePos < GetTabLines().Count() ) { pLine = GetTabLines()[ nLinePos ]; pBox = lcl_LeftBorder2Box( nLeft, pLine ); - ASSERT( pBox, "RowSpan irritation I" ) + OSL_ENSURE( pBox, "RowSpan irritation I" ); if( pBox ) pBox->setRowSpan( --nRowSpan ); } @@ -1580,7 +1576,7 @@ void SwTable::PrepareDelBoxes( const SwSelBoxes& rBoxes ) { pLine = GetTabLines()[ --nLinePos ]; pBox = lcl_LeftBorder2Box( nLeft, pLine ); - ASSERT( pBox, "RowSpan irritation II" ) + OSL_ENSURE( pBox, "RowSpan irritation II" ); if( pBox ) { nRowSpan = pBox->getRowSpan(); @@ -1617,7 +1613,7 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = rLine.GetTabBoxes()[nCurrBox]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); long nWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth(); nRight += nWidth; if( nRight > nMin ) @@ -1657,7 +1653,7 @@ void lcl_SearchSelBox( const SwTable &rTable, SwSelBoxes& rBoxes, long nMin, lon void SwTable::CreateSelection( const SwPaM& rPam, SwSelBoxes& rBoxes, const SearchType eSearch, bool bChkProtected ) const { - ASSERT( bNewModel, "Don't call me for old tables" ); + OSL_ENSURE( bNewModel, "Don't call me for old tables" ); if( !aLines.Count() ) return; const SwNode* pStartNd = rPam.GetPoint()->nNode.GetNode().FindTableBoxStartNode(); @@ -1695,12 +1691,12 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd, for( USHORT nRow = 0; nFound < 2 && nRow < nLines; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - ASSERT( pLine, "Missing table line" ); + OSL_ENSURE( pLine, "Missing table line" ); USHORT nCols = pLine->GetTabBoxes().Count(); for( USHORT nCol = 0; nCol < nCols; ++nCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCol]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); if( pBox->GetSttNd() == pEndNd || pBox->GetSttNd() == pStartNd ) { if( !bChkProtected || @@ -1740,12 +1736,12 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd, for( USHORT nRow = nTop; nRow <= nBottom; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - ASSERT( pLine, "Missing table line" ); + OSL_ENSURE( pLine, "Missing table line" ); USHORT nCount = pLine->GetTabBoxes().Count(); for( USHORT nCurrBox = 0; nCurrBox < nCount; ++nCurrBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); if( pBox->getRowSpan() > 0 && ( !bChkProtected || !pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) ) rBoxes.Insert( pBox ); @@ -1848,7 +1844,7 @@ void SwTable::CreateSelection( const SwNode* pStartNd, const SwNode* pEndNd, void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax ) const { - ASSERT( bNewModel, "Don't call me for old tables" ); + OSL_ENSURE( bNewModel, "Don't call me for old tables" ); rMin = 0; rMax = 0; if( !aLines.Count() || !rBoxes.Count() ) @@ -1860,12 +1856,12 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax for( USHORT nRow = 0; nRow < nLineCnt && nBox < nBoxCnt; ++nRow ) { SwTableLine* pLine = aLines[nRow]; - ASSERT( pLine, "Missing table line" ); + OSL_ENSURE( pLine, "Missing table line" ); USHORT nCols = pLine->GetTabBoxes().Count(); for( USHORT nCol = 0; nCol < nCols; ++nCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCol]; - ASSERT( pBox, "Missing table box" ); + OSL_ENSURE( pBox, "Missing table box" ); if( pBox == rBoxes[nBox] ) { lcl_CheckMinMax( rMin, rMax, *pLine, nCol, nBox == 0 ); @@ -1897,7 +1893,7 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax */ void SwTable::PrepareDeleteCol( long nMin, long nMax ) { - ASSERT( bNewModel, "Don't call me for old tables" ); + OSL_ENSURE( bNewModel, "Don't call me for old tables" ); if( !aLines.Count() || nMax < nMin ) return; long nMid = nMin ? ( nMin + nMax ) / 2 : 0; @@ -1968,9 +1964,9 @@ void SwTable::ExpandSelection( SwSelBoxes& rBoxes ) const void SwTable::CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const { - ASSERT( IsNewModel(), "Don't call me for old tables" ); + OSL_ENSURE( IsNewModel(), "Don't call me for old tables" ); USHORT nLineIdx = GetTabLines().C40_GETPOS( SwTableLine, rpLine ); - ASSERT( nLineIdx < GetTabLines().Count(), "Start line out of range" ); + OSL_ENSURE( nLineIdx < GetTabLines().Count(), "Start line out of range" ); bool bChange = true; if( bUp ) { @@ -2033,12 +2029,12 @@ SwSaveRowSpan::SwSaveRowSpan( SwTableBoxes& rBoxes, USHORT nSplitLn ) { bool bDontSave = true; // nothing changed, nothing to save USHORT nColCount = rBoxes.Count(); - ASSERT( nColCount, "Empty Table Line" ) + OSL_ENSURE( nColCount, "Empty Table Line" ); mnRowSpans.resize( nColCount ); for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { SwTableBox* pBox = rBoxes[nCurrCol]; - ASSERT( pBox, "Missing Table Box" ); + OSL_ENSURE( pBox, "Missing Table Box" ); long nRowSp = pBox->getRowSpan(); mnRowSpans[ nCurrCol ] = nRowSp; if( nRowSp < 0 ) @@ -2059,24 +2055,24 @@ void SwTable::RestoreRowSpan( const SwSaveRowSpan& rSave ) if( !IsNewModel() ) // for new model only return; USHORT nLineCount = GetTabLines().Count(); - ASSERT( rSave.mnSplitLine < nLineCount, "Restore behind last line?" ) + OSL_ENSURE( rSave.mnSplitLine < nLineCount, "Restore behind last line?" ); if( rSave.mnSplitLine < nLineCount ) { SwTableLine* pLine = GetTabLines()[rSave.mnSplitLine]; USHORT nColCount = pLine->GetTabBoxes().Count(); - ASSERT( nColCount, "Empty Table Line" ) - ASSERT( nColCount == rSave.mnRowSpans.size(), "Wrong row span store" ) + OSL_ENSURE( nColCount, "Empty Table Line" ); + OSL_ENSURE( nColCount == rSave.mnRowSpans.size(), "Wrong row span store" ); if( nColCount == rSave.mnRowSpans.size() ) { for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol]; - ASSERT( pBox, "Missing Table Box" ); + OSL_ENSURE( pBox, "Missing Table Box" ); long nRowSp = pBox->getRowSpan(); if( nRowSp != rSave.mnRowSpans[ nCurrCol ] ) { - ASSERT( -nRowSp == rSave.mnRowSpans[ nCurrCol ], "Pardon me?!" ) - ASSERT( rSave.mnRowSpans[ nCurrCol ] < 0, "Pardon me?!" ) + OSL_ENSURE( -nRowSp == rSave.mnRowSpans[ nCurrCol ], "Pardon me?!" ); + OSL_ENSURE( rSave.mnRowSpans[ nCurrCol ] < 0, "Pardon me?!" ); pBox->setRowSpan( -nRowSp ); USHORT nLine = rSave.mnSplitLine; @@ -2129,11 +2125,11 @@ void SwTable::CleanUpBottomRowSpan( USHORT nDelLines ) USHORT nLastLine = GetTabLines().Count()-1; SwTableLine* pLine = GetTabLines()[nLastLine]; USHORT nColCount = pLine->GetTabBoxes().Count(); - ASSERT( nColCount, "Empty Table Line" ) + OSL_ENSURE( nColCount, "Empty Table Line" ); for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol]; - ASSERT( pBox, "Missing Table Box" ); + OSL_ENSURE( pBox, "Missing Table Box" ); long nRowSp = pBox->getRowSpan(); if( nRowSp < 0 ) nRowSp = -nRowSp; @@ -2145,7 +2141,7 @@ void SwTable::CleanUpBottomRowSpan( USHORT nDelLines ) } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 struct RowSpanCheck { @@ -2167,25 +2163,25 @@ void SwTable::CheckConsistency() const { SwTwips nWidth = 0; SwTableLine* pLine = GetTabLines()[nCurrLine]; - ASSERT( pLine, "Missing Table Line" ) + OSL_ENSURE( pLine, "Missing Table Line" ); USHORT nColCount = pLine->GetTabBoxes().Count(); - ASSERT( nColCount, "Empty Table Line" ) + OSL_ENSURE( nColCount, "Empty Table Line" ); for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol]; - ASSERT( pBox, "Missing Table Box" ); + OSL_ENSURE( pBox, "Missing Table Box" ); SwTwips nNewWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth() + nWidth; long nRowSp = pBox->getRowSpan(); if( nRowSp < 0 ) { - ASSERT( aIter != aRowSpanCells.end(), "Missing master box" ) -#ifdef DBG_UTIL + OSL_ENSURE( aIter != aRowSpanCells.end(), "Missing master box" ); +#if OSL_DEBUG_LEVEL > 1 //RowSpanCheck &rCheck = *aIter; #endif - ASSERT( aIter->nLeft == nWidth && aIter->nRight == nNewWidth, + OSL_ENSURE( aIter->nLeft == nWidth && aIter->nRight == nNewWidth, "Wrong position/size of overlapped table box" ); --(aIter->nRowSpan); - ASSERT( aIter->nRowSpan == -nRowSp, "Wrong row span value" ); + OSL_ENSURE( aIter->nRowSpan == -nRowSp, "Wrong row span value" ); if( nRowSp == -1 ) { std::list< RowSpanCheck >::iterator aEraseIter = aIter; @@ -2197,7 +2193,7 @@ void SwTable::CheckConsistency() const } else if( nRowSp != 1 ) { - ASSERT( nRowSp, "Zero row span?!" ); + OSL_ENSURE( nRowSp, "Zero row span?!" ); RowSpanCheck aEntry; aEntry.nLeft = nWidth; aEntry.nRight = nNewWidth; @@ -2208,14 +2204,14 @@ void SwTable::CheckConsistency() const } if( !nCurrLine ) nLineWidth = nWidth; - ASSERT( nWidth == nLineWidth, "Different Line Widths" ) - ASSERT( nWidth == nTabSize, "Boxen der Line zu klein/gross" ) - ASSERT( nWidth >= 0 && nWidth <= USHRT_MAX, "Width out of range" ) - ASSERT( aIter == aRowSpanCells.end(), "Missing overlapped box" ) + OSL_ENSURE( nWidth == nLineWidth, "Different Line Widths" ); + OSL_ENSURE( nWidth == nTabSize, "Boxen der Line zu klein/gross" ); + OSL_ENSURE( nWidth >= 0 && nWidth <= USHRT_MAX, "Width out of range" ); + OSL_ENSURE( aIter == aRowSpanCells.end(), "Missing overlapped box" ); aIter = aRowSpanCells.begin(); } bool bEmpty = aRowSpanCells.empty(); - ASSERT( bEmpty, "Open row span detected" ) + OSL_ENSURE( bEmpty, "Open row span detected" ); } #endif diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index a692ed0142..f7c7b792c5 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -74,15 +74,11 @@ #include <redline.hxx> #include <list> -#ifndef DBG_UTIL -#define CHECK_TABLE(t) -#else -#ifdef DEBUG +#if OSL_DEBUG_LEVEL > 1 #define CHECK_TABLE(t) (t).CheckConsistency(); #else #define CHECK_TABLE(t) #endif -#endif using namespace com::sun::star; @@ -221,12 +217,12 @@ void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd, SwTableBox* pBox, USHORT nInsPos, USHORT nCnt ) { - ASSERT( pBox->GetSttNd(), "Box ohne Start-Node" ); + OSL_ENSURE( pBox->GetSttNd(), "Box ohne Start-Node" ); SwNodeIndex aIdx( *pBox->GetSttNd(), +1 ); SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode(); if( !pCNd ) pCNd = pDoc->GetNodes().GoNext( &aIdx ); - ASSERT( pCNd, "Box ohne ContentNode" ); + OSL_ENSURE( pCNd, "Box ohne ContentNode" ); if( pCNd->IsTxtNode() ) { @@ -406,7 +402,7 @@ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld, } } else { - ASSERT( false, "Rounding error" ); + OSL_ENSURE( false, "Rounding error" ); } nSum += nBox; } @@ -434,7 +430,7 @@ void SwTable::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { if ( !IsModifyLocked() ) { - ASSERT( pOldSize && pOldSize->Which() == RES_FRM_SIZE && + OSL_ENSURE( pOldSize && pOldSize->Which() == RES_FRM_SIZE && pNewSize && pNewSize->Which() == RES_FRM_SIZE, "Kein Old oder New fuer FmtFrmSize-Modify der SwTable." ); AdjustWidths( pOldSize->GetWidth(), pNewSize->GetWidth() ); @@ -949,7 +945,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, Parm aParm( rNew, rOld ); - ASSERT( rOld.Count() == rNew.Count(), "Columnanzahl veraendert."); + OSL_ENSURE( rOld.Count() == rNew.Count(), "Columnanzahl veraendert."); //Raender verarbeiten. Groesse der Tabelle und ein paar Boxen mussen //angepasst werden. Bei der Groesseneinstellung darf allerdings das @@ -1084,7 +1080,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { // steht im tblrwcl.cxx extern void _CheckBoxWidth( const SwTableLine&, SwTwips ); @@ -1191,7 +1187,7 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges USHORT nPos = (USHORT)nSum; while( pCurr != rChanges.end() && pCurr->first < nPos ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT nTemp = pCurr->first; nTemp = pCurr->second; #endif @@ -1291,7 +1287,7 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, const SwTabCols &rOld, const SwTableBox *pStart, BOOL bCurRowOnly ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 static int nCallCount = 0; ++nCallCount; #endif @@ -1509,7 +1505,7 @@ const SwTableBox* SwTable::GetTblBox( const String& rName, // Box ist ?? if( pBox && !pBox->GetSttNd() ) { - ASSERT( FALSE, "Box ohne Inhalt, suche die naechste !!" ); + OSL_ENSURE( FALSE, "Box ohne Inhalt, suche die naechste !!" ); // "herunterfallen lassen" bis zur ersten Box while( pBox->GetTabLines().Count() ) pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0]; @@ -1761,7 +1757,7 @@ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwNodeIndex &rIdx, // an der Table eintragen const SwTableNode* pTblNd = pSttNd->FindTableNode(); - ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" ); + OSL_ENSURE( pTblNd, "in welcher Tabelle steht denn die Box?" ); SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable(). GetTabSortBoxes(); SwTableBox* p = this; // error: &this @@ -1779,7 +1775,7 @@ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwStartNode& rSttNd, SwTableL // an der Table eintragen const SwTableNode* pTblNd = pSttNd->FindTableNode(); - ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" ); + OSL_ENSURE( pTblNd, "in welcher Tabelle steht denn die Box?" ); SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable(). GetTabSortBoxes(); SwTableBox* p = this; // error: &this @@ -1793,7 +1789,7 @@ SwTableBox::~SwTableBox() { // an der Table austragen const SwTableNode* pTblNd = pSttNd->FindTableNode(); - ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" ); + OSL_ENSURE( pTblNd, "in welcher Tabelle steht denn die Box?" ); SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable(). GetTabSortBoxes(); SwTableBox *p = this; // error: &this @@ -1995,7 +1991,7 @@ BOOL SwTableBox::IsInHeadline( const SwTable* pTbl ) const return pTbl->GetTabLines()[ 0 ] == pLine; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ULONG SwTableBox::GetSttIdx() const { @@ -2340,7 +2336,7 @@ void SwTableBoxFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) SwTableBox* pBox = (SwTableBox*)aIter.First( TYPE( SwTableBox ) ); if( pBox ) { - ASSERT( !aIter.Next(), "keine Box oder mehrere am Format" ); + OSL_ENSURE( !aIter.Next(), "keine Box oder mehrere am Format" ); ULONG nNewFmt; if( pNewFmt ) diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 10234830c9..fb9634d155 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 51e3ffbe59..c14046214a 100644 --- a/sw/source/core/text/makefile.mk +++ b/sw/source/core/text/makefile.mk @@ -51,7 +51,7 @@ SLOFILES = \ $(SLO)$/txtcache.obj \ $(SLO)$/txtinit.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 000a3c70b2..624aab8343 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 434e2b0b9e..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() @@ -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 } diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index 4509bd05fd..146166a8e6 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -215,7 +215,7 @@ SwTOXMark::~SwTOXMark() int SwTOXMark::operator==( const SfxPoolItem& rAttr ) const { - ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); + OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return GetRegisteredIn() == ((SwTOXMark&)rAttr).GetRegisteredIn(); } @@ -250,7 +250,7 @@ String SwTOXMark::GetText() const else if( pTxtAttr && pTxtAttr->GetpTxtNd() ) { xub_StrLen* pEndIdx = pTxtAttr->GetEnd(); - ASSERT( pEndIdx, "TOXMark ohne Mark!!"); + OSL_ENSURE( pEndIdx, "TOXMark ohne Mark!!"); if( pEndIdx ) { const xub_StrLen nStt = *pTxtAttr->GetStart(); @@ -308,7 +308,7 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237# case TOX_TABLES : nPoolId = STR_POOLCOLL_TOX_TABLESH; break; case TOX_AUTHORITIES : nPoolId = STR_POOLCOLL_TOX_AUTHORITIESH; break; default: - ASSERT( !this, "ungueltiger TOXTyp"); + OSL_ENSURE( !this, "ungueltiger TOXTyp"); return ; } @@ -917,7 +917,7 @@ FormTokenType SwFormTokensHelper::GetTokenType(const String & sToken, break; } - ASSERT( pNm, "wrong token" ); + OSL_ENSURE( pNm, "wrong token" ); if (pTokenLen) *pTokenLen = nTokenLen; @@ -928,13 +928,13 @@ FormTokenType SwFormTokensHelper::GetTokenType(const String & sToken, void SwForm::SetPattern(USHORT nLevel, const SwFormTokens& rTokens) { - ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); + OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX"); aPattern[nLevel] = rTokens; } void SwForm::SetPattern(USHORT nLevel, const String & rStr) { - ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); + OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX"); SwFormTokensHelper aHelper(rStr); aPattern[nLevel] = aHelper.GetTokens(); @@ -942,7 +942,7 @@ void SwForm::SetPattern(USHORT nLevel, const String & rStr) const SwFormTokens& SwForm::GetPattern(USHORT nLevel) const { - ASSERT(nLevel < GetFormMax(), "Index >= FORM_MAX"); + OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX"); return aPattern[nLevel]; } diff --git a/sw/source/core/tox/toxhlp.cxx b/sw/source/core/tox/toxhlp.cxx index 2733a19ef3..4b06ddb441 100644 --- a/sw/source/core/tox/toxhlp.cxx +++ b/sw/source/core/tox/toxhlp.cxx @@ -58,12 +58,12 @@ IndexEntrySupplierWrapper::IndexEntrySupplierWrapper() } } catch ( UNO_NMSPC::Exception& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 e #endif ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ByteString aMsg( "IndexEntrySupplierWrapper: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -84,12 +84,12 @@ String IndexEntrySupplierWrapper::GetIndexKey( const String& rTxt, sRet = xIES->getIndexKey( rTxt, rTxtReading, rLocale ); } catch ( UNO_NMSPC::Exception& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 e #endif ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ByteString aMsg( "getIndexKey: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -105,12 +105,12 @@ String IndexEntrySupplierWrapper::GetFollowingText( BOOL bMorePages ) const sRet = xIES->getIndexFollowPageWord( bMorePages, aLcl ); } catch ( UNO_NMSPC::Exception& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 e #endif ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ByteString aMsg( "getIndexFollowPageWord: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -128,12 +128,12 @@ IndexEntrySupplierWrapper::GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLc sRet = xIES->getAlgorithmList( rLcl ); } catch ( UNO_NMSPC::Exception& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 e #endif ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ByteString aMsg( "getAlgorithmList: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -151,12 +151,12 @@ sal_Bool IndexEntrySupplierWrapper::LoadAlgorithm( bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions ); } catch ( UNO_NMSPC::Exception& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 e #endif ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ByteString aMsg( "loadAlgorithm: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -177,12 +177,12 @@ sal_Int16 IndexEntrySupplierWrapper::CompareIndexEntry( rTxt2, rTxtReading2, rLocale2 ); } catch ( UNO_NMSPC::Exception& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 e #endif ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ByteString aMsg( "compareIndexEntry: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 881ff1fc9d..63152fb759 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -187,8 +187,8 @@ SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwCntntNode* pNd, { SwPosition aPos( *pNd ); const SwDoc& rDoc = *pNd->GetDoc(); -#ifdef DBG_UTIL - ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht der Absatz" ); #else GetBodyTxtNode( rDoc, aPos, *pFrm ); @@ -341,7 +341,7 @@ BOOL SwTOXIndex::operator==( const SwTOXSortTabBase& rCmpBase ) if(GetLevel() != rCmp.GetLevel() || nKeyLevel != rCmp.nKeyLevel) return FALSE; - ASSERT(pTxtMark, "pTxtMark == 0, Kein Stichwort"); + OSL_ENSURE(pTxtMark, "pTxtMark == 0, Kein Stichwort"); String sMyTxt; String sMyTxtReading; @@ -371,7 +371,7 @@ BOOL SwTOXIndex::operator<( const SwTOXSortTabBase& rCmpBase ) { SwTOXIndex& rCmp = (SwTOXIndex&)rCmpBase; - ASSERT(pTxtMark, "pTxtMark == 0, Kein Stichwort"); + OSL_ENSURE(pTxtMark, "pTxtMark == 0, Kein Stichwort"); String sMyTxt; String sMyTxtReading; @@ -404,7 +404,7 @@ BOOL SwTOXIndex::operator<( const SwTOXSortTabBase& rCmpBase ) void SwTOXIndex::_GetText( String& rTxt, String& rTxtReading ) { - ASSERT(pTxtMark, "pTxtMark == 0, Kein Stichwort"); + OSL_ENSURE(pTxtMark, "pTxtMark == 0, Kein Stichwort"); const SwTOXMark& rTOXMark = pTxtMark->GetTOXMark(); switch(nKeyLevel) { @@ -462,7 +462,7 @@ void SwTOXIndex::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT ) cons USHORT SwTOXIndex::GetLevel() const { - ASSERT(pTxtMark, "pTxtMark == 0, Kein Stichwort"); + OSL_ENSURE(pTxtMark, "pTxtMark == 0, Kein Stichwort"); USHORT nForm = FORM_PRIMARY_KEY; @@ -644,7 +644,7 @@ void SwTOXPara::_GetText( String& rTxt, String& ) rTxt = pFly->GetName(); else { - ASSERT( !this, "Grafik/Object ohne Namen" ) + OSL_ENSURE( !this, "Grafik/Object ohne Namen" ); USHORT nId = nsSwTOXElement::TOX_OLE == eType ? STR_OBJECT_DEFNAME : nsSwTOXElement::TOX_GRAPHIC == eType @@ -741,7 +741,7 @@ String SwTOXPara::GetURL() const // } // else // { -// ASSERT( false, +// OSL_ENSURE( false, // "<SwTOXPara::GetURL()> - text node with numbering rule, but without number. This is a serious defect -> inform OD" ); // } // } @@ -809,7 +809,7 @@ void SwTOXTable::_GetText( String& rTxt, String& ) } else { - ASSERT( !this, "Wo ist meine Tabelle geblieben?" ) + OSL_ENSURE( !this, "Wo ist meine Tabelle geblieben?" ); rTxt = SW_RESSTR( STR_TABLE_DEFNAME ); } } diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 12d5fac40d..a62fe76d0b 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 51ddf18f9b..7bc2ab4c14 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 5a5d08f22e..f1c243d7c0 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 ddc5236c89..f6e40747bb 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 177d6704e8..7830b0ea78 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 1374d11e4c..69b993fc44 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 929258eacf..fb8025fd5f 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 58a12e867d..9a76e6ffa9 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 a491899ce9..62caad92a3 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 6bfa8c6bd6..e7f7620c8a 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 6f7fc3e112..0a2b87520d 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 028e69e152..de3a164255 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 adaa248f7c..3c5c32d31a 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; } @@ -2079,8 +2079,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 ) { diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index 864b83e45a..6d93bfc7d9 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -73,9 +73,9 @@ SwUndoFieldFromDoc::SwUndoFieldFromDoc(const SwPosition & rPos, , pHnt(_pHnt) , bUpdate(_bUpdate) { - ASSERT(pOldField, "No old field!"); - ASSERT(pNewField, "No new field!"); - ASSERT(pDoc, "No document!"); + OSL_ENSURE(pOldField, "No old field!"); + OSL_ENSURE(pNewField, "No new field!"); + OSL_ENSURE(pDoc, "No document!"); } SwUndoFieldFromDoc::~SwUndoFieldFromDoc() diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index dc252ed510..893cb248bf 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -149,7 +149,7 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld, UNDO_CHANGE_PAGEDESC ), aOld(_aOld, _pDoc), aNew(_aNew, _pDoc), pDoc(_pDoc), bExchange( false ) { - ASSERT(0 != pDoc, "no document?"); + OSL_ENSURE(0 != pDoc, "no document?"); #ifdef DEBUG DebugHeaderFooterContent( (SwPageDesc&)aOld ); @@ -228,7 +228,7 @@ SwUndoPageDesc::~SwUndoPageDesc() void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDest ) { - ASSERT( bExchange, "You shouldn't do that." ); + OSL_ENSURE( bExchange, "You shouldn't do that." ); const SwFmtHeader& rDestHead = rDest.GetMaster().GetHeader(); const SwFmtHeader& rSourceHead = rSource.GetMaster().GetHeader(); if( rDestHead.IsActive() ) @@ -373,7 +373,7 @@ SwUndoPageDescCreate::SwUndoPageDescCreate(const SwPageDesc * pNew, : SwUndo(UNDO_CREATE_PAGEDESC), pDesc(pNew), aNew(*pNew, _pDoc), pDoc(_pDoc) { - ASSERT(0 != pDoc, "no document?"); + OSL_ENSURE(0 != pDoc, "no document?"); } SwUndoPageDescCreate::~SwUndoPageDescCreate() @@ -433,7 +433,7 @@ SwUndoPageDescDelete::SwUndoPageDescDelete(const SwPageDesc & _aOld, SwDoc * _pDoc) : SwUndo(UNDO_DELETE_PAGEDESC), aOld(_aOld, _pDoc), pDoc(_pDoc) { - ASSERT(0 != pDoc, "no document?"); + OSL_ENSURE(0 != pDoc, "no document?"); } SwUndoPageDescDelete::~SwUndoPageDescDelete() diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 7a2123618d..8b2cd0d88c 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -164,14 +164,14 @@ void SwDoc::AppendUndo( SwUndo* pUndo ) case UNDO_START: ++nUndoSttEnd; break; - case UNDO_END: ASSERT( nUndoSttEnd, "Undo-Ende ohne Start" ); + case UNDO_END: OSL_ENSURE( nUndoSttEnd, "Undo-Ende ohne Start" ); --nUndoSttEnd; // kein break !!! default: if( pUndos->Count() != nUndoPos && UNDO_END != pUndo->GetId() ) ClearRedo(); else { - ASSERT( pUndos->Count() == nUndoPos || UNDO_END == pUndo->GetId(), + OSL_ENSURE( pUndos->Count() == nUndoPos || UNDO_END == pUndo->GetId(), "Redo history not deleted!" ); } if( !nUndoSttEnd ) @@ -199,7 +199,7 @@ void SwDoc::AppendUndo( SwUndo* pUndo ) USHORT nEnde = UNDO_ACTION_LIMIT; // nur zum Testen der neuen DOC-Member -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { SwUndoId nId = UNDO_EMPTY; USHORT nUndosCnt = 0, nSttEndCnt = 0; @@ -212,8 +212,8 @@ void SwDoc::AppendUndo( SwUndo* pUndo ) if( !nSttEndCnt ) ++nUndosCnt; } - ASSERT( nSttEndCnt == nUndoSttEnd, "Start-Ende Count ungleich" ); - ASSERT( nUndosCnt == nUndoCnt, "Undo Count ungleich" ); + OSL_ENSURE( nSttEndCnt == nUndoSttEnd, "Start-Ende Count ungleich" ); + OSL_ENSURE( nUndosCnt == nUndoCnt, "Undo Count ungleich" ); } #endif @@ -309,7 +309,7 @@ BOOL SwDoc::DelUndoObj( USHORT nEnde ) --nEnde, --nUndoCnt; } - ASSERT( nCnt < nUndoPos || nUndoPos == pUndos->Count(), + OSL_ENSURE( nCnt < nUndoPos || nUndoPos == pUndos->Count(), "Undo-Del-Ende liegt in einer Redo-Aktion" ); // dann setze ab Ende bis Undo-Ende bei allen Undo-Objecte die Werte um @@ -496,7 +496,7 @@ SwUndoId SwDoc::EndUndo(SwUndoId eUndoId, const SwRewriter * pRewriter) // kann eigentlich nur beim Abspielen von Macros passieren, die // Undo/Redo/Repeat benutzen und die eine exitierende Selection // durch Einfuegen loeschen - ASSERT( !this, "kein entsprechendes Ende gefunden" ); + OSL_ENSURE( !this, "kein entsprechendes Ende gefunden" ); // kein entsprechenden Start gefunden -> Ende nicht einfuegen // und die Member am Doc updaten @@ -547,7 +547,7 @@ SwUndoId SwDoc::EndUndo(SwUndoId eUndoId, const SwRewriter * pRewriter) pUndoEnd->SetSttOffset( nSize ); // nur zum Testen der Start/End-Verpointerung vom Start/End Undo -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 { USHORT nEndCnt = 1, nCnt = pUndos->Count(); SwUndoId nTmpId = UNDO_EMPTY; @@ -566,7 +566,7 @@ SwUndoId SwDoc::EndUndo(SwUndoId eUndoId, const SwRewriter * pRewriter) else if( !nEndCnt ) break; } - ASSERT( nCnt == pUndos->Count() - nSize, + OSL_ENSURE( nCnt == pUndos->Count() - nSize, "Start-Ende falsch geklammert" ); } #endif @@ -654,7 +654,7 @@ SwUndoIdAndName * lcl_GetUndoIdAndName(const SwUndos & rUndos, sal_uInt16 nPos ) SwUndoId nId = UNDO_EMPTY; String sStr("??", RTL_TEXTENCODING_ASCII_US); - ASSERT( nPos < rUndos.Count(), "nPos out of range"); + OSL_ENSURE( nPos < rUndos.Count(), "nPos out of range"); switch (pUndo->GetId()) { @@ -1001,7 +1001,7 @@ SwUndo* SwDoc::RemoveLastUndo( SwUndoId eUndoId ) else { pUndo = 0; - ASSERT( !this, "falsches Undo-Object" ); + OSL_ENSURE( !this, "falsches Undo-Object" ); } return pUndo; } diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 2a4ada4bb6..4214c1c22a 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -252,7 +252,7 @@ void SwHistorySetTxt::SetInDoc( SwDoc* pDoc, bool ) } SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode(); - ASSERT( pTxtNd, "SwHistorySetTxt::SetInDoc: not a TextNode" ); + OSL_ENSURE( pTxtNd, "SwHistorySetTxt::SetInDoc: not a TextNode" ); if ( pTxtNd ) { @@ -314,7 +314,7 @@ void SwHistorySetTxtFld::SetInDoc( SwDoc* pDoc, bool ) m_pFld->GetFld()->ChgTyp( pNewFldType ); // change field type SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode(); - ASSERT( pTxtNd, "SwHistorySetTxtFld: no TextNode" ); + OSL_ENSURE( pTxtNd, "SwHistorySetTxtFld: no TextNode" ); if ( pTxtNd ) { @@ -338,7 +338,7 @@ SwHistorySetRefMark::SwHistorySetRefMark( SwTxtRefMark* pTxtHt, ULONG nNodePos ) void SwHistorySetRefMark::SetInDoc( SwDoc* pDoc, bool ) { SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode(); - ASSERT( pTxtNd, "SwHistorySetRefMark: no TextNode" ); + OSL_ENSURE( pTxtNd, "SwHistorySetRefMark: no TextNode" ); if ( !pTxtNd ) return; @@ -370,7 +370,7 @@ SwHistorySetTOXMark::SwHistorySetTOXMark( SwTxtTOXMark* pTxtHt, ULONG nNodePos ) void SwHistorySetTOXMark::SetInDoc( SwDoc* pDoc, bool ) { SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode(); - ASSERT( pTxtNd, "SwHistorySetTOXMark: no TextNode" ); + OSL_ENSURE( pTxtNd, "SwHistorySetTOXMark: no TextNode" ); if ( !pTxtNd ) return; @@ -424,7 +424,7 @@ SwHistoryResetTxt::SwHistoryResetTxt( USHORT nWhich, void SwHistoryResetTxt::SetInDoc( SwDoc* pDoc, bool ) { SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode(); - ASSERT( pTxtNd, "SwHistoryResetTxt: no TextNode" ); + OSL_ENSURE( pTxtNd, "SwHistoryResetTxt: no TextNode" ); if ( pTxtNd ) { pTxtNd->DeleteAttributes( m_nAttr, m_nStart, m_nEnd ); @@ -440,7 +440,7 @@ SwHistorySetFootnote::SwHistorySetFootnote( SwTxtFtn* pTxtFtn, ULONG nNodePos ) , m_nStart( *pTxtFtn->GetStart() ) , m_bEndNote( pTxtFtn->GetFtn().IsEndNote() ) { - ASSERT( pTxtFtn->GetStartNode(), + OSL_ENSURE( pTxtFtn->GetStartNode(), "SwHistorySetFootnote: Footnote without Section" ); // merke die alte NodePos, denn wer weiss was alles in der SaveSection @@ -465,7 +465,7 @@ SwHistorySetFootnote::SwHistorySetFootnote( const SwTxtFtn &rTxtFtn ) , m_nStart( *rTxtFtn.GetStart() ) , m_bEndNote( rTxtFtn.GetFtn().IsEndNote() ) { - ASSERT( rTxtFtn.GetStartNode(), + OSL_ENSURE( rTxtFtn.GetStartNode(), "SwHistorySetFootnote: Footnote without Section" ); } @@ -482,7 +482,7 @@ SwHistorySetFootnote::~SwHistorySetFootnote() void SwHistorySetFootnote::SetInDoc( SwDoc* pDoc, bool ) { SwTxtNode * pTxtNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTxtNode(); - ASSERT( pTxtNd, "SwHistorySetFootnote: no TextNode" ); + OSL_ENSURE( pTxtNd, "SwHistorySetFootnote: no TextNode" ); if ( !pTxtNd ) return; @@ -538,7 +538,7 @@ SwHistoryChangeFmtColl::SwHistoryChangeFmtColl( SwFmtColl* pFmtColl, ULONG nNd, void SwHistoryChangeFmtColl::SetInDoc( SwDoc* pDoc, bool ) { SwCntntNode * pCntntNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetCntntNode(); - ASSERT( pCntntNd, "SwHistoryChangeFmtColl: no ContentNode" ); + OSL_ENSURE( pCntntNd, "SwHistoryChangeFmtColl: no ContentNode" ); // before setting the format, check if it is still available in the // document. if it has been deleted, there is no undo! @@ -565,7 +565,7 @@ SwHistoryTxtFlyCnt::SwHistoryTxtFlyCnt( SwFrmFmt* const pFlyFmt ) : SwHistoryHint( HSTRY_FLYCNT ) , m_pUndo( new SwUndoDelLayFmt( pFlyFmt ) ) { - ASSERT( pFlyFmt, "SwHistoryTxtFlyCnt: no Format" ); + OSL_ENSURE( pFlyFmt, "SwHistoryTxtFlyCnt: no Format" ); m_pUndo->ChgShowSel( FALSE ); } @@ -843,7 +843,7 @@ SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet, case RES_TXTATR_FTN: case RES_TXTATR_META: case RES_TXTATR_METAFIELD: - ASSERT(rSet.Count() == 1, + OSL_ENSURE(rSet.Count() == 1, "text attribute with CH_TXTATR, but not the only one:" "\nnot such a good idea"); break; @@ -880,7 +880,7 @@ void SwHistoryResetAttrSet::SetInDoc( SwDoc* pDoc, bool ) pDoc->DoUndo( FALSE ); SwCntntNode * pCntntNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetCntntNode(); - ASSERT( pCntntNd, "SwHistoryResetAttrSet: no CntntNode" ); + OSL_ENSURE( pCntntNd, "SwHistoryResetAttrSet: no CntntNode" ); if (pCntntNd) { @@ -937,7 +937,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool ) SwPosition aPos( *pNd ); if ( STRING_MAXLEN != m_nOldContentIndex ) { - ASSERT(pCNd, "SwHistoryChangeFlyAnchor: no ContentNode"); + OSL_ENSURE(pCNd, "SwHistoryChangeFlyAnchor: no ContentNode"); if (pCNd) { aPos.nContent.Assign( pCNd, m_nOldContentIndex ); @@ -1050,7 +1050,7 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, ULONG nNodeIdx ) // <-- { - ASSERT( !m_nEndDiff, "History was not deleted after REDO" ); + OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); USHORT nWhich = pNewValue->Which(); if( (nWhich >= POOLATTR_END) || (nWhich == RES_TXTATR_FIELD) ) @@ -1072,7 +1072,7 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, void SwHistory::Add( SwTxtAttr* pHint, ULONG nNodeIdx, bool bNewAttr ) { - ASSERT( !m_nEndDiff, "History was not deleted after REDO" ); + OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); SwHistoryHint * pHt; USHORT nAttrWhich = pHint->Which(); @@ -1117,7 +1117,7 @@ void SwHistory::Add( SwTxtAttr* pHint, ULONG nNodeIdx, bool bNewAttr ) void SwHistory::Add( SwFmtColl* pColl, ULONG nNodeIdx, BYTE nWhichNd ) { - ASSERT( !m_nEndDiff, "History was not deleted after REDO" ); + OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); SwHistoryHint * pHt = new SwHistoryChangeFmtColl( pColl, nNodeIdx, nWhichNd ); @@ -1127,7 +1127,7 @@ void SwHistory::Add( SwFmtColl* pColl, ULONG nNodeIdx, BYTE nWhichNd ) void SwHistory::Add(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOtherPos) { - ASSERT( !m_nEndDiff, "History was not deleted after REDO" ); + OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); SwHistoryHint * pHt = new SwHistoryBookmark(rBkmk, bSavePos, bSaveOtherPos); m_SwpHstry.Insert( pHt, Count() ); @@ -1142,7 +1142,7 @@ void SwHistory::Add( SwFrmFmt& rFmt ) void SwHistory::Add( SwFlyFrmFmt& rFmt, USHORT& rSetPos ) { - ASSERT( !m_nEndDiff, "History was not deleted after REDO" ); + OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); SwHistoryHint * pHint; const USHORT nWh = rFmt.Which(); @@ -1261,7 +1261,7 @@ void SwHistory::Delete( USHORT nStart ) USHORT SwHistory::SetTmpEnd( USHORT nNewTmpEnd ) { - ASSERT( nNewTmpEnd <= Count(), "SwHistory::SetTmpEnd: out of bounds" ); + OSL_ENSURE( nNewTmpEnd <= Count(), "SwHistory::SetTmpEnd: out of bounds" ); USHORT nOld = Count() - m_nEndDiff; m_nEndDiff = Count() - nNewTmpEnd; @@ -1436,7 +1436,7 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet, SwTxtNode * const pTxtNode = dynamic_cast<SwTxtNode *>(const_cast<SwModify *>(GetRegisteredIn())); - ASSERT(pTxtNode, "SwRegHistory not registered at text node?"); + OSL_ENSURE(pTxtNode, "SwRegHistory not registered at text node?"); if (!pTxtNode) return false; diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index dc272d6e6a..959fbbfb27 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -555,13 +555,13 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter ) //Verbindung zwischen Attribut und Format. const SwPosition *pPos = rOldAnch.GetCntntAnchor(); SwTxtNode *pTxtNode = (SwTxtNode*)&pPos->nNode.GetNode(); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); const xub_StrLen nIdx = pPos->nContent.GetIndex(); SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); - ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, + OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFrmFmt, + OSL_ENSURE( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFrmFmt, "Wrong TxtFlyCnt-Hint." ); const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(); @@ -600,7 +600,7 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter ) if( pCont->GetAnchorFrm() && !pObj->IsInserted() ) { - ASSERT( pDoc->GetDrawModel(), "RestoreFlyAnchor without DrawModel" ); + OSL_ENSURE( pDoc->GetDrawModel(), "RestoreFlyAnchor without DrawModel" ); pDoc->GetDrawModel()->GetPage( 0 )->InsertObject( pObj ); } pObj->SetRelativePos( aDrawSavePt ); @@ -614,7 +614,7 @@ bool SwUndoFmtAttr::RestoreFlyAnchor( SwUndoIter& rIter ) { const SwPosition* pPos = aNewAnchor.GetCntntAnchor(); SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "no Text Node at position." ); + OSL_ENSURE( pTxtNd, "no Text Node at position." ); SwFmtFlyCnt aFmt( pFrmFmt ); pTxtNd->InsertItem( aFmt, pPos->nContent.GetIndex(), 0 ); } diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index df45152781..480d9243f8 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -139,7 +139,7 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, BOOL bFullPara, BOOL bCalledByTblCpy ) // Step 1. deletion/record of content indizes if( bDelFullPara ) { - ASSERT( rPam.HasMark(), "PaM ohne Mark" ); + OSL_ENSURE( rPam.HasMark(), "PaM ohne Mark" ); DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint(), DelCntntType(nsDelCntntType::DELCNT_ALL | nsDelCntntType::DELCNT_CHKNOCNTNT) ); @@ -892,7 +892,7 @@ void SwUndoDelete::Redo( SwUndoIter& rUndoIter ) if( bDelFullPara ) { - ASSERT( rPam.HasMark(), "PaM ohne Mark" ); + OSL_ENSURE( rPam.HasMark(), "PaM ohne Mark" ); DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint(), DelCntntType(nsDelCntntType::DELCNT_ALL | nsDelCntntType::DELCNT_CHKNOCNTNT) ); @@ -908,7 +908,7 @@ void SwUndoDelete::Redo( SwUndoIter& rUndoIter ) { if( bDelFullPara ) { - ASSERT( rPam.HasMark(), "PaM ohne Mark" ); + OSL_ENSURE( rPam.HasMark(), "PaM ohne Mark" ); DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint(), DelCntntType(nsDelCntntType::DELCNT_ALL | nsDelCntntType::DELCNT_CHKNOCNTNT) ); diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 564e61cc47..44fb44008f 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -62,7 +62,7 @@ public: SwNodeIndex* GetMvSttIdx() const { return SwUndoSaveSection::GetMvSttIdx(); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT nRedlineCount; #endif }; @@ -435,7 +435,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, ULONG nNodeIdx, } else { - ASSERT( FALSE, "was ist es denn nun?" ); + OSL_ENSURE( FALSE, "was ist es denn nun?" ); } rDoc.DoUndo( bUndo ); @@ -536,7 +536,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, pHistory = new SwHistory; SwTxtAttr* const pFtnHnt = pTxtNd->GetTxtAttrForCharAt( nFtnSttIdx ); - ASSERT( pFtnHnt, "kein FtnAttribut" ); + OSL_ENSURE( pFtnHnt, "kein FtnAttribut" ); SwIndex aIdx( pTxtNd, nFtnSttIdx ); pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), false ); pTxtNd->EraseText( aIdx, 1 ); @@ -560,7 +560,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, pHistory = new SwHistory; SwTxtAttr* const pFtnHnt = pTxtNd->GetTxtAttrForCharAt( nFtnSttIdx ); - ASSERT( pFtnHnt, "kein FtnAttribut" ); + OSL_ENSURE( pFtnHnt, "kein FtnAttribut" ); SwIndex aIdx( pTxtNd, nFtnSttIdx ); pHistory->Add( pFtnHnt, pTxtNd->GetIndex(), false ); pTxtNd->EraseText( aIdx, 1 ); @@ -599,7 +599,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, SwTxtNode* pTxtNd = pDoc->GetNodes()[ pAPos->nNode]->GetTxtNode(); SwTxtAttr* const pFlyHnt = pTxtNd->GetTxtAttrForCharAt( pAPos->nContent.GetIndex()); - ASSERT( pFlyHnt, "kein FlyAttribut" ); + OSL_ENSURE( pFlyHnt, "kein FlyAttribut" ); pHistory->Add( pFlyHnt, 0, false ); // n wieder zurueck, damit nicht ein Format uebesprungen wird ! n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1; @@ -879,7 +879,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, { // ueberpruefe, ob der Inhalt an der alten Position steht SwNodeIndex aSttIdx( pDoc->GetNodes(), nStartPos ); - ASSERT( !pDoc->GetNodes()[ aSttIdx ]->GetCntntNode(), + OSL_ENSURE( !pDoc->GetNodes()[ aSttIdx ]->GetCntntNode(), "Position in irgendeiner Section" ); // move den Inhalt aus dem UndoNodes-Array in den Fly @@ -1046,7 +1046,7 @@ SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos, : SwUndRng( rRedl ), SwRedlineData( rRedl.GetRedlineData(), bCopyNext ) { - ASSERT( POS_OUTSIDE == eCmpPos || + OSL_ENSURE( POS_OUTSIDE == eCmpPos || !rRedl.GetContentIdx(), "Redline mit Content" ); switch( eCmpPos ) @@ -1080,10 +1080,10 @@ SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos, break; default: - ASSERT( !this, "keine gueltigen Daten!" ) + OSL_ENSURE( !this, "keine gueltigen Daten!" ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nRedlineCount = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl().Count(); #endif } @@ -1254,7 +1254,7 @@ BOOL SwUndo::CanRedlineGroup( SwRedlineSaveDatas& rCurr, // #111827# String ShortenString(const String & rStr, xub_StrLen nLength, const String & rFillStr) { - ASSERT( nLength - rFillStr.Len() >= 2, "improper arguments") + OSL_ENSURE( nLength - rFillStr.Len() >= 2, "improper arguments"); String aResult; diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index d70d490c67..7e8f6d7331 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -125,7 +125,7 @@ void SwUndoFlyBase::InsFly( SwUndoIter& rUndoIter, BOOL bShowSelFrm ) { // es muss mindestens das Attribut im TextNode stehen SwCntntNode* pCNd = aAnchor.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); - ASSERT( pCNd->IsTxtNode(), "no Text Node at position." ); + OSL_ENSURE( pCNd->IsTxtNode(), "no Text Node at position." ); SwFmtFlyCnt aFmt( pFrmFmt ); static_cast<SwTxtNode*>(pCNd)->InsertItem( aFmt, nCntPos, nCntPos ); } @@ -176,7 +176,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) { // gibt es ueberhaupt Inhalt, dann sicher diesen const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt(); - ASSERT( rCntnt.GetCntntIdx(), "Fly ohne Inhalt" ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "Fly ohne Inhalt" ); SaveSection( pDoc, *rCntnt.GetCntntIdx() ); ((SwFmtCntnt&)rCntnt).SetNewCntntIdx( (const SwNodeIndex*)0 ); @@ -201,7 +201,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc ) nNdPgPos = pPos->nNode.GetIndex(); nCntPos = pPos->nContent.GetIndex(); SwTxtNode *pTxtNd = pDoc->GetNodes()[ pPos->nNode ]->GetTxtNode(); - ASSERT( pTxtNd, "Kein Textnode gefunden" ); + OSL_ENSURE( pTxtNd, "Kein Textnode gefunden" ); SwTxtFlyCnt* const pAttr = static_cast<SwTxtFlyCnt*>( pTxtNd->GetTxtAttrForCharAt( nCntPos, RES_TXTATR_FLYCNT ) ); // Attribut steht noch im TextNode, loeschen @@ -263,7 +263,7 @@ SwUndoInsLayFmt::SwUndoInsLayFmt( SwFrmFmt* pFormat, ULONG nNodeIdx, xub_StrLen } break; default: - ASSERT( FALSE, "Was denn fuer ein FlyFrame?" ); + OSL_ENSURE( FALSE, "Was denn fuer ein FlyFrame?" ); } } @@ -343,7 +343,7 @@ void SwUndoInsLayFmt::Repeat( SwUndoIter& rUndoIter ) rUndoIter.pAktPam )); } else { - ASSERT( FALSE, "was fuer ein Anker ist es denn nun?" ); + OSL_ENSURE( FALSE, "was fuer ein Anker ist es denn nun?" ); } SwFrmFmt* pFlyFmt = pDoc->CopyLayoutFmt( *pFrmFmt, aAnchor, true, true ); @@ -574,13 +574,13 @@ void SwUndoSetFlyFmt::Undo( SwUndoIter& rIter ) // Attribut und Format. const SwPosition *pPos = rOldAnch.GetCntntAnchor(); SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); const xub_StrLen nIdx = pPos->nContent.GetIndex(); SwTxtAttr * pHnt = pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); - ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, + OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); - ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFrmFmt, + OSL_ENSURE( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFrmFmt, "Wrong TxtFlyCnt-Hint." ); const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).SetFlyFmt(); @@ -639,7 +639,7 @@ void SwUndoSetFlyFmt::PutAttr( USHORT nWhich, const SfxPoolItem* pItem ) if( RES_ANCHOR == nWhich ) { // nur den 1. Ankerwechsel vermerken - ASSERT( !bAnchorChgd, "mehrfacher Ankerwechsel nicht erlaubt!" ); + OSL_ENSURE( !bAnchorChgd, "mehrfacher Ankerwechsel nicht erlaubt!" ); bAnchorChgd = TRUE; diff --git a/sw/source/core/undo/undoflystrattr.cxx b/sw/source/core/undo/undoflystrattr.cxx index 0f3f1800d4..072115ec67 100644 --- a/sw/source/core/undo/undoflystrattr.cxx +++ b/sw/source/core/undo/undoflystrattr.cxx @@ -41,7 +41,7 @@ SwUndoFlyStrAttr::SwUndoFlyStrAttr( SwFlyFrmFmt& rFlyFrmFmt, msOldStr( sOldStr ), msNewStr( sNewStr ) { - ASSERT( eUndoId == UNDO_FLYFRMFMT_TITLE || + OSL_ENSURE( eUndoId == UNDO_FLYFRMFMT_TITLE || eUndoId == UNDO_FLYFRMFMT_DESCRIPTION, "<SwUndoFlyStrAttr::SwUndoFlyStrAttr(..)> - unexpected undo id --> Undo will not work" ); } diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 49440b47aa..a571e8101f 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -149,7 +149,7 @@ void lcl_SaveAnchor( SwFrmFmt* pFmt, ULONG& rNodePos ) // TextAttribut zerstoeren SwTxtNode *pTxtNd = pFmt->GetDoc()->GetNodes()[ rNodePos ]->GetTxtNode(); - ASSERT( pTxtNd, "Kein Textnode gefunden" ); + OSL_ENSURE( pTxtNd, "Kein Textnode gefunden" ); SwTxtFlyCnt* pAttr = static_cast<SwTxtFlyCnt*>( pTxtNd->GetTxtAttrForCharAt( nCntntPos, RES_TXTATR_FLYCNT )); // Attribut steht noch im TextNode, loeschen @@ -196,7 +196,7 @@ void lcl_RestoreAnchor( SwFrmFmt* pFmt, ULONG& rNodePos ) if (FLY_AS_CHAR == rAnchor.GetAnchorId()) { SwTxtNode *pTxtNd = aIdx.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "no Text Node" ); + OSL_ENSURE( pTxtNd, "no Text Node" ); SwFmtFlyCnt aFmt( pFmt ); pTxtNd->InsertItem( aFmt, nCntntPos, nCntntPos ); } @@ -264,7 +264,7 @@ void SwUndoDrawGroup::Undo( SwUndoIter& ) // <-- // --> OD 2005-05-10 #i45952# - notify that position attributes // are already set - ASSERT( rSave.pFmt->ISA(SwDrawFrmFmt), + OSL_ENSURE( rSave.pFmt->ISA(SwDrawFrmFmt), "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); if ( rSave.pFmt->ISA(SwDrawFrmFmt) ) { @@ -315,7 +315,7 @@ void SwUndoDrawGroup::Redo( SwUndoIter& ) // <-- // --> OD 2005-05-10 #i45952# - notify that position attributes // are already set - ASSERT( pObjArr->pFmt->ISA(SwDrawFrmFmt), + OSL_ENSURE( pObjArr->pFmt->ISA(SwDrawFrmFmt), "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); if ( pObjArr->pFmt->ISA(SwDrawFrmFmt) ) { @@ -431,7 +431,7 @@ void SwUndoDrawUnGroup::Undo( SwUndoIter& rIter ) // <-- // --> OD 2005-05-10 #i45952# - notify that position attributes // are already set - ASSERT( pObjArr->pFmt->ISA(SwDrawFrmFmt), + OSL_ENSURE( pObjArr->pFmt->ISA(SwDrawFrmFmt), "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); if ( pObjArr->pFmt->ISA(SwDrawFrmFmt) ) { @@ -482,7 +482,7 @@ void SwUndoDrawUnGroup::Redo( SwUndoIter& ) // <-- // --> OD 2005-05-10 #i45952# - notify that position attributes // are already set - ASSERT( rSave.pFmt->ISA(SwDrawFrmFmt), + OSL_ENSURE( rSave.pFmt->ISA(SwDrawFrmFmt), "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); if ( rSave.pFmt->ISA(SwDrawFrmFmt) ) { @@ -517,7 +517,7 @@ void SwUndoDrawUnGroupConnectToLayout::Undo( SwUndoIter& ) { SdrObject* pObj( aDrawFmtsAndObjs[i].second ); SwDrawContact* pDrawContact( dynamic_cast<SwDrawContact*>(pObj->GetUserCall()) ); - ASSERT( pDrawContact, + OSL_ENSURE( pDrawContact, "<SwUndoDrawUnGroupConnectToLayout::Undo(..)> -- missing SwDrawContact instance" ); if ( pDrawContact ) { @@ -589,7 +589,7 @@ void SwUndoDrawDelete::Undo( SwUndoIter &rIter ) // <-- // --> OD 2005-05-10 #i45952# - notify that position attributes // are already set - ASSERT( rSave.pFmt->ISA(SwDrawFrmFmt), + OSL_ENSURE( rSave.pFmt->ISA(SwDrawFrmFmt), "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" ); if ( rSave.pFmt->ISA(SwDrawFrmFmt) ) { diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index ce75db3ad5..644ea3291e 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -233,7 +233,7 @@ SwUndoInsert::~SwUndoInsert() if( pPos->nContent.GetIndex() ) // nicht den gesamten Node loeschen { SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "kein TextNode, aus dem geloescht werden soll" ); + OSL_ENSURE( pTxtNd, "kein TextNode, aus dem geloescht werden soll" ); pTxtNd->EraseText( pPos->nContent ); pPos->nNode++; } @@ -367,7 +367,7 @@ void SwUndoInsert::Redo( SwUndoIter& rUndoIter ) if( pTxt ) { SwTxtNode *const pTxtNode = pCNd->GetTxtNode(); - ASSERT( pTxtNode, "where is my textnode ?" ); + OSL_ENSURE( pTxtNode, "where is my textnode ?" ); pTxtNode->InsertText( *pTxt, pPam->GetMark()->nContent, m_nInsertFlags ); DELETEZ( pTxt ); @@ -541,7 +541,7 @@ void SwUndoReplace::Redo( SwUndoIter& rUndoIter ) // Count neu if( rUndoIter.pLastUndoObj != this ) { - ASSERT( !nAktPos, "Redo ohne vorheriges Undo??" ); + OSL_ENSURE( !nAktPos, "Redo ohne vorheriges Undo??" ); rUndoIter.pLastUndoObj = this; bOldIterFlag = rUndoIter.bWeiter; rUndoIter.bWeiter = TRUE; @@ -632,7 +632,7 @@ _UnReplaceData::_UnReplaceData( const SwPaM& rPam, const String& rIns, m_bSplitNext = m_nSttNd != pEnd->nNode.GetIndex(); SwTxtNode* pNd = pStt->nNode.GetNode().GetTxtNode(); - ASSERT( pNd, "wo ist der TextNode" ); + OSL_ENSURE( pNd, "wo ist der TextNode" ); pHistory = new SwHistory; DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() ); @@ -685,7 +685,7 @@ void _UnReplaceData::Undo( SwUndoIter& rIter ) rPam.DeleteMark(); SwTxtNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTxtNode(); - ASSERT( pNd, "Wo ist der TextNode geblieben?" ) + OSL_ENSURE( pNd, "Wo ist der TextNode geblieben?" ); SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord(); if( pACEWord ) @@ -714,7 +714,7 @@ void _UnReplaceData::Undo( SwUndoIter& rIter ) pDoc->DeleteAndJoin( rPam ); rPam.DeleteMark(); pNd = rPam.GetNode()->GetTxtNode(); - ASSERT( pNd, "Wo ist der TextNode geblieben?" ); + OSL_ENSURE( pNd, "Wo ist der TextNode geblieben?" ); aIdx.Assign( pNd, m_nSttCnt ); } @@ -774,7 +774,7 @@ void _UnReplaceData::Redo( SwUndoIter& rIter ) rPam.GetPoint()->nNode = m_nSttNd; SwTxtNode* pNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode(); - ASSERT( pNd, "Wo ist der TextNode geblieben?" ) + OSL_ENSURE( pNd, "Wo ist der TextNode geblieben?" ); rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt ); rPam.SetMark(); if( m_bSplitNext ) @@ -945,7 +945,7 @@ void SwUndoInsertLabel::Undo( SwUndoIter& rIter ) if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType ) { - ASSERT( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer nicht initialisiert" ) + OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer nicht initialisiert" ); SwFrmFmt* pFmt; SdrObject *pSdrObj = 0; if( OBJECT.pUndoAttr && @@ -985,7 +985,7 @@ void SwUndoInsertLabel::Redo( SwUndoIter& rIter ) if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType ) { - ASSERT( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer nicht initialisiert" ) + OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer nicht initialisiert" ); SwFrmFmt* pFmt; SdrObject *pSdrObj = 0; if( OBJECT.pUndoAttr && diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx index a18f55c17d..6da4a95b1b 100644 --- a/sw/source/core/undo/unnum.cxx +++ b/sw/source/core/undo/unnum.cxx @@ -230,7 +230,7 @@ void SwUndoDelNum::Undo( SwUndoIter& rUndoIter ) for( USHORT n = 0; n < aNodeIdx.Count(); ++n ) { SwTxtNode* pNd = rDoc.GetNodes()[ aNodeIdx[ n ] ]->GetTxtNode(); - ASSERT( pNd, "wo ist der TextNode geblieben?" ); + OSL_ENSURE( pNd, "wo ist der TextNode geblieben?" ); pNd->SetAttrListLevel(aLevels[ n ] ); if( pNd->GetCondFmtColl() ) diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index 17f70781bf..a9608aaf43 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -84,7 +84,7 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos, nSttCntnt = rPos.nContent.GetIndex(); SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "Overwrite nicht im TextNode?" ); + OSL_ENSURE( pTxtNd, "Overwrite nicht im TextNode?" ); bInsChar = TRUE; xub_StrLen nTxtNdLen = pTxtNd->GetTxt().Len(); @@ -208,7 +208,7 @@ void SwUndoOverwrite::Undo( SwUndoIter& rUndoIter ) pAktPam->DeleteMark(); pAktPam->GetPoint()->nNode = nSttNode; SwTxtNode* pTxtNd = pAktPam->GetNode()->GetTxtNode(); - ASSERT( pTxtNd, "Overwrite nicht im TextNode?" ); + OSL_ENSURE( pTxtNd, "Overwrite nicht im TextNode?" ); SwIndex& rIdx = pAktPam->GetPoint()->nContent; rIdx.Assign( pTxtNd, nSttCntnt ); @@ -293,7 +293,7 @@ void SwUndoOverwrite::Redo( SwUndoIter& rUndoIter ) pAktPam->DeleteMark(); pAktPam->GetPoint()->nNode = nSttNode; SwTxtNode* pTxtNd = pAktPam->GetNode()->GetTxtNode(); - ASSERT( pTxtNd, "Overwrite nicht im TextNode?" ); + OSL_ENSURE( pTxtNd, "Overwrite nicht im TextNode?" ); SwIndex& rIdx = pAktPam->GetPoint()->nContent; if( pRedlSaveData ) diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index a2c573419b..ffb7281559 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -260,7 +260,7 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter ) USHORT nFnd = rDoc.GetRedlinePos( *rDoc.GetNodes()[ nSttNode + 1 ], nsRedlineType_t::REDLINE_INSERT ); - ASSERT( USHRT_MAX != nFnd && nFnd+1 < rDoc.GetRedlineTbl().Count(), + OSL_ENSURE( USHRT_MAX != nFnd && nFnd+1 < rDoc.GetRedlineTbl().Count(), "kein Insert Object gefunden" ); ++nFnd; rDoc.GetRedlineTbl()[nFnd]->Show( 1 ); diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 2f1a904dce..8d51db6b1a 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -131,7 +131,7 @@ void SwUndoInsSection::Undo( SwUndoIter& rUndoIter ) SwSectionNode *const pNd = rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode(); - ASSERT( pNd, "wo ist mein SectionNode?" ); + OSL_ENSURE( pNd, "wo ist mein SectionNode?" ); if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) rDoc.DeleteRedline( *pNd, true, USHRT_MAX ); @@ -245,7 +245,7 @@ void SwUndoInsSection::Join( SwDoc& rDoc, ULONG nNode ) { SwNodeIndex aIdx( rDoc.GetNodes(), nNode ); SwTxtNode* pTxtNd = aIdx.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "wo ist mein TextNode?" ); + OSL_ENSURE( pTxtNd, "wo ist mein TextNode?" ); { RemoveIdxRel( nNode + 1, SwPosition( aIdx, @@ -390,7 +390,7 @@ void SwUndoDelSection::Redo( SwUndoIter& rUndoIter ) SwSectionNode *const pNd = rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode(); - ASSERT( pNd, "wo ist mein SectionNode?" ); + OSL_ENSURE( pNd, "wo ist mein SectionNode?" ); // einfach das Format loeschen, der Rest erfolgt automatisch rDoc.DelSectionFmt( pNd->GetSection().GetFmt() ); } @@ -442,7 +442,7 @@ void SwUndoUpdateSection::Undo( SwUndoIter& rUndoIter ) SwDoc& rDoc = rUndoIter.GetDoc(); SwSectionNode *const pSectNd = rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode(); - ASSERT( pSectNd, "wo ist mein SectionNode?" ); + OSL_ENSURE( pSectNd, "wo ist mein SectionNode?" ); SwSection& rNdSect = pSectNd->GetSection(); SwFmt* pFmt = rNdSect.GetFmt(); diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx index 439e73bf33..875da9c9bc 100644 --- a/sw/source/core/undo/unspnd.cxx +++ b/sw/source/core/undo/unspnd.cxx @@ -59,7 +59,7 @@ SwUndoSplitNode::SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, bTblFlag( FALSE ), bChkTblStt( bChkTable ) { SwTxtNode* pTxtNd = pDoc->GetNodes()[ rPos.nNode ]->GetTxtNode(); - ASSERT( pTxtNd, "nur beim TextNode rufen!" ); + OSL_ENSURE( pTxtNd, "nur beim TextNode rufen!" ); if( pTxtNd->GetpSwpHints() ) { pHistory = new SwHistory; diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 7cc31f6217..735c8c7340 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -64,21 +64,17 @@ #include <comcore.hrc> #include <unochart.hxx> -#ifndef DBG_UTIL -#define CHECK_TABLE(t) -#else -#ifdef DEBUG +#if OSL_DEBUG_LEVEL > 1 #define CHECK_TABLE(t) (t).CheckConsistency(); #else #define CHECK_TABLE(t) #endif -#endif -#ifndef DBG_UTIL - #define _DEBUG_REDLINE( pDoc ) -#else +#if OSL_DEBUG_LEVEL > 1 void lcl_DebugRedline( const SwDoc* pDoc ); #define _DEBUG_REDLINE( pDoc ) lcl_DebugRedline( pDoc ); +#else + #define _DEBUG_REDLINE( pDoc ) #endif inline SwDoc& SwUndoIter::GetDoc() const { return *pAktPam->GetDoc(); } @@ -192,14 +188,11 @@ public: void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos = 0 ); void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos = 0 ); -#if defined( JP_DEBUG ) && defined(DBG_UTIL) +#if OSL_DEBUG_LEVEL > 1 #include "shellio.hxx" -void DumpDoc( SwDoc* pDoc, const String& rFileNm ); void CheckTable( const SwTable& ); -#define DUMPDOC(p,s) DumpDoc( p, s); #define CHECKTABLE(t) CheckTable( t ); #else -#define DUMPDOC(p,s) #define CHECKTABLE(t) #endif @@ -282,7 +275,7 @@ void SwUndoInsTbl::Undo( SwUndoIter& rUndoIter ) SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode ); SwTableNode* pTblNd = aIdx.GetNode().GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + OSL_ENSURE( pTblNd, "kein TabellenNode" ); pTblNd->DelFrms(); if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) @@ -585,7 +578,7 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd, { // an der ContentPosition splitten, das vorherige Zeichen // loeschen (ist der Trenner!) - ASSERT( pTxtNd, "Wo ist der TextNode geblieben?" ); + OSL_ENSURE( pTxtNd, "Wo ist der TextNode geblieben?" ); SwIndex aCntPos( pTxtNd, pSave->m_nCntnt - 1 ); pTxtNd->EraseText( aCntPos, 1 ); @@ -668,7 +661,7 @@ void SwUndoTblToTxt::Redo( SwUndoIter& rUndoIter ) pPam->DeleteMark(); SwTableNode* pTblNd = pPam->GetNode()->GetTableNode(); - ASSERT( pTblNd, "keinen TableNode gefunden" ); + OSL_ENSURE( pTblNd, "keinen TableNode gefunden" ); if( pTblNd->GetTable().IsA( TYPE( SwDDETable )) ) pDDEFldType = (SwDDEFieldType*)((SwDDETable&)pTblNd->GetTable()). @@ -681,7 +674,7 @@ void SwUndoTblToTxt::Redo( SwUndoIter& rUndoIter ) if( !pCNd && 0 == ( pCNd = rDoc.GetNodes().GoNext( &aSaveIdx ) ) && 0 == ( pCNd = rDoc.GetNodes().GoPrevious( &aSaveIdx )) ) { - ASSERT( FALSE, "wo steht denn nun der TextNode" ); + OSL_ENSURE( FALSE, "wo steht denn nun der TextNode" ); } pPam->GetPoint()->nNode = aSaveIdx; @@ -755,7 +748,7 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) ++nTblNd; // Node wurde vorher gesplittet SwNodeIndex aIdx( rDoc.GetNodes(), nTblNd ); SwTableNode* pTNd = rDoc.GetNodes()[ aIdx ]->GetTableNode(); - ASSERT( pTNd, "keinen Tabellen-Node gefunden" ); + OSL_ENSURE( pTNd, "keinen Tabellen-Node gefunden" ); RemoveIdxFromSection( rDoc, nTblNd ); @@ -776,7 +769,7 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) if( pBox ) ::_DeleteBox( rTbl, pBox, 0, FALSE, FALSE ); else { - ASSERT( !this, "Wo ist die Box geblieben?" ); + OSL_ENSURE( !this, "Wo ist die Box geblieben?" ); } } } @@ -868,9 +861,9 @@ SwUndoTblHeadline::SwUndoTblHeadline( const SwTable& rTbl, USHORT nOldHdl, nOldHeadline( nOldHdl ), nNewHeadline( nNewHdl ) { - ASSERT( rTbl.GetTabSortBoxes().Count(), "Tabelle ohne Inhalt" ); + OSL_ENSURE( rTbl.GetTabSortBoxes().Count(), "Tabelle ohne Inhalt" ); const SwStartNode *pSttNd = rTbl.GetTabSortBoxes()[ 0 ]->GetSttNd(); - ASSERT( pSttNd, "Box ohne Inhalt" ); + OSL_ENSURE( pSttNd, "Box ohne Inhalt" ); nTblNd = pSttNd->StartOfSectionIndex(); } @@ -880,7 +873,7 @@ void SwUndoTblHeadline::Undo( SwUndoIter& rUndoIter ) { SwDoc& rDoc = rUndoIter.GetDoc(); SwTableNode* pTNd = rDoc.GetNodes()[ nTblNd ]->GetTableNode(); - ASSERT( pTNd, "keinen Tabellen-Node gefunden" ); + OSL_ENSURE( pTNd, "keinen Tabellen-Node gefunden" ); rDoc.SetRowsToRepeat( pTNd->GetTable(), nOldHeadline ); } @@ -891,7 +884,7 @@ void SwUndoTblHeadline::Redo( SwUndoIter& rUndoIter ) SwDoc& rDoc = rUndoIter.GetDoc(); SwTableNode* pTNd = rDoc.GetNodes()[ nTblNd ]->GetTableNode(); - ASSERT( pTNd, "keinen Tabellen-Node gefunden" ); + OSL_ENSURE( pTNd, "keinen Tabellen-Node gefunden" ); rDoc.SetRowsToRepeat( pTNd->GetTable(), nNewHeadline ); } @@ -1009,7 +1002,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, BOOL bMdfyBox ) { if( !pLn ) { - ASSERT( !this, "Anzahl der Lines hat sich veraendert" ); + OSL_ENSURE( !this, "Anzahl der Lines hat sich veraendert" ); break; } @@ -1206,7 +1199,7 @@ void _SaveLine::RestoreAttr( SwTableLine& rLine, _SaveTable& rSTbl ) { if( !pBx ) { - ASSERT( !this, "Anzahl der Boxen hat sich veraendert" ); + OSL_ENSURE( !this, "Anzahl der Boxen hat sich veraendert" ); break; } pBx->RestoreAttr( *rLine.GetTabBoxes()[ n ], rSTbl ); @@ -1239,7 +1232,7 @@ void _SaveLine::CreateNew( SwTable& rTbl, SwTableBox& rParent, _SaveTable& rSTbl // HB, #127868# robustness: in some cases - which I // cannot reproduce nor see from the code - pNew seems // to be set to NULL in C40_INSERT. - ASSERT(pNew, "Table line just created set to NULL in C40_INSERT"); + OSL_ENSURE(pNew, "Table line just created set to NULL in C40_INSERT"); if (pNew) { @@ -1295,7 +1288,7 @@ void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) { if( !rBox.GetTabLines().Count() ) { - ASSERT( !this, "Anzahl der Lines hat sich veraendert" ); + OSL_ENSURE( !this, "Anzahl der Lines hat sich veraendert" ); } else { @@ -1304,7 +1297,7 @@ void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) { if( !pLn ) { - ASSERT( !this, "Anzahl der Lines hat sich veraendert" ); + OSL_ENSURE( !this, "Anzahl der Lines hat sich veraendert" ); break; } @@ -1343,7 +1336,7 @@ void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) } else { - ASSERT( !this, "Box nicht mehr am gleichen Node" ); + OSL_ENSURE( !this, "Box nicht mehr am gleichen Node" ); } } @@ -1403,7 +1396,7 @@ void _SaveBox::CreateNew( SwTable& rTbl, SwTableLine& rParent, _SaveTable& rSTbl { // Box zum StartNode in der alten Tabelle suchen SwTableBox* pBox = rTbl.GetTblBox( nSttNode ); - ASSERT( pBox, "Wo ist meine TabellenBox geblieben?" ); + OSL_ENSURE( pBox, "Wo ist meine TabellenBox geblieben?" ); SwFrmFmt* pOld = pBox->GetFrmFmt(); pFmt->Add( pBox ); @@ -1450,7 +1443,7 @@ void SwUndoAttrTbl::Undo( SwUndoIter& rUndoIter ) { SwDoc& rDoc = rUndoIter.GetDoc(); SwTableNode* pTblNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + OSL_ENSURE( pTblNd, "kein TabellenNode" ); if (pTblNd) { @@ -1513,7 +1506,7 @@ void SwUndoTblAutoFmt::UndoRedo( BOOL bUndo, SwUndoIter& rUndoIter ) { SwDoc& rDoc = rUndoIter.GetDoc(); SwTableNode* pTblNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + OSL_ENSURE( pTblNd, "kein TabellenNode" ); _SaveTable* pOrig = new _SaveTable( pTblNd->GetTable() ); // dann auch noch ueber die ContentNodes der EndBoxen und @@ -1620,7 +1613,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, USHORT n; USHORT i; - ASSERT( ! IsDelBox(), "falsche Action" ); + OSL_ENSURE( ! IsDelBox(), "falsche Action" ); Ptrs.pNewSttNds = new SvULongs( (BYTE)(rTblBoxes.Count() - rOld.Count()), 5 ); for( n = 0, i = 0; n < rOld.Count(); ++i ) @@ -1673,12 +1666,12 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, const SwTable& rTbl = rTblNd.GetTable(); const SwTableSortBoxes& rTblBoxes = rTbl.GetTabSortBoxes(); - ASSERT( ! IsDelBox(), "falsche Action" ); + OSL_ENSURE( ! IsDelBox(), "falsche Action" ); Ptrs.pNewSttNds = new SvULongs( (BYTE)(rTblBoxes.Count() - rOld.Count()), 5 ); - ASSERT( rTbl.IsNewModel() || rOld.Count() + nCount * rBoxes.Count() == rTblBoxes.Count(), + OSL_ENSURE( rTbl.IsNewModel() || rOld.Count() + nCount * rBoxes.Count() == rTblBoxes.Count(), "unexpected boxes" ); - ASSERT( rOld.Count() <= rTblBoxes.Count(), "more unexpected boxes" ); + OSL_ENSURE( rOld.Count() <= rTblBoxes.Count(), "more unexpected boxes" ); for( USHORT n = 0, i = 0; i < rTblBoxes.Count(); ++i ) { if( ( n < rOld.Count() ) && @@ -1722,7 +1715,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, // find the line number difference // (to help determine bNodesMoved flag below) nLineDiff = nLineDiff - nLineNo; - ASSERT( pSourceBox, "Splitted source box not found!" ); + OSL_ENSURE( pSourceBox, "Splitted source box not found!" ); // find out how many nodes the source box used to have // (to help determine bNodesMoved flag below) USHORT nNdsPos = 0; @@ -1754,7 +1747,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, void SwUndoTblNdsChg::SaveSection( SwStartNode* pSttNd ) { - ASSERT( IsDelBox(), "falsche Action" ); + OSL_ENSURE( IsDelBox(), "falsche Action" ); if( !Ptrs.pDelSects ) Ptrs.pDelSects = new SwUndoSaveSections( 10, 5 ); @@ -1773,7 +1766,7 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode ); SwTableNode* pTblNd = rDoc.GetNodes()[ aIdx ]->GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + OSL_ENSURE( pTblNd, "kein TabellenNode" ); SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() ); aMsgHnt.eFlags = TBL_BOXPTR; @@ -1819,7 +1812,7 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) // Box aus der Tabellen-Struktur entfernen ULONG nIdx = aTmp[ --n ]; SwTableBox* pBox = pTblNd->GetTable().GetTblBox( nIdx ); - ASSERT( pBox, "Wo ist meine TabellenBox geblieben?" ); + OSL_ENSURE( pBox, "Wo ist meine TabellenBox geblieben?" ); // TL_CHART2: notify chart about box to be removed if (pPCD) @@ -1857,7 +1850,7 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) { ULONG nIdx = (*Ptrs.pNewSttNds)[ --n ]; SwTableBox* pBox = pTblNd->GetTable().GetTblBox( nIdx ); - ASSERT( pBox, "Where's my table box?" ); + OSL_ENSURE( pBox, "Where's my table box?" ); // TL_CHART2: notify chart about box to be removed if (pPCD) pPCD->DeleteBox( &pTblNd->GetTable(), *pBox ); @@ -1891,7 +1884,7 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) SwDoc& rDoc = rUndoIter.GetDoc(); SwTableNode* pTblNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + OSL_ENSURE( pTblNd, "kein TabellenNode" ); CHECK_TABLE( pTblNd->GetTable() ) SwSelBoxes aSelBoxes; @@ -2006,7 +1999,7 @@ SwUndoTblMerge::SwUndoTblMerge( const SwPaM& rTblSel ) : SwUndo( UNDO_TABLE_MERGE ), SwUndRng( rTblSel ), pHistory( 0 ) { const SwTableNode* pTblNd = rTblSel.GetNode()->FindTableNode(); - ASSERT( pTblNd, "Wo ist TabllenNode" ) + OSL_ENSURE( pTblNd, "Wo ist TabllenNode" ); pSaveTbl = new _SaveTable( pTblNd->GetTable() ); pMoves = new SwUndoMoves; nTblNode = pTblNd->GetIndex(); @@ -2027,7 +2020,7 @@ void SwUndoTblMerge::Undo( SwUndoIter& rUndoIter ) SwNodeIndex aIdx( rDoc.GetNodes(), nTblNode ); SwTableNode* pTblNd = rDoc.GetNodes()[ aIdx ]->GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + OSL_ENSURE( pTblNd, "kein TabellenNode" ); SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() ); aMsgHnt.eFlags = TBL_BOXPTR; @@ -2044,7 +2037,6 @@ void SwUndoTblMerge::Undo( SwUndoIter& rUndoIter ) SwTableBox *pBox, *pCpyBox = pTblNd->GetTable().GetTabSortBoxes()[0]; SwTableBoxes& rLnBoxes = pCpyBox->GetUpper()->GetTabBoxes(); -DUMPDOC( &rDoc, "d:\\tmp\\tab_a.db" ) CHECKTABLE(pTblNd->GetTable()) SwSelBoxes aSelBoxes; @@ -2063,7 +2055,6 @@ CHECKTABLE(pTblNd->GetTable()) aSelBoxes.Insert( pBox ); } -DUMPDOC( &rDoc, "d:\\tmp\\tab_b.db" ) CHECKTABLE(pTblNd->GetTable()) SwChartDataProvider *pPCD = rDoc.GetChartDataProvider(); @@ -2078,7 +2069,7 @@ CHECKTABLE(pTblNd->GetTable()) { nIdx = aNewSttNds[ --n ]; pBox = pTblNd->GetTable().GetTblBox( nIdx ); - ASSERT( pBox, "Wo ist meine TabellenBox geblieben?" ); + OSL_ENSURE( pBox, "Wo ist meine TabellenBox geblieben?" ); if( !pSaveTbl->IsNewModel() ) rDoc.GetNodes().MakeTxtNode( SwNodeIndex( @@ -2120,11 +2111,7 @@ CHECKTABLE(pTblNd->GetTable()) // das Trennzeichen loeschen pTxtNd->EraseText( aTmpIdx, 1 ); } -// delete pUndo; -DUMPDOC( &rDoc, String( "d:\\tmp\\tab_") + String( aNewSttNds.Count() - i ) + - String(".db") ) } -// pMoves->Remove( 0, pMoves->Count() ); nIdx = pBox->GetSttIdx(); } else @@ -2152,7 +2139,6 @@ DUMPDOC( &rDoc, String( "d:\\tmp\\tab_") + String( aNewSttNds.Count() - i ) + rDoc.DeleteSection( rDoc.GetNodes()[ nIdx ] ); } } -DUMPDOC( &rDoc, "d:\\tmp\\tab_z.db" ) CHECKTABLE(pTblNd->GetTable()) @@ -2311,15 +2297,15 @@ SwUndoTblNumFmt::~SwUndoTblNumFmt() void SwUndoTblNumFmt::Undo( SwUndoIter& rIter ) { - ASSERT( pBoxSet, "Where's the stored item set?" ) + OSL_ENSURE( pBoxSet, "Where's the stored item set?" ); SwDoc& rDoc = rIter.GetDoc(); SwStartNode* pSttNd = rDoc.GetNodes()[ nNode ]-> FindSttNodeByType( SwTableBoxStartNode ); - ASSERT( pSttNd, "ohne StartNode kein TabellenBox" ); + OSL_ENSURE( pSttNd, "ohne StartNode kein TabellenBox" ); SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTblBox( pSttNd->GetIndex() ); - ASSERT( pBox, "keine TabellenBox gefunden" ); + OSL_ENSURE( pBox, "keine TabellenBox gefunden" ); SwTableBoxFmt* pFmt = rDoc.MakeTableBoxFmt(); pFmt->SetFmtAttr( *pBoxSet ); @@ -2416,10 +2402,10 @@ void SwUndoTblNumFmt::Redo( SwUndoIter& rIter ) SwNode* pNd = rDoc.GetNodes()[ pPam->GetPoint()->nNode ]; SwStartNode* pSttNd = pNd->FindSttNodeByType( SwTableBoxStartNode ); - ASSERT( pSttNd, "ohne StartNode kein TabellenBox" ); + OSL_ENSURE( pSttNd, "ohne StartNode kein TabellenBox" ); SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTblBox( pSttNd->GetIndex() ); - ASSERT( pBox, "keine TabellenBox gefunden" ); + OSL_ENSURE( pBox, "keine TabellenBox gefunden" ); SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt(); if( bNewFmt || bNewFml || bNewValue ) @@ -3207,7 +3193,7 @@ void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos ) nM = nU + ( nO - nU ) / 2; if( *(rArr.GetData() + nM) == nIdx ) { - ASSERT( FALSE, "Index ist schon vorhanden, darf nie sein!" ); + OSL_ENSURE( FALSE, "Index ist schon vorhanden, darf nie sein!" ); return; } if( *(rArr.GetData() + nM) < nIdx ) @@ -3234,7 +3220,7 @@ void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos ) nM = nU + ( nO - nU ) / 2; if( *(rArr.GetData() + nM) == nIdx ) { - ASSERT( FALSE, "Index ist schon vorhanden, darf nie sein!" ); + OSL_ENSURE( FALSE, "Index ist schon vorhanden, darf nie sein!" ); return; } if( *(rArr.GetData() + nM) < nIdx ) @@ -3250,35 +3236,18 @@ void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos ) *pInsPos = nU; } -#if defined( JP_DEBUG ) && defined(DBG_UTIL) +#if OSL_DEBUG_LEVEL > 1 -void DumpDoc( SwDoc* pDoc, const String& rFileNm ) -{ - Writer* pWrt = SwIoSystem::GetWriter( "DEBUG" ); - if( pWrt ) - { - SvFileStream aStream( rFileNm, STREAM_STD_WRITE ); - SwPaM* pPam = new SwPaM( pDoc, SwPosition( pDoc->GetNodes().EndOfContent , - pDoc->GetNodes().EndOfContent )); - pPam->Move( fnMoveBackward, fnGoDoc ); - pPam->SetMark(); - pPam->Move( fnMoveForward, fnGoDoc ); - - pWrt->Write( pPam, *pDoc, aStream, rFileNm.GetStr() ); - - delete pPam; - } -} void CheckTable( const SwTable& rTbl ) { const SwNodes& rNds = rTbl.GetFrmFmt()->GetDoc()->GetNodes(); - const SwTableSortBoxes& rSrtArr = pTblNd->GetTable().GetTabSortBoxes(); + const SwTableSortBoxes& rSrtArr = rTbl.GetTabSortBoxes(); for( USHORT n = 0; n < rSrtArr.Count(); ++n ) { const SwTableBox* pBox = rSrtArr[ n ]; const SwNode* pNd = pBox->GetSttNd(); - ASSERT( rNds[ *pBox->GetSttIdx() ] == pNd, "Box mit falchem StartNode" ); + OSL_ENSURE( rNds[ pBox->GetSttIdx() ] == pNd, "Box mit falchem StartNode" ); } } #endif diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 465a9f8fa3..7eb48657e9 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -154,7 +154,7 @@ SwUndoInserts::~SwUndoInserts() if( pPos->nContent.GetIndex() ) // nicht den gesamten Node loeschen { SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "kein TextNode, aus dem geloescht werden soll" ); + OSL_ENSURE( pTxtNd, "kein TextNode, aus dem geloescht werden soll" ); if( pTxtNd ) // Robust { pTxtNd->EraseText( pPos->nContent ); diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 12481508f0..8a6904eda6 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -65,7 +65,7 @@ sal_Int32 GetEnumAsInt32( const UNO_NMSPC::Any& rVal ) catch( UNO_NMSPC::Exception & ) { eVal = 0; - ASSERT( FALSE, "can't get EnumAsInt32" ); + OSL_ENSURE( FALSE, "can't get EnumAsInt32" ); } return eVal; } @@ -87,7 +87,7 @@ BOOL UCB_DeleteFile( const String& rURL ) catch( UNO_NMSPC::Exception& ) { bRemoved = FALSE; - ASSERT( FALSE, "Exeception from executeCommand( delete )" ); + OSL_ENSURE( FALSE, "Exeception from executeCommand( delete )" ); } return bRemoved; } @@ -118,7 +118,7 @@ BOOL UCB_CopyFile( const String& rURL, const String& rNewURL, BOOL bCopyIsMove ) } catch( UNO_NMSPC::Exception& ) { - ASSERT( FALSE, "Exeception from executeCommand( transfer )" ); + OSL_ENSURE( FALSE, "Exeception from executeCommand( transfer )" ); bCopyCompleted = FALSE; } return bCopyCompleted; @@ -152,7 +152,7 @@ BOOL UCB_IsCaseSensitiveFileName( const String& rURL ) catch( UNO_NMSPC::Exception& ) { bCaseSensitive = FALSE; - ASSERT( FALSE, "Exeception from compareContentIds()" ); + OSL_ENSURE( FALSE, "Exeception from compareContentIds()" ); } return bCaseSensitive; } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 1ba1140e29..acc3b9e4a0 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -247,7 +247,7 @@ public: break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwShapeDescriptor_Impl::SetPositionLayoutDir(..)> - invalid attribute value." ); } } @@ -368,7 +368,7 @@ uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) } else { - ASSERT( false, + OSL_ENSURE( false, "<SwFmDrawPage::_CreateShape(..)> - could not retrieve type. Thus, no shape created." ); return xRet; } @@ -953,7 +953,7 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : if ( xShapeAgg.is() ) { xShapeAgg->queryAggregation( ::getCppuType((uno::Reference< drawing::XShape >*)0) ) >>= mxShape; - ASSERT( mxShape.is(), + OSL_ENSURE( mxShape.is(), "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" ); } // <-- @@ -1231,7 +1231,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A //To prevent this the connection between format and attribute has to be broken before. const SwPosition *pPos = aAnchor.GetCntntAnchor(); SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); const xub_StrLen nIdx = pPos->nContent.GetIndex(); SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt( @@ -1318,7 +1318,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A //To prevent this the connection between format and attribute has to be broken before. const SwPosition *pPos = rOldAnchor.GetCntntAnchor(); SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode(); - ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); + OSL_ENSURE( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." ); const xub_StrLen nIdx = pPos->nContent.GetIndex(); SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt( @@ -2118,7 +2118,7 @@ void SwXShape::dispose(void) throw( uno::RuntimeException ) // a 'virtual' drawing object. // OD 25.08.2003 #111713# - refine assertion for safety reason. // --> OD 2005-02-02 #119236# - correct assertion and refine it. - ASSERT( !pObj || + OSL_ENSURE( !pObj || pObj->ISA(SwDrawVirtObj) || pObj->GetUpGroup() || pObj == pFmt->FindSdrObject(), @@ -2277,7 +2277,7 @@ awt::Point SAL_CALL SwXShape::getPosition() throw ( uno::RuntimeException ) // break; // default: // { -// ASSERT( false, +// OSL_ENSURE( false, // "<SwXShape::getPosition()> - unsupported layout direction" ); // } // } @@ -2530,7 +2530,7 @@ awt::Point SwXShape::_ConvertPositionToHoriL2R( const awt::Point _aObjPos, break; default: { - ASSERT( false, + OSL_ENSURE( false, "<SwXShape::_ConvertPositionToHoriL2R(..)> - unsupported layout direction" ); } } @@ -2554,13 +2554,13 @@ drawing::HomogenMatrix3 SwXShape::_ConvertTransformationToLayoutDir( // --> OD 2005-03-10 #i44334#, #i44681# - direct manipulation of the // tranformation structure isn't valid, if it contains rotation. SvxShape* pSvxShape = GetSvxShape(); - ASSERT( pSvxShape, - "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SvxShape found!") + OSL_ENSURE( pSvxShape, + "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SvxShape found!"); if ( pSvxShape ) { const SdrObject* pObj = pSvxShape->GetSdrObject(); - ASSERT( pObj, - "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SdrObject found!") + OSL_ENSURE( pObj, + "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SdrObject found!"); if ( pObj ) { // get position of object in Writer coordinate system. @@ -2705,13 +2705,13 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) awt::Point aConvertedPos( aStartOrEndPos ); SvxShape* pSvxShape = GetSvxShape(); - ASSERT( pSvxShape, - "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!") + OSL_ENSURE( pSvxShape, + "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!"); if ( pSvxShape ) { const SdrObject* pObj = pSvxShape->GetSdrObject(); - ASSERT( pObj, - "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!") + OSL_ENSURE( pObj, + "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!"); if ( pObj ) { // get position of object in Writer coordinate system. @@ -2743,13 +2743,13 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) drawing::PolyPolygonBezierCoords aConvertedPath( aPath ); SvxShape* pSvxShape = GetSvxShape(); - ASSERT( pSvxShape, - "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!") + OSL_ENSURE( pSvxShape, + "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!"); if ( pSvxShape ) { const SdrObject* pObj = pSvxShape->GetSdrObject(); - ASSERT( pObj, - "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!") + OSL_ENSURE( pObj, + "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!"); if ( pObj ) { // get position of object in Writer coordinate system. @@ -2795,7 +2795,7 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) SwXGroupShape::SwXGroupShape(uno::Reference< XInterface > & xShape) : SwXShape(xShape) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 uno::Reference<XShapes> xShapes(xShapeAgg, uno::UNO_QUERY); DBG_ASSERT(xShapes.is(), "no SvxShape found or shape is not a group shape"); #endif diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index c1a7d83806..0f9093a499 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -194,7 +194,7 @@ sal_uInt16 lcl_ServiceIdToResId(sal_uInt16 nServiceId) const ServiceIdResId* pMap = aServiceToRes; while( USHRT_MAX != pMap->nServiceId && nServiceId != pMap->nServiceId ) ++pMap; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( USHRT_MAX == pMap->nServiceId ) DBG_ERROR("service id not found"); #endif @@ -274,7 +274,7 @@ sal_uInt16 lcl_GetServiceForField( const SwField& rFld ) break; } } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( USHRT_MAX == nSrvId ) DBG_ERROR("resid not found"); #endif diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 5eafba7c00..4b68034d05 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1045,7 +1045,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: else if( FN_UNO_TITLE == pEntry->nWID ) { SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); - ASSERT( pFmt, + OSL_ENSURE( pFmt, "unexpected type of <pFmt> --> crash" ); OUString uTemp; aValue >>= uTemp; @@ -1058,7 +1058,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: else if( FN_UNO_DESCRIPTION == pEntry->nWID ) { SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); - ASSERT( pFmt, + OSL_ENSURE( pFmt, "unexpected type of <pFmt> --> crash" ); OUString uTemp; aValue >>= uTemp; @@ -1552,7 +1552,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) else if( FN_UNO_TITLE == pEntry->nWID ) { SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); - ASSERT( pFmt, + OSL_ENSURE( pFmt, "unexpected type of <pFmt> --> crash" ); // assure that <SdrObject> instance exists. GetOrCreateSdrObject( pFlyFmt ); @@ -1562,7 +1562,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) else if( FN_UNO_DESCRIPTION == pEntry->nWID ) { SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); - ASSERT( pFmt, + OSL_ENSURE( pFmt, "unexpected type of <pFmt> --> crash" ); // assure that <SdrObject> instance exists. GetOrCreateSdrObject( pFlyFmt ); @@ -1827,7 +1827,7 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName ) else if( FN_UNO_TITLE == pEntry->nWID ) { SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); - ASSERT( pFmt, + OSL_ENSURE( pFmt, "unexpected type of <pFmt> --> crash" ); // assure that <SdrObject> instance exists. GetOrCreateSdrObject( pFlyFmt ); @@ -1837,7 +1837,7 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName ) else if( FN_UNO_DESCRIPTION == pEntry->nWID ) { SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt); - ASSERT( pFmt, + OSL_ENSURE( pFmt, "unexpected type of <pFmt> --> crash" ); // assure that <SdrObject> instance exists. GetOrCreateSdrObject( pFlyFmt ); @@ -2266,7 +2266,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; ::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect ); pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL ); - ASSERT( pFmt2, "Doc->Insert(notxt) failed." ); + OSL_ENSURE( pFmt2, "Doc->Insert(notxt) failed." ); pDoc->EndUndo(UNDO_INSERT, NULL); pFmt2->Add(this); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index d7d821cc89..3527e3e97e 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -914,14 +914,14 @@ lcl_ForceIntoMeta(SwPaM & rCursor, { sal_Bool bRet( sal_True ); // means not forced in META_CHECK_BOTH SwXMeta const * const pXMeta( dynamic_cast<SwXMeta*>(xParentText.get()) ); - ASSERT(pXMeta, "no parent?"); + OSL_ENSURE(pXMeta, "no parent?"); if (!pXMeta) throw uno::RuntimeException(); SwTxtNode * pTxtNode; xub_StrLen nStart; xub_StrLen nEnd; const bool bSuccess( pXMeta->SetContentRange(pTxtNode, nStart, nEnd) ); - ASSERT(bSuccess, "no pam?"); + OSL_ENSURE(bSuccess, "no pam?"); if (!bSuccess) throw uno::RuntimeException(); // force the cursor back into the meta if it has moved outside @@ -958,7 +958,7 @@ bool SwXTextCursor::IsAtEndOfMeta() const SwUnoCrsr const * const pCursor( m_pImpl->GetCursor() ); SwXMeta const*const pXMeta( dynamic_cast<SwXMeta*>(m_pImpl->m_xParentText.get()) ); - ASSERT(pXMeta, "no meta?"); + OSL_ENSURE(pXMeta, "no meta?"); if (pCursor && pXMeta) { SwTxtNode * pTxtNode; @@ -966,7 +966,7 @@ bool SwXTextCursor::IsAtEndOfMeta() const xub_StrLen nEnd; const bool bSuccess( pXMeta->SetContentRange(pTxtNode, nStart, nEnd) ); - ASSERT(bSuccess, "no pam?"); + OSL_ENSURE(bSuccess, "no pam?"); if (bSuccess) { const SwPosition end(*pTxtNode, nEnd); diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index ae41808f05..ff61c24bdc 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -329,13 +329,13 @@ lcl_ExportFieldMark( SwDoc* pDoc = pUnoCrsr->GetDoc(); //flr: maybe its a good idea to add a special hint to the hints array and rely on the hint segmentation.... const xub_StrLen start = pUnoCrsr->Start()->nContent.GetIndex(); - ASSERT(pUnoCrsr->End()->nContent.GetIndex() == start, + OSL_ENSURE(pUnoCrsr->End()->nContent.GetIndex() == start, "hmm --- why is this different"); pUnoCrsr->Right(1, CRSR_SKIP_CHARS, FALSE, FALSE); if ( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() ) { - ASSERT(false, "cannot move cursor?"); + OSL_ENSURE(false, "cannot move cursor?"); return 0; } @@ -384,7 +384,7 @@ lcl_ExportFieldMark( } else { - ASSERT(false, "no fieldmark found?"); + OSL_ENSURE(false, "no fieldmark found?"); } return xRef; } @@ -657,7 +657,7 @@ lcl_ExportHints( case RES_TXTATR_META: case RES_TXTATR_METAFIELD: { - ASSERT(*pAttr->GetStart() != *pAttr->GetEnd(), + OSL_ENSURE(*pAttr->GetStart() != *pAttr->GetEnd(), "empty meta?"); if ((i_nStartPos > 0) && (*pAttr->GetStart() < i_nStartPos)) @@ -676,7 +676,7 @@ lcl_ExportHints( PortionList_t Top = rPortionStack.top(); if (Top.second != pAttr) { - ASSERT(false, "ExportHints: stack error" ); + OSL_ENSURE(false, "ExportHints: stack error" ); } else { @@ -1114,7 +1114,7 @@ lcl_CreatePortions( bCursorMoved, nNextAttrIndex); if (PortionStack.empty()) { - ASSERT(false, "CreatePortions: stack underflow"); + OSL_ENSURE(false, "CreatePortions: stack underflow"); return; } } @@ -1131,7 +1131,7 @@ lcl_CreatePortions( } else { - ASSERT(!FieldMarks.size() || + OSL_ENSURE(!FieldMarks.size() || (FieldMarks.front() != nCurrentIndex), "fieldmark and hint with CH_TXTATR at same pos?"); } @@ -1163,7 +1163,7 @@ lcl_CreatePortions( } } - ASSERT((PortionStack.size() == 1) && !PortionStack.top().second, + OSL_ENSURE((PortionStack.size() == 1) && !PortionStack.top().second, "CreatePortions: stack error" ); } diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index 4e8f763c75..b1124c7ab2 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -829,7 +829,7 @@ bool SwXMeta::CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb) xub_StrLen nMetaStart; xub_StrLen nMetaEnd; const bool bSuccess( SetContentRange(pTxtNode, nMetaStart, nMetaEnd) ); - ASSERT(bSuccess, "no pam?"); + OSL_ENSURE(bSuccess, "no pam?"); if (!bSuccess) throw lang::DisposedException(); @@ -974,7 +974,7 @@ SwXMeta::dispose() throw (uno::RuntimeException) xub_StrLen nMetaStart; xub_StrLen nMetaEnd; const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd)); - ASSERT(bSuccess, "no pam?"); + OSL_ENSURE(bSuccess, "no pam?"); if (bSuccess) { // -1 because of CH_TXTATR @@ -1062,7 +1062,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } if (!pTxtAttr) { - ASSERT(false, "meta inserted, but has no text attribute?"); + OSL_ENSURE(false, "meta inserted, but has no text attribute?"); throw uno::RuntimeException( C2S("SwXMeta::attach(): cannot create meta"), static_cast< ::cppu::OWeakObject* >(this)); @@ -1104,7 +1104,7 @@ SwXMeta::getAnchor() throw (uno::RuntimeException) xub_StrLen nMetaStart; xub_StrLen nMetaEnd; const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd)); - ASSERT(bSuccess, "no pam?"); + OSL_ENSURE(bSuccess, "no pam?"); if (!bSuccess) { throw lang::DisposedException( @@ -1271,7 +1271,7 @@ SwXMeta::createEnumeration() throw (uno::RuntimeException) xub_StrLen nMetaStart; xub_StrLen nMetaEnd; const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd)); - ASSERT(bSuccess, "no pam?"); + OSL_ENSURE(bSuccess, "no pam?"); if (!bSuccess) throw lang::DisposedException(); @@ -1322,7 +1322,7 @@ SwXMetaField::SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta, TextRangeList_t const*const pPortions) : SwXMetaField_Base(pDoc, pMeta, xParentText, pPortions) { - ASSERT(pMeta && dynamic_cast< ::sw::MetaField* >(pMeta), + OSL_ENSURE(pMeta && dynamic_cast< ::sw::MetaField* >(pMeta), "SwXMetaField created for wrong hint!"); } diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 799132c200..828672182a 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -2253,7 +2253,7 @@ Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName ) // --> OD 2008-04-23 #refactorlists# else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID))) { - ASSERT( pRule->GetDefaultListId().Len() != 0, + OSL_ENSURE( pRule->GetDefaultListId().Len() != 0, "<SwXNumberingRules::getPropertyValue(..)> - no default list id found. Serious defect -> please inform OD." ); aRet <<= OUString(pRule->GetDefaultListId()); } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 8dd1d5f418..9cf318c516 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -3735,11 +3735,11 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( } catch (beans::UnknownPropertyException &) { - ASSERT( false, "Unknown property" ); + OSL_ENSURE( false, "Unknown property" ); } catch (lang::IllegalArgumentException &) { - ASSERT( false, "Illegal argument" ); + OSL_ENSURE( false, "Illegal argument" ); } } diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 4e82ffedf0..4c33dcec36 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -175,7 +175,7 @@ SwXText::PrepareForAttach(uno::Reference< text::XTextRange > &, const SwPaM &) bool SwXText::CheckForOwnMemberMeta(const SwPaM &, const bool) throw (lang::IllegalArgumentException, uno::RuntimeException) { - ASSERT(CURSOR_META != m_pImpl->m_eType, "should not be called!"); + OSL_ENSURE(CURSOR_META != m_pImpl->m_eType, "should not be called!"); return false; } diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index 4776dd12cc..e4cfb912fb 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -101,7 +101,7 @@ void SAL_CALL SwXTextMarkup::commitTextMarkup( if( pGrammarContact ) { pWList = pGrammarContact->getGrammarCheck( *mpTxtNode, true ); - ASSERT( pWList, "GrammarContact _has_ to deliver a wrong list" ) + OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" ); } else { @@ -127,7 +127,7 @@ void SAL_CALL SwXTextMarkup::commitTextMarkup( } else { - ASSERT( false, "Unknown mark-up type" ) + OSL_ENSURE( false, "Unknown mark-up type" ); return; } @@ -241,7 +241,7 @@ void lcl_commitGrammarMarkUp( ::sal_Int32 nLength, const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer) { - ASSERT( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" ) + OSL_ENSURE( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" ); const ModelToViewHelper::ModelPosition aStartPos = ModelToViewHelper::ConvertToModelPosition( pConversionMap, nStart ); const ModelToViewHelper::ModelPosition aEndPos = @@ -373,7 +373,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) if( pGrammarContact ) { pWList = pGrammarContact->getGrammarCheck( *mpTxtNode, true ); - ASSERT( pWList, "GrammarContact _has_ to deliver a wrong list" ) + OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" ); } else { diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 1cc78d70a1..62ed0a4f0e 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -189,13 +189,13 @@ bool SwPagePreviewLayout::Init( const sal_uInt16 _nCols, // check environment and parameters { bool bColsRowsValid = (_nCols != 0) && (_nRows != 0); - ASSERT( bColsRowsValid, "preview layout parameters not correct - preview layout can *not* be initialized" ); + OSL_ENSURE( bColsRowsValid, "preview layout parameters not correct - preview layout can *not* be initialized" ); if ( !bColsRowsValid ) return false; bool bPxWinSizeValid = (_rPxWinSize.Width() >= 0) && (_rPxWinSize.Height() >= 0); - ASSERT( bPxWinSizeValid, "no window size - preview layout can *not* be initialized" ); + OSL_ENSURE( bPxWinSizeValid, "no window size - preview layout can *not* be initialized" ); if ( !bPxWinSizeValid ) return false; } @@ -266,7 +266,7 @@ bool SwPagePreviewLayout::ReInit() // check environment and parameters { bool bLayoutSettingsValid = mbLayoutInfoValid && mbLayoutSizesValid; - ASSERT( bLayoutSettingsValid, + OSL_ENSURE( bLayoutSettingsValid, "no valid preview layout info/sizes - no re-init of page preview layout"); if ( !bLayoutSettingsValid ) return false; @@ -295,13 +295,13 @@ bool SwPagePreviewLayout::Prepare( const sal_uInt16 _nProposedStartPageNum, // check environment and parameters { bool bLayoutSettingsValid = mbLayoutInfoValid && mbLayoutSizesValid; - ASSERT( bLayoutSettingsValid, + OSL_ENSURE( bLayoutSettingsValid, "no valid preview layout info/sizes - no prepare of preview paint"); if ( !bLayoutSettingsValid ) return false; bool bStartPageRangeValid = nProposedStartPageNum <= mnPages; - ASSERT( bStartPageRangeValid, + OSL_ENSURE( bStartPageRangeValid, "proposed start page not existing - no prepare of preview paint"); if ( !bStartPageRangeValid ) return false; @@ -310,13 +310,13 @@ bool SwPagePreviewLayout::Prepare( const sal_uInt16 _nProposedStartPageNum, _aProposedStartPos.X() >= 0 && _aProposedStartPos.Y() >= 0 && _aProposedStartPos.X() <= maPreviewDocRect.Right() && _aProposedStartPos.Y() <= maPreviewDocRect.Bottom(); - ASSERT( bStartPosRangeValid, + OSL_ENSURE( bStartPosRangeValid, "proposed start position out of range - no prepare of preview paint"); if ( !bStartPosRangeValid ) return false; bool bWinSizeValid = _rPxWinSize.Width() != 0 && _rPxWinSize.Height() != 0; - ASSERT ( bWinSizeValid, "no window size - no prepare of preview paint"); + OSL_ENSURE( bWinSizeValid, "no window size - no prepare of preview paint"); if ( !bWinSizeValid ) return false; @@ -819,7 +819,7 @@ bool SwPagePreviewLayout::CalcStartValuesForSelectedPageMove( { if ( _nHoriMove != 0 && _nVertMove != 0 ) { - ASSERT( false, "missing implementation for moving preview selected page horizontal AND vertical"); + OSL_ENSURE( false, "missing implementation for moving preview selected page horizontal AND vertical"); return false; } @@ -977,7 +977,7 @@ bool SwPagePreviewLayout::Paint( const Rectangle _aOutRect ) const !mrParentViewShell.GetOut()->GetConnectMetaFile() ) return false; - ASSERT( mbPaintInfoValid, + OSL_ENSURE( mbPaintInfoValid, "invalid preview settings - no paint of preview" ); if ( !mbPaintInfoValid ) return false; @@ -1133,7 +1133,7 @@ void SwPagePreviewLayout::Repaint( const Rectangle _aInvalidCoreRect ) const !mrParentViewShell.GetOut()->GetConnectMetaFile() ) return; - ASSERT( mbPaintInfoValid, + OSL_ENSURE( mbPaintInfoValid, "invalid preview settings - no paint of preview" ); if ( !mbPaintInfoValid ) return; @@ -1325,7 +1325,7 @@ sal_uInt16 SwPagePreviewLayout::GetColOfPage( sal_uInt16 _nPageNum ) const Size SwPagePreviewLayout::GetPrevwDocSize() const { - ASSERT( PreviewLayoutValid(), "PagePreviewLayout not valid" ); + OSL_ENSURE( PreviewLayoutValid(), "PagePreviewLayout not valid" ); return maPreviewDocRect.GetSize(); } diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index ee0bdd2371..a1e2d450f0 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -41,7 +41,7 @@ #include <svx/svdoutl.hxx> -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include <svx/fmglob.hxx> #endif @@ -127,7 +127,7 @@ void SwViewImp::PaintLayer( const SdrLayerID _nLayerID, if ( (_nLayerID == pIDDMA->GetHellId()) || (_nLayerID == pIDDMA->GetHeavenId()) ) { - ASSERT( _pPageBackgrdColor, + OSL_ENSURE( _pPageBackgrdColor, "incorrect usage of SwViewImp::PaintLayer: pPageBackgrdColor have to be set for painting layer <hell> or <heaven>"); if ( _pPageBackgrdColor ) { @@ -217,7 +217,7 @@ void SwViewImp::NotifySizeChg( const Size &rNewSz ) if ( !bCheckDrawObjs ) return; - ASSERT( pSh->getIDocumentDrawModelAccess()->GetDrawModel(), "NotifySizeChg without DrawModel" ); + OSL_ENSURE( pSh->getIDocumentDrawModelAccess()->GetDrawModel(), "NotifySizeChg without DrawModel" ); SdrPage* pPage = pSh->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 ); const ULONG nObjs = pPage->GetObjCount(); for( ULONG nObj = 0; nObj < nObjs; ++nObj ) diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 0b2288eab4..614e9adbdd 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -58,7 +58,7 @@ void SwViewImp::Init( const SwViewOption *pNewOpt ) { - ASSERT( pDrawView, "SwViewImp::Init without DrawView" ); + OSL_ENSURE( pDrawView, "SwViewImp::Init without DrawView" ); //Now create the page view if it does not exist. SwRootFrm *pRoot = pSh->getIDocumentLayoutAccess()->GetRootFrm(); if ( !pSdrPageView ) @@ -131,8 +131,8 @@ SwViewImp::~SwViewImp() DelRegion(); - ASSERT( !pLayAct, "Have action for the rest of your life." ); - ASSERT( !pIdleAct,"Be idle for the rest of your life." ); + OSL_ENSURE( !pLayAct, "Have action for the rest of your life." ); + OSL_ENSURE( !pIdleAct,"Be idle for the rest of your life." ); } void SwViewImp::DelRegion() @@ -249,7 +249,7 @@ void SwViewImp::MakeDrawView() { bool bIsReadOnly(pSwViewOption->IsReadonly()); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // add test possibilities static bool bAlwaysActivateForTest(false); if(bAlwaysActivateForTest && bIsReadOnly) @@ -286,7 +286,7 @@ Color SwViewImp::GetRetoucheColor() const void SwViewImp::InitPagePreviewLayout() { - ASSERT( pSh->GetLayout(), "no layout - page preview layout can not be created."); + OSL_ENSURE( pSh->GetLayout(), "no layout - page preview layout can not be created."); if ( pSh->GetLayout() ) mpPgPrevwLayout = new SwPagePreviewLayout( *pSh, *(pSh->GetLayout()) ); } @@ -296,8 +296,8 @@ void SwViewImp::UpdateAccessible() // We require a layout and an XModel to be accessible. IDocumentLayoutAccess* pIDLA = GetShell()->getIDocumentLayoutAccess(); Window *pWin = GetShell()->GetWin(); - ASSERT( pIDLA->GetRootFrm(), "no layout, no access" ); - ASSERT( pWin, "no window, no access" ); + OSL_ENSURE( pIDLA->GetRootFrm(), "no layout, no access" ); + OSL_ENSURE( pWin, "no window, no access" ); if( IsAccessible() && pIDLA->GetRootFrm() && pWin ) GetAccessibleMap().GetDocumentView(); @@ -307,7 +307,7 @@ void SwViewImp::DisposeAccessible( const SwFrm *pFrm, const SdrObject *pObj, sal_Bool bRecursive ) { - ASSERT( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" ); + OSL_ENSURE( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" ); ViewShell *pVSh = GetShell(); ViewShell *pTmp = pVSh; do @@ -321,7 +321,7 @@ void SwViewImp::DisposeAccessible( const SwFrm *pFrm, void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj, const SwRect& rOldFrm ) { - ASSERT( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" ); + OSL_ENSURE( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" ); ViewShell *pVSh = GetShell(); ViewShell *pTmp = pVSh; do @@ -335,7 +335,7 @@ void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj, void SwViewImp::InvalidateAccessibleFrmContent( const SwFrm *pFrm ) { - ASSERT( pFrm->IsAccessibleFrm(), "frame is not accessible" ); + OSL_ENSURE( pFrm->IsAccessibleFrm(), "frame is not accessible" ); ViewShell *pVSh = GetShell(); ViewShell *pTmp = pVSh; do @@ -467,7 +467,7 @@ void SwViewImp::InvalidateAccessiblePreViewSelection( sal_uInt16 nSelPage ) SwAccessibleMap *SwViewImp::CreateAccessibleMap() { - ASSERT( !pAccMap, "accessible map exists" ) + OSL_ENSURE( !pAccMap, "accessible map exists" ); pAccMap = new SwAccessibleMap( GetShell() ); return pAccMap; } diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 87a78294a1..5b7e034885 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -74,7 +74,7 @@ void ViewShell::AdjustOptionsForPagePreview( const SwPrtOptions &_rPrintOptions { if ( !IsPreView() ) { - ASSERT( false, "view shell doesn't belongs to a page preview - no adjustment of its view options"); + OSL_ENSURE( false, "view shell doesn't belongs to a page preview - no adjustment of its view options"); return; } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 354f067220..72dcebcd0e 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -515,10 +515,10 @@ void ViewShell::MakeVisible( const SwRect &rRect ) EndAction(); } while( nOldH != pRoot->Frm().Height() && nLoopCnt-- ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { - ASSERT( !this, "MakeVisible fuer Drucker wird doch gebraucht?" ); + OSL_ENSURE( !this, "MakeVisible fuer Drucker wird doch gebraucht?" ); } #endif @@ -940,15 +940,15 @@ void ViewShell::SizeChgNotify() void ViewShell::VisPortChgd( const SwRect &rRect) { - ASSERT( GetWin(), "VisPortChgd ohne Window." ); + OSL_ENSURE( GetWin(), "VisPortChgd ohne Window." ); if ( rRect == VisArea() ) return; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if ( bInEndAction ) { - ASSERT( !this, "Scroll waehrend einer EndAction." ); + OSL_ENSURE( !this, "Scroll waehrend einer EndAction." ); } #endif @@ -1799,7 +1799,7 @@ void ViewShell::CheckBrowseView( BOOL bBrowseChgd ) SET_CURR_SHELL( this ); - ASSERT( GetLayout(), "Layout not ready" ); + OSL_ENSURE( GetLayout(), "Layout not ready" ); // Wenn das Layout noch nicht einmal eine Hoehe hat, // ist sowieso nichts formatiert. @@ -1941,7 +1941,7 @@ void ViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) Window *pMyWin = GetWin(); if( !pMyWin ) { - ASSERT( pMyWin, "ViewShell::ApplyViewOptions: no window" ); + OSL_ENSURE( pMyWin, "ViewShell::ApplyViewOptions: no window" ); return; } @@ -2157,8 +2157,8 @@ uno::Reference< ::com::sun::star::accessibility::XAccessible > ViewShell::Create SwDoc *pMyDoc = GetDoc(); // We require a layout and an XModel to be accessible. - ASSERT( pMyDoc->GetRootFrm(), "no layout, no access" ); - ASSERT( GetWin(), "no window, no access" ); + OSL_ENSURE( pMyDoc->GetRootFrm(), "no layout, no access" ); + OSL_ENSURE( GetWin(), "no window, no access" ); if( pMyDoc->GetRootFrm() && GetWin() ) xAcc = Imp()->GetAccessibleMap().GetDocumentView(); @@ -2173,8 +2173,8 @@ ViewShell::CreateAccessiblePreview() "Can't create accessible preview for non-preview ViewShell" ); // We require a layout and an XModel to be accessible. - ASSERT( pDoc->GetRootFrm(), "no layout, no access" ); - ASSERT( GetWin(), "no window, no access" ); + OSL_ENSURE( pDoc->GetRootFrm(), "no layout, no access" ); + OSL_ENSURE( GetWin(), "no window, no access" ); if ( IsPreView() && pDoc->GetRootFrm() && GetWin() ) { @@ -2264,7 +2264,7 @@ void ViewShell::SetCareWin( Window* pNew ) // #i12836# enhanced pdf export sal_Int32 ViewShell::GetPageNumAndSetOffsetForPDF( OutputDevice& rOut, const SwRect& rRect ) const { - ASSERT( GetLayout(), "GetPageNumAndSetOffsetForPDF assumes presence of layout" ) + OSL_ENSURE( GetLayout(), "GetPageNumAndSetOffsetForPDF assumes presence of layout" ); sal_Int32 nRet = -1; @@ -2275,7 +2275,7 @@ sal_Int32 ViewShell::GetPageNumAndSetOffsetForPDF( OutputDevice& rOut, const SwR const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aRect.Center() ); if ( pPage ) { - ASSERT( pPage, "GetPageNumAndSetOffsetForPDF: No page found" ) + OSL_ENSURE( pPage, "GetPageNumAndSetOffsetForPDF: No page found" ); Point aOffset( pPage->Frm().Pos() ); aOffset.X() = -aOffset.X(); diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 29514ed245..6540aa1820 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -283,7 +283,7 @@ ViewShell::~ViewShell() for( SwFrm* pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) ); pFrm; pFrm = (SwFrm*)aIter.Next() ) { - ASSERT( pFrm->IsNoTxtFrm(), "GraphicNode with Text?" ); + OSL_ENSURE( pFrm->IsNoTxtFrm(), "GraphicNode with Text?" ); ((SwNoTxtFrm*)pFrm)->StopAnimation( pOut ); } } @@ -312,7 +312,7 @@ ViewShell::~ViewShell() SwPaintQueue::Remove( this ); - ASSERT( !nStartAction, "EndAction() pending." ); + OSL_ENSURE( !nStartAction, "EndAction() pending." ); } if ( pDoc ) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index ffe193bd74..a1dcb9ee34 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -194,7 +194,7 @@ void SwPaintQueue::Remove( ViewShell *pSh ) void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, BOOL /*bPDFExport*/ ) { - ASSERT( !pSh->GetWin(), "Drucken mit Window?" ); + OSL_ENSURE( !pSh->GetWin(), "Drucken mit Window?" ); pSh->aVisArea = rRect; pSh->Imp()->SetFirstVisPageInvalid(); Point aPt( rRect.Pos() ); @@ -241,7 +241,7 @@ void ViewShell::InitPrt( OutputDevice *pOutDev ) void ViewShell::ChgAllPageOrientation( USHORT eOri ) { - ASSERT( nStartAction, "missing an Action" ); + OSL_ENSURE( nStartAction, "missing an Action" ); SET_CURR_SHELL( this ); USHORT nAll = GetDoc()->GetPageDescCnt(); @@ -277,7 +277,7 @@ void ViewShell::ChgAllPageOrientation( USHORT eOri ) void ViewShell::ChgAllPageSize( Size &rSz ) { - ASSERT( nStartAction, "missing an Action" ); + OSL_ENSURE( nStartAction, "missing an Action" ); SET_CURR_SHELL( this ); SwDoc* pMyDoc = GetDoc(); @@ -344,7 +344,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax ) SwDoc * ViewShell::CreatePrtDoc( SfxObjectShellRef &rDocShellRef) { - ASSERT( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only"); + OSL_ENSURE( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only"); SwFEShell* pFESh = (SwFEShell*)this; SwDoc *pPrtDoc = new SwDoc; @@ -388,7 +388,7 @@ SwDoc * ViewShell::CreatePrtDoc( SfxObjectShellRef &rDocShellRef) } const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aSelPoint ); - ASSERT( pPage, "no page found!" ); + OSL_ENSURE( pPage, "no page found!" ); // get page descriptor - fall back to the first one if pPage could not be found const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDescByName( @@ -438,7 +438,7 @@ SwDoc * ViewShell::CreatePrtDoc( SfxObjectShellRef &rDocShellRef) SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) { - ASSERT( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only"); + OSL_ENSURE( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only"); SwFEShell* pFESh = (SwFEShell*)this; pPrtDoc->LockExpFlds(); @@ -483,7 +483,7 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) } const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aSelPoint ); - ASSERT( pPage, "no page found!" ); + OSL_ENSURE( pPage, "no page found!" ); // get page descriptor - fall back to the first one if pPage could not be found const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDescByName( diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index 6dc7be3793..3dcaf53273 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -82,7 +82,7 @@ ULONG AsciiReader::Read( SwDoc &rDoc, const String&, SwPaM &rPam, const String & { if( !pStrm ) { - ASSERT( !this, "ASCII-Read ohne Stream" ); + OSL_ENSURE( !this, "ASCII-Read ohne Stream" ); return ERR_SWG_READ_ERROR; } @@ -254,7 +254,7 @@ ULONG SwASCIIParser::CallParser() pInsPam->GetCntntNode(), nSttCntnt ); // !!!!! - ASSERT( !this, "Have to change - hard attr. to para. style" ); + OSL_ENSURE( !this, "Have to change - hard attr. to para. style" ); pDoc->InsertItemSet( *pInsPam, *pItemSet, 0 ); } } @@ -287,7 +287,7 @@ ULONG SwASCIIParser::ReadChars() nOrig = nLen = rInput.Read(pArr, ASC_BUFFLEN); CharSet eCharSet; bool bRet = SwIoSystem::IsDetectableText(pArr, nLen, &eCharSet, &bSwapUnicode); - ASSERT(bRet, "Autodetect of text import without nag dialog must " + OSL_ENSURE(bRet, "Autodetect of text import without nag dialog must " "have failed"); if (bRet && eCharSet != RTL_TEXTENCODING_DONTKNOW) { @@ -307,7 +307,7 @@ ULONG SwASCIIParser::ReadChars() if( currentCharSet == RTL_TEXTENCODING_DONTKNOW ) currentCharSet = RTL_TEXTENCODING_ASCII_US; hConverter = rtl_createTextToUnicodeConverter( currentCharSet ); - ASSERT( hConverter, "no string convert avaiable" ); + OSL_ENSURE( hConverter, "no string convert avaiable" ); if (!hConverter) return ERROR_SW_READ_BASE; bSwapUnicode = false; diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index a024cbdf1d..14a8a0f379 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -206,7 +206,7 @@ SwRead GetReader( const String& rFltName ) ULONG StgReader::OpenMainStream( SvStorageStreamRef& rRef, USHORT& rBuffSize ) { ULONG nRet = ERR_SWG_READ_ERROR; - ASSERT( pStg, "wo ist mein Storage?" ); + OSL_ENSURE( pStg, "wo ist mein Storage?" ); const SfxFilter* pFltr = SwIoSystem::GetFilterOfFormat( aFltName ); if( pFltr ) { @@ -229,7 +229,6 @@ ULONG StgReader::OpenMainStream( SvStorageStreamRef& rRef, USHORT& rBuffSize ) return nRet; } -/* */ void Writer::SetPasswd( const String& ) {} @@ -752,7 +751,7 @@ rtl_TextEncoding CharSetFromName(const String& rChrSetStr) } } - ASSERT(nRet != pStart->eCode, "TXT: That was an unknown language!"); + OSL_ENSURE(nRet != pStart->eCode, "TXT: That was an unknown language!"); return nRet; } @@ -775,7 +774,7 @@ String NameFromCharSet(rtl_TextEncoding nChrSet) } } - ASSERT(pRet != pStart->pName, "TXT: That was an unknown language!"); + OSL_ENSURE(pRet != pStart->pName, "TXT: That was an unknown language!"); return String::CreateFromAscii(pRet); } diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 480f2ccb31..4bb6a97844 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -200,9 +200,9 @@ BOOL SwIoSystem::IsValidStgFilter(SotStorage& rStg, const SfxFilter& rFilter) void TerminateBuffer(sal_Char *pBuffer, ULONG nBytesRead, ULONG nBufferLen) { - ASSERT(nBytesRead <= nBufferLen - 2, + OSL_ENSURE(nBytesRead <= nBufferLen - 2, "what you read must be less than the max + null termination"); - ASSERT(!(nBufferLen & 0x00000001), "nMaxReadBuf must be an even number"); + OSL_ENSURE(!(nBufferLen & 0x00000001), "nMaxReadBuf must be an even number"); if (nBytesRead <= nBufferLen - 2) { pBuffer[nBytesRead] = '\0'; diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 186439d292..8ff6a1664e 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -500,7 +500,7 @@ SwDoc* Reader::GetTemplateDoc() if( bLoad ) { ClearTemplate(); - ASSERT( !pTemplate, "Who holds the template doc?" ); + OSL_ENSURE( !pTemplate, "Who holds the template doc?" ); // #95605#: If the writer module is not installed, // we cannot create a SwDocShell. We could create a @@ -531,7 +531,7 @@ SwDoc* Reader::GetTemplateDoc() } } - ASSERT( !pTemplate || FStatHelper::IsDocument( aFileName ) || + OSL_ENSURE( !pTemplate || FStatHelper::IsDocument( aFileName ) || aTemplateNm.EqualsAscii( "$$Dummy$$" ), "TemplatePtr but no template exist!" ); } @@ -590,7 +590,7 @@ void Reader::MakeHTMLDummyTemplateDoc() // muessen die Methode ueberladen int Reader::SetStrmStgPtr() { - ASSERT( pMedium, "Wo ist das Medium??" ); + OSL_ENSURE( pMedium, "Wo ist das Medium??" ); if( pMedium->IsStorage() ) { @@ -653,7 +653,7 @@ void Reader::ResetFrmFmts( SwDoc& rDoc ) switch (i) { default: - ASSERT(i == 0, "Impossible"); + OSL_ENSURE(i == 0, "Impossible"); //fallthrough case 0: nPoolId = RES_POOLFRM_FRAME; @@ -806,7 +806,7 @@ ULONG SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName ) SwTableNode* pTblNd = (SwTableNode*)aBoxes[0]->GetSttNd()->StartOfSectionNode(); SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 ); SwCntntNode *pNd = aIdx.GetNode().GetCntntNode(); - ASSERT( pNd, "Node not found" ); + OSL_ENSURE( pNd, "Node not found" ); SwPosition aPos( aIdx, SwIndex( pNd ) ); pTblNd->GetTable().MakeCopy( pDoc, aPos, aBoxes ); } diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index f57cd92ba8..4e8ca43396 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -338,7 +338,7 @@ static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut ) switch( eUnit ) { case FUNIT_100TH_MM: - ASSERT( FUNIT_MM == eUnit, "Masseinheit wird nicht unterstuetzt" ); + OSL_ENSURE( FUNIT_MM == eUnit, "Masseinheit wird nicht unterstuetzt" ); case FUNIT_MM: // 0.01mm = 0.57twip nMul = 25400; // 25.4 * 1000 @@ -349,7 +349,7 @@ static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut ) case FUNIT_M: case FUNIT_KM: - ASSERT( FUNIT_CM == eUnit, "Masseinheit wird nicht unterstuetzt" ); + OSL_ENSURE( FUNIT_CM == eUnit, "Masseinheit wird nicht unterstuetzt" ); case FUNIT_CM: #ifdef EXACT_VALUES // 0.001cm = 0.57twip @@ -366,7 +366,7 @@ static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut ) break; case FUNIT_TWIP: - ASSERT( FUNIT_POINT == eUnit, "Masseinheit wird nicht unterstuetzt" ); + OSL_ENSURE( FUNIT_POINT == eUnit, "Masseinheit wird nicht unterstuetzt" ); case FUNIT_POINT: #ifdef EXACT_VALUES // 0.01pt = 0.2twip @@ -404,7 +404,7 @@ static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut ) case FUNIT_PERCENT: case FUNIT_INCH: default: - ASSERT( FUNIT_INCH == eUnit, "Masseinheit wird nicht unterstuetzt" ); + OSL_ENSURE( FUNIT_INCH == eUnit, "Masseinheit wird nicht unterstuetzt" ); #ifdef EXACT_VALUES // 0.0001in = 0.144twip nMul = 100000; @@ -879,7 +879,7 @@ USHORT SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken, // Wenn eine PoolId gesetzt ist, entspricht der Name der // Vorlage dem szugehoerigen Token - ASSERT( rRefPoolId != 0 == rToken.Len() > 0, + OSL_ENSURE( rRefPoolId != 0 == rToken.Len() > 0, "Token missing" ); } else @@ -1106,7 +1106,7 @@ const SwFmt *SwHTMLWriter::GetTemplateFmt( USHORT nPoolFmtId, if( pTemplate ) { - ASSERT( !(USER_FMT & nPoolFmtId), + OSL_ENSURE( !(USER_FMT & nPoolFmtId), "In der Dok-Vorlage gibt es keine Benutzer-Vorlagen" ); if( POOLGRP_NOCOLLID & nPoolFmtId ) pRefFmt = pTemplate->GetCharFmtFromPool( nPoolFmtId ); @@ -1119,7 +1119,7 @@ const SwFmt *SwHTMLWriter::GetTemplateFmt( USHORT nPoolFmtId, const SwFmt *SwHTMLWriter::GetParentFmt( const SwFmt& rFmt, USHORT nDeep ) { - ASSERT( nDeep != USHRT_MAX, "GetParent fuer HTML-Vorlage aufgerufen!" ); + OSL_ENSURE( nDeep != USHRT_MAX, "GetParent fuer HTML-Vorlage aufgerufen!" ); const SwFmt *pRefFmt = 0; if( nDeep > 0 ) @@ -1151,7 +1151,7 @@ void SwHTMLWriter::SubtractItemSet( SfxItemSet& rItemSet, BOOL bClearSame, const SfxItemSet *pRefScriptItemSet ) { - ASSERT( bSetDefaults || bClearSame, + OSL_ENSURE( bSetDefaults || bClearSame, "SwHTMLWriter::SubtractItemSet: Bei diesen Flags passiert nix" ); SfxItemSet aRefItemSet( *rRefItemSet.GetPool(), rRefItemSet.GetRanges() ); aRefItemSet.Set( rRefItemSet ); @@ -2160,10 +2160,10 @@ void SwHTMLWriter::OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt, BOOL bOutXPos = FALSE, bOutYPos = FALSE; if( RES_DRAWFRMFMT == rFrmFmt.Which() ) { - ASSERT( pSdrObj, "Kein SdrObject uebergeben. Ineffizient" ); + OSL_ENSURE( pSdrObj, "Kein SdrObject uebergeben. Ineffizient" ); if( !pSdrObj ) pSdrObj = rFrmFmt.FindSdrObject(); - ASSERT( pSdrObj, "Wo ist das SdrObject" ); + OSL_ENSURE( pSdrObj, "Wo ist das SdrObject" ); if( pSdrObj ) { Point aPos( pSdrObj->GetRelativePos() ); @@ -2227,10 +2227,10 @@ void SwHTMLWriter::OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt, { if( RES_DRAWFRMFMT == rFrmFmt.Which() ) { - ASSERT( pSdrObj, "Kein SdrObject uebergeben. Ineffizient" ); + OSL_ENSURE( pSdrObj, "Kein SdrObject uebergeben. Ineffizient" ); if( !pSdrObj ) pSdrObj = rFrmFmt.FindSdrObject(); - ASSERT( pSdrObj, "Wo ist das SdrObject" ); + OSL_ENSURE( pSdrObj, "Wo ist das SdrObject" ); if( pSdrObj ) { Size aTwipSz( pSdrObj->GetLogicRect().GetSize() ); @@ -2254,9 +2254,9 @@ void SwHTMLWriter::OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt, } else { - ASSERT( HTML_FRMOPT_ABSSIZE & nFrmOpts, + OSL_ENSURE( HTML_FRMOPT_ABSSIZE & nFrmOpts, "Absolute Groesse wird exportiert" ); - ASSERT( HTML_FRMOPT_ANYSIZE & nFrmOpts, + OSL_ENSURE( HTML_FRMOPT_ANYSIZE & nFrmOpts, "Jede Groesse wird exportiert" ); USHORT nMode = 0; if( nFrmOpts & HTML_FRMOPT_S_WIDTH ) @@ -2426,7 +2426,7 @@ void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt ) // Schliesslich bleibt noch der Hintergrund der Seite uebrig und als // letzte Rettung das Item der Config. - ASSERT( pCurrPageDesc, "Keine Seiten-Vorlage gemerkt" ); + OSL_ENSURE( pCurrPageDesc, "Keine Seiten-Vorlage gemerkt" ); if( !OutCSS1_FrmFmtBrush( *this, pCurrPageDesc->GetMaster().GetBackground() ) ) { @@ -2478,7 +2478,7 @@ static Writer& OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( Writer& rWrt, { // das geht auch in HTML und muss nicht als STYLE-Option // und darf nicht als Hint geschrieben werden - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Underline als Hint schreiben?" ); pUStr = sCSS1_PV_underline; } @@ -2501,7 +2501,7 @@ static Writer& OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( Writer& rWrt, { // das geht auch in HTML und muss nicht als STYLE-Option // und darf nicht als Hint geschrieben werden - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Overline als Hint schreiben?" ); pOStr = sCSS1_PV_overline; } @@ -2524,7 +2524,7 @@ static Writer& OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( Writer& rWrt, { // das geht auch in HTML und muss nicht als STYLE-Option // und darf nicht als Hint geschrieben werden - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "CrossedOut als Hint schreiben?" ); pCOStr = sCSS1_PV_line_through; } @@ -2543,7 +2543,7 @@ static Writer& OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( Writer& rWrt, { // das geht auch in HTML und muss nicht als STYLE-Option // und darf nicht als Hint geschrieben werden - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Blink als Hint schreiben?" ); pBStr = sCSS1_PV_blink; } @@ -2617,7 +2617,7 @@ static Writer& OutCSS1_SvxColor( Writer& rWrt, const SfxPoolItem& rHt ) if( rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) && !rHTMLWrt.bCfgPreferStyles ) return rWrt; - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Farbe wirklich als Hint ausgeben?" ); Color aColor( ((const SvxColorItem&)rHt).GetValue() ); @@ -2662,7 +2662,7 @@ static Writer& OutCSS1_SvxFont( Writer& rWrt, const SfxPoolItem& rHt ) if( !rHTMLWrt.IsCSS1Script( nScript ) ) return rWrt; - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Font wirklich als Hint ausgeben?" ); String sOut; @@ -2736,7 +2736,7 @@ static Writer& OutCSS1_SvxPosture( Writer& rWrt, const SfxPoolItem& rHt ) { // das geht auch in HTML und muss nicht als STYLE-Option // und darf nicht als Hint geschrieben werden - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Italic als Hint schreiben?" ); pStr = sCSS1_PV_italic; } @@ -2804,7 +2804,7 @@ static Writer& OutCSS1_SvxLanguage( Writer& rWrt, const SfxPoolItem& rHt ) if( !rHTMLWrt.IsCSS1Script( nScript ) ) return rWrt; - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Language wirklich als Hint ausgeben?" ); LanguageType eLang = ((const SvxLanguageItem &)rHt).GetLanguage(); @@ -2870,7 +2870,7 @@ static Writer& OutCSS1_SvxFontWeight( Writer& rWrt, const SfxPoolItem& rHt ) { // das geht auch in HTML und muss nicht als STYLE-Option // und darf nicht als Hint geschrieben werden - ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), "Fett als Hint schreiben?" ); pStr = sCSS1_PV_bold; } @@ -3123,7 +3123,7 @@ static Writer& OutCSS1_SwFmtFrmSize( Writer& rWrt, const SfxPoolItem& rHt, bOutHeight = (nMode & CSS1_FRMSIZE_VARHEIGHT) != 0; break; default: - ASSERT( bOutHeight, "Hoehe wird nicht exportiert" ); + OSL_ENSURE( bOutHeight, "Hoehe wird nicht exportiert" ); break; } @@ -3382,7 +3382,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt, { // Fuer Seitenvorlagen wurde der Grafik-Name uebergeben. Es wird // nur ein Attribut ausgegeben, wenn die Grafik nicht gekachelt ist. - ASSERT( pLink, "Wo ist der Grafik-Name der Seitenvorlage?" ); + OSL_ENSURE( pLink, "Wo ist der Grafik-Name der Seitenvorlage?" ); if( !pLink || !pLink->Len() || GPOS_TILED==ePos ) return rWrt; } diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 7ca5239238..7bf2edfa32 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -145,7 +145,7 @@ static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt ); static Writer& OutHTML_HoriSpacer( Writer& rWrt, INT16 nSize ) { - ASSERT( nSize>0, "horizontaler SPACER mit negativem Wert?" ) + OSL_ENSURE( nSize>0, "horizontaler SPACER mit negativem Wert?" ); if( nSize <= 0 ) return rWrt; @@ -363,9 +363,9 @@ SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate, // Den Selektor des Formats holen USHORT nDeep = SwHTMLWriter::GetCSS1Selector( pFmt, aToken, aClass, nRefPoolId ); - ASSERT( nDeep ? aToken.Len()>0 : aToken.Len()==0, + OSL_ENSURE( nDeep ? aToken.Len()>0 : aToken.Len()==0, "Hier stimmt doch was mit dem Token nicht!" ); - ASSERT( nDeep ? nRefPoolId : !nRefPoolId, + OSL_ENSURE( nDeep ? nRefPoolId : !nRefPoolId, "Hier stimmt doch was mit der Vergleichs-Vorlage nicht!" ); BOOL bTxtColl = pFmt->Which() == RES_TXTFMTCOLL || @@ -576,7 +576,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, const SfxItemSet *pNodeItemSet, SwHTMLTxtCollOutputInfo& rInfo ) { - ASSERT( RES_CONDTXTFMTCOLL==rFmt.Which() || RES_TXTFMTCOLL==rFmt.Which(), + OSL_ENSURE( RES_CONDTXTFMTCOLL==rFmt.Which() || RES_TXTFMTCOLL==rFmt.Which(), "keine Absatz-Vorlage" ); SwHTMLWriter & rHWrt = (SwHTMLWriter&)rWrt; @@ -619,9 +619,9 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, bNumbered = aNumInfo.IsNumbered(); BYTE nLvl = aNumInfo.GetLevel(); - ASSERT( pTxtNd->GetActualListLevel() == nLvl, + OSL_ENSURE( pTxtNd->GetActualListLevel() == nLvl, "Gemerkter Num-Level ist falsch" ); - ASSERT( bNumbered == static_cast< BOOL >(pTxtNd->IsCountedInList()), + OSL_ENSURE( bNumbered == static_cast< BOOL >(pTxtNd->IsCountedInList()), "Gemerkter Numerierungs-Zustand ist falsch" ); if( bNumbered ) @@ -674,13 +674,13 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, // der erste Buchstabe reicht meistens switch( rInfo.aToken.GetChar( 0 ) ) { - case 'A': ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_address), + case 'A': OSL_ENSURE( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_address), "Doch kein ADDRESS?" ); rInfo.bParaPossible = TRUE; rHWrt.bNoAlign = TRUE; break; - case 'B': ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_blockquote), + case 'B': OSL_ENSURE( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_blockquote), "Doch kein BLOCKQUOTE?" ); rInfo.bParaPossible = TRUE; rHWrt.bNoAlign = TRUE; @@ -692,7 +692,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, } else { - ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_preformtxt), + OSL_ENSURE( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_preformtxt), "Doch kein PRE?" ); if( HTML_PREFORMTXT_ON == rHWrt.nLastParaToken ) { @@ -707,7 +707,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, } break; - case 'D': ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_dt) || + case 'D': OSL_ENSURE( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_dt) || rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_dd), "Doch kein DD/DT?" ); bDT = rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_dt); @@ -729,7 +729,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, // Falls noetig, die harte Attributierung der Vorlage uebernehmen if( pFmtInfo->pItemSet ) { - ASSERT( !rInfo.pItemSet, "Wo kommt der Item-Set her?" ); + OSL_ENSURE( !rInfo.pItemSet, "Wo kommt der Item-Set her?" ); rInfo.pItemSet = new SfxItemSet( *pFmtInfo->pItemSet ); } @@ -858,7 +858,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, // ggf. eine Aufzaehlung- oder Numerierungsliste beginnen if( rInfo.bInNumBulList ) { - ASSERT( !rHWrt.nDefListLvl, "DL in OL geht nicht!" ); + OSL_ENSURE( !rHWrt.nDefListLvl, "DL in OL geht nicht!" ); OutHTML_NumBulListStart( rHWrt, aNumInfo ); if( bNumbered ) @@ -1115,8 +1115,8 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, if( nBulletGrfLvl != 255 ) { - ASSERT( aNumInfo.GetNumRule(), "Wo ist die Numerierung geblieben???" ); - ASSERT( nBulletGrfLvl < MAXLEVEL, "So viele Ebenen gibt's nicht" ); + OSL_ENSURE( aNumInfo.GetNumRule(), "Wo ist die Numerierung geblieben???" ); + OSL_ENSURE( nBulletGrfLvl < MAXLEVEL, "So viele Ebenen gibt's nicht" ); const SwNumFmt& rNumFmt = aNumInfo.GetNumRule()->Get(nBulletGrfLvl); OutHTML_BulletImage( rWrt, OOO_STRING_SVTOOLS_HTML_image, 0, @@ -1340,7 +1340,7 @@ USHORT HTMLEndPosLst::_FindStartPos( const HTMLSttEndPos *pPos ) const for( i = 0; i < aStartLst.Count() && aStartLst[i] != pPos; i++ ) ; - ASSERT( i != aStartLst.Count(), "Item nicht in Start-Liste gefunden!" ); + OSL_ENSURE( i != aStartLst.Count(), "Item nicht in Start-Liste gefunden!" ); return i==aStartLst.Count() ? USHRT_MAX : i; } @@ -1352,7 +1352,7 @@ USHORT HTMLEndPosLst::_FindEndPos( const HTMLSttEndPos *pPos ) const for( i = 0; i < aEndLst.Count() && aEndLst[i] != pPos; i++ ) ; - ASSERT( i != aEndLst.Count(), "Item nicht in Ende-Liste gefunden" ); + OSL_ENSURE( i != aEndLst.Count(), "Item nicht in Ende-Liste gefunden" ); return i==aEndLst.Count() ? USHRT_MAX : i; } @@ -1801,8 +1801,8 @@ HTMLEndPosLst::HTMLEndPosLst( SwDoc *pD, SwDoc* pTempl, HTMLEndPosLst::~HTMLEndPosLst() { - ASSERT( !aStartLst.Count(), "Start-Liste im Destruktor nicht leer" ); - ASSERT( !aEndLst.Count(), "End-Liste im Destruktor nicht leer" ); + OSL_ENSURE( !aStartLst.Count(), "Start-Liste im Destruktor nicht leer" ); + OSL_ENSURE( !aEndLst.Count(), "End-Liste im Destruktor nicht leer" ); } @@ -1854,7 +1854,7 @@ void HTMLEndPosLst::InsertNoScript( const SfxPoolItem& rItem, case HTML_CHRFMT_VALUE: { - ASSERT( RES_TXTATR_CHARFMT == rItem.Which(), + OSL_ENSURE( RES_TXTATR_CHARFMT == rItem.Which(), "Doch keine Zeichen-Vorlage" ); const SwFmtCharFmt& rChrFmt = (const SwFmtCharFmt&)rItem; const SwCharFmt* pFmt = rChrFmt.GetCharFmt(); @@ -1887,7 +1887,7 @@ void HTMLEndPosLst::InsertNoScript( const SfxPoolItem& rItem, // Eine Vordergrund-Farbe als Absatz-Attribut wird nur // exportiert, wenn sie nicht der Default-Farbe entspricht. { - ASSERT( RES_CHRATR_COLOR == rItem.Which(), + OSL_ENSURE( RES_CHRATR_COLOR == rItem.Which(), "Doch keine Vordergrund-Farbe" ); Color aColor( ((const SvxColorItem&)rItem).GetValue() ); if( COL_AUTO == aColor.GetColor() ) @@ -1899,7 +1899,7 @@ void HTMLEndPosLst::InsertNoScript( const SfxPoolItem& rItem, case HTML_DROPCAP_VALUE: { - ASSERT( RES_PARATR_DROP == rItem.Which(), + OSL_ENSURE( RES_PARATR_DROP == rItem.Which(), "Doch kein Drop-Cap" ); const SwFmtDrop& rDrop = (const SwFmtDrop&)rItem; nEnd = nStart + rDrop.GetChars(); @@ -2081,7 +2081,7 @@ sal_uInt16 HTMLEndPosLst::GetScriptAtPos( xub_StrLen nPos , sal_uInt16 i=0; while( i < nScriptChgs && nPos >= aScriptChgLst[i] ) i++; - ASSERT( i < nScriptChgs, "script list is to short" ); + OSL_ENSURE( i < nScriptChgs, "script list is to short" ); if( i < nScriptChgs ) { if( i18n::ScriptType::WEAK == aScriptLst[i] ) @@ -2161,7 +2161,7 @@ void HTMLEndPosLst::OutEndAttrs( SwHTMLWriter& rHWrt, xub_StrLen nPos, { // Das Attribut wird vor der aktuellen Position beendet. Das // darf nicht sein, aber wie koennen trotzdem damit umgehen - ASSERT( nEnd >= nPos, + OSL_ENSURE( nEnd >= nPos, "Das Attribut sollte schon laengst beendet sein" ); i++; } @@ -2578,7 +2578,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) else { // Hints ohne-Ende werden als letztes ausgebeben - ASSERT( !pTxtHt, + OSL_ENSURE( !pTxtHt, "Wieso gibt es da schon ein Attribut ohne Ende?" ); if( rHTMLWrt.nTxtAttrsToIgnore>0 ) { @@ -2684,7 +2684,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) if( bFlysLeft ) bFlysLeft = rHTMLWrt.OutFlyFrm( rNode.GetIndex(), nEnde, HTML_POS_INSIDE ); - ASSERT( !bFlysLeft, "Es wurden nicht alle Rahmen gespeichert!" ); + OSL_ENSURE( !bFlysLeft, "Es wurden nicht alle Rahmen gespeichert!" ); rHTMLWrt.bTxtAttr = FALSE; @@ -3207,7 +3207,7 @@ static Writer& OutHTML_SwFmtINetFmt( Writer& rWrt, const SfxPoolItem& rHt ) // das OutHTML_INetFmt( rWrt, rINetFmt, FALSE ); - ASSERT( rHTMLWrt.aINetFmts.Count(), "da fehlt doch ein URL-Attribut" ); + OSL_ENSURE( rHTMLWrt.aINetFmts.Count(), "da fehlt doch ein URL-Attribut" ); if( rHTMLWrt.aINetFmts.Count() ) { // das eigene Attribut vom Stack holen @@ -3251,7 +3251,7 @@ static Writer& OutHTML_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt ) return rWrt; const SwHTMLFmtInfo *pFmtInfo = rHTMLWrt.aChrFmtInfos[nPos]; - ASSERT( pFmtInfo, "Wieso gint es keine Infos ueber die Zeichenvorlage?" ); + OSL_ENSURE( pFmtInfo, "Wieso gint es keine Infos ueber die Zeichenvorlage?" ); if( rHTMLWrt.bTagOn ) { diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index d60987cc22..202ee99d95 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -251,12 +251,12 @@ void SwHTMLParser::InsertBasicDocEvent( rtl::OUString aEvent, const String& rNam ScriptType eScrType, const String& rScrType ) { - ASSERT( rName.Len(), "InsertBasicDocEvent() ohne Macro gerufen" ); + OSL_ENSURE( rName.Len(), "InsertBasicDocEvent() ohne Macro gerufen" ); if( !rName.Len() ) return; SwDocShell *pDocSh = pDoc->GetDocShell(); - ASSERT( pDocSh, "Wo ist die DocShell?" ); + OSL_ENSURE( pDocSh, "Wo ist die DocShell?" ); if( !pDocSh ) return; @@ -281,7 +281,7 @@ void SwHTMLWriter::OutBasic() SFX_APP()->EnterBasicCall(); BasicManager *pBasicMan = pDoc->GetDocShell()->GetBasicManager(); - ASSERT( pBasicMan, "Wo ist der Basic-Manager?" ); + OSL_ENSURE( pBasicMan, "Wo ist der Basic-Manager?" ); //JP 17.07.96: Bug 29538 - nur das DocumentBasic schreiben if( !pBasicMan || pBasicMan == SFX_APP()->GetBasicManager() ) { @@ -300,7 +300,7 @@ void SwHTMLWriter::OutBasic() for( USHORT j=0; j<pModules->Count(); j++ ) { const SbModule *pModule = PTR_CAST( SbModule, pModules->Get(j) ); - ASSERT( pModule, "Wo ist das Modul?" ); + OSL_ENSURE( pModule, "Wo ist das Modul?" ); String sLang( String::CreateFromAscii( SVX_MACRO_LANGUAGE_STARBASIC ) ); diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index 5162de0e94..7359a60c75 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -114,7 +114,7 @@ void SwCSS1Parser::ChgPageDesc( const SwPageDesc *pPageDesc, return; } - ASSERT( i<nPageDescs, "Seitenvorlage nicht gefunden" ); + OSL_ENSURE( i<nPageDescs, "Seitenvorlage nicht gefunden" ); } SwCSS1Parser::SwCSS1Parser( SwDoc *pD, sal_uInt32 aFHeights[7], const String& rBaseURL, BOOL bNewDoc ) : @@ -239,7 +239,7 @@ static void SetCharFmtAttrs( SwCharFmt *pCharFmt, SfxItemSet& rItemSet ) void SwCSS1Parser::SetLinkCharFmts() { - ASSERT( !bLinkCharFmtsSet, "Aufruf von SetLinkCharFmts unnoetig" ); + OSL_ENSURE( !bLinkCharFmtsSet, "Aufruf von SetLinkCharFmts unnoetig" ); SvxCSS1MapEntry *pStyleEntry = GetTag( String::CreateFromAscii(OOO_STRING_SVTOOLS_HTML_anchor) ); @@ -359,7 +359,7 @@ static void SetTxtCollAttrs( SwTxtFmtColl *pColl, SfxItemSet& rItemSet, void SwCSS1Parser::SetTableTxtColl( BOOL bHeader ) { - ASSERT( !(bHeader ? bTableHeaderTxtCollSet : bTableTxtCollSet), + OSL_ENSURE( !(bHeader ? bTableHeaderTxtCollSet : bTableTxtCollSet), "Aufruf von SetTableTxtColl unnoetig" ); USHORT nPoolId; @@ -656,7 +656,7 @@ static CSS1SelectorType GetTokenAndClass( const CSS1Selector *pSelector, if( CSS1_SELTYPE_ELEM_CLASS==eType ) { xub_StrLen nPos = rToken.Search( '.' ); - ASSERT( nPos != STRING_NOTFOUND, "kein Punkt in Class-Selektor???" ); + OSL_ENSURE( nPos != STRING_NOTFOUND, "kein Punkt in Class-Selektor???" ); if( nPos != STRING_NOTFOUND ) { rClass = rToken.Copy( nPos+1 ); @@ -702,7 +702,7 @@ static void RemoveScriptItems( SfxItemSet& rItemSet, sal_uInt16 nScript, case CSS1_SCRIPT_ALL: break; default: - ASSERT( aClearItems[0], "unknown script type" ); + OSL_ENSURE( aClearItems[0], "unknown script type" ); break; } @@ -1227,7 +1227,7 @@ SwCharFmt* SwCSS1Parser::GetChrFmt( USHORT nToken2, const String& rClass ) const } } - ASSERT( pCFmt, "Keine Zeichen-Vorlage???" ); + OSL_ENSURE( pCFmt, "Keine Zeichen-Vorlage???" ); // Wenn es eine Klasse gibt, die Klassen-Vorlage suchen aber nicht // neu anlegen. @@ -1321,7 +1321,7 @@ SwTxtFmtColl *SwCSS1Parser::GetTxtFmtColl( USHORT nTxtColl, String sName; if( USER_FMT & nTxtColl ) // eine vom Reader angelegte { - ASSERT( !this, "Wo kommt die Benutzer-Vorlage her?" ); + OSL_ENSURE( !this, "Wo kommt die Benutzer-Vorlage her?" ); pColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); } else @@ -1329,7 +1329,7 @@ SwTxtFmtColl *SwCSS1Parser::GetTxtFmtColl( USHORT nTxtColl, pColl = GetTxtCollFromPool( nTxtColl ); } - ASSERT( pColl, "Keine Absatz-Vorlage???" ); + OSL_ENSURE( pColl, "Keine Absatz-Vorlage???" ); if( aClass.Len() ) { String aTmp( pColl->GetName() ); @@ -1418,7 +1418,7 @@ const SwPageDesc *SwCSS1Parser::GetPageDesc( USHORT nPoolId, BOOL bCreate ) // dazu brauchen wir auch die Nummer der neuen Vorlage pPageDesc = FindPageDesc( pDoc, nPoolId, nPage ); - ASSERT( pPageDesc==pNewPageDesc, "Seitenvorlage nicht gefunden" ); + OSL_ENSURE( pPageDesc==pNewPageDesc, "Seitenvorlage nicht gefunden" ); pDoc->CopyPageDesc( *pMasterPageDesc, *pNewPageDesc, FALSE ); @@ -1512,7 +1512,7 @@ BOOL SwCSS1Parser::MayBePositioned( const SvxCSS1PropertyInfo& rPropInfo, void SwCSS1Parser::AddClassName( String& rFmtName, const String& rClass ) { - ASSERT( rClass.Len(), "Style-Klasse ohne Laenge?" ); + OSL_ENSURE( rClass.Len(), "Style-Klasse ohne Laenge?" ); (rFmtName += '.') += rClass; } @@ -1802,7 +1802,7 @@ BOOL SwHTMLParser::FileDownload( const String& rURL, #endif CallStartAction( pOldVSh ); #if OSL_DEBUG_LEVEL > 1 - ASSERT( pOldVSh == pVSh, "FileDownload: ViewShell wurde ausgetauscht" ); + OSL_ENSURE( pOldVSh == pVSh, "FileDownload: ViewShell wurde ausgetauscht" ); (void) pVSh; #endif @@ -1814,13 +1814,13 @@ void SwHTMLParser::InsertLink() BOOL bFinishDownload = FALSE; if( pPendStack ) { - ASSERT( ShouldFinishFileDownload(), + OSL_ENSURE( ShouldFinishFileDownload(), "Pending-Stack ohne File-Download?" ); SwPendingStack* pTmp = pPendStack->pNext; delete pPendStack; pPendStack = pTmp; - ASSERT( !pPendStack, "Wo kommt der Pending-Stack her?" ); + OSL_ENSURE( !pPendStack, "Wo kommt der Pending-Stack her?" ); bFinishDownload = TRUE; } diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index 46a925ab8f..b0b3406640 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -150,7 +150,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) { // Hier darf es keine vorlauefigen Absatz-Attribute geben, den die // koennten jetzt gesetzt werden und dann sind die Zeiger ungueltig!!! - ASSERT( !aParaAttrs.Count(), + OSL_ENSURE( !aParaAttrs.Count(), "Hoechste Gefahr: Es gibt noch nicht-endgueltige Absatz-Attribute" ); if( aParaAttrs.Count() ) aParaAttrs.Remove( 0, aParaAttrs.Count() ); @@ -358,7 +358,7 @@ void SwHTMLParser::EndContext( _HTMLAttrContext *pContext ) while( aContexts.Count() > nContextStMin ) { _HTMLAttrContext *pCntxt = PopContext(); - ASSERT( pCntxt != pContext, + OSL_ENSURE( pCntxt != pContext, "Kontext noch im Stack" ); if( pCntxt == pContext ) break; @@ -414,10 +414,10 @@ void SwHTMLParser::ClearContext( _HTMLAttrContext *pContext ) DeleteAttr( rAttrs[i] ); } - ASSERT( !pContext->GetSpansSection(), + OSL_ENSURE( !pContext->GetSpansSection(), "Bereich kann nicht mehr verlassen werden" ); - ASSERT( !pContext->HasSaveDocContext(), + OSL_ENSURE( !pContext->HasSaveDocContext(), "Rahmen kann nicht mehr verlassen werden" ); // PRE-/LISTING- und XMP-Umgebungen wieder starten @@ -543,7 +543,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet, pCSS1Parser->SetFmtBreak( rItemSet, rPropInfo ); // /Feature: PrintExt - ASSERT( aContexts.Count() <= nContextStAttrMin || + OSL_ENSURE( aContexts.Count() <= nContextStAttrMin || aContexts[aContexts.Count()-1] != pContext, "SwHTMLParser::InsertAttrs: Kontext doch schon auf dem Stack" ); @@ -588,7 +588,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet, // eingefuegt. if( rPropInfo.bLeftMargin ) { - ASSERT( rPropInfo.nLeftMargin < 0 || + OSL_ENSURE( rPropInfo.nLeftMargin < 0 || rPropInfo.nLeftMargin == pLRItem->GetTxtLeft(), "linker Abstand stimmt nicht mit Item ueberein" ); if( rPropInfo.nLeftMargin < 0 && @@ -599,7 +599,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet, } if( rPropInfo.bRightMargin ) { - ASSERT( rPropInfo.nRightMargin < 0 || + OSL_ENSURE( rPropInfo.nRightMargin < 0 || rPropInfo.nRightMargin == pLRItem->GetRight(), "rechter Abstand stimmt nicht mit Item ueberein" ); if( rPropInfo.nRightMargin < 0 && diff --git a/sw/source/filter/html/htmldraw.cxx b/sw/source/filter/html/htmldraw.cxx index fffbb242e5..b10945464f 100644 --- a/sw/source/filter/html/htmldraw.cxx +++ b/sw/source/filter/html/htmldraw.cxx @@ -278,7 +278,7 @@ static void PutEEPoolItem( SfxItemSet &rEEItemSet, void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) { - ASSERT( !pMarquee, "Marquee in Marquee???" ); + OSL_ENSURE( !pMarquee, "Marquee in Marquee???" ); aContents.Erase(); String aId, aStyle, aClass; @@ -569,7 +569,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) void SwHTMLParser::EndMarquee() { - ASSERT( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(), + OSL_ENSURE( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(), "kein Marquee oder falscher Typ" ); if( bFixMarqueeWidth ) @@ -597,7 +597,7 @@ void SwHTMLParser::EndMarquee() void SwHTMLParser::InsertMarqueeText() { - ASSERT( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(), + OSL_ENSURE( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(), "kein Marquee oder falscher Typ" ); // das akteulle Textstueck an den Text anhaengen @@ -606,7 +606,7 @@ void SwHTMLParser::InsertMarqueeText() void SwHTMLParser::ResizeDrawObject( SdrObject* pObj, SwTwips nWidth ) { - ASSERT( OBJ_TEXT==pObj->GetObjIdentifier(), + OSL_ENSURE( OBJ_TEXT==pObj->GetObjIdentifier(), "kein Marquee oder falscher Typ" ); if( OBJ_TEXT!=pObj->GetObjIdentifier() ) @@ -693,7 +693,7 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, { SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt; - ASSERT( rWrt.pDoc->GetDrawModel(), "Da gibt's ein Draw-Obj ohne ein Draw-Model zu haben?" ); + OSL_ENSURE( rWrt.pDoc->GetDrawModel(), "Da gibt's ein Draw-Obj ohne ein Draw-Model zu haben?" ); const SdrTextObj *pTextObj = (const SdrTextObj *)&rSdrObject; // Gibt es ueberhaupt auszugebenden Text @@ -710,10 +710,10 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, // BEHAVIOUR SdrTextAniKind eAniKind = pTextObj->GetTextAniKind(); - ASSERT( SDRTEXTANI_SCROLL==eAniKind || + OSL_ENSURE( SDRTEXTANI_SCROLL==eAniKind || SDRTEXTANI_ALTERNATE==eAniKind || SDRTEXTANI_SLIDE==eAniKind, - "Text-Draw-Objekt nicht fuer Marquee geeignet" ) + "Text-Draw-Objekt nicht fuer Marquee geeignet" ); const sal_Char *pStr = 0; switch( eAniKind ) diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 9e41ef2a6a..a97ee39c0d 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -559,25 +559,25 @@ void SwHTMLParser::EndField() switch( pField->Which() ) { case RES_DOCINFOFLD: - ASSERT( ((SwDocInfoField*)pField)->IsFixed(), + OSL_ENSURE( ((SwDocInfoField*)pField)->IsFixed(), "DokInfo-Feld haette nicht gemerkt werden muessen" ); ((SwDocInfoField*)pField)->SetExpansion( aContents ); break; case RES_EXTUSERFLD: - ASSERT( ((SwExtUserField*)pField)->IsFixed(), + OSL_ENSURE( ((SwExtUserField*)pField)->IsFixed(), "ExtUser-Feld haette nicht gemerkt werden muessen" ); ((SwExtUserField*)pField)->SetExpansion( aContents ); break; case RES_AUTHORFLD: - ASSERT( ((SwAuthorField*)pField)->IsFixed(), + OSL_ENSURE( ((SwAuthorField*)pField)->IsFixed(), "Author-Feld haette nicht gemerkt werden muessen" ); ((SwAuthorField*)pField)->SetExpansion( aContents ); break; case RES_FILENAMEFLD: - ASSERT( ((SwFileNameField*)pField)->IsFixed(), + OSL_ENSURE( ((SwFileNameField*)pField)->IsFixed(), "FileName-Feld haette nicht gemerkt werden muessen" ); ((SwFileNameField*)pField)->SetExpansion( aContents ); break; diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 4494134536..50dd594c50 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -115,7 +115,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, default: ; } - ASSERT( pSubStr, "ubekannter Subtyp fuer SwExtUserField" ); + OSL_ENSURE( pSubStr, "ubekannter Subtyp fuer SwExtUserField" ); bFixed = ((const SwExtUserField*)pFld)->IsFixed(); break; @@ -126,7 +126,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, case AF_NAME: pFmtStr = OOO_STRING_SW_HTML_FF_name; break; case AF_SHORTCUT: pFmtStr = OOO_STRING_SW_HTML_FF_shortcut; break; } - ASSERT( pFmtStr, "ubekanntes Format fuer SwAuthorField" ); + OSL_ENSURE( pFmtStr, "ubekanntes Format fuer SwAuthorField" ); bFixed = ((const SwAuthorField*)pFld)->IsFixed(); break; @@ -150,7 +150,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, case PG_NEXT: pSubStr = OOO_STRING_SW_HTML_FS_next; break; case PG_PREV: pSubStr = OOO_STRING_SW_HTML_FS_prev; break; } - ASSERT( pSubStr, "ubekannter Subtyp fuer SwPageNumberField" ); + OSL_ENSURE( pSubStr, "ubekannter Subtyp fuer SwPageNumberField" ); pFmtStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFmt) ); if( (SvxExtNumType)nFmt==SVX_NUM_CHAR_SPECIAL ) @@ -217,7 +217,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, { // Fuer ein fixes Feld och den Num-Value ausgeben. // Fixe Felder ohne Zahlenformate sollte es - // eigentlich nicht geben. ASSERT ist unten. + // eigentlich nicht geben. OSL_ENSURE(ist unten. dNumValue = ((const SwDocInfoField*)pFld)->GetValue(); bNumValue = TRUE; } @@ -262,7 +262,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, ; } bFixed = ((const SwFileNameField*)pFld)->IsFixed(); - ASSERT( pFmtStr, "unbekanntes Format fuer SwFileNameField" ); + OSL_ENSURE( pFmtStr, "unbekanntes Format fuer SwFileNameField" ); break; } @@ -292,7 +292,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, } if( bNumFmt ) { - ASSERT( nFmt, "Zahlenformat ist 0" ); + OSL_ENSURE( nFmt, "Zahlenformat ist 0" ); sOut = HTMLOutFuncs::CreateTableDataOptionsValNum( sOut, bNumValue, dNumValue, nFmt, *rHTMLWrt.pDoc->GetNumberFormatter(), @@ -529,7 +529,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt ) else { const SwTxtFld *pTxtFld = rFld.GetTxtFld(); - ASSERT( pTxtFld, "Where is the txt fld?" ); + OSL_ENSURE( pTxtFld, "Where is the txt fld?" ); if( pTxtFld ) OutHTML_SwField( rWrt, pFld, pTxtFld->GetTxtNode(), *pTxtFld->GetStart() ); diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index 3d76f5036a..15477ea723 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -311,7 +311,7 @@ USHORT SwHTMLWriter::GuessFrmType( const SwFrmFmt& rFrmFmt, void SwHTMLWriter::CollectFlyFrms() { - ASSERT( HTML_CFG_MAX+1 == MAX_BROWSERS, + OSL_ENSURE( HTML_CFG_MAX+1 == MAX_BROWSERS, "number of browser configurations has changed" ); BYTE nSz = (BYTE)Min( pDoc->GetSpzFrmFmts()->Count(), USHORT(255) ); @@ -488,7 +488,7 @@ void SwHTMLWriter::OutFrmFmt( BYTE nMode, const SwFrmFmt& rFrmFmt, switch( nOutMode ) { case HTML_OUT_TBLNODE: // OK - ASSERT( !pCntnrStr, "Table: Container ist hier nicht vorgesehen" ); + OSL_ENSURE( !pCntnrStr, "Table: Container ist hier nicht vorgesehen" ); OutHTML_FrmFmtTableNode( *this, rFrmFmt ); break; case HTML_OUT_GRFNODE: // OK @@ -502,14 +502,14 @@ void SwHTMLWriter::OutFrmFmt( BYTE nMode, const SwFrmFmt& rFrmFmt, break; case HTML_OUT_DIV: case HTML_OUT_SPAN: - ASSERT( !pCntnrStr, "Div: Container ist hier nicht vorgesehen" ); + OSL_ENSURE( !pCntnrStr, "Div: Container ist hier nicht vorgesehen" ); OutHTML_FrmFmtAsDivOrSpan( *this, rFrmFmt, HTML_OUT_SPAN==nOutMode ); break; case HTML_OUT_MULTICOL: // OK OutHTML_FrmFmtAsMulticol( *this, rFrmFmt, pCntnrStr != 0 ); break; case HTML_OUT_SPACER: // OK - ASSERT( !pCntnrStr, "Spacer: Container ist hier nicht vorgesehen" ); + OSL_ENSURE( !pCntnrStr, "Spacer: Container ist hier nicht vorgesehen" ); OutHTML_FrmFmtAsSpacer( *this, rFrmFmt ); break; case HTML_OUT_CONTROL: // OK @@ -521,7 +521,7 @@ void SwHTMLWriter::OutFrmFmt( BYTE nMode, const SwFrmFmt& rFrmFmt, OutHTML_FrmFmtAsMarquee( *this, rFrmFmt, *pSdrObject ); break; case HTML_OUT_MARQUEE: - ASSERT( !pCntnrStr, "Marquee: Container ist hier nicht vorgesehen" ); + OSL_ENSURE( !pCntnrStr, "Marquee: Container ist hier nicht vorgesehen" ); OutHTML_DrawFrmFmtAsMarquee( *this, (const SwDrawFrmFmt &)rFrmFmt, *pSdrObject ); break; @@ -710,7 +710,7 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, (nPrcHeight ? 0 : pFSItem->GetHeight()-aTwipSpc.Height()) ); - ASSERT( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, + OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, "Rahmengroesse minus Abstand < 0!!!???" ); if( aTwipSz.Width() < 0 ) aTwipSz.Width() = 0; @@ -910,7 +910,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, nWidth -= ( rBox.CalcLineSpace(BOX_LINE_LEFT) + rBox.CalcLineSpace(BOX_LINE_RIGHT) ); - ASSERT( nWidth>0, "Gibt es 0 twip breite Grafiken!?" ); + OSL_ENSURE( nWidth>0, "Gibt es 0 twip breite Grafiken!?" ); if( nWidth<=0 ) // sollte nicht passieren nWidth = 1; @@ -926,7 +926,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, nHeight -= ( rBox.CalcLineSpace(BOX_LINE_TOP) + rBox.CalcLineSpace(BOX_LINE_BOTTOM) ); - ASSERT( nHeight>0, "Gibt es 0 twip hohe Grafiken!?" ); + OSL_ENSURE( nHeight>0, "Gibt es 0 twip hohe Grafiken!?" ); if( nHeight<=0 ) nHeight = 1; @@ -1340,11 +1340,11 @@ static Writer& OutHTML_FrmFmtTableNode( Writer& rWrt, const SwFrmFmt& rFrmFmt ) bTopCaption = TRUE; pTblNd = rHTMLWrt.pDoc->GetNodes()[nStt+1]->GetTableNode(); } - ASSERT( pTblNd, "Rahmen enthaelt keine Tabelle" ); + OSL_ENSURE( pTblNd, "Rahmen enthaelt keine Tabelle" ); if( pTblNd ) { ULONG nTblEnd = pTblNd->EndOfSectionIndex(); - ASSERT( nTblEnd == nEnd - 1 || + OSL_ENSURE( nTblEnd == nEnd - 1 || (nTblEnd == nEnd - 2 && !bTopCaption), "Ungeuelter Rahmen-Inhalt fuer Tabelle" ); @@ -1426,7 +1426,7 @@ static Writer & OutHTML_FrmFmtAsMulticol( Writer& rWrt, const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt(); ULONG nStt = rFlyCntnt.GetCntntIdx()->GetIndex(); const SwStartNode* pSttNd = rWrt.pDoc->GetNodes()[nStt]->GetStartNode(); - ASSERT( pSttNd, "Wo ist der Start-Node" ); + OSL_ENSURE( pSttNd, "Wo ist der Start-Node" ); { // in einem Block damit rechtzeitig vor dem Ende der alte Zustand @@ -1515,7 +1515,7 @@ static Writer& OutHTML_FrmFmtAsDivOrSpan( Writer& rWrt, rHTMLWrt.OutFlyFrm( nStt, 0, HTML_POS_ANY ); const SwStartNode* pSttNd = rWrt.pDoc->GetNodes()[nStt]->GetStartNode(); - ASSERT( pSttNd, "Wo ist der Start-Node" ); + OSL_ENSURE( pSttNd, "Wo ist der Start-Node" ); { // in einem Block damit rechtzeitig vor dem Ende der alte Zustand @@ -1579,7 +1579,7 @@ static Writer& OutHTML_FrmFmtGrfNode( Writer& rWrt, const SwFrmFmt& rFrmFmt, const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt(); ULONG nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1; SwGrfNode *pGrfNd = rHTMLWrt.pDoc->GetNodes()[ nStt ]->GetGrfNode(); - ASSERT( pGrfNd, "Grf-Node erwartet" ); + OSL_ENSURE( pGrfNd, "Grf-Node erwartet" ); if( !pGrfNd ) return rWrt; @@ -1706,7 +1706,7 @@ Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrmFmt& rFrmFmt, const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt(); ULONG nStt = rFlyCntnt.GetCntntIdx()->GetIndex(); const SwStartNode* pSttNd = rWrt.pDoc->GetNodes()[nStt]->GetStartNode(); - ASSERT( pSttNd, "Wo ist der Start-Node" ); + OSL_ENSURE( pSttNd, "Wo ist der Start-Node" ); if( !bHeader && aSpacer.Len() ) { @@ -1889,7 +1889,7 @@ SwHTMLPosFlyFrm::SwHTMLPosFlyFrm( const SwPosFlyFrm& rPosFly, // Auto-gebundene Rahmen werden ein Zeichen weiter hinten // ausgegeben, weil dann die Positionierung mit Netscape // uebereinstimmt. - ASSERT( rAnchor.GetCntntAnchor(), "Keine Anker-Position?" ); + OSL_ENSURE( rAnchor.GetCntntAnchor(), "Keine Anker-Position?" ); if( rAnchor.GetCntntAnchor() ) { nCntntIdx = rAnchor.GetCntntAnchor()->nContent.GetIndex(); @@ -1898,7 +1898,7 @@ SwHTMLPosFlyFrm::SwHTMLPosFlyFrm( const SwPosFlyFrm& rPosFly, if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel ) { const SwCntntNode *pCNd = pNdIdx->GetNode().GetCntntNode(); - ASSERT( pCNd, "Kein Content-Node an PaM-Position" ); + OSL_ENSURE( pCNd, "Kein Content-Node an PaM-Position" ); if( pCNd && nCntntIdx < pCNd->Len() ) nCntntIdx++; } diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index a40a9a8e59..82d5d08052 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -217,7 +217,7 @@ public: pDocSh( pDSh ), pHeaderAttrs( pDSh ? pDSh->GetHeaderAttributes() : 0 ) { - ASSERT( pDocSh, "Keine DocShell, keine Controls" ); + OSL_ENSURE( pDocSh, "Keine DocShell, keine Controls" ); } const uno::Reference< XMultiServiceFactory >& GetServiceFactory(); @@ -286,7 +286,7 @@ const uno::Reference< XMultiServiceFactory >& SwHTMLForm_Impl::GetServiceFactory xServiceFactory = uno::Reference< XMultiServiceFactory >( pDocSh->GetBaseModel(), UNO_QUERY ); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XServiceFactory nicht vom Model erhalten" ); } return xServiceFactory; @@ -299,10 +299,10 @@ const uno::Reference< drawing::XDrawPage >& SwHTMLForm_Impl::GetDrawPage() { uno::Reference< drawing::XDrawPageSupplier > xTxtDoc( pDocSh->GetBaseModel(), UNO_QUERY ); - ASSERT( xTxtDoc.is(), + OSL_ENSURE( xTxtDoc.is(), "drawing::XDrawPageSupplier nicht vom XModel erhalten" ); xDrawPage = xTxtDoc->getDrawPage(); - ASSERT( xDrawPage.is(), "drawing::XDrawPage nicht erhalten" ); + OSL_ENSURE( xDrawPage.is(), "drawing::XDrawPage nicht erhalten" ); } return xDrawPage; } @@ -315,7 +315,7 @@ const uno::Reference< container::XIndexContainer >& SwHTMLForm_Impl::GetForms() if( xDrawPage.is() ) { uno::Reference< XFormsSupplier > xFormsSupplier( xDrawPage, UNO_QUERY ); - ASSERT( xFormsSupplier.is(), + OSL_ENSURE( xFormsSupplier.is(), "XFormsSupplier nicht vom drawing::XDrawPage erhalten" ); uno::Reference< container::XNameContainer > xNameCont = @@ -323,7 +323,7 @@ const uno::Reference< container::XIndexContainer >& SwHTMLForm_Impl::GetForms() xForms = uno::Reference< container::XIndexContainer >( xNameCont, UNO_QUERY ); - ASSERT( xForms.is(), "XForms nicht erhalten" ); + OSL_ENSURE( xForms.is(), "XForms nicht erhalten" ); } } return xForms; @@ -338,7 +338,7 @@ const uno::Reference< drawing::XShapes > & SwHTMLForm_Impl::GetShapes() if( xDrawPage.is() ) { xShapes = uno::Reference< drawing::XShapes >( xDrawPage, UNO_QUERY ); - ASSERT( xShapes.is(), + OSL_ENSURE( xShapes.is(), "XShapes nicht vom drawing::XDrawPage erhalten" ); } } @@ -352,7 +352,7 @@ const uno::Reference< script::XEventAttacherManager >& { xControlEventManager = uno::Reference< script::XEventAttacherManager >( xFormComps, UNO_QUERY ); - ASSERT( xControlEventManager.is(), + OSL_ENSURE( xControlEventManager.is(), "uno::Reference< XEventAttacherManager > nicht von xFormComps erhalten" ); } @@ -369,7 +369,7 @@ const uno::Reference< script::XEventAttacherManager >& { xFormEventManager = uno::Reference< script::XEventAttacherManager >( xForms, UNO_QUERY ); - ASSERT( xFormEventManager.is(), + OSL_ENSURE( xFormEventManager.is(), "uno::Reference< XEventAttacherManager > nicht von xForms erhalten" ); } } @@ -438,7 +438,7 @@ SwHTMLImageWatcher::SwHTMLImageWatcher( uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl() ); xSrc = uno::Reference< XImageProducerSupplier >( xControlModel, UNO_QUERY ); - ASSERT( xSrc.is(), "Kein XImageProducerSupplier" ); + OSL_ENSURE( xSrc.is(), "Kein XImageProducerSupplier" ); // Als Event-Listener am Shape anmelden, damit wir es beim dispose // loslassen ko”nnen ... @@ -477,7 +477,7 @@ void SwHTMLImageWatcher::clear() void SwHTMLImageWatcher::init( sal_Int32 Width, sal_Int32 Height ) throw( uno::RuntimeException ) { - ASSERT( bSetWidth || bSetHeight, + OSL_ENSURE( bSetWidth || bSetHeight, "Breite oder Hoehe muss angepasst werden" ); // Wenn keine Breite oder Hoehe angegeben ist, ist das das init von @@ -535,7 +535,7 @@ void SwHTMLImageWatcher::init( sal_Int32 Width, sal_Int32 Height ) xTunnel->getSomething(SwXShape::getUnoTunnelId()) )) : 0; - ASSERT( pSwShape, "Wo ist das SW-Shape?" ); + OSL_ENSURE( pSwShape, "Wo ist das SW-Shape?" ); if( pSwShape ) { SwFrmFmt *pFrmFmt = pSwShape->GetFrmFmt(); @@ -684,14 +684,14 @@ public: void SwHTMLParser::SetPendingControlSize( int nToken ) { - ASSERT( pPendStack, "Wo ist der Pending Stack?" ); + OSL_ENSURE( pPendStack, "Wo ist der Pending Stack?" ); SwHTMLFormPendingStackData_Impl *pData = (SwHTMLFormPendingStackData_Impl *)pPendStack->pData; SwPendingStack* pTmp = pPendStack->pNext; delete pPendStack; pPendStack = pTmp; - ASSERT( !pPendStack, "Wo kommt der Pending-Stack her?" ); + OSL_ENSURE( !pPendStack, "Wo kommt der Pending-Stack her?" ); SetControlSize( pData->GetShape(), pData->GetTextSize(), pData->IsMinWidth(), pData->IsMinHeight(), @@ -742,16 +742,16 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha xTunnel->getSomething(SwXShape::getUnoTunnelId()) )) : 0; - ASSERT( pSwShape, "Wo ist das SW-Shape?" ); + OSL_ENSURE( pSwShape, "Wo ist das SW-Shape?" ); // es muss ein Draw-Format sein SwFrmFmt *pFrmFmt = pSwShape->GetFrmFmt(); - ASSERT( RES_DRAWFRMFMT == pFrmFmt->Which(), "Kein DrawFrmFmt" ); + OSL_ENSURE( RES_DRAWFRMFMT == pFrmFmt->Which(), "Kein DrawFrmFmt" ); // Schauen, ob es ein SdrObject dafuer gibt const SdrObject *pObj = pFrmFmt->FindSdrObject(); - ASSERT( pObj, "SdrObject nicht gefunden" ); - ASSERT( FmFormInventor == pObj->GetObjInventor(), "falscher Inventor" ); + OSL_ENSURE( pObj, "SdrObject nicht gefunden" ); + OSL_ENSURE( FmFormInventor == pObj->GetObjInventor(), "falscher Inventor" ); const SdrView* pDrawView = pVSh ? pVSh->GetDrawView() : 0; @@ -778,7 +778,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha if( rTextSz.Width() || rTextSz.Height()) { uno::Reference< awt::XTextLayoutConstrains > xLC( xControl, UNO_QUERY ); - ASSERT( xLC.is(), "kein XTextLayoutConstrains" ); + OSL_ENSURE( xLC.is(), "kein XTextLayoutConstrains" ); if( xLC.is() ) { awt::Size aTmpSz( rTextSz.Width(), rTextSz.Height() ); @@ -1894,7 +1894,7 @@ void SwHTMLParser::InsertInput() aNewSz = Application::GetDefaultDevice() ->PixelToLogic( aNewSz, MapMode( MAP_100TH_MM ) ); aSz.Width() = aNewSz.Width(); - ASSERT( !aTextSz.Width(), "Text-Breite ist gegeben" ); + OSL_ENSURE( !aTextSz.Width(), "Text-Breite ist gegeben" ); bMinWidth = sal_False; } } @@ -1952,7 +1952,7 @@ void SwHTMLParser::InsertInput() bHidden ); if( aTextSz.Width() || aTextSz.Height() || bMinWidth || bMinHeight ) { - ASSERT( !(bSetGrfWidth || bSetGrfHeight), "Grafikgroesse anpassen???" ); + OSL_ENSURE( !(bSetGrfWidth || bSetGrfHeight), "Grafikgroesse anpassen???" ); SetControlSize( xShape, aTextSz, bMinWidth, bMinHeight, HTML_INPUT ); } @@ -1989,8 +1989,8 @@ void SwHTMLParser::NewTextArea() return; } - ASSERT( !bTextArea, "TextArea in TextArea???" ); - ASSERT( !pFormImpl || !pFormImpl->GetFCompPropSet().is(), + OSL_ENSURE( !bTextArea, "TextArea in TextArea???" ); + OSL_ENSURE( !pFormImpl || !pFormImpl->GetFCompPropSet().is(), "TextArea in Control???" ); if( !pFormImpl || !pFormImpl->GetFormComps().is() ) @@ -2162,7 +2162,7 @@ void SwHTMLParser::NewTextArea() aTmp ); } - ASSERT( !pFormImpl->GetText().Len(), "Text ist nicht leer!" ); + OSL_ENSURE( !pFormImpl->GetText().Len(), "Text ist nicht leer!" ); if( !nCols ) nCols = 20; @@ -2218,8 +2218,8 @@ void SwHTMLParser::NewTextArea() void SwHTMLParser::EndTextArea() { - ASSERT( bTextArea, "keine TextArea oder falscher Typ" ); - ASSERT( pFormImpl && pFormImpl->GetFCompPropSet().is(), + OSL_ENSURE( bTextArea, "keine TextArea oder falscher Typ" ); + OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(), "TextArea fehlt" ); const uno::Reference< beans::XPropertySet > & rPropSet = @@ -2248,8 +2248,8 @@ void SwHTMLParser::EndTextArea() void SwHTMLParser::InsertTextAreaText( sal_uInt16 nToken ) { - ASSERT( bTextArea, "keine TextArea oder falscher Typ" ); - ASSERT( pFormImpl && pFormImpl->GetFCompPropSet().is(), + OSL_ENSURE( bTextArea, "keine TextArea oder falscher Typ" ); + OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(), "TextArea fehlt" ); String& rText = pFormImpl->GetText(); @@ -2284,8 +2284,8 @@ void SwHTMLParser::NewSelect() return; } - ASSERT( !bSelect, "Select in Select???" ); - ASSERT( !pFormImpl || !pFormImpl->GetFCompPropSet().is(), + OSL_ENSURE( !bSelect, "Select in Select???" ); + OSL_ENSURE( !pFormImpl || !pFormImpl->GetFCompPropSet().is(), "Select in Control???" ); if( !pFormImpl || !pFormImpl->GetFormComps().is() ) @@ -2510,8 +2510,8 @@ void SwHTMLParser::EndSelect() return; } - ASSERT( bSelect, "keine Select" ); - ASSERT( pFormImpl && pFormImpl->GetFCompPropSet().is(), + OSL_ENSURE( bSelect, "keine Select" ); + OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(), "kein Select-Control" ); const uno::Reference< beans::XPropertySet > & rPropSet = @@ -2581,7 +2581,7 @@ void SwHTMLParser::EndSelect() if( bFixSelectWidth ) { - ASSERT( pFormImpl->GetShape().is(), "Kein Shape gemerkt" ); + OSL_ENSURE( pFormImpl->GetShape().is(), "Kein Shape gemerkt" ); Size aTextSz( -1, 0 ); SetControlSize( pFormImpl->GetShape(), aTextSz, sal_False, sal_False, HTML_SELECT_OFF ); @@ -2603,8 +2603,8 @@ void SwHTMLParser::EndSelect() void SwHTMLParser::InsertSelectOption() { - ASSERT( bSelect, "keine Select" ); - ASSERT( pFormImpl && pFormImpl->GetFCompPropSet().is(), + OSL_ENSURE( bSelect, "keine Select" ); + OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(), "kein Select-Control" ); bLBEntrySelected = sal_False; @@ -2640,8 +2640,8 @@ void SwHTMLParser::InsertSelectOption() void SwHTMLParser::InsertSelectText() { - ASSERT( bSelect, "keine Select" ); - ASSERT( pFormImpl && pFormImpl->GetFCompPropSet().is(), + OSL_ENSURE( bSelect, "keine Select" ); + OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(), "kein Select-Control" ); sal_uInt16 nEntryCnt = pFormImpl->GetStringList().Count(); diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 20e3f92021..99480ad1d5 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -130,7 +130,7 @@ void lcl_html_outEvents( SvStream& rStrm, { uno::Reference< container::XChild > xChild( rFormComp, uno::UNO_QUERY ); uno::Reference< uno::XInterface > xParentIfc = xChild->getParent(); - ASSERT( xParentIfc.is(), "lcl_html_outEvents: no parent interface" ); + OSL_ENSURE( xParentIfc.is(), "lcl_html_outEvents: no parent interface" ); if( !xParentIfc.is() ) return; uno::Reference< container::XIndexAccess > xIndexAcc( xParentIfc, uno::UNO_QUERY ); @@ -144,7 +144,7 @@ void lcl_html_outEvents( SvStream& rStrm, for( nPos = 0 ; nPos < nCount; nPos++ ) { uno::Any aTmp = xIndexAcc->getByIndex(nPos); - ASSERT( aTmp.getValueType() == + OSL_ENSURE( aTmp.getValueType() == ::getCppuType( (uno::Reference<form::XFormComponent>*)0 ) || aTmp.getValueType() == ::getCppuType( (uno::Reference<form::XForm>*)0 ), @@ -401,27 +401,27 @@ void SwHTMLWriter::OutHiddenForms() uno::Reference< drawing::XDrawPageSupplier > xDPSupp( pDocSh->GetBaseModel(), uno::UNO_QUERY ); - ASSERT( xDPSupp.is(), "XTextDocument nicht vom XModel erhalten" ); + OSL_ENSURE( xDPSupp.is(), "XTextDocument nicht vom XModel erhalten" ); uno::Reference< drawing::XDrawPage > xDrawPage = xDPSupp->getDrawPage(); - ASSERT( xDrawPage.is(), "XDrawPage nicht erhalten" ); + OSL_ENSURE( xDrawPage.is(), "XDrawPage nicht erhalten" ); if( !xDrawPage.is() ) return; uno::Reference< form::XFormsSupplier > xFormsSupplier( xDrawPage, uno::UNO_QUERY ); - ASSERT( xFormsSupplier.is(), + OSL_ENSURE( xFormsSupplier.is(), "XFormsSupplier nicht vom XDrawPage erhalten" ); uno::Reference< container::XNameContainer > xTmp = xFormsSupplier->getForms(); - ASSERT( xTmp.is(), "XForms nicht erhalten" ); + OSL_ENSURE( xTmp.is(), "XForms nicht erhalten" ); uno::Reference< container::XIndexContainer > xForms( xTmp, uno::UNO_QUERY ); - ASSERT( xForms.is(), "XForms ohne container::XIndexContainer?" ); + OSL_ENSURE( xForms.is(), "XForms ohne container::XIndexContainer?" ); sal_Int32 nCount = xForms->getCount(); for( sal_Int32 i=0; i<nCount; i++) { uno::Any aTmp = xForms->getByIndex( i ); - ASSERT( aTmp.getValueType() == + OSL_ENSURE( aTmp.getValueType() == ::getCppuType((uno::Reference< form::XForm >*)0), "OutHiddenForms: falsche Reflection" ); if( aTmp.getValueType() == @@ -441,7 +441,7 @@ void SwHTMLWriter::OutHiddenForm( const uno::Reference< form::XForm > & rForm ) for( sal_Int32 i=0; i<nCount; i++ ) { uno::Any aTmp = xFormComps->getByIndex( i ); - ASSERT( aTmp.getValueType() == + OSL_ENSURE( aTmp.getValueType() == ::getCppuType((uno::Reference<form::XFormComponent>*)0), "OutHiddenForm: falsche Reflection" ); if( aTmp.getValueType() != @@ -606,7 +606,7 @@ void SwHTMLWriter::OutHiddenControls( for( nPos=0; !bDone && nPos < nCount; nPos++ ) { uno::Any aTmp = rFormComps->getByIndex( nPos ); - ASSERT( aTmp.getValueType() == + OSL_ENSURE( aTmp.getValueType() == ::getCppuType((uno::Reference< form::XFormComponent>*)0), "OutHiddenControls: falsche Reflection" ); bDone = aTmp.getValueType() == @@ -619,7 +619,7 @@ void SwHTMLWriter::OutHiddenControls( for( ; nPos < nCount; nPos++ ) { uno::Any aTmp = rFormComps->getByIndex( nPos ); - ASSERT( aTmp.getValueType() == + OSL_ENSURE( aTmp.getValueType() == ::getCppuType((uno::Reference< form::XFormComponent>*)0), "OutHiddenControls: falsche Reflection" ); if( aTmp.getValueType() != @@ -687,7 +687,7 @@ void SwHTMLWriter::OutHiddenControls( const SdrObject *SwHTMLWriter::GetHTMLControl( const SwDrawFrmFmt& rFmt ) { // es muss ein Draw-Format sein - ASSERT( RES_DRAWFRMFMT == rFmt.Which(), + OSL_ENSURE( RES_DRAWFRMFMT == rFmt.Which(), "GetHTMLControl nuer fuer Draw-Formate erlaubt" ); // Schauen, ob es ein SdrObject dafuer gibt @@ -699,7 +699,7 @@ const SdrObject *SwHTMLWriter::GetHTMLControl( const SwDrawFrmFmt& rFmt ) uno::Reference< awt::XControlModel > xControlModel = pFormObj->GetUnoControlModel(); - ASSERT( xControlModel.is(), "UNO-Control ohne Model" ); + OSL_ENSURE( xControlModel.is(), "UNO-Control ohne Model" ); if( !xControlModel.is() ) return 0; @@ -730,11 +730,11 @@ static void GetControlSize( const SdrObject& rSdrObj, Size& rSz, SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObj ); uno::Reference< awt::XControl > xControl; SdrView* pDrawView = pVSh->GetDrawView(); - ASSERT( pDrawView && pVSh->GetWin(), "no DrawView or window!" ); + OSL_ENSURE( pDrawView && pVSh->GetWin(), "no DrawView or window!" ); if ( pDrawView && pVSh->GetWin() ) xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin() ); uno::Reference< awt::XTextLayoutConstrains > xLC( xControl, uno::UNO_QUERY ); - ASSERT( xLC.is(), "kein XTextLayoutConstrains" ); + OSL_ENSURE( xLC.is(), "kein XTextLayoutConstrains" ); if( !xLC.is() ) return; @@ -755,7 +755,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, uno::Reference< awt::XControlModel > xControlModel = pFormObj->GetUnoControlModel(); - ASSERT( xControlModel.is(), "UNO-Control ohne Model" ); + OSL_ENSURE( xControlModel.is(), "UNO-Control ohne Model" ); if( !xControlModel.is() ) return rWrt; @@ -1078,7 +1078,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, sOut.Erase(); } - ASSERT( !bInCntnr, "Container wird fuer Controls nicht unterstuertzt" ); + OSL_ENSURE( !bInCntnr, "Container wird fuer Controls nicht unterstuertzt" ); if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_DRAW ) && !bInCntnr ) { // Wenn Zeichen-Objekte nicht absolut positioniert werden duerfen, @@ -1355,7 +1355,7 @@ static void AddControl( HTMLControls& rControls, sal_uInt32 nNodeIdx ) { SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pSdrObj ); - ASSERT( pFormObj, "Doch kein FormObj" ); + OSL_ENSURE( pFormObj, "Doch kein FormObj" ); uno::Reference< awt::XControlModel > xControlModel = pFormObj->GetUnoControlModel(); if( !xControlModel.is() ) @@ -1365,7 +1365,7 @@ static void AddControl( HTMLControls& rControls, uno::Reference< uno::XInterface > xIfc = xFormComp->getParent(); uno::Reference< form::XForm > xForm(xIfc, uno::UNO_QUERY); - ASSERT( xForm.is(), "Wo ist die Form?" ); + OSL_ENSURE( xForm.is(), "Wo ist die Form?" ); if( xForm.is() ) { uno::Reference< container::XIndexContainer > xFormComps( xForm, uno::UNO_QUERY ); @@ -1400,7 +1400,7 @@ void SwHTMLWriter::GetControls() continue; const SdrObject *pSdrObj = pPosFlyFrm->GetSdrObject(); - ASSERT( pSdrObj, "Wo ist das SdrObject?" ); + OSL_ENSURE( pSdrObj, "Wo ist das SdrObject?" ); if( !pSdrObj ) continue; diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index 90f990e895..916c2f06b7 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -302,7 +302,7 @@ Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt ) if( rFmtFtn.IsEndNote() ) { nPos = rHTMLWrt.pFootEndNotes ? rHTMLWrt.pFootEndNotes->Count() : 0; - ASSERT( nPos == rHTMLWrt.nFootNote + rHTMLWrt.nEndNote, + OSL_ENSURE( nPos == rHTMLWrt.nFootNote + rHTMLWrt.nEndNote, "OutHTML_SwFmtFtn: Position falsch" ); sClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote_anc ); sFtnName.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote ); @@ -347,12 +347,12 @@ Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt ) void SwHTMLWriter::OutFootEndNotes() { - ASSERT( pFootEndNotes, + OSL_ENSURE( pFootEndNotes, "SwHTMLWriter::OutFootEndNotes(): unnoetiger Aufruf" ); if( !pFootEndNotes ) return; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT nFtn = nFootNote, nEn = nEndNote; #endif nFootNote = 0, nEndNote = 0; @@ -387,9 +387,9 @@ void SwHTMLWriter::OutFootEndNotes() bLFPossible = TRUE; IncIndentLevel(); // Inhalt von <DIV> einruecken - ASSERT( pTxtFtn, "SwHTMLWriter::OutFootEndNotes: SwTxtFtn fehlt" ); + OSL_ENSURE( pTxtFtn, "SwHTMLWriter::OutFootEndNotes: SwTxtFtn fehlt" ); SwNodeIndex *pSttNdIdx = pTxtFtn->GetStartNode(); - ASSERT( pSttNdIdx, + OSL_ENSURE( pSttNdIdx, "SwHTMLWriter::OutFootEndNotes: StartNode-Index fehlt" ); if( pSttNdIdx ) { @@ -404,7 +404,7 @@ void SwHTMLWriter::OutFootEndNotes() HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_division, FALSE ); bLFPossible = TRUE; - ASSERT( !pFmtFtn, + OSL_ENSURE( !pFmtFtn, "SwHTMLWriter::OutFootEndNotes: Ftn wurde nicht ausgegeben" ); if( pFmtFtn ) { @@ -417,10 +417,10 @@ void SwHTMLWriter::OutFootEndNotes() } } -#ifdef DBG_UTIL - ASSERT( nFtn == nFootNote, +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( nFtn == nFootNote, "SwHTMLWriter::OutFootEndNotes: Anzahl Fussnoten stimmt nicht" ); - ASSERT( nEn == nEndNote, + OSL_ENSURE( nEn == nEndNote, "SwHTMLWriter::OutFootEndNotes: Anzahl Endnoten stimmt nicht" ); #endif diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index a023a7ab40..a4305d47bc 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -111,7 +111,7 @@ ImageMap *SwHTMLParser::FindImageMap( const String& rName ) const { ImageMap *pMap = 0; - ASSERT( rName.GetChar(0) != '#', "FindImageName: Name beginnt mit #!" ); + OSL_ENSURE( rName.GetChar(0) != '#', "FindImageName: Name beginnt mit #!" ); if( pImageMaps ) { @@ -456,7 +456,7 @@ IMAGE_SETEVENT: if( pTxtNode && ! pTxtNode->IsCountedInList()) { - ASSERT( pTxtNode->GetActualListLevel() == GetNumInfo().GetLevel(), + OSL_ENSURE( pTxtNode->GetActualListLevel() == GetNumInfo().GetLevel(), "Numerierungs-Ebene stimmt nicht" ); pTxtNode->SetCountedInList( true ); @@ -691,7 +691,7 @@ IMAGE_SETEVENT: // min. Werte einhalten !! if( nPrcWidth ) { - ASSERT( !aTwipSz.Width(), + OSL_ENSURE( !aTwipSz.Width(), "Wieso ist da trotz %-Angabe eine Breite gesetzt?" ); aTwipSz.Width() = aGrfSz.Width() ? aGrfSz.Width() : HTML_DFLT_IMG_WIDTH; @@ -704,7 +704,7 @@ IMAGE_SETEVENT: } if( nPrcHeight ) { - ASSERT( !aTwipSz.Height(), + OSL_ENSURE( !aTwipSz.Height(), "Wieso ist da trotz %-Angabe eine Hoehe gesetzt?" ); aTwipSz.Height() = aGrfSz.Height() ? aGrfSz.Height() : HTML_DFLT_IMG_HEIGHT; @@ -1383,7 +1383,7 @@ void SwHTMLParser::StripTrailingPara() SwCntntNode* pNd = pDoc->GetNodes().GoPrevious(&nNewNdIdx); if(!pNd) { - ASSERT(!this, "Hoppla, wo ist mein Vorgaenger-Node"); + OSL_ENSURE(!this, "Hoppla, wo ist mein Vorgaenger-Node"); return; } // --> OD 2007-09-27 #i81002# - refactoring diff --git a/sw/source/filter/html/htmlnum.cxx b/sw/source/filter/html/htmlnum.cxx index bb5339d69f..d69ffe1cef 100644 --- a/sw/source/filter/html/htmlnum.cxx +++ b/sw/source/filter/html/htmlnum.cxx @@ -565,7 +565,7 @@ void SwHTMLParser::NewNumBulListItem( int nToken ) pDoc->MakeNumRule( aNumRuleName, &aNumRule ); - ASSERT( !nOpenParaToken, + OSL_ENSURE( !nOpenParaToken, "Jetzt geht ein offenes Absatz-Element verloren" ); // Wir tun so, als ob wir in einem Absatz sind. Dann wird // beim naechsten Absatz wenigstens die Numerierung @@ -675,9 +675,9 @@ void SwHTMLParser::EndNumBulListItem( int nToken, sal_Bool bSetColl, void SwHTMLParser::SetNodeNum( sal_uInt8 nLevel, bool bCountedInList ) { SwTxtNode* pTxtNode = pPam->GetNode()->GetTxtNode(); - ASSERT( pTxtNode, "Kein Text-Node an PaM-Position" ); + OSL_ENSURE( pTxtNode, "Kein Text-Node an PaM-Position" ); - ASSERT( GetNumInfo().GetNumRule(), "Kein Numerierungs-Regel" ); + OSL_ENSURE( GetNumInfo().GetNumRule(), "Kein Numerierungs-Regel" ); const String& rName = GetNumInfo().GetNumRule()->GetName(); ((SwCntntNode *)pTxtNode)->SetAttr( SwNumRuleItem(rName) ); @@ -784,7 +784,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, break; } - ASSERT(! pTxtNd->IsOutline(), + OSL_ENSURE(! pTxtNd->IsOutline(), "outline not expected"); if( pTxtNd->GetActualListLevel() + 1 < @@ -898,7 +898,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, } else { - ASSERT( false, + OSL_ENSURE( false, "<OutHTML_NumBulListStart(..) - text node has no number." ); } } diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 0eef14b8c6..53fc05e9ff 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1005,7 +1005,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, ULONG nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1; SwOLENode *pOLENd = rHTMLWrt.pDoc->GetNodes()[ nStt ]->GetOLENode(); - ASSERT( pOLENd, "OLE-Node erwartet" ); + OSL_ENSURE( pOLENd, "OLE-Node erwartet" ); if( !pOLENd ) return rWrt; @@ -1269,7 +1269,7 @@ Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFrmFmt, ULONG nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1; SwOLENode *pOLENd = rHTMLWrt.pDoc->GetNodes()[ nStt ]->GetOLENode(); - ASSERT( pOLENd, "OLE-Node erwartet" ); + OSL_ENSURE( pOLENd, "OLE-Node erwartet" ); if( !pOLENd ) return rWrt; diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index d36760c7ec..6e01e074ab 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -430,7 +430,7 @@ void SwHTMLParser::FixHeaderFooterDistance( sal_Bool bHeader, SwFrmFmt *pHdFtFmt = bHeader ? (SwFrmFmt*)rPageFmt.GetHeader().GetHeaderFmt() : (SwFrmFmt*)rPageFmt.GetFooter().GetFooterFmt(); - ASSERT( pHdFtFmt, "Doch keine Kopf- oder Fusszeile" ); + OSL_ENSURE( pHdFtFmt, "Doch keine Kopf- oder Fusszeile" ); const SwFmtCntnt& rFlyCntnt = pHdFtFmt->GetCntnt(); const SwNodeIndex& rCntntStIdx = *rFlyCntnt.GetCntntIdx(); @@ -525,7 +525,7 @@ sal_Bool SwHTMLParser::EndSection( sal_Bool bLFStripped ) return sal_True; } - ASSERT( !this, "Falsche PaM Position Beenden eines Bereichs" ); + OSL_ENSURE( !this, "Falsche PaM Position Beenden eines Bereichs" ); return sal_False; } @@ -816,7 +816,7 @@ void SwHTMLParser::MovePageDescAttrs( SwNode *pSrcNd, SwCntntNode* pDestCntntNd = pDoc->GetNodes()[nDestIdx]->GetCntntNode(); - ASSERT( pDestCntntNd, "Wieso ist das Ziel kein Content-Node?" ); + OSL_ENSURE( pDestCntntNd, "Wieso ist das Ziel kein Content-Node?" ); if( pSrcNd->IsCntntNode() ) { diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index bc972608a4..b4a077507b 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -730,7 +730,7 @@ void HTMLTableCnts::Add( HTMLTableCnts* pNewCnts ) inline void HTMLTableCnts::SetTableBox( SwTableBox *pBox ) { - ASSERT( pLayoutInfo, "Da sit noch keine Layout-Info" ); + OSL_ENSURE( pLayoutInfo, "Da sit noch keine Layout-Info" ); if( pLayoutInfo ) pLayoutInfo->SetTableBox( pBox ); } @@ -860,7 +860,7 @@ HTMLTableRow::HTMLTableRow( sal_uInt16 nCells ): pCells->Insert( new HTMLTableCell, pCells->Count() ); } - ASSERT( nCells==pCells->Count(), + OSL_ENSURE( nCells==pCells->Count(), "Zellenzahl in neuer HTML-Tabellenzeile stimmt nicht" ); } @@ -878,7 +878,7 @@ inline void HTMLTableRow::SetHeight( sal_uInt16 nHght ) inline HTMLTableCell *HTMLTableRow::GetCell( sal_uInt16 nCell ) const { - ASSERT( nCell<pCells->Count(), + OSL_ENSURE( nCell<pCells->Count(), "ungueltiger Zellen-Index in HTML-Tabellenzeile" ); return (*pCells)[nCell]; } @@ -900,15 +900,15 @@ void HTMLTableRow::Expand( sal_uInt16 nCells, sal_Bool bOneCell ) nColSpan--; } - ASSERT( nCells==pCells->Count(), + OSL_ENSURE( nCells==pCells->Count(), "Zellenzahl in expandierter HTML-Tabellenzeile stimmt nicht" ); } void HTMLTableRow::Shrink( sal_uInt16 nCells ) { - ASSERT( nCells < pCells->Count(), "Anzahl Zellen falsch" ); + OSL_ENSURE( nCells < pCells->Count(), "Anzahl Zellen falsch" ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_uInt16 nEnd = pCells->Count(); #endif // The colspan of empty cells at the end has to be fixed to the new @@ -919,22 +919,24 @@ void HTMLTableRow::Shrink( sal_uInt16 nCells ) HTMLTableCell *pCell = (*pCells)[--i]; if( !pCell->GetContents() ) { - ASSERT( pCell->GetColSpan() == nEnd - i, +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pCell->GetColSpan() == nEnd - i, "invalid col span for empty cell at row end" ); +#endif pCell->SetColSpan( nCells-i); } else break; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 for( i=nCells; i<nEnd; i++ ) { HTMLTableCell *pCell = (*pCells)[i]; - ASSERT( pCell->GetRowSpan() == 1, + OSL_ENSURE( pCell->GetRowSpan() == 1, "RowSpan von zu loesender Zelle ist falsch" ); - ASSERT( pCell->GetColSpan() == nEnd - i, + OSL_ENSURE( pCell->GetColSpan() == nEnd - i, "ColSpan von zu loesender Zelle ist falsch" ); - ASSERT( !pCell->GetContents(), "Zu loeschende Zelle hat Inhalt" ); + OSL_ENSURE( !pCell->GetContents(), "Zu loeschende Zelle hat Inhalt" ); } #endif @@ -973,7 +975,7 @@ inline SwHTMLTableLayoutColumn *HTMLTableColumn::CreateLayoutInfo() inline sal_uInt16 HTMLTableColumn::GetFrmFmtIdx( sal_Bool bBorderLine, sal_Int16 eVertOrient ) const { - ASSERT( text::VertOrientation::TOP != eVertOrient, "Top ist nicht erlaubt" ); + OSL_ENSURE( text::VertOrientation::TOP != eVertOrient, "Top ist nicht erlaubt" ); sal_uInt16 n = bBorderLine ? 3 : 0; switch( eVertOrient ) { @@ -1302,7 +1304,7 @@ const SwStartNode* HTMLTable::GetPrevBoxStartNode( sal_uInt16 nRow, sal_uInt16 n } } } - ASSERT( pPrevCnts, "keine gefuellte Vorgaenger-Zelle gefunden" ); + OSL_ENSURE( pPrevCnts, "keine gefuellte Vorgaenger-Zelle gefunden" ); if( !pPrevCnts ) { pPrevCnts = GetCell(0,0)->GetContents(); @@ -1352,7 +1354,7 @@ sal_uInt16 HTMLTable::GetTopCellSpace( sal_uInt16 nRow, sal_uInt16 nRowSpan, else if( bSwBorders && ((*pRows)[nRow+nRowSpan-1])->bBottomBorder && nSpace < MIN_BORDER_DIST ) { - ASSERT( !nCellPadding, "GetTopCellSpace: CELLPADDING!=0" ); + OSL_ENSURE( !nCellPadding, "GetTopCellSpace: CELLPADDING!=0" ); // Wenn die Gegenueberliegende Seite umrandet ist muessen // wir zumindest den minimalen Abstand zum Inhalt // beruecksichtigen. (Koennte man zusaetzlich auch an @@ -1390,9 +1392,9 @@ sal_uInt16 HTMLTable::GetBottomCellSpace( sal_uInt16 nRow, sal_uInt16 nRowSpan, } else if( nRow==0 && bTopBorder && nSpace < MIN_BORDER_DIST ) { - ASSERT( GetBorderWidth( aTopBorderLine, sal_True ) > 0, + OSL_ENSURE( GetBorderWidth( aTopBorderLine, sal_True ) > 0, "GetBottomCellSpace: |aTopLine| == 0" ); - ASSERT( !nCellPadding, "GetBottomCellSpace: CELLPADDING!=0" ); + OSL_ENSURE( !nCellPadding, "GetBottomCellSpace: CELLPADDING!=0" ); // Wenn die Gegenueberliegende Seite umrandet ist muessen // wir zumindest den minimalen Abstand zum Inhalt // beruecksichtigen. (Koennte man zusaetzlich auch an @@ -1608,7 +1610,7 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox, else pFrmFmt->ResetFmtAttr( RES_BOXATR_FORMAT ); - ASSERT( eVOri != text::VertOrientation::TOP, "text::VertOrientation::TOP ist nicht erlaubt!" ); + OSL_ENSURE( eVOri != text::VertOrientation::TOP, "text::VertOrientation::TOP ist nicht erlaubt!" ); if( text::VertOrientation::NONE != eVOri ) { pFrmFmt->SetFmtAttr( SwFmtVertOrient( 0, eVOri ) ); @@ -1629,7 +1631,7 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox, } else { - ASSERT( pBox->GetSttNd() || + OSL_ENSURE( pBox->GetSttNd() || SFX_ITEM_SET!=pFrmFmt->GetAttrSet().GetItemState( RES_VERT_ORIENT, sal_False ), "Box ohne Inhalt hat vertikale Ausrichtung" ); @@ -1696,7 +1698,7 @@ static void ResetLineFrmFmtAttrs( SwFrmFmt *pFrmFmt ) { pFrmFmt->ResetFmtAttr( RES_FRM_SIZE ); pFrmFmt->ResetFmtAttr( RES_BACKGROUND ); - ASSERT( SFX_ITEM_SET!=pFrmFmt->GetAttrSet().GetItemState( + OSL_ENSURE( SFX_ITEM_SET!=pFrmFmt->GetAttrSet().GetItemState( RES_VERT_ORIENT, sal_False ), "Zeile hat vertikale Ausrichtung" ); } @@ -1781,15 +1783,15 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper, sal_Bool bSplitted = sal_False; while( !bSplitted ) { - ASSERT( nCol < nRightCol, "Zu weit gelaufen" ); + OSL_ENSURE( nCol < nRightCol, "Zu weit gelaufen" ); HTMLTableCell *pCell = GetCell(nTopRow,nCol); const sal_Bool bSplit = 1 == pCell->GetColSpan(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( nCol == nRightCol-1 ) { - ASSERT( bSplit, "Split-Flag falsch" ); + OSL_ENSURE( bSplit, "Split-Flag falsch" ); } #endif if( bSplit ) @@ -1840,7 +1842,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper, bSplitted = sal_True; } - ASSERT( pBox, "Colspan trouble" ) + OSL_ENSURE( pBox, "Colspan trouble" ); if( pBox ) rBoxes.C40_INSERT( SwTableBox, pBox, rBoxes.Count() ); @@ -1953,7 +1955,7 @@ void HTMLTable::InheritBorders( const HTMLTable *pParent, sal_uInt16 nRowSpan, sal_uInt16 /*nColSpan*/, sal_Bool bFirstPara, sal_Bool bLastPara ) { - ASSERT( nRows>0 && nCols>0 && nCurRow==nRows, + OSL_ENSURE( nRows>0 && nCols>0 && nCurRow==nRows, "Wurde CloseTable nicht aufgerufen?" ); // Die Child-Tabelle muss einen Rahmen bekommen, wenn die umgebende @@ -2121,7 +2123,7 @@ sal_uInt16 HTMLTable::GetBorderWidth( const SvxBorderLine& rBLine, inline HTMLTableCell *HTMLTable::GetCell( sal_uInt16 nRow, sal_uInt16 nCell ) const { - ASSERT( nRow<pRows->Count(), + OSL_ENSURE( nRow<pRows->Count(), "ungueltiger Zeilen-Index in HTML-Tabelle" ); return ((*pRows)[nRow])->GetCell( nCell ); } @@ -2147,7 +2149,7 @@ sal_Int16 HTMLTable::GetInheritedVertOri() const if( text::VertOrientation::TOP==eVOri ) eVOri = eVertOri; - ASSERT( eVertOri != text::VertOrientation::TOP, "text::VertOrientation::TOP ist nicht erlaubt!" ); + OSL_ENSURE( eVertOri != text::VertOrientation::TOP, "text::VertOrientation::TOP ist nicht erlaubt!" ); return eVOri; } @@ -2177,7 +2179,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts, for( i=0; i<nRows; i++ ) ((*pRows)[i])->Expand( nColsReq, i<nCurRow ); nCols = nColsReq; - ASSERT( pColumns->Count()==nCols, + OSL_ENSURE( pColumns->Count()==nCols, "Anzahl der Spalten nach Expandieren stimmt nicht" ); } if( nColsReq > nFilledCols ) @@ -2190,7 +2192,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts, for( i=nRows; i<nRowsReq; i++ ) pRows->Insert( new HTMLTableRow(nCols), pRows->Count() ); nRows = nRowsReq; - ASSERT( nRows==pRows->Count(), "Zeilenzahl in Insert stimmt nicht" ); + OSL_ENSURE( nRows==pRows->Count(), "Zeilenzahl in Insert stimmt nicht" ); } // Testen, ob eine Ueberschneidung vorliegt und diese @@ -2273,7 +2275,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts, inline void HTMLTable::CloseSection( sal_Bool bHead ) { // die vorhergende Section beenden, falls es schon eine Zeile gibt - ASSERT( nCurRow<=nRows, "ungeultige aktuelle Zeile" ); + OSL_ENSURE( nCurRow<=nRows, "ungeultige aktuelle Zeile" ); if( nCurRow>0 && nCurRow<=nRows ) ((*pRows)[nCurRow-1])->SetEndOfGroup(); if( bHead ) @@ -2291,7 +2293,7 @@ void HTMLTable::OpenRow( SvxAdjust eAdjust, sal_Int16 eVertOrient, for( sal_uInt16 i=nRows; i<nRowsReq; i++ ) pRows->Insert( new HTMLTableRow(nCols), pRows->Count() ); nRows = nRowsReq; - ASSERT( nRows==pRows->Count(), + OSL_ENSURE( nRows==pRows->Count(), "Zeilenzahl in OpenRow stimmt nicht" ); } @@ -2311,7 +2313,7 @@ void HTMLTable::OpenRow( SvxAdjust eAdjust, sal_Int16 eVertOrient, void HTMLTable::CloseRow( sal_Bool bEmpty ) { - ASSERT( nCurRow<nRows, "aktulle Zeile hinter dem Tabellenende" ); + OSL_ENSURE( nCurRow<nRows, "aktulle Zeile hinter dem Tabellenende" ); // leere Zellen bekommen einfach einen etwas dickeren unteren Rand! if( bEmpty ) @@ -2352,7 +2354,7 @@ inline void HTMLTable::CloseColGroup( sal_uInt16 nSpan, sal_uInt16 _nWidth, if( nSpan ) InsertCol( nSpan, _nWidth, bRelWidth, eAdjust, eVertOrient ); - ASSERT( nCurCol<=nCols, "ungueltige Spalte" ); + OSL_ENSURE( nCurCol<=nCols, "ungueltige Spalte" ); if( nCurCol>0 && nCurCol<=nCols ) ((*pColumns)[nCurCol-1])->SetEndOfGroup(); } @@ -2501,10 +2503,10 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail, sal_uInt16 nAbsLeftSpace, sal_uInt16 nAbsRightSpace, sal_uInt16 nInhAbsSpace ) { - ASSERT( nRows>0 && nCols>0 && nCurRow==nRows, + OSL_ENSURE( nRows>0 && nCols>0 && nCurRow==nRows, "Wurde CloseTable nicht aufgerufen?" ); - ASSERT( (pLayoutInfo==0) == (this==pTopTable), + OSL_ENSURE( (pLayoutInfo==0) == (this==pTopTable), "Top-Tabelle hat keine Layout-Info oder umgekehrt" ); if( this==pTopTable ) @@ -2600,7 +2602,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, pFrmFmt->SetFmtAttr( SwFmtHoriOrient(0,eHoriOri) ); if( text::HoriOrientation::LEFT_AND_WIDTH==eHoriOri ) { - ASSERT( nLeftMargin || nRightMargin, + OSL_ENSURE( nLeftMargin || nRightMargin, "Da gibt's wohl noch Reste von relativen Breiten" ); // The right margin will be ignored anyway. @@ -2643,7 +2645,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, ( pLayoutInfo->GetRelLeftFill() > 0 || pLayoutInfo->GetRelRightFill() > 0 ) ) { - ASSERT( pBox, "kein TableBox fuer Tabelle in Tabelle" ); + OSL_ENSURE( pBox, "kein TableBox fuer Tabelle in Tabelle" ); SwTableLines& rLines = pBox->GetTabLines(); @@ -2747,7 +2749,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, // rechts umflossen werden soll, dann stacken wir sie // in einem Rahmen mit 100%-Breite, damit ihre Groesse // angepasst wird. Der Rahmen darf nicht angepasst werden. - ASSERT( HasToFly(), "Warum ist die Tabelle in einem Rahmen?" ); + OSL_ENSURE( HasToFly(), "Warum ist die Tabelle in einem Rahmen?" ); sal_uInt32 nMin = pLayoutInfo->GetMin(); if( nMin > USHRT_MAX ) nMin = USHRT_MAX; @@ -2884,7 +2886,7 @@ void _HTMLTableContext::RestorePREListingXMP( SwHTMLParser& rParser ) const SwStartNode *SwHTMLParser::InsertTableSection ( const SwStartNode *pPrevStNd ) { - ASSERT( pPrevStNd, "Start-Node ist NULL" ); + OSL_ENSURE( pPrevStNd, "Start-Node ist NULL" ); pCSS1Parser->SetTDTagStyles(); SwTxtFmtColl *pColl = pCSS1Parser->GetTxtCollFromPool( RES_POOLCOLL_TABLE ); @@ -3146,7 +3148,7 @@ void _SectionSaveStruct::Restore( SwHTMLParser& rParser ) rParser.nFontStHeadStart = nFontStHeadStartSave; // Der Kontext-Stack muss schon aufgeraeumt sein! - ASSERT( rParser.aContexts.Count() == rParser.nContextStMin && + OSL_ENSURE( rParser.aContexts.Count() == rParser.nContextStMin && rParser.aContexts.Count() == rParser.nContextStAttrMin, "Der Kontext-Stack wurde nicht aufgeraeumt" ); rParser.nContextStMin = nContextStMinSave; @@ -3381,7 +3383,7 @@ void _CellSaveStruct::AddContents( HTMLTableCnts *pNewCnts ) void _CellSaveStruct::InsertCell( SwHTMLParser& rParser, HTMLTable *pCurTable ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // Die Attribute muessen schon beim Auefrauemen des Kontext-Stacks // entfernt worden sein, sonst ist etwas schiefgelaufen. Das // Checken wir mal eben ... @@ -3404,7 +3406,7 @@ void _CellSaveStruct::InsertCell( SwHTMLParser& rParser, for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; ++pTbl ) { - ASSERT( !*pTbl, "Die Attribut-Tabelle ist nicht leer" ); + OSL_ENSURE( !*pTbl, "Die Attribut-Tabelle ist nicht leer" ); } } #endif @@ -3510,7 +3512,7 @@ HTMLTableCnts *SwHTMLParser::InsertTableContents( _HTMLAttr *pAttr = *pTbl; while( pAttr ) { - ASSERT( !pAttr->GetPrev(), "Attribut hat Previous-Liste" ); + OSL_ENSURE( !pAttr->GetPrev(), "Attribut hat Previous-Liste" ); pAttr->nSttPara = rSttPara; pAttr->nEndPara = rSttPara; pAttr->nSttCntnt = nSttCnt; @@ -3636,7 +3638,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, // Entweder kommt die Tabelle in keinen Rahmen und befindet // sich in keinem Rahmen (wird also durch Zellen simuliert), // oder es gibt bereits Inhalt an der entsprechenden Stelle. - ASSERT( !bForceFrame || pCurTable->HasParentSection(), + OSL_ENSURE( !bForceFrame || pCurTable->HasParentSection(), "Tabelle im Rahmen hat keine Umgebung!" ); sal_Bool bAppend = sal_False; @@ -3819,7 +3821,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, // Inhalt der Box-Section bewegen (der Ausrichtungs-Parameter // ist erstmal nur ein Dummy und wird spaeter noch richtig // gesetzt) - ASSERT( !pPam->GetPoint()->nContent.GetIndex(), + OSL_ENSURE( !pPam->GetPoint()->nContent.GetIndex(), "Der Absatz hinter der Tabelle ist nicht leer!" ); const SwTable* pSwTable = pDoc->InsertTable( SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ), @@ -3846,7 +3848,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, { SwTxtNode* pOldTxtNd = pDoc->GetNodes()[pSavePos->nNode]->GetTxtNode(); - ASSERT( pOldTxtNd, "Wieso stehen wir in keinem Txt-Node?" ); + OSL_ENSURE( pOldTxtNd, "Wieso stehen wir in keinem Txt-Node?" ); SwFrmFmt *pFrmFmt = pSwTable->GetFrmFmt(); const SfxPoolItem* pItem2; @@ -3888,7 +3890,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, nLeftSpace, nRightSpace, pSwTable, bForceFrame ); - ASSERT( !pPostIts, "ubenutzte PostIts" ); + OSL_ENSURE( !pPostIts, "ubenutzte PostIts" ); } else { @@ -3947,7 +3949,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, nToken = FilterToken( nToken ); - ASSERT( pPendStack || !bCallNextToken || pSaveStruct->IsInSection(), + OSL_ENSURE( pPendStack || !bCallNextToken || pSaveStruct->IsInSection(), "Wo ist die Section gebieben?" ); if( !pPendStack && bCallNextToken && pSaveStruct->IsInSection() ) { @@ -4042,7 +4044,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, // nur wenn die Tabelle wirklich zu Ende ist! if( pSubTable ) { - ASSERT( pSubTable->GetTableAdjust(sal_False)!= SVX_ADJUST_LEFT && + OSL_ENSURE( pSubTable->GetTableAdjust(sal_False)!= SVX_ADJUST_LEFT && pSubTable->GetTableAdjust(sal_False)!= SVX_ADJUST_RIGHT, "links oder rechts ausgerichtete Tabellen gehoehren in Rahmen" ); @@ -4051,7 +4053,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, pSubTable->GetParentContents(); if( pParentContents ) { - ASSERT( !pSaveStruct->IsInSection(), + OSL_ENSURE( !pSaveStruct->IsInSection(), "Wo ist die Section geblieben" ); // Wenn jetzt keine Tabelle kommt haben wir eine @@ -4064,7 +4066,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, if( pSubTable->GetContext() ) { - ASSERT( !pSubTable->GetContext()->GetFrmFmt(), + OSL_ENSURE( !pSubTable->GetContext()->GetFrmFmt(), "Tabelle steht im Rahmen" ); if( pCapStNd && pSubTable->IsTopCaption() ) @@ -4148,7 +4150,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, break; } - ASSERT( !bPending || !pPendStack, + OSL_ENSURE( !bPending || !pPendStack, "SwHTMLParser::BuildTableCell: Es gibt wieder einen Pend-Stack" ); bPending = sal_False; if( IsParserWorking() ) @@ -4175,7 +4177,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, if( !pSaveStruct->GetFirstContents() || (!pSaveStruct->IsInSection() && !pCurTable->HasColTags()) ) { - ASSERT( pSaveStruct->GetFirstContents() || + OSL_ENSURE( pSaveStruct->GetFirstContents() || !pSaveStruct->IsInSection(), "Section oder nicht, das ist hier die Frage" ); const SwStartNode *pStNd = @@ -4352,7 +4354,7 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, sal_Bool bReadOptions, nToken = FilterToken( nToken ); - ASSERT( pPendStack || !bCallNextToken || + OSL_ENSURE( pPendStack || !bCallNextToken || pCurTable->GetContext() || pCurTable->HasParentSection(), "Wo ist die Section gebieben?" ); if( !pPendStack && bCallNextToken && @@ -4436,7 +4438,7 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, sal_Bool bReadOptions, break; } - ASSERT( !bPending || !pPendStack, + OSL_ENSURE( !bPending || !pPendStack, "SwHTMLParser::BuildTableRow: Es gibt wieder einen Pend-Stack" ); bPending = sal_False; if( IsParserWorking() ) @@ -4528,7 +4530,7 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable, nToken = FilterToken( nToken ); - ASSERT( pPendStack || !bCallNextToken || + OSL_ENSURE( pPendStack || !bCallNextToken || pCurTable->GetContext() || pCurTable->HasParentSection(), "Wo ist die Section gebieben?" ); if( !pPendStack && bCallNextToken && @@ -4596,7 +4598,7 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable, NextToken( nToken ); } - ASSERT( !bPending || !pPendStack, + OSL_ENSURE( !bPending || !pPendStack, "SwHTMLParser::BuildTableSection: Es gibt wieder einen Pend-Stack" ); bPending = sal_False; if( IsParserWorking() ) @@ -4723,7 +4725,7 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable, nToken = FilterToken( nToken ); - ASSERT( pPendStack || !bCallNextToken || + OSL_ENSURE( pPendStack || !bCallNextToken || pCurTable->GetContext() || pCurTable->HasParentSection(), "Wo ist die Section gebieben?" ); if( !pPendStack && bCallNextToken && @@ -4813,7 +4815,7 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable, NextToken( nToken ); } - ASSERT( !bPending || !pPendStack, + OSL_ENSURE( !bPending || !pPendStack, "SwHTMLParser::BuildTableColGrp: Es gibt wieder einen Pend-Stack" ); bPending = sal_False; if( IsParserWorking() ) @@ -4893,7 +4895,7 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable ) delete pPendStack; pPendStack = pTmp; nToken = pPendStack ? pPendStack->nToken : GetSaveToken(); - ASSERT( !pPendStack, "Wo kommt hier ein Pending-Stack her?" ); + OSL_ENSURE( !pPendStack, "Wo kommt hier ein Pending-Stack her?" ); SaveState( nToken ); } @@ -4997,7 +4999,7 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable ) delete pPendStack; pPendStack = pTmp; - ASSERT( !pTmp, "weiter kann es nicht gehen!" ); + OSL_ENSURE( !pTmp, "weiter kann es nicht gehen!" ); nNxtToken = 0; // neu lesen } @@ -5090,10 +5092,10 @@ void _TblSaveStruct::MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDoc pCurTable->MakeTable( 0, nWidth ); _HTMLTableContext *pTCntxt = pCurTable->GetContext(); - ASSERT( pTCntxt, "Wo ist der Tabellen-Kontext" ); + OSL_ENSURE( pTCntxt, "Wo ist der Tabellen-Kontext" ); SwTableNode *pTblNd = pTCntxt->GetTableNode(); - ASSERT( pTblNd, "Wo ist der Tabellen-Node" ); + OSL_ENSURE( pTblNd, "Wo ist der Tabellen-Node" ); if( pDoc->GetRootFrm() && pTblNd ) { @@ -5110,7 +5112,7 @@ void _TblSaveStruct::MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDoc { pTblNd->DelFrms(); SwNodeIndex aIdx( *pTblNd->EndOfSectionNode(), 1 ); - ASSERT( aIdx.GetIndex() <= pTCntxt->GetPos()->nNode.GetIndex(), + OSL_ENSURE( aIdx.GetIndex() <= pTCntxt->GetPos()->nNode.GetIndex(), "unerwarteter Node fuer das Tabellen-Layout" ); pTblNd->MakeFrms( &aIdx ); } @@ -5318,7 +5320,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, nToken = FilterToken( nToken ); - ASSERT( pPendStack || !bCallNextToken || + OSL_ENSURE( pPendStack || !bCallNextToken || pCurTable->GetContext() || pCurTable->HasParentSection(), "Wo ist die Section gebieben?" ); if( !pPendStack && bCallNextToken && @@ -5388,7 +5390,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, break; } - ASSERT( !bPending || !pPendStack, + OSL_ENSURE( !bPending || !pPendStack, "SwHTMLParser::BuildTable: Es gibt wieder einen Pend-Stack" ); bPending = sal_False; if( IsParserWorking() ) @@ -5444,8 +5446,8 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, sal_Bool bTop = pTable->IsTopCaption(); SwStartNode *pTblStNd = pTCntxt->GetTableNode(); - ASSERT( pTblStNd, "Wo ist der Tabellen-Node" ); - ASSERT( pTblStNd==pPam->GetNode()->FindTableNode(), + OSL_ENSURE( pTblStNd, "Wo ist der Tabellen-Node" ); + OSL_ENSURE( pTblStNd==pPam->GetNode()->FindTableNode(), "Stehen wir in der falschen Tabelle?" ); SwNode* pNd; diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index c599518699..e6f82b6a2c 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -145,7 +145,7 @@ void SwHTMLWrtTable::PixelizeBorders() sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox, sal_Bool bTop, sal_Bool bBottom, sal_Bool bLeft, sal_Bool bRight ) { - ASSERT( bTop || bBottom || bLeft || bRight, + OSL_ENSURE( bTop || bBottom || bLeft || bRight, "HasTabBackground: darf nicht aufgerufen werden" ); sal_Bool bRet = sal_False; @@ -180,7 +180,7 @@ sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox, sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine, sal_Bool bTop, sal_Bool bBottom, sal_Bool bLeft, sal_Bool bRight ) { - ASSERT( bTop || bBottom || bLeft || bRight, + OSL_ENSURE( bTop || bBottom || bLeft || bRight, "HasTabBackground: darf nicht aufgerufen werden" ); sal_Bool bRet = sal_False; @@ -674,7 +674,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, } else { - ASSERT( Application::GetDefaultDevice(), "kein Application-Window!?" ); + OSL_ENSURE( Application::GetDefaultDevice(), "kein Application-Window!?" ); sOut += "100%"; } } @@ -1078,7 +1078,7 @@ Writer& OutHTML_SwTblNode( Writer& rWrt, SwTableNode & rNode, if( bCheckDefList ) { - ASSERT( !rHTMLWrt.GetNumInfo().GetNumRule() || + OSL_ENSURE( !rHTMLWrt.GetNumInfo().GetNumRule() || rHTMLWrt.GetNextNumInfo(), "NumInfo fuer naechsten Absatz fehlt!" ); const SvxLRSpaceItem& aLRItem = pFmt->GetLRSpace(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 6cf9f7f50a..075dfabc34 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/i18n/ScriptType.hpp> #include <sfx2/sfx.hrc> #include <svx/svxids.hrc> -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 #include <stdlib.h> #endif #include <hintids.hxx> @@ -193,7 +193,7 @@ String HTMLReader::GetTemplateName() const if( !bSet ) { sTemplate.Erase(); - ASSERT( !this, + OSL_ENSURE( !this, "Die html.vor befindet sich nicht mehr im definierten Directory!"); } @@ -202,7 +202,7 @@ String HTMLReader::GetTemplateName() const int HTMLReader::SetStrmStgPtr() { - ASSERT( pMedium, "Wo ist das Medium??" ); + OSL_ENSURE( pMedium, "Wo ist das Medium??" ); if( pMedium->IsRemote() || !pMedium->IsStorage() ) { @@ -218,7 +218,7 @@ ULONG HTMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const { if( !pStrm ) { - ASSERT( pStrm, "HTML-Read ohne Stream" ); + OSL_ENSURE( pStrm, "HTML-Read ohne Stream" ); return ERR_SWG_READ_ERROR; } @@ -304,7 +304,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, // <-- nOpenParaToken( 0 ), eJumpTo( JUMPTO_NONE ), -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nContinue( 0 ), #endif eParaAdjust( SVX_ADJUST_END ), @@ -433,8 +433,8 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, __EXPORT SwHTMLParser::~SwHTMLParser() { -#ifdef DBG_UTIL - ASSERT( !nContinue, "DTOR im Continue - Das geht schief!!!" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !nContinue, "DTOR im Continue - Das geht schief!!!" ); #endif BOOL bAsync = pDoc->IsInLoadAsynchron(); pDoc->SetInLoadAsynchron( FALSE ); @@ -465,7 +465,7 @@ __EXPORT SwHTMLParser::~SwHTMLParser() if( aSetAttrTab.Count() ) { - ASSERT( !aSetAttrTab.Count(),"Es stehen noch Attribute auf dem Stack" ); + OSL_ENSURE( !aSetAttrTab.Count(),"Es stehen noch Attribute auf dem Stack" ); aSetAttrTab.DeleteAndDestroy( 0, aSetAttrTab.Count() ); } @@ -475,10 +475,10 @@ __EXPORT SwHTMLParser::~SwHTMLParser() DeleteFormImpl(); DeleteFootEndNoteImpl(); - ASSERT( !pTable, "Es existiert noch eine offene Tabelle" ); + OSL_ENSURE( !pTable, "Es existiert noch eine offene Tabelle" ); delete pImageMaps; - ASSERT( !pPendStack, + OSL_ENSURE( !pPendStack, "SwHTMLParser::~SwHTMLParser: Hier sollte es keinen Pending-Stack mehr geben" ); while( pPendStack ) { @@ -583,15 +583,15 @@ SvParserState __EXPORT SwHTMLParser::CallParser() void __EXPORT SwHTMLParser::Continue( int nToken ) { -#ifdef DBG_UTIL - ASSERT( !nContinue, "Continue im Continue - Das sollte doch nicht sein, oder?" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !nContinue, "Continue im Continue - Das sollte doch nicht sein, oder?" ); nContinue++; #endif // Wenn der Import (vom SFX) abgebrochen wurde, wird ein Fehler // gesetzt aber trotzdem noch weiter gemacht, damit vernuenftig // aufgeraeumt wird. - ASSERT( SVPAR_ERROR!=eState, + OSL_ENSURE( SVPAR_ERROR!=eState, "SwHTMLParser::Continue: bereits ein Fehler gesetzt" ); if( pDoc->GetDocShell() && pDoc->GetDocShell()->IsAbortingImport() ) eState = SVPAR_ERROR; @@ -609,7 +609,7 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) bViewCreated = TRUE; pDoc->SetInLoadAsynchron( TRUE ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nContinue--; #endif @@ -637,11 +637,11 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) // beendet wird. if( SVPAR_ERROR == eState ) { - ASSERT( !pPendStack || pPendStack->nToken, + OSL_ENSURE( !pPendStack || pPendStack->nToken, "SwHTMLParser::Continue: Pending-Stack ohne Token" ); if( pPendStack && pPendStack->nToken ) NextToken( pPendStack->nToken ); - ASSERT( !pPendStack, + OSL_ENSURE( !pPendStack, "SwHTMLParser::Continue: Es gibt wieder einen Pend-Stack" ); } else @@ -683,7 +683,7 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) while( GetNumInfo().GetNumRule() ) EndNumBulList(); - ASSERT( !nContextStMin, "Es gibt geschuetzte Kontexte" ); + OSL_ENSURE( !nContextStMin, "Es gibt geschuetzte Kontexte" ); nContextStMin = 0; while( aContexts.Count() ) { @@ -719,11 +719,11 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) pPam->GetPoint()->nContent.Assign( pTxtNode, nStt ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // !!! sollte nicht moeglich sein, oder ?? -ASSERT( pSttNdIdx->GetIndex()+1 != pPam->GetBound( TRUE ).nNode.GetIndex(), +OSL_ENSURE( pSttNdIdx->GetIndex()+1 != pPam->GetBound( TRUE ).nNode.GetIndex(), "Pam.Bound1 steht noch im Node" ); -ASSERT( pSttNdIdx->GetIndex()+1 != pPam->GetBound( FALSE ).nNode.GetIndex(), +OSL_ENSURE( pSttNdIdx->GetIndex()+1 != pPam->GetBound( FALSE ).nNode.GetIndex(), "Pam.Bound2 steht noch im Node" ); if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( TRUE ).nNode.GetIndex() ) @@ -917,7 +917,7 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() ) // wieder rekonstruieren. CallEndAction( TRUE ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nContinue--; #endif } @@ -939,7 +939,7 @@ void SwHTMLParser::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) void SwHTMLParser::DocumentDetected() { - ASSERT( !bDocInitalized, "DocumentDetected mehrfach aufgerufen" ); + OSL_ENSURE( !bDocInitalized, "DocumentDetected mehrfach aufgerufen" ); bDocInitalized = TRUE; if( IsNewDoc() ) { @@ -966,13 +966,13 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) // wurde der Import vom SFX abgebrochen? Wenn ein Pending-Stack // existiert den noch aufraumen eState = SVPAR_ERROR; - ASSERT( !pPendStack || pPendStack->nToken, + OSL_ENSURE( !pPendStack || pPendStack->nToken, "SwHTMLParser::NextToken: Pending-Stack ohne Token" ); if( 1 == pDoc->getReferenceCount() || !pPendStack ) return ; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( pPendStack ) { switch( nToken ) @@ -989,7 +989,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) case HTML_SELECT_OFF: break; default: - ASSERT( !pPendStack, "Unbekanntes Token fuer Pending-Stack" ); + OSL_ENSURE( !pPendStack, "Unbekanntes Token fuer Pending-Stack" ); break; } } @@ -1099,7 +1099,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) break; default: - ASSERT( !this, "SwHTMLParser::NextToken: ungueltiges Tag" ); + OSL_ENSURE( !this, "SwHTMLParser::NextToken: ungueltiges Tag" ); break; } @@ -1698,7 +1698,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) { if( nOpenParaToken ) EndPara(); - ASSERT( !pTable, "Tabelle in Tabelle darf hier nicht vorkommen" ); + OSL_ENSURE( !pTable, "Tabelle in Tabelle darf hier nicht vorkommen" ); if( !pTable && (IsNewDoc() || !pPam->GetNode()->FindTableNode()) && (pPam->GetPoint()->nNode.GetIndex() > pDoc->GetNodes().GetEndOfExtras().GetIndex() || @@ -2197,7 +2197,7 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum ) { const SwTxtNode *pTxtNd = pAttr->GetSttPara().GetNode().GetTxtNode(); - ASSERT( pTxtNd, "No text node" ); + OSL_ENSURE( pTxtNd, "No text node" ); if( pTxtNd ) { const String& rText = pTxtNd->GetTxt(); @@ -2294,7 +2294,7 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum ) // Now it is time to get rid of all script dependent hints that are // equal to the settings in the style SwTxtNode *pTxtNd = rEndIdx.GetNode().GetTxtNode(); - ASSERT( pTxtNd, "There is the txt node" ); + OSL_ENSURE( pTxtNd, "There is the txt node" ); sal_uInt16 nCntAttr = (pTxtNd && pTxtNd->GetpSwpHints()) ? pTxtNd->GetSwpHints().Count() : 0; if( nCntAttr ) @@ -2361,7 +2361,7 @@ BOOL SwHTMLParser::AppendTxtNode( SwHTMLAppendMode eMode, BOOL bUpdateNum ) { // The hint starts before another one ends. // The hint in this case is not deleted - ASSERT( pHt->GetEnd() && *pHt->GetEnd() <= aEndPos[nIdx], + OSL_ENSURE( pHt->GetEnd() && *pHt->GetEnd() <= aEndPos[nIdx], "hints aren't nested properly!" ); } } @@ -2416,7 +2416,7 @@ void SwHTMLParser::Show() // - die eiegen View-Shell wieder gesetzt // - und Start-Action gerufen - ASSERT( SVPAR_WORKING==eState, "Show nicht im Working-State - Das kann ins Auge gehen" ); + OSL_ENSURE( SVPAR_WORKING==eState, "Show nicht im Working-State - Das kann ins Auge gehen" ); ViewShell *pOldVSh = CallEndAction(); GetpApp()->Reschedule(); @@ -2446,7 +2446,7 @@ void SwHTMLParser::ShowStatline() // - die eiegen View-Shell wieder gesetzt // - ein Start/End-Action gerufen, wenn gescrollt wurde. - ASSERT( SVPAR_WORKING==eState, "ShowStatLine nicht im Working-State - Das kann ins Auge gehen" ); + OSL_ENSURE( SVPAR_WORKING==eState, "ShowStatLine nicht im Working-State - Das kann ins Auge gehen" ); // Laufbalkenanzeige if( !GetMedium() || !GetMedium()->IsRemote() ) @@ -2474,16 +2474,16 @@ void SwHTMLParser::ShowStatline() ViewShell *SwHTMLParser::CallStartAction( ViewShell *pVSh, BOOL bChkPtr ) { - ASSERT( !pActionViewShell, "CallStartAction: ViewShell schon gesetzt" ); + OSL_ENSURE( !pActionViewShell, "CallStartAction: ViewShell schon gesetzt" ); if( !pVSh || bChkPtr ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 ViewShell *pOldVSh = pVSh; #endif pDoc->GetEditShell( &pVSh ); - ASSERT( !pVSh || !pOldVSh || pOldVSh == pVSh, "CallStartAction: Wer hat die ViewShell ausgetauscht?" ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( !pVSh || !pOldVSh || pOldVSh == pVSh, "CallStartAction: Wer hat die ViewShell ausgetauscht?" ); if( pOldVSh && !pVSh ) pVSh = 0; #endif @@ -2507,7 +2507,7 @@ ViewShell *SwHTMLParser::CallEndAction( BOOL bChkAction, BOOL bChkPtr ) { ViewShell *pVSh = 0; pDoc->GetEditShell( &pVSh ); - ASSERT( !pVSh || pActionViewShell == pVSh, + OSL_ENSURE( !pVSh || pActionViewShell == pVSh, "CallEndAction: Wer hat die ViewShell ausgetauscht?" ); #if OSL_DEBUG_LEVEL > 1 if( pActionViewShell && !pVSh ) @@ -2573,7 +2573,7 @@ ViewShell *SwHTMLParser::CheckActionViewShell() { ViewShell *pVSh = 0; pDoc->GetEditShell( &pVSh ); - ASSERT( !pVSh || pActionViewShell == pVSh, + OSL_ENSURE( !pVSh || pActionViewShell == pVSh, "CheckActionViewShell: Wer hat die ViewShell ausgetauscht?" ); #if OSL_DEBUG_LEVEL > 1 if( pActionViewShell && !pVSh ) @@ -2644,7 +2644,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, USHORT ii = aParaAttrs.Count(); while( ii-- ) { - ASSERT( pAttr != aParaAttrs[ii], + OSL_ENSURE( pAttr != aParaAttrs[ii], "SetAttr: Attribut duerfte noch nicht gesetzt werden" ); aParaAttrs.Remove( ii ); } @@ -2685,7 +2685,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, pAttr->nSttCntnt = 0; else { - ASSERT( !this, "SetAttr: GoNext() failed!" ); + OSL_ENSURE( !this, "SetAttr: GoNext() failed!" ); delete pAttr; pAttr = pPrev; continue; // break; @@ -2713,7 +2713,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, pAttr->nEndCntnt = pCNd->Len(); else { - ASSERT( !this, "SetAttr: GoPrevious() failed!" ); + OSL_ENSURE( !this, "SetAttr: GoPrevious() failed!" ); pAttrPam->DeleteMark(); delete pAttr; pAttr = pPrev; @@ -2748,7 +2748,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, if( pAttrPam->GetMark()->nNode.GetIndex() != rEndIdx.GetIndex() ) { - ASSERT( !pAttrPam->GetPoint()->nContent.GetIndex(), + OSL_ENSURE( !pAttrPam->GetPoint()->nContent.GetIndex(), "Content-Position vor Tabelle nicht 0???" ); pAttrPam->Move( fnMoveBackward ); } @@ -2815,7 +2815,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, pCNd->SetAttr( *pAttr->pItem ); break; } - ASSERT( !this, + OSL_ENSURE( !this, "LRSpace ueber mehrere Absaetze gesetzt!" ); // kein break (hier sollen wir trotzdem nie hinkommen; default: @@ -2844,7 +2844,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, SwFrmFmt *pFrmFmt = aMoveFlyFrms[ --n ]; const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor(); - ASSERT( FLY_AT_PARA == rAnchor.GetAnchorId(), + OSL_ENSURE( FLY_AT_PARA == rAnchor.GetAnchorId(), "Nur Auto-Rahmen brauchen eine Spezialbehandlung" ); const SwPosition *pFlyPos = rAnchor.GetCntntAnchor(); ULONG nFlyParaIdx = pFlyPos->nNode.GetIndex(); @@ -2904,8 +2904,8 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, if( bBeforeTable && pAttrPam->GetPoint()->nNode.GetIndex() == rEndIdx.GetIndex() ) { - ASSERT( !bBeforeTable, "Aha, der Fall tritt also doch ein" ); - ASSERT( !pAttrPam->GetPoint()->nContent.GetIndex(), + OSL_ENSURE( !bBeforeTable, "Aha, der Fall tritt also doch ein" ); + OSL_ENSURE( !pAttrPam->GetPoint()->nContent.GetIndex(), "Content-Position vor Tabelle nicht 0???" ); // !!! pAttrPam->Move( fnMoveBackward ); @@ -2942,11 +2942,11 @@ void SwHTMLParser::NewAttr( _HTMLAttr **ppAttr, const SfxPoolItem& rItem ) void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr, BOOL bChkEmpty ) { - ASSERT( !ppDepAttr, "SwHTMLParser::EndAttr: ppDepAttr-Feature ungetestet?" ); + OSL_ENSURE( !ppDepAttr, "SwHTMLParser::EndAttr: ppDepAttr-Feature ungetestet?" ); // Der Listenkopf ist im Attribut gespeichert _HTMLAttr **ppHead = pAttr->ppHead; - ASSERT( ppHead, "keinen Attributs-Listenkopf gefunden!" ); + OSL_ENSURE( ppHead, "keinen Attributs-Listenkopf gefunden!" ); // die aktuelle Psoition als Ende-Position merken const SwNodeIndex* pEndIdx = &pPam->GetPoint()->nNode; @@ -2966,7 +2966,7 @@ void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr, while( pLast && pLast->GetNext() != pAttr ) pLast = pLast->GetNext(); - ASSERT( pLast, "Attribut nicht in eigener Liste gefunden!" ); + OSL_ENSURE( pLast, "Attribut nicht in eigener Liste gefunden!" ); } BOOL bMoveBack = FALSE; @@ -3008,7 +3008,7 @@ void SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr, { const SwTxtNode *pTxtNd = pAttr->GetSttPara().GetNode() .GetTxtNode(); - ASSERT( pTxtNd, "No text node" ); + OSL_ENSURE( pTxtNd, "No text node" ); const String& rText = pTxtNd->GetTxt(); sal_uInt16 nScriptTxt = pBreakIt->GetBreakIter()->getScriptType( rText, pAttr->GetSttCnt() ); @@ -3105,7 +3105,7 @@ void SwHTMLParser::DeleteAttr( _HTMLAttr* pAttr ) { // Hier darf es keine vorlauefigen Absatz-Attribute geben, den die // koennten jetzt gesetzt werden und dann sind die Zeiger ungueltig!!! - ASSERT( !aParaAttrs.Count(), + OSL_ENSURE( !aParaAttrs.Count(), "Hoechste Gefahr: Es gibt noch nicht-endgueltige Absatz-Attribute" ); if( aParaAttrs.Count() ) aParaAttrs.Remove( 0, aParaAttrs.Count() ); @@ -3113,7 +3113,7 @@ void SwHTMLParser::DeleteAttr( _HTMLAttr* pAttr ) // Der Listenkopf ist im Attribut gespeichert _HTMLAttr **ppHead = pAttr->ppHead; - ASSERT( ppHead, "keinen Attributs-Listenkopf gefunden!" ); + OSL_ENSURE( ppHead, "keinen Attributs-Listenkopf gefunden!" ); // Wird das zueltzt gestartete oder ein frueher gestartetes Attribut // entfernt? @@ -3129,7 +3129,7 @@ void SwHTMLParser::DeleteAttr( _HTMLAttr* pAttr ) while( pLast && pLast->GetNext() != pAttr ) pLast = pLast->GetNext(); - ASSERT( pLast, "Attribut nicht in eigener Liste gefunden!" ); + OSL_ENSURE( pLast, "Attribut nicht in eigener Liste gefunden!" ); } // nun das Attrubut entfernen @@ -3161,7 +3161,7 @@ void SwHTMLParser::SaveAttrTab( _HTMLAttrTable& rNewAttrTab ) { // Hier darf es keine vorlauefigen Absatz-Attribute geben, den die // koennten jetzt gesetzt werden und dann sind die Zeiger ungueltig!!! - ASSERT( !aParaAttrs.Count(), + OSL_ENSURE( !aParaAttrs.Count(), "Hoechste Gefahr: Es gibt noch nicht-endgueltige Absatz-Attribute" ); if( aParaAttrs.Count() ) aParaAttrs.Remove( 0, aParaAttrs.Count() ); @@ -3190,7 +3190,7 @@ void SwHTMLParser::SplitAttrTab( _HTMLAttrTable& rNewAttrTab, { // Hier darf es keine vorlauefigen Absatz-Attribute geben, den die // koennten jetzt gesetzt werden und dann sind die Zeiger ungueltig!!! - ASSERT( !aParaAttrs.Count(), + OSL_ENSURE( !aParaAttrs.Count(), "Hoechste Gefahr: Es gibt noch nicht-endgueltige Absatz-Attribute" ); if( aParaAttrs.Count() ) aParaAttrs.Remove( 0, aParaAttrs.Count() ); @@ -3294,7 +3294,7 @@ void SwHTMLParser::RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab, { // Hier darf es keine vorlauefigen Absatz-Attribute geben, den die // koennten jetzt gesetzt werden und dann sind die Zeiger ungueltig!!! - ASSERT( !aParaAttrs.Count(), + OSL_ENSURE( !aParaAttrs.Count(), "Hoechste Gefahr: Es gibt noch nicht-endgueltige Absatz-Attribute" ); if( aParaAttrs.Count() ) aParaAttrs.Remove( 0, aParaAttrs.Count() ); @@ -3305,7 +3305,7 @@ void SwHTMLParser::RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab, for( USHORT nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* ); nCnt--; (++pTbl, ++pSaveTbl) ) { - ASSERT( !*pTbl, "Die Attribut-Tabelle ist nicht leer!" ); + OSL_ENSURE( !*pTbl, "Die Attribut-Tabelle ist nicht leer!" ); const SwPosition *pPos = pPam->GetPoint(); const SwNodeIndex& rSttPara = pPos->nNode; @@ -3316,7 +3316,7 @@ void SwHTMLParser::RestoreAttrTab( const _HTMLAttrTable& rNewAttrTab, _HTMLAttr *pAttr = *pTbl; while( pAttr ) { - ASSERT( !pAttr->GetPrev() || !pAttr->GetPrev()->ppHead, + OSL_ENSURE( !pAttr->GetPrev() || !pAttr->GetPrev()->ppHead, "Previous-Attribut hat noch einen Header" ); pAttr->SetHead( pTbl ); if( bSetNewStart ) @@ -3463,12 +3463,12 @@ void SwHTMLParser::NewStdAttr( int nToken, InsertAttr( ppAttr ,rItem, pCntxt ); if( pItem2 ) { - ASSERT( ppAttr2, "missing table entry for item2" ); + OSL_ENSURE( ppAttr2, "missing table entry for item2" ); InsertAttr( ppAttr2, *pItem2, pCntxt ); } if( pItem3 ) { - ASSERT( ppAttr3, "missing table entry for item3" ); + OSL_ENSURE( ppAttr3, "missing table entry for item3" ); InsertAttr( ppAttr3, *pItem3, pCntxt ); } } @@ -3679,7 +3679,7 @@ void SwHTMLParser::NewFontAttr( int nToken ) nFontHeight = aFontHeights[nSize-1]; } - ASSERT( !nSize == !nFontHeight, "HTML-Font-Size != Font-Height" ); + OSL_ENSURE( !nSize == !nFontHeight, "HTML-Font-Size != Font-Height" ); String aFontName, aStyleName; FontFamily eFamily = FAMILY_DONTKNOW; // Family und Pitch, @@ -3857,7 +3857,7 @@ void SwHTMLParser::NewPara() if( ParseStyleOptions( aStyle, aId, aEmptyStr, aItemSet, aPropInfo, &aLang, &aDir ) ) { - ASSERT( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), + OSL_ENSURE( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), "Class wird nicht beruecksichtigt" ); DoPositioning( aItemSet, aPropInfo, pCntxt ); InsertAttrs( aItemSet, aPropInfo, pCntxt ); @@ -3876,7 +3876,7 @@ void SwHTMLParser::NewPara() // Laufbalkenanzeige ShowStatline(); - ASSERT( !nOpenParaToken, "Jetzt geht ein offenes Absatz-Element verloren" ); + OSL_ENSURE( !nOpenParaToken, "Jetzt geht ein offenes Absatz-Element verloren" ); nOpenParaToken = HTML_PARABREAK_ON; } @@ -3884,10 +3884,10 @@ void SwHTMLParser::EndPara( BOOL bReal ) { if( HTML_LI_ON==nOpenParaToken && pTable ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const SwNumRule *pNumRule = pPam->GetNode()->GetTxtNode()->GetNumRule(); + OSL_ENSURE( pNumRule, "Wo ist die Numrule geblieben" ); #endif - ASSERT( pNumRule, "Wo ist die Numrule geblieben" ); } // leere Absaetze werden von Netscape uebersprungen, von uns jetzt auch @@ -3992,7 +3992,7 @@ void SwHTMLParser::NewHeading( int nToken ) if( ParseStyleOptions( aStyle, aId, aEmptyStr, aItemSet, aPropInfo, &aLang, &aDir ) ) { - ASSERT( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), + OSL_ENSURE( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), "Class wird nicht beruecksichtigt" ); DoPositioning( aItemSet, aPropInfo, pCntxt ); InsertAttrs( aItemSet, aPropInfo, pCntxt ); @@ -4108,7 +4108,7 @@ void SwHTMLParser::NewTxtFmtColl( int nToken, USHORT nColl ) eMode = AM_SOFTNOSPACE; break; default: - ASSERT( !this, "unbekannte Vorlage" ); + OSL_ENSURE( !this, "unbekannte Vorlage" ); break; } if( pPam->GetPoint()->nContent.GetIndex() ) @@ -4127,7 +4127,7 @@ void SwHTMLParser::NewTxtFmtColl( int nToken, USHORT nColl ) if( ParseStyleOptions( aStyle, aId, aEmptyStr, aItemSet, aPropInfo, &aLang, &aDir ) ) { - ASSERT( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), + OSL_ENSURE( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), "Class wird nicht beruecksichtigt" ); DoPositioning( aItemSet, aPropInfo, pCntxt ); InsertAttrs( aItemSet, aPropInfo, pCntxt ); @@ -4161,7 +4161,7 @@ void SwHTMLParser::EndTxtFmtColl( int nToken ) eMode = AM_SOFTNOSPACE; break; default: - ASSERT( !this, "unbekannte Vorlage" ); + OSL_ENSURE( !this, "unbekannte Vorlage" ); break; } if( pPam->GetPoint()->nContent.GetIndex() ) @@ -4343,7 +4343,7 @@ void SwHTMLParser::NewDefListItem( int nToken ) if( !bInDefList ) { nDefListDeep++; - ASSERT( !nOpenParaToken, + OSL_ENSURE( !nOpenParaToken, "Jetzt geht ein offenes Absatz-Element verloren" ); nOpenParaToken = static_cast< sal_uInt16 >(nToken); } @@ -4742,7 +4742,7 @@ void SwHTMLParser::NewCharFmt( int nToken ) // die Vorlage setzen und im Kontext merken SwCharFmt* pCFmt = pCSS1Parser->GetChrFmt( static_cast< sal_uInt16 >(nToken), aClass ); - ASSERT( pCFmt, "keine Zeichenvorlage zu Token gefunden" ); + OSL_ENSURE( pCFmt, "keine Zeichenvorlage zu Token gefunden" ); // Styles parsen (zu Class siehe auch NewPara) @@ -4753,7 +4753,7 @@ void SwHTMLParser::NewCharFmt( int nToken ) if( ParseStyleOptions( aStyle, aId, aEmptyStr, aItemSet, aPropInfo, &aLang, &aDir ) ) { - ASSERT( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), + OSL_ENSURE( !aClass.Len() || !pCSS1Parser->GetClass( aClass ), "Class wird nicht beruecksichtigt" ); DoPositioning( aItemSet, aPropInfo, pCntxt ); InsertAttrs( aItemSet, aPropInfo, pCntxt, TRUE ); @@ -5329,7 +5329,7 @@ void SwHTMLParser::InsertHorzRule() // den aktuellen Kontext vom Stack holen _HTMLAttrContext *pPoppedContext = PopContext( HTML_HORZRULE ); - ASSERT( pPoppedContext==pCntxt, "wo kommt denn da ein HR-Kontext her?" ); + OSL_ENSURE( pPoppedContext==pCntxt, "wo kommt denn da ein HR-Kontext her?" ); delete pPoppedContext; pPam->Move( fnMoveForward ); @@ -5480,11 +5480,11 @@ void _HTMLAttr::Reset( const SwNodeIndex& rSttPara, USHORT nSttCnt, void _HTMLAttr::InsertPrev( _HTMLAttr *pPrv ) { - ASSERT( !pPrv->pNext || pPrv->pNext == this, + OSL_ENSURE( !pPrv->pNext || pPrv->pNext == this, "_HTMLAttr::InsertPrev: pNext falsch" ); pPrv->pNext = 0; - ASSERT( 0 == pPrv->ppHead || ppHead == pPrv->ppHead, + OSL_ENSURE( 0 == pPrv->ppHead || ppHead == pPrv->ppHead, "_HTMLAttr::InsertPrev: ppHead falsch" ); pPrv->ppHead = 0; diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 9d71aa83ef..24595edd27 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -451,7 +451,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient enum JumpToMarks { JUMPTO_NONE, JUMPTO_MARK, JUMPTO_TABLE, JUMPTO_FRAME, JUMPTO_REGION, JUMPTO_GRAPHIC } eJumpTo; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_uInt16 nContinue; // Tiefe der Continue-Aufrufe #endif diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index ae54c6f8eb..05523d6ea8 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -204,7 +204,7 @@ ULONG SwHTMLWriter::WriteStream() sal_Bool bOldHTMLMode = sal_False; sal_uInt16 nOldTxtFmtCollCnt = 0, nOldCharFmtCnt = 0; - ASSERT( !pTemplate, "Wo kommt denn die HTML-Vorlage hier her?" ); + OSL_ENSURE( !pTemplate, "Wo kommt denn die HTML-Vorlage hier her?" ); pTemplate = ((HTMLReader*)ReadHTML)->GetTemplateDoc(); if( pTemplate ) { @@ -296,7 +296,7 @@ ULONG SwHTMLWriter::WriteStream() } else { - ASSERT( FILE_LINK_SECTION != pSNd->GetSection().GetType(), + OSL_ENSURE( FILE_LINK_SECTION != pSNd->GetSection().GetType(), "Export gelinkter Bereiche am Dok-Anfang ist nicht implemntiert" ); // nur das Tag fuer die Section merken @@ -379,7 +379,7 @@ ULONG SwHTMLWriter::WriteStream() // loesche die Tabelle mit den freifliegenden Rahmen sal_uInt16 i; - ASSERT( !pHTMLPosFlyFrms, "Wurden nicht alle Rahmen ausgegeben" ); + OSL_ENSURE( !pHTMLPosFlyFrms, "Wurden nicht alle Rahmen ausgegeben" ); if( pHTMLPosFlyFrms ) { pHTMLPosFlyFrms->DeleteAndDestroy( 0, pHTMLPosFlyFrms->Count() ); @@ -425,7 +425,7 @@ ULONG SwHTMLWriter::WriteStream() delete pxFormComps; pxFormComps = 0; - ASSERT( !pFootEndNotes, + OSL_ENSURE( !pFootEndNotes, "SwHTMLWriter::Write: Ftns nicht durch OutFootEndNotes geloescht" ); pCurrPageDesc = 0; @@ -447,13 +447,13 @@ ULONG SwHTMLWriter::WriteStream() sal_uInt16 nTxtFmtCollCnt = pTemplate->GetTxtFmtColls()->Count(); while( nTxtFmtCollCnt > nOldTxtFmtCollCnt ) pTemplate->DelTxtFmtColl( --nTxtFmtCollCnt ); - ASSERT( pTemplate->GetTxtFmtColls()->Count() == nOldTxtFmtCollCnt, + OSL_ENSURE( pTemplate->GetTxtFmtColls()->Count() == nOldTxtFmtCollCnt, "falsche Anzahl TxtFmtColls geloescht" ); sal_uInt16 nCharFmtCnt = pTemplate->GetCharFmts()->Count(); while( nCharFmtCnt > nOldCharFmtCnt ) pTemplate->DelCharFmt( --nCharFmtCnt ); - ASSERT( pTemplate->GetCharFmts()->Count() == nOldCharFmtCnt, + OSL_ENSURE( pTemplate->GetCharFmts()->Count() == nOldCharFmtCnt, "falsche Anzahl CharFmts geloescht" ); // HTML-Modus wieder restaurieren @@ -520,7 +520,7 @@ void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, const SwFmtCol *pCol, sal_Bool bContinued=sal_False ) { - ASSERT( pCol || !bContinued, "Continuation of DIV" ); + OSL_ENSURE( pCol || !bContinued, "Continuation of DIV" ); if( rHTMLWrt.bLFPossible ) rHTMLWrt.OutNewLine(); @@ -647,7 +647,7 @@ static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd ) const SwSection& rSection = rSectNd.GetSection(); const SwSectionFmt *pFmt = rSection.GetFmt(); - ASSERT( pFmt, "Section without a format?" ); + OSL_ENSURE( pFmt, "Section without a format?" ); sal_Bool bStartTag = sal_True; sal_Bool bEndTag = sal_True; @@ -746,7 +746,7 @@ void SwHTMLWriter::Out_SwDoc( SwPaM* pPam ) { SwNode * pNd = pCurPam->GetNode(); - ASSERT( !(pNd->IsGrfNode() || pNd->IsOLENode()), + OSL_ENSURE( !(pNd->IsGrfNode() || pNd->IsOLENode()), "Grf- oder OLE-Node hier unerwartet" ); if( pNd->IsTxtNode() ) { @@ -873,7 +873,7 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs() 0==(pTxtNd=pDoc->GetNodes()[nIdx]->GetTxtNode()) ) nIdx++; - ASSERT( pTxtNd, "Kein Text-Node gefunden" ); + OSL_ENSURE( pTxtNd, "Kein Text-Node gefunden" ); if( !pTxtNd || !pTxtNd->HasHints() ) return 0; diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index 4f73757505..7851d15f55 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -566,8 +566,8 @@ public: // methoden zur verwaltung von styles: void BeginStyle(USHORT nUserCode, RES_POOL_COLLFMT_TYPE aType) { - ASSERT(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds"); - ASSERT(pColls[nUserCode] == NULL, "user codes dublicate"); + OSL_ENSURE(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds"); + OSL_ENSURE(pColls[nUserCode] == NULL, "user codes dublicate"); if (eSubMode == Style) EndStyle(); pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), aType); @@ -576,8 +576,8 @@ public: } void BeginStyle( USHORT nUserCode, const String& rName ) { - ASSERT(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds"); - ASSERT(pColls[nUserCode] == NULL, "user codes dublicate"); + OSL_ENSURE(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds"); + OSL_ENSURE(pColls[nUserCode] == NULL, "user codes dublicate"); if (eSubMode == Style) EndStyle(); pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), rName ); @@ -588,8 +588,8 @@ public: { return pColls[nUserCode] != 0; } void BaseStyle(USHORT nBased) { - ASSERT(eSubMode == Style, "wrong state for style"); - ASSERT(pColls[nBased], "Style based on noexistent style" ); + OSL_ENSURE(eSubMode == Style, "wrong state for style"); + OSL_ENSURE(pColls[nBased], "Style based on noexistent style" ); if( eSubMode == Style && pColls[nBased]->GetColl() ) ((SwFltFormatCollection*)pOut)->Derived(pColls[nBased]->GetColl()); } @@ -597,7 +597,7 @@ public: void EndStyle() { -// ASSERT(eSubMode == Style, "wrong state for style"); +// OSL_ENSURE(eSubMode == Style, "wrong state for style"); nAktStyle = 0; pOut = pOutDoc; eSubMode = None; diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx index f90f58bb2c..c78a6c486b 100644 --- a/sw/source/filter/inc/wrtswtbl.hxx +++ b/sw/source/filter/inc/wrtswtbl.hxx @@ -260,7 +260,7 @@ protected: BOOL bRelWidths : 1; // Breiten relativ ausgeben? BOOL bUseLayoutHeights : 1; // Layout zur Hoehenbestimmung nehmen? -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL bGetLineHeightCalled : 1; #endif diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx index ebe67fa070..0dd3f0a1b2 100644 --- a/sw/source/filter/rtf/rtffld.cxx +++ b/sw/source/filter/rtf/rtffld.cxx @@ -139,7 +139,7 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext ) String sNm( rName ); sNm = sNm.EraseLeadingChars().GetToken(0, ' '); - ASSERT( sNm.Len(), "Feldname hat keine Laenge!" ); + OSL_ENSURE( sNm.Len(), "Feldname hat keine Laenge!" ); if( !sNm.Len() ) return RTFFLD_UNKNOWN; @@ -180,7 +180,7 @@ static USHORT CheckNumberFmtStr( const String& rNStr ) "\x04""PAGE" /* PAGEDESC */ }; - ASSERT(sizeof(aNumberTypeTab) / sizeof(sal_Char *) + OSL_ENSURE(sizeof(aNumberTypeTab) / sizeof(sal_Char *) >= SVX_NUM_PAGEDESC - SVX_NUM_CHARS_UPPER_LETTER, "impossible"); for (USHORT n = SVX_NUM_CHARS_UPPER_LETTER; n <= SVX_NUM_PAGEDESC; ++n) @@ -1043,7 +1043,7 @@ void SwRTFParser::ReadField() { const SwField *pFld = pFldAttr->GetFld().GetFld(); SwFieldType *pTyp = pFld ? pFld->GetTyp() : 0; - ASSERT(pTyp->Which() == RES_USERFLD, "expected a user field"); + OSL_ENSURE(pTyp->Which() == RES_USERFLD, "expected a user field"); if (pTyp->Which() == RES_USERFLD) { SwUserFieldType *pUsrTyp = (SwUserFieldType*)pTyp; diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx index 470dbcf461..1a2eb5f9aa 100644 --- a/sw/source/filter/rtf/rtffly.cxx +++ b/sw/source/filter/rtf/rtffly.cxx @@ -237,9 +237,9 @@ void SwRTFParser::SetFlysInDoc() { SwFlySave* pFlySave = aFlyArr[ n ]; - ASSERT( !pFlySave->nSttNd.GetNode().FindFlyStartNode(), + OSL_ENSURE( !pFlySave->nSttNd.GetNode().FindFlyStartNode(), "Content vom Fly steht in einem Fly" ); - ASSERT( pFlySave->nSttNd.GetIndex() <= pFlySave->nEndNd.GetIndex(), + OSL_ENSURE( pFlySave->nSttNd.GetIndex() <= pFlySave->nEndNd.GetIndex(), "Fly hat falschen Bereich" ); @@ -396,7 +396,7 @@ void SwRTFParser::SetFlysInDoc() // patch from cmc for #i52542# if (pSttNd->GetIndex() + 1 == pSttNd->EndOfSectionIndex()) { - ASSERT(!this, "nothing in this frame, not legal"); + OSL_ENSURE(!this, "nothing in this frame, not legal"); delete pFlySave; continue; } @@ -1425,7 +1425,7 @@ void SwRTFParser::_SetPictureSize( const SwNoTxtNode& rNd, void SwRTFParser::GetPageSize( Size& rSize ) { - ASSERT(!maSegments.empty(), "not possible"); + OSL_ENSURE(!maSegments.empty(), "not possible"); if (maSegments.empty()) { rSize.Width() = 12240 - 1800 - 1800; diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx index 45d583a52d..9b6921aa32 100644 --- a/sw/source/filter/rtf/rtfnum.cxx +++ b/sw/source/filter/rtf/rtfnum.cxx @@ -685,10 +685,10 @@ void SwRTFParser::RemoveUnusedNumRule( SwNumRule* pRule ) } pDoc->DelNumRule( pRule->GetName() ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else { - ASSERT( pRule, "NumRulePointer 0 kann nicht geloescht werden" ); + OSL_ENSURE( pRule, "NumRulePointer 0 kann nicht geloescht werden" ); } #endif } diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx index 929de88245..d21b52178c 100644 --- a/sw/source/filter/rtf/rtftbl.cxx +++ b/sw/source/filter/rtf/rtftbl.cxx @@ -115,7 +115,7 @@ static void SetRowBorder(SfxItemSet& rSet, const Row &rRow) void rtfSections::PrependedInlineNode(const SwPosition &rPos, const SwNode &rNode) { - ASSERT(!mrReader.IsNewDoc() || !maSegments.empty(), + OSL_ENSURE(!mrReader.IsNewDoc() || !maSegments.empty(), "should not be possible, must be at least one segment in a new document"); if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode)) maSegments.back().maStart = SwNodeIndex(rNode); @@ -719,7 +719,7 @@ void SwRTFParser::ReadTable( int nToken ) aBoxFmts[0]->Add( pBox ); SwTxtNode* pTNd = pDoc->GetNodes()[ pBox->GetSttIdx()+1 ] ->GetTxtNode(); - ASSERT( pTNd, "wo ist der Textnode dieser Box?" ); + OSL_ENSURE( pTNd, "wo ist der Textnode dieser Box?" ); pTNd->ChgFmtColl( pColl ); ++nStt; nRowsToRepeat=0; @@ -762,7 +762,7 @@ void SwRTFParser::ReadTable( int nToken ) } } - ASSERT(!bFailure, "RTF Table failure"); + OSL_ENSURE(!bFailure, "RTF Table failure"); if (bFailure) { SkipToken( -1 ); // zum Letzen gueltigen zurueck @@ -808,7 +808,7 @@ void SwRTFParser::GotoNextBox() { nInsTblRow = USHRT_MAX; - ASSERT( pTableNode, "Kein Tabellennode, dann auch keine Box" ); + OSL_ENSURE( pTableNode, "Kein Tabellennode, dann auch keine Box" ); if (!pTableNode) return; diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index d81702decc..7d7c8b9e89 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -137,7 +137,7 @@ ULONG RtfReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const S { if( !pStrm ) { - ASSERT( FALSE, "RTF-Read ohne Stream" ); + OSL_ENSURE( FALSE, "RTF-Read ohne Stream" ); return ERR_SWG_READ_ERROR; } @@ -380,12 +380,12 @@ void SwRTFParser::Continue( int nToken ) pPam->GetPoint()->nContent.Assign( pTxtNode, nStt ); } -#ifdef DBG_UTIL -// !!! sollte nicht moeglich sein, oder ?? -ASSERT( pSttNdIdx->GetIndex()+1 != pPam->GetBound( TRUE ).nNode.GetIndex(), - "Pam.Bound1 steht noch im Node" ); -ASSERT( pSttNdIdx->GetIndex()+1 != pPam->GetBound( FALSE ).nNode.GetIndex(), - "Pam.Bound2 steht noch im Node" ); +#if OSL_DEBUG_LEVEL > 1 + // !!! sollte nicht moeglich sein, oder ?? + OSL_ENSURE( pSttNdIdx->GetIndex()+1 != pPam->GetBound( TRUE ).nNode.GetIndex(), + "Pam.Bound1 steht noch im Node" ); + OSL_ENSURE( pSttNdIdx->GetIndex()+1 != pPam->GetBound( FALSE ).nNode.GetIndex(), + "Pam.Bound2 steht noch im Node" ); if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( TRUE ).nNode.GetIndex() ) { @@ -796,7 +796,7 @@ void rtfSections::MoveFrom(SwPageDesc &rFrom, SwPageDesc &rDest) void rtfSections::SetHdFt(rtfSection &rSection) { - ASSERT(rSection.mpPage, "makes no sense to call without a main page"); + OSL_ENSURE(rSection.mpPage, "makes no sense to call without a main page"); if (rSection.mpPage && rSection.maPageInfo.mpPageHdFt) { if (rSection.maPageInfo.mbPageHdFtUsed) @@ -839,7 +839,7 @@ SwSectionFmt *rtfSections::InsertSection(SwPaM& rMyPaM, rtfSection &rSection) rSection.mpSection = mrReader.pDoc->InsertSwSection( rMyPaM, aSectionData, 0, &aSet ); - ASSERT(rSection.mpSection, "section not inserted!"); + OSL_ENSURE(rSection.mpSection, "section not inserted!"); if (!rSection.mpSection) return 0; @@ -852,7 +852,7 @@ SwSectionFmt *rtfSections::InsertSection(SwPaM& rMyPaM, rtfSection &rSection) break; } - ASSERT(pPage, "no page outside this section!"); + OSL_ENSURE(pPage, "no page outside this section!"); if (!pPage) pPage = &mrReader.pDoc->_GetPageDesc(0); @@ -868,7 +868,7 @@ SwSectionFmt *rtfSections::InsertSection(SwPaM& rMyPaM, rtfSection &rSection) long nRight = rLR.GetRight(); SwSectionFmt *pFmt = rSection.mpSection->GetFmt(); - ASSERT(pFmt, "impossible"); + OSL_ENSURE(pFmt, "impossible"); if (!pFmt) return 0; SetCols(*pFmt, rSection, (USHORT)(nWidth - nLeft - nRight) ); @@ -926,7 +926,7 @@ void rtfSections::InsertSegments(bool bNewDoc) , 0, false); aIter->mpTitlePage = &mrReader.pDoc->_GetPageDesc(nPos); } - ASSERT(aIter->mpTitlePage, "no page!"); + OSL_ENSURE(aIter->mpTitlePage, "no page!"); if (!aIter->mpTitlePage) continue; @@ -948,7 +948,7 @@ void rtfSections::InsertSegments(bool bNewDoc) aIter->mpTitlePage, false); aIter->mpPage = &mrReader.pDoc->_GetPageDesc(nPos); } - ASSERT(aIter->mpPage, "no page!"); + OSL_ENSURE(aIter->mpPage, "no page!"); if (!aIter->mpPage) continue; @@ -978,7 +978,7 @@ void rtfSections::InsertSegments(bool bNewDoc) SwTable& rTable = aIter->maStart.GetNode().GetTableNode()->GetTable(); SwFrmFmt* pApply = rTable.GetFrmFmt(); - ASSERT(pApply, "impossible"); + OSL_ENSURE(pApply, "impossible"); if (pApply) pApply->SetFmtAttr(aPgDesc); } @@ -1074,7 +1074,7 @@ void InsertedTablesManager::DelAndMakeTblFrms() // exitiert schon ein Layout, dann muss an dieser Tabelle die BoxFrames // neu erzeugt SwTableNode *pTable = aIter->first->GetTableNode(); - ASSERT(pTable, "Why no expected table"); + OSL_ENSURE(pTable, "Why no expected table"); if (pTable) { SwFrmFmt * pFrmFmt = pTable->GetTable().GetFrmFmt(); @@ -1386,7 +1386,7 @@ void SwRTFParser::ReadShapeObject() break; case RTF_SN: nToken = GetNextToken(); - ASSERT(nToken==RTF_TEXTTOKEN, "expected name"); + OSL_ENSURE(nToken==RTF_TEXTTOKEN, "expected name"); sn=aToken; break; case RTF_SV: @@ -2111,7 +2111,7 @@ void SwRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos, xub_StrLen& rCntPos ) SwCntntNode* pNode = pDoc->GetNodes().GoPrevious( &aIdx ); if( !pNode ) { - ASSERT( FALSE, "keinen vorherigen ContentNode gefunden" ); + OSL_ENSURE( FALSE, "keinen vorherigen ContentNode gefunden" ); } rpNodePos = new SwNodeIdx( aIdx ); @@ -2125,12 +2125,12 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) SwPaM aPam( *pPam->GetPoint() ); -#ifdef DBG_UTIL - ASSERT( nSNd <= nENd, "Start groesser als Ende" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( nSNd <= nENd, "Start groesser als Ende" ); SwNode* pDebugNd = pDoc->GetNodes()[ nSNd ]; - ASSERT( pDebugNd->IsCntntNode(), "Start kein ContentNode" ); + OSL_ENSURE( pDebugNd->IsCntntNode(), "Start kein ContentNode" ); pDebugNd = pDoc->GetNodes()[ nENd ]; - ASSERT( pDebugNd->IsCntntNode(), "Ende kein ContentNode" ); + OSL_ENSURE( pDebugNd->IsCntntNode(), "Ende kein ContentNode" ); #endif SwCntntNode* pCNd = pDoc->GetNodes()[ nSNd ]->GetCntntNode(); @@ -2684,7 +2684,7 @@ void SwRTFParser::ReadDocControls( int nToken ) pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ); } - ASSERT(pColl, "impossible to have no standard style"); + OSL_ENSURE(pColl, "impossible to have no standard style"); if (pColl) { @@ -2833,7 +2833,7 @@ void SwRTFParser::ReadSectControls( int nToken ) return; } - ASSERT(!maSegments.empty(), "suspicious to have a section with no " + OSL_ENSURE(!maSegments.empty(), "suspicious to have a section with no " "page info, though probably legal"); if (maSegments.empty()) { @@ -3104,7 +3104,7 @@ void SwRTFParser::ReadSectControls( int nToken ) case RTF_MARGT: case RTF_MARGB: case RTF_FACINGP: - ASSERT(!this, "why are these tokens found in this section?"); + OSL_ENSURE(!this, "why are these tokens found in this section?"); ReadDocControls( nToken ); break; default: @@ -3232,7 +3232,7 @@ void SwRTFParser::ReadPageDescTbl() case '}': if (1 == --nNumOpenBrakets) { - ASSERT(pPgFmt && pPg, "Serious problem here"); + OSL_ENSURE(pPgFmt && pPg, "Serious problem here"); if (pPgFmt && pPg) { // PageDesc ist fertig, setze am Doc @@ -3268,7 +3268,7 @@ void SwRTFParser::ReadPageDescTbl() if (nPos != pDoc->MakePageDesc( String::CreateFromInt32(nTokenValue))) { - ASSERT( FALSE, "PageDesc an falscher Position" ); + OSL_ENSURE( FALSE, "PageDesc an falscher Position" ); } } pPg = &pDoc->_GetPageDesc(nPos); @@ -3431,7 +3431,7 @@ void SwRTFParser::ReadPageDescTbl() case RTF_TEXTTOKEN: if (!DelCharAtEnd(aToken, ';' ).Len()) break; - ASSERT(pPg, "Unexpected missing pPg"); + OSL_ENSURE(pPg, "Unexpected missing pPg"); if (pPg) { pPg->SetName(aToken); @@ -3507,7 +3507,7 @@ void SwRTFParser::ReadPrtData() static const SwNodeIndex* SetHeader(SwFrmFmt* pHdFtFmt, BOOL bReuseOld) { - ASSERT(pHdFtFmt, "Impossible, no header"); + OSL_ENSURE(pHdFtFmt, "Impossible, no header"); const SwFrmFmt* pExisting = bReuseOld ? pHdFtFmt->GetHeader().GetHeaderFmt() : 0; if (!pExisting) @@ -3521,7 +3521,7 @@ static const SwNodeIndex* SetHeader(SwFrmFmt* pHdFtFmt, BOOL bReuseOld) static const SwNodeIndex* SetFooter(SwFrmFmt* pHdFtFmt, BOOL bReuseOld) { - ASSERT(pHdFtFmt, "Impossible, no footer"); + OSL_ENSURE(pHdFtFmt, "Impossible, no footer"); const SwFrmFmt* pExisting = bReuseOld ? pHdFtFmt->GetFooter().GetFooterFmt() : 0; if (!pExisting) @@ -3536,7 +3536,7 @@ static const SwNodeIndex* SetFooter(SwFrmFmt* pHdFtFmt, BOOL bReuseOld) void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc ) { - ASSERT( RTF_FOOTNOTE == nToken || + OSL_ENSURE( RTF_FOOTNOTE == nToken || RTF_FLY_INPARA == nToken || pPageDesc, "PageDesc fehlt" ); @@ -3587,7 +3587,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc ) pTxtAttr = pTxtNd->InsertItem( aFtnNote, nPos, nPos, bDelFirstChar ? nsSetAttrMode::SETATTR_NOTXTATRCHR : 0 ); - ASSERT( pTxtAttr, "konnte die Fussnote nicht einfuegen/finden" ); + OSL_ENSURE( pTxtAttr, "konnte die Fussnote nicht einfuegen/finden" ); if( pTxtAttr ) pSttIdx = ((SwTxtFtn*)pTxtAttr)->GetStartNode(); @@ -3614,7 +3614,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc ) pTxtAttr = pPam->GetNode()->GetTxtNode()->GetTxtAttrForCharAt( nPos, RES_TXTATR_FLYCNT ); - ASSERT( pTxtAttr, "konnte den Fly nicht einfuegen/finden" ); + OSL_ENSURE( pTxtAttr, "konnte den Fly nicht einfuegen/finden" ); pSttIdx = pHdFtFmt->GetCntnt().GetCntntIdx(); bSetFlyInDoc = FALSE; @@ -3853,7 +3853,7 @@ SwTxtFmtColl* SwRTFParser::MakeColl(const String& rName, USHORT nPos, String aNm( rName ); if( !aNm.Len() ) { - ASSERT(!this, "not a bug, but I (cmc) want to see an example of this"); + OSL_ENSURE(!this, "not a bug, but I (cmc) want to see an example of this"); if( !nPos ) { pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ); @@ -3901,7 +3901,7 @@ SwCharFmt* SwRTFParser::MakeCharFmt(const String& rName, USHORT nPos, String aNm( rName ); if( !aNm.Len() ) { - ASSERT(!this, "not a bug, but I (cmc) want to see an example of this"); + OSL_ENSURE(!this, "not a bug, but I (cmc) want to see an example of this"); aNm.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NoName(" )); aNm += String::CreateFromInt32( nPos ); aNm += ')'; diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 857c9de57c..c6c2ad576b 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -93,7 +93,7 @@ Writer_Impl::~Writer_Impl() void Writer_Impl::RemoveFontList( SwDoc& rDoc ) { - ASSERT( pFontRemoveLst, "wo ist die FontListe?" ); + OSL_ENSURE( pFontRemoveLst, "wo ist die FontListe?" ); for( USHORT i = pFontRemoveLst->Count(); i; ) { SvxFontItem* pItem = (SvxFontItem*)(*pFontRemoveLst)[ --i ]; @@ -232,7 +232,7 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx, SwCntntNode* pCNode = aStt.GetNode().GetCntntNode(); if( !pCNode && 0 == ( pCNode = pNds->GoNext( &aStt )) ) { - ASSERT( false, "An StartPos kein ContentNode mehr" ); + OSL_ENSURE( false, "An StartPos kein ContentNode mehr" ); } SwPaM* pNew = new SwPaM( aStt ); @@ -241,7 +241,7 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx, if( 0 == (pCNode = aStt.GetNode().GetCntntNode()) && 0 == (pCNode = pNds->GoPrevious( &aStt )) ) { - ASSERT( false, "An StartPos kein ContentNode mehr" ); + OSL_ENSURE( false, "An StartPos kein ContentNode mehr" ); } pCNode->MakeEndIndex( &pNew->GetPoint()->nContent ); pNew->GetPoint()->nNode = aStt; @@ -253,7 +253,7 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx, // Stream-spezifisches SvStream& Writer::Strm() { - ASSERT( m_pImpl->m_pStream, "Oh-oh. Writer with no Stream!" ); + OSL_ENSURE( m_pImpl->m_pStream, "Oh-oh. Writer with no Stream!" ); return *m_pImpl->m_pStream; } @@ -345,13 +345,13 @@ ULONG Writer::Write( SwPaM& rPam, SfxMedium& rMed, const String* pFileName ) ULONG Writer::Write( SwPaM& /*rPam*/, SvStorage&, const String* ) { - ASSERT( !this, "Schreiben in Storages auf einem Stream?" ); + OSL_ENSURE( !this, "Schreiben in Storages auf einem Stream?" ); return ERR_SWG_WRITE_ERROR; } ULONG Writer::Write( SwPaM&, const uno::Reference < embed::XStorage >&, const String*, SfxMedium* ) { - ASSERT( !this, "Schreiben in Storages auf einem Stream?" ); + OSL_ENSURE( !this, "Schreiben in Storages auf einem Stream?" ); return ERR_SWG_WRITE_ERROR; } @@ -532,7 +532,7 @@ void Writer::CreateBookmarkTbl() USHORT Writer::GetBookmarks(const SwCntntNode& rNd, xub_StrLen nStt, xub_StrLen nEnd, SvPtrarr& rArr) { - ASSERT( !rArr.Count(), "es sind noch Eintraege vorhanden" ); + OSL_ENSURE( !rArr.Count(), "es sind noch Eintraege vorhanden" ); ULONG nNd = rNd.GetIndex(); SvPtrarr* pArr = (m_pImpl->pBkmkNodePos) ? @@ -576,7 +576,7 @@ USHORT Writer::GetBookmarks(const SwCntntNode& rNd, xub_StrLen nStt, ULONG StgWriter::WriteStream() { - ASSERT( !this, "Schreiben in Streams auf einem Storage?" ); + OSL_ENSURE( !this, "Schreiben in Streams auf einem Storage?" ); return ERR_SWG_WRITE_ERROR; } diff --git a/sw/source/filter/writer/wrt_fn.cxx b/sw/source/filter/writer/wrt_fn.cxx index 8a6273cc92..dc2f9c20f5 100644 --- a/sw/source/filter/writer/wrt_fn.cxx +++ b/sw/source/filter/writer/wrt_fn.cxx @@ -42,7 +42,7 @@ Writer& Out( const SwAttrFnTab pTab, const SfxPoolItem& rHt, Writer & rWrt ) { USHORT nId = rHt.Which(); - ASSERT( nId < POOLATTR_END && nId >= POOLATTR_BEGIN, "SwAttrFnTab::Out()" ); + OSL_ENSURE( nId < POOLATTR_END && nId >= POOLATTR_BEGIN, "SwAttrFnTab::Out()" ); FnAttrOut pOut; if( 0 != ( pOut = pTab[ nId - RES_CHRATR_BEGIN] )) (*pOut)( rWrt, rHt ); @@ -70,7 +70,7 @@ Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt, FnAttrOut pOut; if( !bDeep || !pSet->GetParent() ) { - ASSERT( rSet.Count(), "Wurde doch schon behandelt oder?" ); + OSL_ENSURE( rSet.Count(), "Wurde doch schon behandelt oder?" ); SfxItemIter aIter( *pSet ); pItem = aIter.GetCurItem(); do { @@ -119,7 +119,7 @@ Writer& Out( const SwNodeFnTab pTab, SwNode& rNode, Writer & rWrt ) nId = RES_OLENODE; break; default: - ASSERT(false, "was fuer ein Node ist es denn nun?"); + OSL_ENSURE(false, "was fuer ein Node ist es denn nun?"); break; } FnNodeOut pOut; diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index ab189458a2..d3558139ce 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -112,7 +112,7 @@ long SwWriteTable::GetBoxWidth( const SwTableBox *pBox ) long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL bOldGetLineHeightCalled = bGetLineHeightCalled; bGetLineHeightCalled = TRUE; #endif @@ -133,8 +133,8 @@ long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) // <-- bUseLayoutHeights = bLayoutAvailable; /*FALSE;*/ -#ifdef DBG_UTIL - ASSERT( bLayoutAvailable || !bOldGetLineHeightCalled, "Layout ungueltig?" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bLayoutAvailable || !bOldGetLineHeightCalled, "Layout ungueltig?" ); #endif } @@ -362,7 +362,7 @@ USHORT SwWriteTable::GetAbsWidth( USHORT nCol, USHORT nColSpan ) const nWidth -= GetLeftSpace( nCol ) + GetRightSpace( nCol, nColSpan ); - ASSERT( nWidth > 0, "Spaltenbreite <= 0. OK?" ); + OSL_ENSURE( nWidth > 0, "Spaltenbreite <= 0. OK?" ); return nWidth > 0 ? (USHORT)nWidth : 0; } @@ -409,7 +409,7 @@ long SwWriteTable::GetAbsHeight( long nRawHeight, USHORT nRow, nRawHeight -= nBorder; } - ASSERT( nRawHeight > 0, "Zeilenheohe <= 0. OK?" ); + OSL_ENSURE( nRawHeight > 0, "Zeilenheohe <= 0. OK?" ); return nRawHeight > 0 ? nRawHeight : 0; } @@ -429,7 +429,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, BOOL bSubExpanded = FALSE; USHORT nLines = rLines.Count(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT nEndCPos = 0; #endif @@ -450,7 +450,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, layout, you may run into this robust code. It's not allowed that subrows leaves their parentrow. If this would happen the line height of subrow is reduced to a part of the remaining height */ - ASSERT( FALSE, "Corrupt line height I" ); + OSL_ENSURE( FALSE, "Corrupt line height I" ); nRPos -= nLineHeight; nLineHeight = nStartRPos + nParentLineHeight - nRPos; // remaining parent height nLineHeight /= nLines - nLine; // divided through the number of remaining sub rows @@ -465,17 +465,17 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, } else { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 long nCheckPos = nRPos + GetLineHeight( pLine ); #endif nRPos = nStartRPos + nParentLineHeight; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwWriteTableRow aRow( nStartRPos + nParentLineHeight, bUseLayoutHeights ); - ASSERT( aRows.Seek_Entry(&aRow), + OSL_ENSURE( aRows.Seek_Entry(&aRow), "Parent-Zeile nicht gefunden" ); SwWriteTableRow aRowCheckPos(nCheckPos,bUseLayoutHeights); SwWriteTableRow aRowRPos(nRPos,bUseLayoutHeights); - ASSERT( !bUseLayoutHeights || + OSL_ENSURE( !bUseLayoutHeights || aRowCheckPos == aRowRPos, "Hoehe der Zeilen stimmt nicht mit Parent ueberein" ); #endif @@ -505,14 +505,14 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, if( nBox==nBoxes-1 ) { - ASSERT( nLine==0 && nParentLineWidth==0, + OSL_ENSURE( nLine==0 && nParentLineWidth==0, "Jetzt wird die Parent-Breite plattgemacht!" ); nParentLineWidth = nCPos-nStartCPos; } } else { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 USHORT nCheckPos = nCPos + (USHORT)GetBoxWidth( pBox ); if( !nEndCPos ) { @@ -520,17 +520,17 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, } else { - ASSERT( SwWriteTableCol(nCheckPos) == + OSL_ENSURE( SwWriteTableCol(nCheckPos) == SwWriteTableCol(nEndCPos), "Zelle enthaelt unterschiedlich breite Zeilen" ); } #endif nCPos = nStartCPos + nParentLineWidth; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwWriteTableCol aCol( nStartCPos + nParentLineWidth ); - ASSERT( aCols.Seek_Entry(&aCol), + OSL_ENSURE( aCols.Seek_Entry(&aCol), "Parent-Zelle nicht gefunden" ); - ASSERT( SwWriteTableCol(nCheckPos) == + OSL_ENSURE( SwWriteTableCol(nCheckPos) == SwWriteTableCol(nCPos), "Breite der Zellen stimmt nicht mit Parent ueberein" ); #endif @@ -579,7 +579,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, if( nParentLineHeight && nStartRPos + nParentLineHeight <= nRPos ) { /* See comment in CollectTableRowCols */ - ASSERT( FALSE, "Corrupt line height II" ); + OSL_ENSURE( FALSE, "Corrupt line height II" ); nRPos -= nLineHeight; nLineHeight = nStartRPos + nParentLineHeight - nRPos; // remaining parent height nLineHeight /= nLines - nLine; // divided through the number of remaining sub rows @@ -592,13 +592,15 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, // Und ihren Index USHORT nOldRow = nRow; SwWriteTableRow aRow( nRPos,bUseLayoutHeights ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL bFound = #endif aRows.Seek_Entry( &aRow, &nRow ); - ASSERT( bFound, "Wo ist die Zeile geblieben?" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bFound, "Wo ist die Zeile geblieben?" ); +#endif - ASSERT( nOldRow <= nRow, "Don't look back!" ); + OSL_ENSURE( nOldRow <= nRow, "Don't look back!" ); if( nOldRow > nRow ) { nOldRow = nRow; @@ -676,11 +678,13 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, // Und ihren Index USHORT nOldCol = nCol; SwWriteTableCol aCol( nCPos ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BOOL bFound2 = #endif aCols.Seek_Entry( &aCol, &nCol ); - ASSERT( bFound2, "Wo ist die Spalte geblieben?" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bFound2, "Wo ist die Spalte geblieben?" ); +#endif if( !ShouldExpandSub( pBox, bSubExpanded, nDepth ) ) { @@ -711,7 +715,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, if (!(nBorderMask & 4) && nOldCol < aCols.Count()) { SwWriteTableCol *pCol = aCols[nOldCol]; - ASSERT(pCol, "No TableCol found, panic!"); + OSL_ENSURE(pCol, "No TableCol found, panic!"); if (pCol) pCol->bLeftBorder = FALSE; } @@ -719,7 +723,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, if (!(nBorderMask & 8)) { SwWriteTableCol *pCol = aCols[nCol]; - ASSERT(pCol, "No TableCol found, panic!"); + OSL_ENSURE(pCol, "No TableCol found, panic!"); if (pCol) pCol->bRightBorder = FALSE; } @@ -763,7 +767,7 @@ SwWriteTable::SwWriteTable(const SwTableLines& rLines, long nWidth, nInnerBorder(0), nBaseWidth(nBWidth), nHeadEndRow(USHRT_MAX), nLeftSub(nLSub), nRightSub(nRSub), nTabWidth(nWidth), bRelWidths(bRel), bUseLayoutHeights(true), -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bGetLineHeightCalled(false), #endif bColsOption(false), bColTags(true), bLayoutExport(false), @@ -790,7 +794,7 @@ SwWriteTable::SwWriteTable( const SwHTMLTableLayout *pLayoutInfo ) nInnerBorder(0), nBaseWidth(pLayoutInfo->GetWidthOption()), nHeadEndRow(0), nLeftSub(0), nRightSub(0), nTabWidth(pLayoutInfo->GetWidthOption()), bRelWidths(pLayoutInfo->HasPrcWidthOption()), bUseLayoutHeights(false), -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bGetLineHeightCalled(false), #endif bColsOption(pLayoutInfo->HasColsOption()), @@ -861,7 +865,7 @@ SwWriteTable::SwWriteTable( const SwHTMLTableLayout *pLayoutInfo ) USHORT nRowSpan = pLayoutCell->GetRowSpan(); USHORT nColSpan = pLayoutCell->GetColSpan(); const SwTableBox *pBox = pLayoutCnts->GetTableBox(); - ASSERT( pBox, + OSL_ENSURE( pBox, "Tabelle in Tabelle kann nicht ueber Layout exportiert werden" ); long nHeight = bHeightExported ? 0 : GetLineHeight( pBox ); diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index d4db641976..e659a7e4e1 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -86,7 +86,7 @@ static SwCntntNode* GetCntntNode(SwDoc* pDoc, SwNodeIndex& rIdx, BOOL bNext) { pCNd = bNext ? pDoc->GetNodes().GoPrevious(&rIdx) : pDoc->GetNodes().GoNext(&rIdx); - ASSERT(pCNd, "kein ContentNode gefunden"); + OSL_ENSURE(pCNd, "kein ContentNode gefunden"); } return pCNd; } @@ -161,7 +161,7 @@ BOOL SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, BOOL bCheck ) } rRegion.GetPoint()->nContent.Assign(pCNd, nPtCntnt); #if OSL_DEBUG_LEVEL > 1 - ASSERT( CheckNodesRange( rRegion.Start()->nNode, + OSL_ENSURE( CheckNodesRange( rRegion.Start()->nNode, rRegion.End()->nNode, TRUE ), "Attribut oder AEhnliches ueber Bereichs-Grenzen" ); #endif @@ -180,7 +180,7 @@ SwFltControlStack::SwFltControlStack(SwDoc* pDo, ULONG nFieldFl) SwFltControlStack::~SwFltControlStack() { - ASSERT(!Count(), "noch Attribute auf dem Stack"); + OSL_ENSURE(!Count(), "noch Attribute auf dem Stack"); } // MoveAttrs() ist fuer folgendes Problem: @@ -203,14 +203,14 @@ void SwFltControlStack::MoveAttrs( const SwPosition& rPos ) if(( pEntry->nMkNode.GetIndex() + 1 == nPosNd ) &&( pEntry->nMkCntnt >= nPosCt )){ pEntry->nMkCntnt++; - ASSERT( pEntry->nMkCntnt + OSL_ENSURE( pEntry->nMkCntnt <= pDoc->GetNodes()[nPosNd]->GetCntntNode()->Len(), "Attribut-Anfang hinter Zeilenende" ); } if(( pEntry->nPtNode.GetIndex() + 1 == nPosNd ) &&( pEntry->nPtCntnt >= nPosCt )){ pEntry->nPtCntnt++; - ASSERT( pEntry->nPtCntnt + OSL_ENSURE( pEntry->nPtCntnt <= pDoc->GetNodes()[nPosNd]->GetCntntNode()->Len(), "Attribut-Ende hinter Zeilenende" ); } @@ -236,7 +236,7 @@ void SwFltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem & rAtt void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt) { - ASSERT(nCnt < maEntries.size(), "Out of range!"); + OSL_ENSURE(nCnt < maEntries.size(), "Out of range!"); if (nCnt < maEntries.size()) { myEIter aElement = maEntries.begin() + nCnt; @@ -301,10 +301,10 @@ void SwFltControlStack::KillUnlockedAttrs(const SwPosition& pPos) void SwFltControlStack::SetAttr(const SwPosition& rPos, USHORT nAttrId, BOOL bTstEnde, long nHand, BOOL consumedByField ) { - ASSERT(!nAttrId || + OSL_ENSURE(!nAttrId || (POOLATTR_BEGIN <= nAttrId && POOLATTR_END > nAttrId) || (RES_FLTRATTR_BEGIN <= nAttrId && RES_FLTRATTR_END > nAttrId), - "Falsche Id fuers Attribut") + "Falsche Id fuers Attribut"); USHORT nCnt = static_cast< USHORT >(Count()); @@ -649,7 +649,7 @@ void SwFltControlStack::Delete(const SwPaM &rPam) USHORT nEndIdx = pEnd->nContent.GetIndex(); //We don't support deleting content that is over one node, or removing a node. - ASSERT(aEndNode == aStartNode, "nodes must be the same, or this method extended"); + OSL_ENSURE(aEndNode == aStartNode, "nodes must be the same, or this method extended"); if (aEndNode != aStartNode) return; @@ -1002,7 +1002,7 @@ SwFltShell::~SwFltShell() SwFltShell& SwFltShell::operator << ( const String& rStr ) { - ASSERT(eSubMode != Style, "char insert while in style-mode"); + OSL_ENSURE(eSubMode != Style, "char insert while in style-mode"); GetDoc().InsertString( *pPaM, rStr ); return *this; } @@ -1039,7 +1039,7 @@ String SwFltShell::QuoteStr( const String& rIn ) SwFltShell& SwFltShell::operator << ( const sal_Unicode c ) { - ASSERT( eSubMode != Style, "char insert while in style-mode"); + OSL_ENSURE( eSubMode != Style, "char insert while in style-mode"); GetDoc().InsertString( *pPaM, c ); return *this; } @@ -1129,7 +1129,7 @@ SwFltShell& SwFltShell::SetStyle( USHORT nStyle ) } else { - ASSERT( FALSE, "Ungueltiger SwFltStyleCode" ); + OSL_ENSURE( FALSE, "Ungueltiger SwFltStyleCode" ); } return *this; } @@ -1152,7 +1152,7 @@ SwFltShell& SwFltShell::EndItem( USHORT nAttrId ) switch( nAttrId ) { case RES_FLTR_BOOKMARK: - ASSERT( FALSE, "Falscher Aufruf fuer Bookmark-Ende" ); + OSL_ENSURE( FALSE, "Falscher Aufruf fuer Bookmark-Ende" ); break; case RES_FLTR_TOX: @@ -1285,64 +1285,64 @@ SwFltOutBase::SwFltOutBase(SwDoc& rDocu) const SfxPoolItem& SwFltOutBase::GetCellAttr(USHORT nWhich) { - ASSERT(FALSE, "GetCellAttr ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "GetCellAttr ausserhalb von normalem Text"); return GetDoc().GetAttrPool().GetDefaultItem(nWhich); } BOOL SwFltOutBase::BeginTable() { - ASSERT(FALSE, "BeginTable ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "BeginTable ausserhalb von normalem Text"); return FALSE; } void SwFltOutBase::NextTableCell() { - ASSERT(FALSE, "NextTableCell ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "NextTableCell ausserhalb von normalem Text"); } void SwFltOutBase::NextTableRow() { - ASSERT(FALSE, "NextTableRow ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "NextTableRow ausserhalb von normalem Text"); } void SwFltOutBase::SetTableWidth(SwTwips /*nW*/) { - ASSERT(FALSE, "SetTableWidth ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "SetTableWidth ausserhalb von normalem Text"); } void SwFltOutBase::SetTableOrient(sal_Int16 /*eOri*/) { - ASSERT(FALSE, "SetTableOrient ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "SetTableOrient ausserhalb von normalem Text"); } void SwFltOutBase::SetCellWidth(SwTwips /*nWidth*/, USHORT /*nCell*/) { - ASSERT(FALSE, "SetCellWidth ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "SetCellWidth ausserhalb von normalem Text"); } void SwFltOutBase::SetCellHeight(SwTwips /*nH*/) { - ASSERT(FALSE, "SetCellHeight ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "SetCellHeight ausserhalb von normalem Text"); } void SwFltOutBase::SetCellBorder(const SvxBoxItem& /*rFmtBox*/, USHORT /*nCell*/) { - ASSERT(FALSE, "SetCellBorder ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "SetCellBorder ausserhalb von normalem Text"); } void SwFltOutBase::SetCellSpace(USHORT /*nSp*/) { - ASSERT(FALSE, "SetCellSpace ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "SetCellSpace ausserhalb von normalem Text"); } void SwFltOutBase::DeleteCell(USHORT /*nCell*/) { - ASSERT(FALSE, "DeleteCell ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "DeleteCell ausserhalb von normalem Text"); } void SwFltOutBase::EndTable() { - ASSERT(FALSE, "EndTable ausserhalb von normalem Text"); + OSL_ENSURE(FALSE, "EndTable ausserhalb von normalem Text"); } /*virtual*/ BOOL SwFltOutDoc::IsInTable() @@ -1356,7 +1356,7 @@ BOOL SwFltOutDoc::BeginTable() return FALSE; if (pTable){ - ASSERT(FALSE, "BeginTable in Table"); + OSL_ENSURE(FALSE, "BeginTable in Table"); return FALSE; } // Alle Attribute schliessen, da sonst Attribute @@ -1365,7 +1365,7 @@ BOOL SwFltOutDoc::BeginTable() rEndStack.SetAttr( *pPaM->GetPoint(), 0, FALSE ); // create table: - ASSERT(pTabSavedPos == NULL, "SwFltOutDoc"); + OSL_ENSURE(pTabSavedPos == NULL, "SwFltOutDoc"); pTabSavedPos = new SwPosition(*pPaM->GetPoint()); pTable = GetDoc().InsertTable( SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ), @@ -1382,7 +1382,7 @@ BOOL SwFltOutDoc::BeginTable() SwTableBox* SwFltOutDoc::GetBox(USHORT ny, USHORT nx /*= USHRT_MAX */) { if(!pTable){ - ASSERT(pTable, "GetBox ohne Tabelle"); + OSL_ENSURE(pTable, "GetBox ohne Tabelle"); return 0; } if( nx == USHRT_MAX ) // aktuelle Zelle @@ -1391,44 +1391,44 @@ SwTableBox* SwFltOutDoc::GetBox(USHORT ny, USHORT nx /*= USHRT_MAX */) // get structs to table cells const SwTableLines* pTableLines = &pTable->GetTabLines(); if(!pTableLines){ - ASSERT(FALSE, "SwFltOutDoc:GetBox:pTableLines"); + OSL_ENSURE(FALSE, "SwFltOutDoc:GetBox:pTableLines"); return 0; } if( ny >= pTableLines->Count() ){ // Notbremse - ASSERT( FALSE, "SwFltOutDoc:GetBox:ny >= Count()"); + OSL_ENSURE( FALSE, "SwFltOutDoc:GetBox:ny >= Count()"); ny = pTableLines->Count() - 1; } SwTableLine* pTableLine = (*pTableLines)[ny]; if(!pTableLine){ - ASSERT(FALSE, "SwFltOutDoc:GetBox:pTableLine"); + OSL_ENSURE(FALSE, "SwFltOutDoc:GetBox:pTableLine"); return 0; } SwTableBoxes* pTableBoxes = &pTableLine->GetTabBoxes(); if(!pTableBoxes){ - ASSERT(FALSE, "SwFltOutDoc:GetBox:pTableBoxes"); + OSL_ENSURE(FALSE, "SwFltOutDoc:GetBox:pTableBoxes"); return 0; } if( nx >= pTableBoxes->Count() ){ // Notbremse - ASSERT(FALSE, "SwFltOutDoc:GetBox:nx >= Count()"); + OSL_ENSURE(FALSE, "SwFltOutDoc:GetBox:nx >= Count()"); nx = pTableBoxes->Count() - 1; } SwTableBox* pTableBox = (*pTableBoxes)[nx]; - ASSERT(pTableBox != 0, "SwFltOutDoc:GetBox:pTableBox"); + OSL_ENSURE(pTableBox != 0, "SwFltOutDoc:GetBox:pTableBox"); return pTableBox; } void SwFltOutDoc::NextTableCell() { if(!pTable){ - ASSERT(pTable, "NextTableCell ohne Tabelle"); + OSL_ENSURE(pTable, "NextTableCell ohne Tabelle"); return; } const SwTableLines* pTableLines = &pTable->GetTabLines(); SwTableLine* pTableLine = (*pTableLines)[usTableY]; SwTableBoxes* pTableBoxes = &pTableLine->GetTabBoxes(); SwTableBox* pTableBox = (*pTableBoxes)[usTableX]; - ASSERT(pTableBox != 0, "SwFltOutDoc:NextTableCell:pTableBox"); + OSL_ENSURE(pTableBox != 0, "SwFltOutDoc:NextTableCell:pTableBox"); if(!pTableBox) return; //#pragma message(__FILE__ "(?) : Sw's const problem") @@ -1443,7 +1443,7 @@ void SwFltOutDoc::NextTableCell() pTableBoxes->Count()); SeekCell(usTableY, usTableX, TRUE); pTableBox = (*pTableBoxes)[usTableX]; - ASSERT(pTableBox != 0, "SwFltOutDoc:pTableBox"); + OSL_ENSURE(pTableBox != 0, "SwFltOutDoc:pTableBox"); if(pTableBox) (*pTableBoxes)[usTableX]->ClaimFrmFmt(); } @@ -1467,10 +1467,10 @@ void SwFltOutDoc::NextTableRow() void SwFltOutDoc::SetTableWidth(SwTwips nSwWidth) { if(!pTable){ - ASSERT(pTable, "SetTableWidth ohne Tabelle"); + OSL_ENSURE(pTable, "SetTableWidth ohne Tabelle"); return; } - ASSERT( nSwWidth > MINLAY, "Tabellenbreite <= MINLAY" ); + OSL_ENSURE( nSwWidth > MINLAY, "Tabellenbreite <= MINLAY" ); if( nSwWidth != nTableWidth ){ if( nTableWidth ) // Nicht beim ersten Setzen SplitTable(); @@ -1482,7 +1482,7 @@ void SwFltOutDoc::SetTableWidth(SwTwips nSwWidth) void SwFltOutDoc::SetTableOrient(sal_Int16 eOri) { if(!pTable){ - ASSERT(pTable, "SetTableOrient ohne Tabelle"); + OSL_ENSURE(pTable, "SetTableOrient ohne Tabelle"); return; } pTable->GetFrmFmt()->SetFmtAttr( SwFmtHoriOrient( 0, eOri )); @@ -1491,10 +1491,10 @@ void SwFltOutDoc::SetTableOrient(sal_Int16 eOri) void SwFltOutDoc::SetCellWidth(SwTwips nWidth, USHORT nCell /* = USHRT_MAX */ ) { if(!pTable){ - ASSERT(pTable, "SetCellWidth ohne Tabelle"); + OSL_ENSURE(pTable, "SetCellWidth ohne Tabelle"); return; } - ASSERT( nWidth > MINLAY, "Tabellenzellenbreite <= MINLAY" ); + OSL_ENSURE( nWidth > MINLAY, "Tabellenzellenbreite <= MINLAY" ); if (nWidth < MINLAY) nWidth = MINLAY; @@ -1509,7 +1509,7 @@ void SwFltOutDoc::SetCellWidth(SwTwips nWidth, USHORT nCell /* = USHRT_MAX */ ) void SwFltOutDoc::SetCellHeight(SwTwips nHeight) { if(!pTable){ - ASSERT(pTable, "SetCellHeight ohne Tabelle"); + OSL_ENSURE(pTable, "SetCellHeight ohne Tabelle"); return; } @@ -1525,7 +1525,7 @@ void SwFltOutDoc::SetCellHeight(SwTwips nHeight) const SfxPoolItem& SwFltOutDoc::GetCellAttr(USHORT nWhich) { if (!pTable){ - ASSERT(pTable, "GetCellAttr ohne Table"); + OSL_ENSURE(pTable, "GetCellAttr ohne Table"); return GetDoc().GetAttrPool().GetDefaultItem(nWhich); } @@ -1547,7 +1547,7 @@ void SwFltOutDoc::SetCellBorder(const SvxBoxItem& rFmtBox, void SwFltOutDoc::SetCellSpace(USHORT nDist) { if(!pTable){ - ASSERT(pTable, "SetCellSpace ohne Tabelle"); + OSL_ENSURE(pTable, "SetCellSpace ohne Tabelle"); return; } SwTableBox* pTableBox = GetBox(usTableY, usTableX); @@ -1582,7 +1582,7 @@ void SwFltOutDoc::SplitTable() { if(!pTable) { - ASSERT(pTable, "SplitTable ohne Tabelle"); + OSL_ENSURE(pTable, "SplitTable ohne Tabelle"); return; } SwTableBox* pAktBox = GetBox(usTableY, usTableX); @@ -1595,7 +1595,7 @@ void SwFltOutDoc::SplitTable() void SwFltOutDoc::EndTable() { if (!pTable){ - ASSERT(pTable, "EndTable ohne Table"); + OSL_ENSURE(pTable, "EndTable ohne Table"); return; } // Alle Attribute schliessen, da sonst Attribute @@ -1628,7 +1628,7 @@ BOOL SwFltOutDoc::SeekCell(short nRow, short nCol, BOOL bPam) if ((USHORT)nRow >= pTableLines->Count()) { - ASSERT((USHORT)nRow >= pTableLines->Count(), "SwFltOutDoc"); + OSL_ENSURE((USHORT)nRow >= pTableLines->Count(), "SwFltOutDoc"); return FALSE; } pTableLine = (*pTableLines)[nRow]; @@ -1638,7 +1638,7 @@ BOOL SwFltOutDoc::SeekCell(short nRow, short nCol, BOOL bPam) pTableBox = (*pTableBoxes)[nCol]; if( !pTableBox->GetSttNd() ) { - ASSERT(pTableBox->GetSttNd(), "SwFltOutDoc"); + OSL_ENSURE(pTableBox->GetSttNd(), "SwFltOutDoc"); return FALSE; } if(bPam) @@ -1679,12 +1679,14 @@ SfxItemSet* SwFltOutBase::NewFlyDefaults() BOOL SwFltOutBase::BeginFly( RndStdIds eAnchor /*= FLY_AT_PARA*/, BOOL bAbsolutePos /*= FALSE*/, const SfxItemSet* -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 pMoreAttrs /*= 0*/ #endif ) { - ASSERT(!pMoreAttrs, "SwFltOutBase:BeginFly mit pMoreAttrs" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE(!pMoreAttrs, "SwFltOutBase:BeginFly mit pMoreAttrs" ); +#endif eFlyAnchor = eAnchor; bFlyAbsPos = bAbsolutePos; // Bloedsinn eigentlich return TRUE; @@ -1693,11 +1695,11 @@ BOOL SwFltOutBase::BeginFly( RndStdIds eAnchor /*= FLY_AT_PARA*/, /*virtual*/ void SwFltOutBase::SetFlyAnchor( RndStdIds eAnchor ) { if( !IsInFly() ){ - ASSERT( FALSE, "SetFlyAnchor() ohne Fly" ); + OSL_ENSURE( FALSE, "SetFlyAnchor() ohne Fly" ); return; } if ( eAnchor == FLY_AS_CHAR ){ - ASSERT( FALSE, "SetFlyAnchor( FLY_AS_CHAR ) nicht implementiert" ); + OSL_ENSURE( FALSE, "SetFlyAnchor( FLY_AS_CHAR ) nicht implementiert" ); return; } SwFmtAnchor& rAnchor = (SwFmtAnchor&)GetFlyFrmAttr( RES_ANCHOR ); @@ -1742,7 +1744,7 @@ BOOL SwFltOutDoc::BeginFly( RndStdIds eAnchor, rEndStack.SetAttr( *pPaM->GetPoint(), 0, FALSE ); // create Fly: - ASSERT(pFlySavedPos == NULL, "BeginFly in Fly"); // rekursiv geht noch nicht + OSL_ENSURE(pFlySavedPos == NULL, "BeginFly in Fly"); // rekursiv geht noch nicht pFlySavedPos = new SwPosition(*pPaM->GetPoint()); @@ -1762,7 +1764,7 @@ BOOL SwFltOutDoc::BeginFly( RndStdIds eAnchor, // set pam in Fly const SwFmtCntnt& rCntnt = pF->GetCntnt(); - ASSERT( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." ); pPaM->GetPoint()->nNode = rCntnt.GetCntntIdx()->GetIndex() + 1; SwCntntNode *pNode = pPaM->GetCntntNode(); pPaM->GetPoint()->nContent.Assign( pNode, 0 ); @@ -1775,7 +1777,7 @@ BOOL SwFltOutDoc::BeginFly( RndStdIds eAnchor, if (pFly){ pFly->SetFmtAttr( rAttr ); }else{ - ASSERT(pFly, "SetFlyAttr ohne Doc-Fly"); + OSL_ENSURE(pFly, "SetFlyAttr ohne Doc-Fly"); return; } } @@ -1785,7 +1787,7 @@ BOOL SwFltOutDoc::BeginFly( RndStdIds eAnchor, if (pFly){ return pFly->GetFmtAttr( nWhich ); }else{ - ASSERT(pFly, "GetFlyAttr ohne Fly"); + OSL_ENSURE(pFly, "GetFlyAttr ohne Fly"); return GetDoc().GetAttrPool().GetDefaultItem(nWhich); } } @@ -1793,7 +1795,7 @@ BOOL SwFltOutDoc::BeginFly( RndStdIds eAnchor, void SwFltOutDoc::EndFly() { if( pTable ){ - ASSERT( FALSE, "SwFltOutDoc::EndFly() in Table" ); + OSL_ENSURE( FALSE, "SwFltOutDoc::EndFly() in Table" ); return; } // Alle Attribute schliessen, da sonst Attribute @@ -1848,8 +1850,8 @@ void SwFltFormatCollection::EndFly() // Wird nie aufgerufen BOOL SwFltFormatCollection::BeginStyleFly( SwFltOutDoc* pOutDoc ) { - ASSERT( pOutDoc, "BeginStyleFly ohne pOutDoc" ); - ASSERT( pOutDoc && !pOutDoc->IsInFly(), "BeginStyleFly in Fly" ); + OSL_ENSURE( pOutDoc, "BeginStyleFly ohne pOutDoc" ); + OSL_ENSURE( pOutDoc && !pOutDoc->IsInFly(), "BeginStyleFly in Fly" ); if( pOutDoc && !pOutDoc->IsInFly() ) return pOutDoc->BeginFly( eFlyAnchor, bFlyAbsPos, pFlyAttrs ); else @@ -1865,11 +1867,11 @@ BOOL SwFltShell::BeginFly( RndStdIds eAnchor, { if (pOut->IsInFly()){ - ASSERT(FALSE, "BeginFly in Fly"); + OSL_ENSURE(FALSE, "BeginFly in Fly"); return FALSE; } if (pOutDoc->IsInTable()){ - ASSERT(FALSE, "BeginFly in Table"); + OSL_ENSURE(FALSE, "BeginFly in Table"); return FALSE; } pOut->BeginFly( eAnchor, bAbsolutePos, pColls[nAktStyle]->GetpFlyAttrs() ); @@ -1893,11 +1895,11 @@ void SwFltShell::SetFlyYPos( short nYPos, sal_Int16 eVRel, void SwFltShell::EndFly() { if (!pOut->IsInFly()){ - ASSERT(FALSE, "EndFly ohne Fly"); + OSL_ENSURE(FALSE, "EndFly ohne Fly"); return; } if (pOutDoc->IsInTable()){ // Table verschraenkt mit Fly macht keinen Sinn - ASSERT(FALSE, "EndFly in Table ( verschraenkt )"); + OSL_ENSURE(FALSE, "EndFly in Table ( verschraenkt )"); EndTable(); // -> Table beenden } pOut->EndFly(); @@ -1911,11 +1913,11 @@ void SwFltShell::EndFly() void SwFltShell::BeginFootnote() { if( pOut->IsInFly() ){ // Passiert z.B. bei Fussnote in Fly - ASSERT(FALSE, "Fussnote in Fly nicht erlaubt"); + OSL_ENSURE(FALSE, "Fussnote in Fly nicht erlaubt"); return; } if( pOutDoc->IsInTable() ){ - ASSERT(FALSE, "Fussnote in Table z.Zt. nicht erlaubt"); + OSL_ENSURE(FALSE, "Fussnote in Table z.Zt. nicht erlaubt"); return; } @@ -1927,18 +1929,18 @@ void SwFltShell::BeginFootnote() SwFmtFtn aFtn; GetDoc().InsertPoolItem(*pPaM, aFtn, 0); - ASSERT(pSavedPos == NULL, "SwFltShell"); + OSL_ENSURE(pSavedPos == NULL, "SwFltShell"); pSavedPos = new SwPosition(*pPaM->GetPoint()); pPaM->Move(fnMoveBackward, fnGoCntnt); SwTxtNode* pTxt = pPaM->GetNode()->GetTxtNode(); SwTxtAttr *const pFN = pTxt->GetTxtAttrForCharAt( pPaM->GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN); if( !pFN ){ // Passiert z.B. bei Fussnote in Fly - ASSERT(pFN, "Probleme beim Anlegen des Fussnoten-Textes"); + OSL_ENSURE(pFN, "Probleme beim Anlegen des Fussnoten-Textes"); return; } const SwNodeIndex* pStartIndex = ((SwTxtFtn*)pFN)->GetStartNode(); - ASSERT(pStartIndex, "Probleme beim Anlegen des Fussnoten-Textes"); + OSL_ENSURE(pStartIndex, "Probleme beim Anlegen des Fussnoten-Textes"); pPaM->GetPoint()->nNode = pStartIndex->GetIndex() + 1; pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); eSubMode = Footnote; @@ -1968,7 +1970,7 @@ void SwFltShell::BeginHeader(SwPageDesc* /*pPD*/) const SwNodeIndex* pStartIndex = pHdFtFmt->GetCntnt().GetCntntIdx(); if (!pStartIndex) return; - ASSERT(pSavedPos == NULL, "SwFltShell"); + OSL_ENSURE(pSavedPos == NULL, "SwFltShell"); pSavedPos = new SwPosition(*pPaM->GetPoint()); pPaM->GetPoint()->nNode = pStartIndex->GetIndex() + 1; pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); @@ -1984,7 +1986,7 @@ void SwFltShell::BeginFooter(SwPageDesc* /*pPD*/) const SwNodeIndex* pStartIndex = pHdFtFmt->GetCntnt().GetCntntIdx(); if (!pStartIndex) return; - ASSERT(pSavedPos == NULL, "SwFltShell"); + OSL_ENSURE(pSavedPos == NULL, "SwFltShell"); pSavedPos = new SwPosition(*pPaM->GetPoint()); pPaM->GetPoint()->nNode = pStartIndex->GetIndex() + 1; pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); @@ -2054,8 +2056,8 @@ SwFltFormatCollection::SwFltFormatCollection( void SwFltShell::NextStyle(USHORT nWhich, USHORT nNext) { - ASSERT(pColls[nWhich], "Next style for noexistent style" ); - ASSERT(pColls[nNext], "Next style to noexistent style" ); + OSL_ENSURE(pColls[nWhich], "Next style for noexistent style" ); + OSL_ENSURE(pColls[nNext], "Next style to noexistent style" ); if( pColls[nWhich] && pColls[nNext] ) pColls[nWhich]->GetColl()->SetNextTxtFmtColl( *pColls[nNext]->GetColl() ); diff --git a/sw/source/filter/ww1/w1par.cxx b/sw/source/filter/ww1/w1par.cxx index 2b299f439f..a7605be0b8 100644 --- a/sw/source/filter/ww1/w1par.cxx +++ b/sw/source/filter/ww1/w1par.cxx @@ -73,7 +73,7 @@ static ULONG WW1_Read_FieldIniFlags() ULONG WW1Reader::Read(SwDoc& rDoc, const String& rBaseURL, SwPaM& rPam, const String& /*cName*/) { ULONG nRet = ERR_SWG_READ_ERROR; - ASSERT(pStrm!=NULL, "W1-Read ohne Stream"); + OSL_ENSURE(pStrm!=NULL, "W1-Read ohne Stream"); if (pStrm != NULL) { BOOL bNew = !bInsertMode; // Neues Doc ( kein Einfuegen ) diff --git a/sw/source/filter/ww1/w1sprm.cxx b/sw/source/filter/ww1/w1sprm.cxx index 54693c737b..67cc5496cd 100644 --- a/sw/source/filter/ww1/w1sprm.cxx +++ b/sw/source/filter/ww1/w1sprm.cxx @@ -102,7 +102,7 @@ void Ww1SingleSprm::Start( void Ww1SingleSprm::Stop( Ww1Shell&, BYTE, BYTE*, USHORT, Ww1Manager&) { -// ASSERT(FALSE, "Unknown Sprm"); +// OSL_ENSURE(FALSE, "Unknown Sprm"); } ////////////////////////////////////////////////////////////////// STOP @@ -213,7 +213,7 @@ SvxBorderLine* Ww1SingleSprmPBrc::SetBorder(SvxBorderLine* pLine, W1_BRC10* pBrc { switch(pBrc->dxpLine1WidthGet()) { - default: ASSERT(FALSE, "unknown linewidth"); + default: OSL_ENSURE(FALSE, "unknown linewidth"); case 0: return 0; // keine Linie case 1: nCode = DEF_LINE_WIDTH_0; break; case 2: nCode = DEF_LINE_WIDTH_1; break; @@ -237,20 +237,20 @@ SvxBorderLine* Ww1SingleSprmPBrc::SetBorder(SvxBorderLine* pLine, W1_BRC10* pBrc { switch(pBrc->dxpLine1WidthGet()) { - default: ASSERT(FALSE, "unknown linewidth"); + default: OSL_ENSURE(FALSE, "unknown linewidth"); case 1: nCode = DEF_DOUBLE_LINE0_IN; break; } pLine->SetOutWidth(nCode); switch(pBrc->dxpLine2WidthGet()) { - default: ASSERT(FALSE, "unknown linewidth"); + default: OSL_ENSURE(FALSE, "unknown linewidth"); case 1: nCode = DEF_DOUBLE_LINE0_OUT; break; } pLine->SetInWidth(nCode); } switch(pBrc->dxpLine1WidthGet()) { - default: ASSERT(FALSE, "unknown space"); + default: OSL_ENSURE(FALSE, "unknown space"); case 0: nCode = DEF_DOUBLE_LINE0_DIST; break; case 1: nCode = DEF_DOUBLE_LINE1_DIST; break; case 2: nCode = DEF_DOUBLE_LINE2_DIST; break; @@ -264,14 +264,16 @@ void Ww1SingleSprmPBrc::Start( Ww1Shell& rOut, BYTE, W1_BRC10* pBrc, USHORT -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 nSize #endif , Ww1Manager& /*rMan*/, SvxBoxItem& aBox) { - ASSERT(sizeof(W1_BRC10) == nSize, "sizemissmatch"); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE(sizeof(W1_BRC10) == nSize, "sizemissmatch"); +#endif if(pBrc->dxpSpaceGet()) aBox.SetDistance(10 + 20 * pBrc->dxpSpaceGet()); //??? Warum 10+... ???? @@ -459,14 +461,16 @@ void Ww1SingleSprmPFInTable::Start( void Ww1SingleSprmPFInTable::Stop( Ww1Shell& -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 rOut #endif , BYTE, BYTE*, USHORT, Ww1Manager& rMan) { - ASSERT(rOut.IsInTable(), ""); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE(rOut.IsInTable(), ""); +#endif rMan.SetInTtp( FALSE ); } diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 5de6b11255..ca8205dce3 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -206,7 +206,7 @@ GridColsPtr WW8TableNodeInfoInner::getGridColsOfRow(AttributeOutputBase & rBase) WidthsPtr pWidths(getWidthsOfRow()); const SwFrmFmt *pFmt = getTable()->GetFrmFmt(); - ASSERT(pFmt,"Impossible"); + OSL_ENSURE(pFmt,"Impossible"); if (!pFmt) return pResult; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 424ba625e6..5e3501e395 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3476,7 +3476,7 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) } else if (m_rExport.bOutPageDescs ) { - ASSERT( m_rExport.GetCurItemSet(), "Impossible" ); + OSL_ENSURE( m_rExport.GetCurItemSet(), "Impossible" ); if ( !m_rExport.GetCurItemSet() ) return; diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 146f123859..ad916cdc3d 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -427,7 +427,7 @@ void DocxExport::PrepareNewPageDesc( const SfxItemSet* pSet, const SwSectionFmt* pFmt = GetSectionFormat( rNd ); const ULONG nLnNm = GetSectionLineNo( pSet, rNd ); - ASSERT( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." ); + OSL_ENSURE( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." ); if ( pNewPgDescFmt ) { diff --git a/sw/source/filter/ww8/dump/dump8a.cxx b/sw/source/filter/ww8/dump/dump8a.cxx index 97dd165ae5..b35a64bce7 100644 --- a/sw/source/filter/ww8/dump/dump8a.cxx +++ b/sw/source/filter/ww8/dump/dump8a.cxx @@ -39,7 +39,7 @@ #include "ww8darr.hxx" #include "ww8dout.hxx" -#define ASSERT( a, b ) ( (a)?(void)0:(void)(*pOut<<endl1<<"ASSERTION failed "<< __FILE__<<__LINE__<< b <<endl1) ) +#define OSL_ENSURE( a, b ) ( (a)?(void)0:(void)(*pOut<<endl1<<"ASSERTION failed "<< __FILE__<<__LINE__<< b <<endl1) ) #define nWW8MaxListLevel 9 @@ -1300,7 +1300,7 @@ static void DumpPLCF( long nPos, long nLen, ePLCFT ePlc ) ACHTUNG: im FILTER nicht "FALSE" sondern "!this()" schreiben, da sonst Warning unter OS/2 */ - ASSERT( FALSE, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( FALSE, "Es wurde vergessen, nVersion zu kodieren!" ); return; } @@ -1351,7 +1351,7 @@ static void DumpPLCF( long nPos, long nLen, ePLCFT ePlc ) ACHTUNG: im FILTER nicht "FALSE" sondern "!this()" schreiben, da sonst Warning unter OS/2 */ - ASSERT( FALSE, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( FALSE, "Es wurde vergessen, nVersion zu kodieren!" ); return; } @@ -2650,7 +2650,7 @@ int DoConvert( const String& rName, BYTE nVersion ) ACHTUNG: im FILTER nicht "FALSE" sondern "!this()" schreiben, da sonst Warning unter OS/2 */ - ASSERT( FALSE, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( FALSE, "Es wurde vergessen, nVersion zu kodieren!" ); return 1; } diff --git a/sw/source/filter/ww8/dump/ww8scan.cxx b/sw/source/filter/ww8/dump/ww8scan.cxx index b4f2341859..cf58b2814c 100644 --- a/sw/source/filter/ww8/dump/ww8scan.cxx +++ b/sw/source/filter/ww8/dump/ww8scan.cxx @@ -39,11 +39,11 @@ #ifdef DUMP #define ERR_SWG_READ_ERROR 1234 -#define ASSERT( a, b ) +#define OSL_ENSURE( a, b ) #else // dump #include <swerror.h> // ERR_WW6_... -#include <errhdl.hxx> // ASSERT() +#include <errhdl.hxx> // OSL_ENSURE() #include <swtypes.hxx> // DELETEZ #endif // dump @@ -51,7 +51,7 @@ #include "ww8scan.hxx" #define ASSERT_RET_ON_FAIL( aCon, aError, aRet ) \ - ASSERT(aCon, aError); \ + OSL_ENSURE(aCon, aError); \ if (!(aCon)) \ return aRet; @@ -105,7 +105,7 @@ public: wwSortedArray(C *pWwSprmTab, size_t nNoElems) : mpWwSprmTab(pWwSprmTab), mnNoElems(nNoElems) { - ASSERT(mnNoElems && pWwSprmTab, "WW8: empty Array: Don't do that"); + OSL_ENSURE(mnNoElems && pWwSprmTab, "WW8: empty Array: Don't do that"); std::sort(mpWwSprmTab, mpWwSprmTab + mnNoElems); #ifdef DEBUG bool bBroken=false; @@ -688,7 +688,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher() wwSprmParser::wwSprmParser(int nVersion) : mnVersion(nVersion) { - ASSERT((mnVersion >= 6 && mnVersion <= 8), "Impossible value for version"); + OSL_ENSURE(mnVersion >= 6 && mnVersion <= 8), "Impossible value for version"); mnDelta = (8 > mnVersion) ? 0 : 1; @@ -706,7 +706,7 @@ SprmInfo wwSprmParser::GetSprmInfo(sal_uInt16 nId) const const SprmInfo* pFound = mpKnownSprms->search(aSrch); if (pFound == 0) { - ASSERT(mnVersion >= 8, + OSL_ENSURE(mnVersion >= 8, "Unknown ww6 sprm, dangerous, report to development"); aSrch.nId = 0; @@ -1091,7 +1091,7 @@ WW8PLCFx& WW8PLCFx_PCD::operator ++( int ) if (pPcdI) (*pPcdI)++; else - ASSERT( !this, "pPcdI fehlt"); + OSL_ENSURE( !this, "pPcdI fehlt"); return *this; } @@ -1102,11 +1102,11 @@ WW8_FC WW8PLCFx_PCD::AktPieceStartCp2Fc( WW8_CP nCp ) if ( !pPcdI->Get(nCpStart, nCpEnd, pData) ) { - ASSERT( !this, "AktPieceStartCp2Fc() with false Cp found (1)" ); + OSL_ENSURE( !this, "AktPieceStartCp2Fc() with false Cp found (1)" ); return LONG_MAX; } - ASSERT( nCp >= nCpStart && nCp < nCpEnd, + OSL_ENSURE( nCp >= nCpStart && nCp < nCpEnd, "AktPieceCp2Fc() with false Cp found (2)" ); if( nCp < nCpStart ) @@ -1140,7 +1140,7 @@ WW8_CP WW8PLCFx_PCD::AktPieceStartFc2Cp( WW8_FC nStartPos ) void* pData; if ( !pPcdI->Get( nCpStart, nCpEnd, pData ) ) { - ASSERT( !this, "AktPieceStartFc2Cp() - Fehler" ); + OSL_ENSURE( !this, "AktPieceStartFc2Cp() - Fehler" ); return LONG_MAX; } bool bIsUnicode = false; @@ -1430,7 +1430,7 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const void* pData; if( !pPieceIter->Get( nCpStart, nCpEnd, pData ) ) { // ausserhalb PLCFfpcd ? - ASSERT( !this, "PLCFpcd-WW8Fc2Cp() ging schief" ); + OSL_ENSURE( !this, "PLCFpcd-WW8Fc2Cp() ging schief" ); break; } INT32 nFcStart = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc ); @@ -1498,7 +1498,7 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, if( pTestFlag ) *pTestFlag = false; else - ASSERT( !this, "Falscher CP an WW8Cp2Fc() uebergeben" ); + OSL_ENSURE( !this, "Falscher CP an WW8Cp2Fc() uebergeben" ); return LONG_MAX; } long nCpStart, nCpEnd; @@ -1508,7 +1508,7 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, if( pTestFlag ) *pTestFlag = false; else - ASSERT( !this, "PLCFfpcd-Get ging schief" ); + OSL_ENSURE( !this, "PLCFfpcd-Get ging schief" ); return LONG_MAX; } if( pNextPieceCp ) @@ -1595,7 +1595,7 @@ WW8PLCFpcd* WW8ScannerBase::OpenPieceTable( SvStream* pStr, const WW8Fib* pWwF ) // lies Piece Table PLCF ein INT32 nPLCFfLen; *pStr >> nPLCFfLen; - ASSERT( 65536 > nPLCFfLen, "PLCFfpcd ueber 64 k" ); + OSL_ENSURE( 65536 > nPLCFfLen, "PLCFfpcd ueber 64 k" ); return new WW8PLCFpcd( pStr, pStr->Tell(), nPLCFfLen, 8 ); } @@ -1713,7 +1713,7 @@ WW8ScannerBase::WW8ScannerBase( SvStream* pSt, SvStream* pTblSt, } break; default: - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); break; } @@ -2149,7 +2149,7 @@ bool WW8PLCFspecial::GetData(long nInIdx, long& rPos, void*& rpValue) const WW8PLCF::WW8PLCF( SvStream* pSt, long nFilePos, long nPLCF, long nStruct, long nStartPos ) :nIdx( 0 ), nStru( nStruct ) { - ASSERT( nPLCF, "WW8PLCF: nPLCF ist Null!" ); + OSL_ENSURE( nPLCF, "WW8PLCF: nPLCF ist Null!" ); nIMax = ( nPLCF - 4 ) / ( 4 + nStruct ); @@ -2200,7 +2200,7 @@ void WW8PLCF::ReadPLCF( SvStream* pSt, long nFilePos, long nPLCF ) void WW8PLCF::GeneratePLCF( SvStream* pSt, long nPN, long ncpN ) { - ASSERT( nIMax < (long)ncpN, "Pcl.Fkp: Warum ist PLCF zu gross ?" ); + OSL_ENSURE( nIMax < (long)ncpN, "Pcl.Fkp: Warum ist PLCF zu gross ?" ); nIMax = ncpN; long nSiz = 6 * nIMax + 4; pPLCF_PosArray = new INT32[ ( nSiz + 3 ) / 4 ]; // Pointer auf Pos-Array @@ -2611,7 +2611,7 @@ bool WW8PLCFx_Fc_FKP::WW8Fkp::HasSprm(USHORT nId, //----------------------------------------- void WW8PLCFx::GetSprms( WW8PLCFxDesc* p ) { - ASSERT( !this, "Falsches GetSprms gerufen" ); + OSL_ENSURE( !this, "Falsches GetSprms gerufen" ); p->nStartPos = p->nEndPos = LONG_MAX; p->pMemPos = 0; p->nSprmsLen = 0; @@ -2621,7 +2621,7 @@ void WW8PLCFx::GetSprms( WW8PLCFxDesc* p ) long WW8PLCFx::GetNoSprms( long& rStart, long& rEnd, long& rLen ) { - ASSERT( !this, "Falsches GetNoSprms gerufen" ); + OSL_ENSURE( !this, "Falsches GetNoSprms gerufen" ); rStart = rEnd = LONG_MAX; rLen = 0; return 0; @@ -2674,7 +2674,7 @@ bool WW8PLCFx_Fc_FKP::NewFkp() break; default: // Programm-Fehler! - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); return false; } @@ -3124,7 +3124,7 @@ void WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc* p) { if( !pPieceIter->Get( nCpStart, nCpEnd, pData ) ) { - ASSERT( !this, "piece iter broken!" ); + OSL_ENSURE( !this, "piece iter broken!" ); break; } bIsUnicode = false; @@ -3611,7 +3611,7 @@ WW8PLCFx& WW8PLCFx_FLD::operator ++( int ) bool WW8PLCFx_FLD::GetPara(long nIdx, WW8FieldDesc& rF) { - ASSERT( pPLCF, "Aufruf ohne Feld PLCFspecial" ); + OSL_ENSURE( pPLCF, "Aufruf ohne Feld PLCFspecial" ); if( !pPLCF ) return false; @@ -3683,7 +3683,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, UINT32 nStart, INT32 nLen, BYTE nBChar; if( nLen2 != nLen ) { - ASSERT( nLen2 == nLen, "Fib length and read length are different" ); + OSL_ENSURE( nLen2 == nLen, "Fib length and read length are different" ); if (nLen > USHRT_MAX) nLen = USHRT_MAX; else if (nLen < 2 ) @@ -3853,14 +3853,14 @@ long WW8PLCFx_Book::GetLen() const { if( nIsEnd ) { - ASSERT( !this, "Falscher Aufruf (1) von PLCF_Book::GetLen()" ); + OSL_ENSURE( !this, "Falscher Aufruf (1) von PLCF_Book::GetLen()" ); return 0; } void * p; WW8_CP nStartPos; if( !pBook[0]->Get( nStartPos, p ) ) { - ASSERT( !this, "Falscher Aufruf (2) von PLCF_Book::GetLen()" ); + OSL_ENSURE( !this, "Falscher Aufruf (2) von PLCF_Book::GetLen()" ); return 0; } USHORT nEndIdx = SVBT16ToShort( *((SVBT16*)p) ); @@ -3871,7 +3871,7 @@ long WW8PLCFx_Book::GetLen() const void WW8PLCFx_Book::SetStatus(USHORT nIndex, eBookStatus eStat ) { - ASSERT(nIndex < nIMax, "set status of non existing bookmark!"); + OSL_ENSURE(nIndex < nIMax, "set status of non existing bookmark!"); pStatus[nIndex] = (eBookStatus)( pStatus[nIndex] | eStat ); } @@ -3915,7 +3915,7 @@ String WW8PLCFx_Book::GetBookmark(long nStart,long nEnd, USHORT &nIndex) nEndIdx = SVBT16ToShort( *((SVBT16*)p) ); else { - ASSERT( !this, "Bookmark-EndIdx nicht lesbar" ); + OSL_ENSURE( !this, "Bookmark-EndIdx nicht lesbar" ); nEndIdx = i; } @@ -3951,7 +3951,7 @@ bool WW8PLCFx_Book::MapName(String& rName) nEndIdx = SVBT16ToShort( *((SVBT16*)p) ); else { - ASSERT( !this, "Bookmark-EndIdx nicht lesbar" ); + OSL_ENSURE( !this, "Bookmark-EndIdx nicht lesbar" ); nEndIdx = i; } nEndAkt = pBook[1]->GetPos( nEndIdx ); @@ -4028,7 +4028,7 @@ void WW8PLCFMan::AdjustEnds( WW8PLCFxDesc& rDesc ) void WW8PLCFxDesc::ReduceByOffset() { - ASSERT((LONG_MAX == nStartPos) || (nStartPos <= nEndPos), + OSL_ENSURE(LONG_MAX == nStartPos) || (nStartPos <= nEndPos), "Attr-Anfang und -Ende ueber Kreuz" ); if( nStartPos != LONG_MAX ) @@ -4046,7 +4046,7 @@ void WW8PLCFxDesc::ReduceByOffset() } if( nEndPos != LONG_MAX ) { - ASSERT(nCpOfs <= nEndPos, + OSL_ENSURE(nCpOfs <= nEndPos, "oh oh, so much for the subdocument piece theory"); nEndPos -= nCpOfs; } @@ -4067,7 +4067,7 @@ void WW8PLCFMan::GetNewNoSprms( WW8PLCFxDesc& rDesc ) rDesc.nCp2OrIdx = rDesc.pPLCFx->GetNoSprms(rDesc.nStartPos, rDesc.nEndPos, rDesc.nSprmsLen); - ASSERT((LONG_MAX == rDesc.nStartPos) || (rDesc.nStartPos <= rDesc.nEndPos), + OSL_ENSURE(LONG_MAX == rDesc.nStartPos) || (rDesc.nStartPos <= rDesc.nEndPos), "Attr-Anfang und -Ende ueber Kreuz" ); rDesc.ReduceByOffset(); @@ -4282,7 +4282,7 @@ WW8PLCFMan::~WW8PLCFMan() // 2. CP, wo ist naechste Attr.-Aenderung USHORT WW8PLCFMan::WhereIdx(bool* pbStart, long* pPos) const { - ASSERT(nPLCF,"What the hell"); + OSL_ENSURE(nPLCF,"What the hell"); long nNext = LONG_MAX; // SuchReihenfolge: USHORT nNextIdx = nPLCF;// first ending found ( CHP, PAP, ( SEP ) ), bool bStart = true; // dann Anfaenge finden ( ( SEP ), PAP, CHP ) @@ -4405,7 +4405,7 @@ void WW8PLCFMan::GetSprmEnd( short nIdx, WW8PLCFManResult* pRes ) const pRes->nSprmId = p->pIdStk->top(); // get end position else { - ASSERT( !this, "No Id on the Stack" ); + OSL_ENSURE( !this, "No Id on the Stack" ); pRes->nSprmId = 0; } } @@ -4576,7 +4576,7 @@ void WW8PLCFMan::AdvSprm(short nIdx, bool bStart) p->nSprmsLen = 0; GetNewSprms( *p ); } - ASSERT( p->nStartPos <= p->nEndPos, "Attribut ueber Kreuz" ); + OSL_ENSURE( p->nStartPos <= p->nEndPos, "Attribut ueber Kreuz" ); } } } @@ -4667,7 +4667,7 @@ bool WW8PLCFMan::Get(WW8PLCFManResult* pRes) const if( nIdx >= nPLCF ) { - ASSERT( !this, "Position not found" ); + OSL_ENSURE( !this, "Position not found" ); return true; } @@ -4705,7 +4705,7 @@ USHORT WW8PLCFMan::GetColl() const return pPap->pPLCFx->GetIstd(); else { - ASSERT( !this, "GetColl ohne PLCF_Pap" ); + OSL_ENSURE( !this, "GetColl ohne PLCF_Pap" ); return 0; } } @@ -4867,7 +4867,7 @@ WW8Fib::WW8Fib( SvStream& rSt, BYTE nWantedVersion,UINT32 nOffset ) nFibMin = 0; // Programm-Fehler! nFibMax = 0; nFib = 1; - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); break; } if ( (nFib < nFibMin) || (nFib > nFibMax) ) @@ -5507,7 +5507,7 @@ bool WW8Fib::Write(SvStream& rStrm) rtl_TextEncoding WW8Fib::GetFIBCharset(UINT16 chs) { - ASSERT(chs <= 0x100, "overflowed winword charset set"); + OSL_ENSURE(chs <= 0x100, "overflowed winword charset set"); rtl_TextEncoding eCharSet = (0x0100 == chs) ? RTL_TEXTENCODING_APPLE_ROMAN @@ -5702,7 +5702,7 @@ WW8_STD* WW8Style::Read1Style( short& rSkip, String* pString, short* pcbStd ) } break; default: - ASSERT(!this, "Es wurde vergessen, nVersion zu kodieren!"); + OSL_ENSURE(!this, "Es wurde vergessen, nVersion zu kodieren!"); break; } } @@ -5750,7 +5750,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) // always in ANSI, even if eStructCharSet == CHARSET_MAC !! if( rFib.lcbSttbfffn <= 2 ) { - ASSERT( !this, "Fonttabelle kaputt! (rFib.lcbSttbfffn < 2)" ); + OSL_ENSURE( !this, "Fonttabelle kaputt! (rFib.lcbSttbfffn < 2)" ); pFontA = 0; nMax = 0; return; @@ -6516,7 +6516,7 @@ USHORT WW8DopTypography::GetConvertedLang() const nLang = LANGUAGE_CHINESE_TRADITIONAL; break; default: - ASSERT(!this, "Unknown MS Asian Typography language, report"); + OSL_ENSURE(!this, "Unknown MS Asian Typography language, report"); nLang = LANGUAGE_CHINESE; break; case 0: @@ -6573,7 +6573,7 @@ USHORT wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm) nL = SVBT16ToShort( &pSprm[1 + mnDelta] ) + aSprm.nLen - 1; break; default: - ASSERT(!this, "Unknown sprm varient"); + OSL_ENSURE(!this, "Unknown sprm varient"); break; } break; diff --git a/sw/source/filter/ww8/fields.cxx b/sw/source/filter/ww8/fields.cxx index a819a0395c..fa99b3a281 100644 --- a/sw/source/filter/ww8/fields.cxx +++ b/sw/source/filter/ww8/fields.cxx @@ -30,7 +30,8 @@ #include "precompiled_sw.hxx" #include "fields.hxx" -#include <errhdl.hxx> //ASSERT (use our own ww header later for asserts) +#include <errhdl.hxx> +#include <osl/diagnose.h> #include <sal/macros.h> #include <stddef.h> @@ -144,7 +145,7 @@ namespace ww size_t nIndex = static_cast<size_t>(eIndex); if (nIndex >= SAL_N_ELEMENTS(aFieldNames)) eIndex = eNONE; - ASSERT(eIndex != eNONE, "Unknown WinWord Field, let cmc know"); + OSL_ENSURE(eIndex != eNONE, "Unknown WinWord Field, let cmc know"); return aFieldNames[eIndex]; } } diff --git a/sw/source/filter/ww8/hash_wrap.hxx b/sw/source/filter/ww8/hash_wrap.hxx index 6b3a56f87e..ff71be2369 100644 --- a/sw/source/filter/ww8/hash_wrap.hxx +++ b/sw/source/filter/ww8/hash_wrap.hxx @@ -33,7 +33,7 @@ #include <hash_set> #include <tools/debug.hxx> -#include <errhdl.hxx> // ASSERT() +#include <errhdl.hxx> // OSL_ENSURE() //simple wrapper around hash_set to behave like sorted array namespace ww @@ -66,7 +66,7 @@ namespace ww WrappedHash(const C *pWwSprmTab, const size_t nNoElems) { - ASSERT(nNoElems && pWwSprmTab, "WW8: empty Array: Don't do that"); + OSL_ENSURE(nNoElems && pWwSprmTab, "WW8: empty Array: Don't do that"); const C *pIter = pWwSprmTab; const C *pEnd = pWwSprmTab + nNoElems; while (pIter < pEnd) diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index b876a9eca1..65ae866dc3 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2465,7 +2465,7 @@ void RtfAttributeOutput::ParaNumRule_Impl( const SwTxtNode* pTxtNd, sal_Int32 nL if( pRule && pTxtNd->IsInList() ) { // --> OD 2008-03-18 #refactorlists# - ASSERT( pTxtNd->GetActualListLevel() >= 0 && pTxtNd->GetActualListLevel() < MAXLEVEL, + OSL_ENSURE( pTxtNd->GetActualListLevel() >= 0 && pTxtNd->GetActualListLevel() < MAXLEVEL, "<SwRTFWriter::OutListNum(..)> - text node does not have valid list level. Serious defect -> please inform OD" ); // <-- @@ -2663,8 +2663,7 @@ void RtfAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) { if( m_rExport.bOutPageDescs ) { - - ASSERT( m_rExport.GetCurItemSet(), "Impossible" ); + OSL_ENSURE( m_rExport.GetCurItemSet(), "Impossible" ); if ( !m_rExport.GetCurItemSet() ) return; diff --git a/sw/source/filter/ww8/sortedarray.hxx b/sw/source/filter/ww8/sortedarray.hxx index 479f43c087..93e62b9c3d 100644 --- a/sw/source/filter/ww8/sortedarray.hxx +++ b/sw/source/filter/ww8/sortedarray.hxx @@ -30,7 +30,7 @@ #define WW_SORTEDARRAY_HXX #include <algorithm> -#include <errhdl.hxx> // ASSERT() +#include <errhdl.hxx> // OSL_ENSURE() #include <tools/debug.hxx> //simple template that manages a static [] array by sorting at construction @@ -69,7 +69,7 @@ namespace ww SortedArray(C *pWwSprmTab, size_t nNoElems) : mpWwSprmTab(pWwSprmTab), mnNoElems(nNoElems) { - ASSERT(mnNoElems && pWwSprmTab, "WW8: empty Array: Don't do that"); + OSL_ENSURE(mnNoElems && pWwSprmTab, "WW8: empty Array: Don't do that"); std::sort(mpWwSprmTab, mpWwSprmTab + mnNoElems); #if OSL_DEBUG_LEVEL > 1 bool bBroken=false; diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 9e10b7a5ae..0ba74818ec 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -232,7 +232,7 @@ namespace sw } else { - ASSERT(!this, "Impossible"); + OSL_ENSURE(!this, "Impossible"); meWriterType = eTxtBox; } break; @@ -247,7 +247,7 @@ namespace sw } else { - ASSERT(!this, "Impossible"); + OSL_ENSURE(!this, "Impossible"); meWriterType = eDrawing; } break; @@ -300,7 +300,7 @@ namespace sw bool DrawingOLEAdaptor::TransferToDoc( ::rtl::OUString &rName ) { - ASSERT(mxIPRef.is(), "Transferring invalid object to doc"); + OSL_ENSURE(mxIPRef.is(), "Transferring invalid object to doc"); if (!mxIPRef.is()) return false; @@ -594,7 +594,7 @@ namespace sw return &(pRule->Get( static_cast< USHORT >(rTxtNode.GetActualListLevel()) )); } - ASSERT(rTxtNode.GetDoc(), "No document for node?, suspicious"); + OSL_ENSURE(rTxtNode.GetDoc(), "No document for node?, suspicious"); if (!rTxtNode.GetDoc()) return 0; @@ -632,7 +632,7 @@ namespace sw SwNoTxtNode *GetNoTxtNodeFromSwFrmFmt(const SwFrmFmt &rFmt) { const SwNodeIndex *pIndex = rFmt.GetCntnt().GetCntntIdx(); - ASSERT(pIndex, "No NodeIndex in SwFrmFmt ?, suspicious"); + OSL_ENSURE(pIndex, "No NodeIndex in SwFrmFmt ?, suspicious"); if (!pIndex) return 0; SwNodeIndex aIdx(*pIndex, 1); @@ -646,7 +646,7 @@ namespace sw { const SwTable& rTable = rNd.GetTableNode()->GetTable(); const SwFrmFmt* pApply = rTable.GetFrmFmt(); - ASSERT(pApply, "impossible"); + OSL_ENSURE(pApply, "impossible"); if (pApply) pBreak = &(ItemGet<SvxFmtBreakItem>(*pApply, RES_BREAK)); } @@ -724,13 +724,13 @@ namespace sw } } - ASSERT(aGrTwipSz.Width() && aGrTwipSz.Height(), "0 x 0 graphic ?"); + OSL_ENSURE(aGrTwipSz.Width() && aGrTwipSz.Height(), "0 x 0 graphic ?"); return aGrTwipSz; } void RedlineStack::open(const SwPosition& rPos, const SfxPoolItem& rAttr) { - ASSERT(rAttr.Which() == RES_FLTR_REDLINE, "not a redline"); + OSL_ENSURE(rAttr.Which() == RES_FLTR_REDLINE, "not a redline"); maStack.push_back(new SwFltStackEntry(rPos,rAttr.Clone())); } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index b4a1b143c9..6f9921afac 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -165,7 +165,7 @@ namespace myImplHelpers }; const size_t nArrSize = (SAL_N_ELEMENTS(aArr)); - ASSERT(nArrSize == 75, "Style Array has false size"); + OSL_ENSURE(nArrSize == 75, "Style Array has false size"); SwTxtFmtColl* pRet = 0; //If this is a built-in word style that has a built-in writer @@ -528,7 +528,7 @@ namespace sw const String &rTxt = rTxtNd.GetTxt(); bool bParaIsRTL = false; - ASSERT(rTxtNd.GetDoc(), "No document for node?, suspicious"); + OSL_ENSURE(rTxtNd.GetDoc(), "No document for node?, suspicious"); if (rTxtNd.GetDoc()) { if (FRMDIR_HORI_RIGHT_TOP == @@ -725,7 +725,7 @@ namespace sw case RTL_TEXTENCODING_UTF7: case RTL_TEXTENCODING_UTF8: case RTL_TEXTENCODING_JAVA_UTF8: - ASSERT(nRet != 0x80, "This method may be redundant"); + OSL_ENSURE(nRet != 0x80, "This method may be redundant"); nRet = 0x80; break; default: diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 3591eb7310..3ff45e612d 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -115,7 +115,7 @@ using namespace nsFieldFlags; //#110185# get a part fix for this type of element bool WW8Export::MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt) { - ASSERT(bWrtWW8, "Not allowed"); + OSL_ENSURE(bWrtWW8, "Not allowed"); if (!bWrtWW8) return false; bool bHack = false; @@ -203,7 +203,7 @@ void WW8Export::DoComboBox(const rtl::OUString &rName, const rtl::OUString &rSelected, uno::Sequence<rtl::OUString> &rListItems) { - ASSERT(bWrtWW8, "Not allowed"); + OSL_ENSURE(bWrtWW8, "Not allowed"); if (!bWrtWW8) return; OutputField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN), @@ -516,7 +516,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const } else { - ASSERT(pObj, "wo ist das SDR-Object?"); + OSL_ENSURE(pObj, "wo ist das SDR-Object?"); if (pObj) { aRect = pObj->GetSnapRect(); @@ -618,7 +618,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const nFlags |= 0x0400 | nContour; break; default: - ASSERT(!this, "Unsupported surround type for export"); + OSL_ENSURE(!this, "Unsupported surround type for export"); break; } if (pObj && (pObj->GetLayer() == rWrt.pDoc->GetHellId() || @@ -768,8 +768,8 @@ UINT32 WW8Export::GetSdrOrdNum( const SwFrmFmt& rFmt ) const void WW8Export::AppendFlyInFlys(const sw::Frame& rFrmFmt, const Point& rNdTopLeft) { - ASSERT(bWrtWW8, "this has gone horribly wrong"); - ASSERT(!pEscher, "der EscherStream wurde schon geschrieben!"); + OSL_ENSURE(bWrtWW8, "this has gone horribly wrong"); + OSL_ENSURE(!pEscher, "der EscherStream wurde schon geschrieben!"); if (pEscher) return ; PlcDrawObj *pDrwO; @@ -786,7 +786,7 @@ void WW8Export::AppendFlyInFlys(const sw::Frame& rFrmFmt, WW8_CP nCP = Fc2Cp(Strm().Tell()); bool bSuccess = pDrwO->Append(*this, nCP, rFrmFmt, rNdTopLeft); - ASSERT(bSuccess, "Couldn't export a graphical element!"); + OSL_ENSURE(bSuccess, "Couldn't export a graphical element!"); if (bSuccess) { @@ -1044,7 +1044,7 @@ const SfxPoolItem& MSWord_SdrAttrIter::GetItem( USHORT nWhich ) const { SfxItemSet aSet(pEditObj->GetParaAttribs(nPara)); nWhich = GetSetWhichFromSwDocWhich(aSet, *m_rExport.pDoc, nWhich); - ASSERT(nWhich, "Impossible, catastrophic failure imminent"); + OSL_ENSURE(nWhich, "Impossible, catastrophic failure imminent"); pRet = &aSet.Get(nWhich); } return *pRet; @@ -1089,7 +1089,7 @@ void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr) void WW8Export::WriteSdrTextObj(const SdrObject& rObj, BYTE nTyp) { const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, &rObj); - ASSERT(pTxtObj, "That is no SdrTextObj!"); + OSL_ENSURE(pTxtObj, "That is no SdrTextObj!"); if (!pTxtObj) return; @@ -1134,7 +1134,7 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, BYTE nTyp) rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet(); - ASSERT( !pO->Count(), " pO ist am Zeilenanfang nicht leer" ); + OSL_ENSURE( !pO->Count(), " pO ist am Zeilenanfang nicht leer" ); String aStr( rEditObj.GetText( n )); xub_StrLen nAktPos = 0; @@ -1171,7 +1171,7 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, BYTE nTyp) } while( nAktPos < nEnd ); - ASSERT( !pO->Count(), " pO ist am ZeilenEnde nicht leer" ); + OSL_ENSURE( !pO->Count(), " pO ist am ZeilenEnde nicht leer" ); pO->Insert( bNul, pO->Count() ); // Style # as short pO->Insert( bNul, pO->Count() ); @@ -1227,7 +1227,7 @@ void WW8Export::CreateEscher() GetItemState(RES_BACKGROUND); if (pHFSdrObjs->size() || pSdrObjs->size() || SFX_ITEM_SET == eBackSet) { - ASSERT( !pEscher, "wer hat den Pointer nicht geloescht?" ); + OSL_ENSURE( !pEscher, "wer hat den Pointer nicht geloescht?" ); SvMemoryStream* pEscherStrm = new SvMemoryStream; pEscherStrm->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); pEscher = new SwEscherEx(pEscherStrm, *this); @@ -1339,7 +1339,7 @@ INT32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId) INT32 nBorderThick=0; SwNoTxtNode *pNd = GetNoTxtNodeFromSwFrmFmt(rFmt); SwGrfNode *pGrfNd = pNd ? pNd->GetGrfNode() : 0; - ASSERT(pGrfNd, "No SwGrfNode ?, suspicious"); + OSL_ENSURE(pGrfNd, "No SwGrfNode ?, suspicious"); if (!pGrfNd) return nBorderThick; @@ -1932,7 +1932,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) { INT32 nBorderThick=0; DrawObj *pObj = (*aIter); - ASSERT(pObj, "impossible"); + OSL_ENSURE(pObj, "impossible"); if (!pObj) continue; const sw::Frame &rFrame = pObj->maCntnt; @@ -1971,9 +1971,9 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) if (bSwapInPage) (const_cast<SdrObject*>(pSdrObj))->SetPage(0); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else - ASSERT( !this, "Where is the SDR-Object?" ); + OSL_ENSURE( !this, "Where is the SDR-Object?" ); #endif } @@ -2186,7 +2186,7 @@ bool WinwordAnchoring::ConvertPosition( SwFmtHoriOrient& _iorHoriOri, } break; default: - ASSERT( false, + OSL_ENSURE( false, "<WinwordAnchoring::ConvertPosition(..)> - unknown horizontal relation" ); } } @@ -2300,7 +2300,7 @@ bool WinwordAnchoring::ConvertPosition( SwFmtHoriOrient& _iorHoriOri, case text::RelOrientation::FRAME_LEFT: case text::RelOrientation::FRAME_RIGHT: default: - ASSERT( false, + OSL_ENSURE( false, "<WinwordAnchoring::ConvertPosition(..)> - unknown vertical relation" ); } } @@ -2572,7 +2572,7 @@ USHORT FindPos(const SwFrmFmt &rFmt, unsigned int nHdFtIndex, for (DrawObjPointerIter aIter = rPVec.begin(); aIter != aEnd; ++aIter) { const DrawObj *pObj = (*aIter); - ASSERT(pObj, "Impossible"); + OSL_ENSURE(pObj, "Impossible"); if (!pObj) continue; if ( @@ -2611,7 +2611,7 @@ INT32 SwEscherEx::WriteTxtFlyFrame(const DrawObj &rObj, UINT32 nShapeId, switch (nDirection) { default: - ASSERT(!this, "unknown direction type"); + OSL_ENSURE(!this, "unknown direction type"); case FRMDIR_HORI_LEFT_TOP: nFlow=mso_txflHorzN; break; @@ -2669,7 +2669,7 @@ void SwEscherEx::WriteOCXControl( const SwFrmFmt& rFmt, UINT32 nShapeId ) SdrModel *pModel = rWrt.pDoc->GetDrawModel(); OutputDevice *pDevice = Application::GetDefaultDevice(); - ASSERT(pModel && pDevice, "no model or device"); + OSL_ENSURE(pModel && pDevice, "no model or device"); // #i71538# use complete SdrViews // SdrExchangeView aExchange(pModel, pDevice); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index f470985b65..907a408e43 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -117,7 +117,7 @@ using namespace sw::mark; using namespace nsFieldFlags; static String lcl_getFieldCode( const IFieldmark* pFieldmark ) { - ASSERT(pFieldmark!=NULL, "where is my fieldmark???"); + OSL_ENSURE(pFieldmark!=NULL, "where is my fieldmark???"); if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMTEXT ) ) { return String::CreateFromAscii(" FORMTEXT "); @@ -137,7 +137,7 @@ static String lcl_getFieldCode( const IFieldmark* pFieldmark ) { } ww::eField lcl_getFieldId( const IFieldmark* pFieldmark ) { - ASSERT(pFieldmark!=NULL, "where is my fieldmark???"); + OSL_ENSURE(pFieldmark!=NULL, "where is my fieldmark???"); if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMTEXT ) ) { return ww::eFORMTEXT; } else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMDROPDOWN ) ) { @@ -180,7 +180,7 @@ public: void SwWW8AttrIter::IterToCurrent() { - ASSERT(maCharRuns.begin() != maCharRuns.end(), "Impossible"); + OSL_ENSURE(maCharRuns.begin() != maCharRuns.end(), "Impossible"); mnScript = maCharRunIter->mnScript; meChrSet = maCharRunIter->meCharSet; mbCharIsRTL = maCharRunIter->mbRTL; @@ -499,7 +499,7 @@ void SwWW8AttrIter::OutAttr( xub_StrLen nSwPos, bool bRuby ) m_rExport.pOutFmtNode = pOldMod; } - ASSERT( pFont, "must be *some* font associated with this txtnode" ); + OSL_ENSURE( pFont, "must be *some* font associated with this txtnode" ); if ( pFont ) { SvxFontItem aFont( *pFont ); @@ -665,7 +665,7 @@ void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, xub_StrLen /*nPos*/, cDirective = 'd'; break; default: - ASSERT( !this,"Unhandled Ruby justication code" ); + OSL_ENSURE( !this,"Unhandled Ruby justication code" ); break; } aStr += String::CreateFromInt32( nJC ); @@ -764,7 +764,7 @@ String &TruncateBookmark( String &rRet ) { if ( rRet.Len() > 40 ) rRet.Erase( 40 ); - ASSERT( rRet.Len() <= 40, "Word cannot have bookmarks longer than 40 chars" ); + OSL_ENSURE( rRet.Len() <= 40, "Word cannot have bookmarks longer than 40 chars" ); return rRet; } @@ -1111,7 +1111,7 @@ void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAtt } break; default: - ASSERT( !this, "Unhandled option for toc export" ); + OSL_ENSURE( !this, "Unhandled option for toc export" ); break; } @@ -1327,7 +1327,7 @@ short MSWordExportBase::TrueFrameDirection( const SwFrmFmt &rFlyFmt ) const else nRet = GetCurrentPageDirection(); - ASSERT( nRet != FRMDIR_ENVIRONMENT, "leaving with environment direction" ); + OSL_ENSURE( nRet != FRMDIR_ENVIRONMENT, "leaving with environment direction" ); return nRet; } @@ -1930,7 +1930,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) // Exception: footnotes at the end of line if ( nNextAttr == nEnd ) { - ASSERT( nOpenAttrWithRange >= 0, "odd to see this happening, expected >= 0" ); + OSL_ENSURE( nOpenAttrWithRange >= 0, "odd to see this happening, expected >= 0" ); if ( !bTxtAtr && nOpenAttrWithRange <= 0 ) { if ( aAttrIter.IsRedlineAtEnd( nEnd ) ) @@ -1959,13 +1959,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) // Exception: footnotes at the end of line if ( nNextAttr == nEnd ) { - ASSERT(nOpenAttrWithRange >= 0, + OSL_ENSURE(nOpenAttrWithRange >= 0, "odd to see this happening, expected >= 0"); bool bAttrWithRange = (nOpenAttrWithRange > 0); if ( nAktPos != nEnd ) { nOpenAttrWithRange += aAttrIter.OutAttrWithRange(nEnd); - ASSERT(nOpenAttrWithRange == 0, + OSL_ENSURE(nOpenAttrWithRange == 0, "odd to see this happening, expected 0"); } @@ -2461,7 +2461,7 @@ void WW8Export::AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* void WW8Export::OutWW6FlyFrmsInCntnt( const SwTxtNode& rNd ) { - ASSERT(!bWrtWW8, "I shouldn't be needed for Word >=8"); + OSL_ENSURE(!bWrtWW8, "I shouldn't be needed for Word >=8"); if ( bWrtWW8 ) return; @@ -2539,7 +2539,7 @@ void WW8AttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point if (bUseEscher) { - ASSERT( m_rWW8Export.bWrtWW8, "this has gone horribly wrong" ); + OSL_ENSURE( m_rWW8Export.bWrtWW8, "this has gone horribly wrong" ); // write as escher m_rWW8Export.AppendFlyInFlys(rFmt, rNdTopLeft); } @@ -2686,7 +2686,7 @@ void WW8AttributeOutput::Redline( const SwRedlineData* pRedline ) } break; default: - ASSERT(!this, "Unhandled redline type for export"); + OSL_ENSURE(!this, "Unhandled redline type for export"); break; } diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 9d9e3c84c2..129b62856a 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -141,7 +141,7 @@ USHORT MSWordExportBase::GetId( const SwNumRule& rNumRule ) //here in the ww export filter sal_Int16 GetWordFirstLineOffset(const SwNumFmt &rFmt) { - ASSERT( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION, + OSL_ENSURE( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION, "<GetWordFirstLineOffset> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION" ); short nFirstLineOffset; @@ -359,7 +359,7 @@ void MSWordExportBase::AbstractNumberingDefinitions() default: { nFollow = 0; - ASSERT( false, + OSL_ENSURE( false, "unknown GetLabelFollowedBy() return value" ); } } @@ -609,8 +609,7 @@ void WW8Export::Out_WwNumLvl( BYTE nWwLevel ) void WW8Export::Out_SwNumLvl( BYTE nSwLevel ) { - - ASSERT( nSwLevel < MAXLEVEL, "numbered?"); + OSL_ENSURE( nSwLevel < MAXLEVEL, "numbered?"); Out_WwNumLvl( nSwLevel + 1 ); } @@ -891,7 +890,7 @@ bool WW8Export::Out_SwNum(const SwTxtNode* pNd) if (nLevel < 0 || nLevel >= MAXLEVEL) { - ASSERT(FALSE, "Invalid level"); + OSL_ENSURE(FALSE, "Invalid level"); return false; } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 7e55f86e37..c2bd9fdd53 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -428,12 +428,12 @@ void MSWordStyles::WriteProperties( const SwFmt* pFmt, bool bParProp, USHORT nPo { m_rExport.AttrOutput().StartStyleProperties( bParProp, nPos ); - ASSERT( m_rExport.pCurrentStyle == NULL, "Current style not NULL" ); // set current style before calling out + OSL_ENSURE( m_rExport.pCurrentStyle == NULL, "Current style not NULL" ); // set current style before calling out m_rExport.pCurrentStyle = pFmt; m_rExport.OutputFormat( *pFmt, bParProp, !bParProp ); - ASSERT( m_rExport.pCurrentStyle == pFmt, "current style was changed" ); + OSL_ENSURE( m_rExport.pCurrentStyle == pFmt, "current style was changed" ); // reset current style... m_rExport.pCurrentStyle = NULL; @@ -989,7 +989,7 @@ WW8_WrPlcSepx::~WW8_WrPlcSepx() sal_uInt16 MSWordSections::CurrentNumberOfColumns( const SwDoc &rDoc ) const { - ASSERT( aSects.Count(), "no segement inserted yet" ); + OSL_ENSURE( aSects.Count(), "no segement inserted yet" ); if ( !aSects.Count() ) return 1; @@ -1004,7 +1004,7 @@ sal_uInt16 MSWordSections::NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo if ( !pPd ) { - ASSERT( pPd, "totally impossible" ); + OSL_ENSURE( pPd, "totally impossible" ); return 1; } @@ -1727,7 +1727,7 @@ bool WW8_WrPlcSepx::WriteKFTxt( WW8Export& rWrt ) pAttrs = new WW8_PdAttrDesc[ aSects.Count() ]; ULONG nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() ); - ASSERT( !pTxtPos, "wer hat den Pointer gesetzt?" ); + OSL_ENSURE( !pTxtPos, "wer hat den Pointer gesetzt?" ); pTxtPos = new WW8_WrPlc0( nCpStart ); WriteFtnEndTxt( rWrt, nCpStart ); @@ -1788,7 +1788,7 @@ void WW8_WrPlcSepx::WriteSepx( SvStream& rStrm ) const void WW8_WrPlcSepx::WritePlcSed( WW8Export& rWrt ) const { - ASSERT( aCps.Count() == aSects.Count() + 1, "WrPlcSepx: DeSync" ); + OSL_ENSURE( aCps.Count() == aSects.Count() + 1, "WrPlcSepx: DeSync" ); ULONG nFcStart = rWrt.pTableStrm->Tell(); USHORT i; @@ -1833,14 +1833,14 @@ void MSWordExportBase::WriteHeaderFooterText( const SwFmt& rFmt, bool bHeader ) { bHasHdr = true; const SwFmtHeader& rHd = rFmt.GetHeader(); - ASSERT( rHd.GetHeaderFmt(), "Header text is not here" ); + OSL_ENSURE( rHd.GetHeaderFmt(), "Header text is not here" ); pCntnt = &rHd.GetHeaderFmt()->GetCntnt(); } else { bHasFtr = true; const SwFmtFooter& rFt = rFmt.GetFooter(); - ASSERT( rFt.GetFooterFmt(), "Footer text is not here" ); + OSL_ENSURE( rFt.GetFooterFmt(), "Footer text is not here" ); pCntnt = &rFt.GetFooterFmt()->GetCntnt(); } @@ -1868,7 +1868,7 @@ void MSWordExportBase::WriteHeaderFooterText( const SwFmt& rFmt, bool bHeader ) if ( !pSttIdx ) { // es gibt keine Kopf-/Fusszeile, aber ein CR ist immer noch noetig - ASSERT( pSttIdx, "K/F-Text nicht richtig da" ); + OSL_ENSURE( pSttIdx, "K/F-Text nicht richtig da" ); AttrOutput().EmptyParagraph(); // CR ans Ende ( sonst mault WW ) } } @@ -1993,10 +1993,10 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp, else { const SwFrmFmt* pFmt = ::FindFrmFmt( &rObj ); - ASSERT( pFmt, "wo ist das Format geblieben?" ); + OSL_ENSURE( pFmt, "wo ist das Format geblieben?" ); const SwNodeIndex* pNdIdx = pFmt->GetCntnt().GetCntntIdx(); - ASSERT( pNdIdx, "wo ist der StartNode der Textbox?" ); + OSL_ENSURE( pNdIdx, "wo ist der StartNode der Textbox?" ); rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1, pNdIdx->GetNode().EndOfSectionIndex(), nTTyp ); @@ -2044,7 +2044,7 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp, const SwFmtFtn* pFtn = (SwFmtFtn*)aCntnt[ i ]; rWrt.WriteFtnBegin( *pFtn ); const SwNodeIndex* pIdx = pFtn->GetTxtFtn()->GetStartNode(); - ASSERT( pIdx, "wo ist der StartNode der Fuss-/EndNote?" ); + OSL_ENSURE( pIdx, "wo ist der StartNode der Fuss-/EndNote?" ); rWrt.WriteSpecialText( pIdx->GetIndex() + 1, pIdx->GetNode().EndOfSectionIndex(), nTTyp ); @@ -2052,7 +2052,7 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp, break; default: - ASSERT( !this, "was ist das fuer ein SubDocType?" ); + OSL_ENSURE( !this, "was ist das fuer ein SubDocType?" ); } pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() )); @@ -2076,7 +2076,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp, if ( !nLen ) return; - ASSERT( aCps.Count() + 2 == pTxtPos->Count(), "WritePlc: DeSync" ); + OSL_ENSURE( aCps.Count() + 2 == pTxtPos->Count(), "WritePlc: DeSync" ); ::std::vector<String> aStrArr; WW8Fib& rFib = *rWrt.pFib; // n+1-te CP-Pos nach Handbuch @@ -2153,7 +2153,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp, { pTxtPos->Write( *rWrt.pTableStrm ); const SvULongs* pShapeIds = GetShapeIdArr(); - ASSERT( pShapeIds, "wo sind die ShapeIds?" ); + OSL_ENSURE( pShapeIds, "wo sind die ShapeIds?" ); for ( i = 0; i < nLen; ++i ) { @@ -2215,7 +2215,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp, //aStrArr is sorted myiter aIter = ::std::lower_bound(aStrArr.begin(), aStrArr.end(), rAtn.msOwner); - ASSERT(aIter != aStrArr.end() && *aIter == rAtn.msOwner, + OSL_ENSURE(aIter != aStrArr.end() && *aIter == rAtn.msOwner, "Impossible"); sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin()); String sAuthor(*aIter); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 1e34fdeb19..8dbc0f0e88 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -457,7 +457,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) in OOo have been changed away from OUR defaults, and if one has then export that. If more than one has in the future we may hack in something which examines our document properties to see which language is used the - most and choose that, for now we choose the first and throw an ASSERT. + most and choose that, for now we choose the first and throw an ASSERT */ /*Our default Japanese Level is 2, this is a special MS hack to set this*/ @@ -510,7 +510,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) } } - ASSERT( nNoNeeded<=1, "Example of unexportable forbidden chars" ); + OSL_ENSURE( nNoNeeded<=1, "Example of unexportable forbidden chars" ); rTypo.reserved1=nUseReserved; if (rTypo.iLevelOfKinsoku) { @@ -558,7 +558,7 @@ const SfxPoolItem* MSWordExportBase::HasItem( USHORT nWhich ) const pItem = pChpIter->HasTextItem( nWhich ); else { - ASSERT( !this, "Wo ist mein ItemSet / pChpIter ?" ); + OSL_ENSURE( !this, "Wo ist mein ItemSet / pChpIter ?" ); pItem = 0; } return pItem; @@ -573,14 +573,14 @@ const SfxPoolItem& MSWordExportBase::GetItem(USHORT nWhich) const // ourer own Ids. So the Id have to translate from our into the // EditEngine Range nWhich = sw::hack::GetSetWhichFromSwDocWhich(*pISet, *pDoc, nWhich); - ASSERT(nWhich != 0, "All broken, Impossible"); + OSL_ENSURE(nWhich != 0, "All broken, Impossible"); pItem = &pISet->Get(nWhich, true); } else if( pChpIter ) pItem = &pChpIter->GetItem( nWhich ); else { - ASSERT( !this, "Wo ist mein ItemSet / pChpIter ?" ); + OSL_ENSURE( !this, "Wo ist mein ItemSet / pChpIter ?" ); pItem = 0; } return *pItem; @@ -603,7 +603,7 @@ WW8_WrPlc1::~WW8_WrPlc1() WW8_CP WW8_WrPlc1::Prev() const { USHORT nLen = aPos.Count(); - ASSERT(nLen,"Prev called on empty list"); + OSL_ENSURE(nLen,"Prev called on empty list"); return nLen ? aPos[nLen-1] : 0; } @@ -757,9 +757,9 @@ ULONG SwWW8Writer::FillUntil( SvStream& rStrm, ULONG nEndPos ) if( nEndPos > nCurPos ) SwWW8Writer::FillCount( rStrm, nEndPos - nCurPos ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else - ASSERT( nEndPos == nCurPos, "Falsches FillUntil()" ); + OSL_ENSURE( nEndPos == nCurPos, "Falsches FillUntil()" ); #endif return rStrm.Tell(); } @@ -830,7 +830,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const BYTE* pSprms) aFkps.Insert( pF, aFkps.Count() ); if( !pF->Append( nEndFc, nVarLen, pNewSprms ) ) { - ASSERT( !this, "Sprm liess sich nicht einfuegen" ); + OSL_ENSURE( !this, "Sprm liess sich nicht einfuegen" ); } } if( pNewSprms != pSprms ) //Merge to new has created a new block @@ -968,19 +968,19 @@ BYTE *WW8_WrFkp::CopyLastSprms(BYTE &rLen, bool bVer8) bool WW8_WrFkp::Append( WW8_FC nEndFc, USHORT nVarLen, const BYTE* pSprms ) { - ASSERT( !nVarLen || pSprms, "Item-Pointer fehlt" ); - ASSERT( nVarLen < ( ( ePlc == PAP ) ? 497U : 502U ), "Sprms zu lang !" ); + OSL_ENSURE( !nVarLen || pSprms, "Item-Pointer fehlt" ); + OSL_ENSURE( nVarLen < ( ( ePlc == PAP ) ? 497U : 502U ), "Sprms zu lang !" ); if( bCombined ) { - ASSERT( !this, "Fkp::Append: Fkp is already combined" ); + OSL_ENSURE( !this, "Fkp::Append: Fkp is already combined" ); return false; } INT32 n = ((INT32*)pFkp)[nIMax]; // letzter Eintrag if( nEndFc <= n ) { - ASSERT( nEndFc >= n, "+Fkp: FC rueckwaerts" ); - ASSERT( !nVarLen || !pSprms || nEndFc != n, + OSL_ENSURE( nEndFc >= n, "+Fkp: FC rueckwaerts" ); + OSL_ENSURE( !nVarLen || !pSprms || nEndFc != n, "+Fkp: selber FC mehrfach benutzt" ); // selber FC ohne Sprm wird ohne zu mosern ignoriert. @@ -1166,7 +1166,7 @@ void WW8_WrPct::AppendPc(WW8_FC nStartFc, bool bIsUnicode) { if ( 0 != pPcts->Count() ) { - ASSERT( 1 == pPcts->Count(), "Leeres Piece !!"); + OSL_ENSURE( 1 == pPcts->Count(), "Leeres Piece !!"); pPcts->DeleteAndDestroy( pPcts->Count() - 1 , 1); } } @@ -1238,14 +1238,14 @@ void WW8_WrPct::WritePc( WW8Export& rWrt ) void WW8_WrPct::SetParaBreak() { - ASSERT( pPcts->Count(),"SetParaBreak : aPcts.Count = 0" ); + OSL_ENSURE( pPcts->Count(),"SetParaBreak : aPcts.Count = 0" ); pPcts->GetObject( pPcts->Count() - 1)->SetStatus(); } WW8_CP WW8_WrPct::Fc2Cp( ULONG nFc ) const { - ASSERT( nFc >= (ULONG)nOldFc, "FilePos liegt vorm letzten Piece" ); - ASSERT( pPcts->Count(), "Fc2Cp noch kein Piece vorhanden" ); + OSL_ENSURE( nFc >= (ULONG)nOldFc, "FilePos liegt vorm letzten Piece" ); + OSL_ENSURE( pPcts->Count(), "Fc2Cp noch kein Piece vorhanden" ); nFc -= nOldFc; if( bIsUni ) @@ -1289,7 +1289,7 @@ void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm, const ::sw:: else { // old -> its the end position - ASSERT( aEndCps[ nPos ] == aSttCps[ nPos ], "end position is valid" ); + OSL_ENSURE( aEndCps[ nPos ] == aSttCps[ nPos ], "end position is valid" ); //If this bookmark was around a field in writer, then we want to move //it to the field result in word. The end is therefore one cp @@ -1854,14 +1854,14 @@ void WW8Export::RestoreData() GetWriter().bWriteAll = rData.bOldWriteAll; - ASSERT( !pO->Count(), "pO is not empty in WW8Export::RestoreData()" ); + OSL_ENSURE( !pO->Count(), "pO is not empty in WW8Export::RestoreData()" ); if ( rData.pOOld ) { delete pO; pO = rData.pOOld; } - ASSERT( !mpTableAt || !mpTableAt->Count(), "mpTableAt is not empty in WW8Export::RestoreData()" ); + OSL_ENSURE( !mpTableAt || !mpTableAt->Count(), "mpTableAt is not empty in WW8Export::RestoreData()" ); if ( mpTableAt ) delete mpTableAt; mpTableAt = rData.mpTableAtOld; @@ -2057,7 +2057,7 @@ void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t const SwTable * pTable = pTableTextNodeInfoInner->getTable(); const SwFrmFmt *pFmt = pTable->GetFrmFmt(); - ASSERT(pFmt,"Impossible"); + OSL_ENSURE(pFmt,"Impossible"); if (!pFmt) return; @@ -2159,7 +2159,7 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t */ //const bool bNewTableModel = pTbl->IsNewModel(); const SwFrmFmt *pFmt = pTable->GetFrmFmt(); - ASSERT(pFmt,"Impossible"); + OSL_ENSURE(pFmt,"Impossible"); if (!pFmt) return; @@ -2263,7 +2263,7 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableT const SwTable *pTable = pTableTextNodeInfoInner->getTable( ); const SwFrmFmt *pFmt = pTable->GetFrmFmt(); - ASSERT(pFmt,"Impossible"); + OSL_ENSURE(pFmt,"Impossible"); if (!pFmt) return; @@ -2276,7 +2276,7 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableT unsigned long nTblSz = static_cast<unsigned long>(rSize.GetWidth()); if (nTblSz > USHRT_MAX/2 && !bRelBoxSize) { - ASSERT(bRelBoxSize, "huge table width but not relative, suspicious"); + OSL_ENSURE(bRelBoxSize, "huge table width but not relative, suspicious"); bRelBoxSize = true; } @@ -2311,7 +2311,7 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableT } - ASSERT(nWidthPercent, "Impossible"); + OSL_ENSURE(nWidthPercent, "Impossible"); if (nWidthPercent) { nPageSize *= nWidthPercent; @@ -3507,7 +3507,7 @@ void WW8SHDLong::Write( WW8Export& rExport ) void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) { - ASSERT( bWrtWW8, "No 95 export yet" ); + OSL_ENSURE( bWrtWW8, "No 95 export yet" ); if ( !bWrtWW8 ) return; @@ -3515,7 +3515,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( pFieldmark ); - ASSERT(rFieldmark.GetFieldname().equalsAscii( ODF_FORMTEXT ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMDROPDOWN ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMCHECKBOX ), "Unknown field type!!!"); + OSL_ENSURE(rFieldmark.GetFieldname().equalsAscii( ODF_FORMTEXT ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMDROPDOWN ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMCHECKBOX ), "Unknown field type!!!"); if ( ! ( rFieldmark.GetFieldname().equalsAscii( ODF_FORMTEXT ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMDROPDOWN ) || rFieldmark.GetFieldname().equalsAscii( ODF_FORMCHECKBOX ) ) ) diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 1b7c356c07..a93c6cb6f7 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -104,7 +104,7 @@ using namespace nsFieldFlags; void WW8Export::OutputGrfNode( const SwGrfNode& /*rNode*/ ) { OSL_TRACE("WW8Export::OutputGrfNode( const SwGrfNode& )\n" ); - ASSERT( mpParentFrame, "frame not set!" ); + OSL_ENSURE( mpParentFrame, "frame not set!" ); if ( mpParentFrame ) { OutGrf( *mpParentFrame ); @@ -766,7 +766,7 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) { const SwNode *pNode = rItem.maFly.GetContent(); const SwGrfNode *pNd = pNode ? pNode->GetGrfNode() : 0; - ASSERT(pNd, "Impossible"); + OSL_ENSURE(pNd, "Impossible"); if (pNd) WriteGrfFromGrfNode(rStrm, *pNd, rItem.maFly, nWidth, nHeight); } @@ -776,11 +776,11 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) #ifdef OLE_PREVIEW_AS_EMF const SwNode *pNode = rItem.maFly.GetContent(); const SwOLENode *pNd = pNode ? pNode->GetOLENode() : 0; - ASSERT(pNd, "Impossible"); + OSL_ENSURE(pNd, "Impossible"); if (!rWrt.bWrtWW8) { SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd); - ASSERT( pOleNd, " Wer hat den OleNode versteckt ?" ); + OSL_ENSURE( pOleNd, " Wer hat den OleNode versteckt ?" ); SwOLEObj& rSObj= pOleNd->GetOLEObj(); uno::Reference < embed::XEmbeddedObject > rObj( rSObj.GetOleRef() ); @@ -823,7 +823,7 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) #else // cast away const SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd); - ASSERT( pOleNd, " Wer hat den OleNode versteckt ?" ); + OSL_ENSURE( pOleNd, " Wer hat den OleNode versteckt ?" ); SwOLEObj& rSObj= pOleNd->GetOLEObj(); // TODO/LATER: do we need to load object? @@ -849,7 +849,7 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) case sw::Frame::eDrawing: case sw::Frame::eTxtBox: case sw::Frame::eFormControl: - ASSERT(rWrt.bWrtWW8, + OSL_ENSURE(rWrt.bWrtWW8, "You can't try and export these in WW8 format, a filter bug"); /* #i3958# We only export an empty dummy picture frame here, this is @@ -866,7 +866,7 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) } break; default: - ASSERT(!this, + OSL_ENSURE(!this, "Some inline export not implemented, remind cmc before we ship :-)"); break; } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 88d990cd0e..606e7fe583 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -389,7 +389,7 @@ bool MSWordExportBase::SetAktPageDescFromNode(const SwNode &rNd) { bool bNewPageDesc = false; const SwPageDesc* pCurrent = SwPageDesc::GetPageDescOfNode(rNd); - ASSERT(pCurrent && pAktPageDesc, "Not possible surely"); + OSL_ENSURE(pCurrent && pAktPageDesc, "Not possible surely"); if (pAktPageDesc && pCurrent) { if (pCurrent != pAktPageDesc) @@ -477,7 +477,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode if ( !bRemoveHardBreakInsideTable ) { - ASSERT(pAktPageDesc, "should not be possible"); + OSL_ENSURE(pAktPageDesc, "should not be possible"); /* If because of this pagebreak the page desc following the page break is the follow style of the current page desc then output a @@ -533,7 +533,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode if ( bHackInBreak ) { - ASSERT( pAktPageDesc, "should not be possible" ); + OSL_ENSURE( pAktPageDesc, "should not be possible" ); if ( pAktPageDesc ) bNewPageDesc = SetAktPageDescFromNode( rNd ); } @@ -609,7 +609,7 @@ void WW8Export::PrepareNewPageDesc( const SfxItemSet*pSet, const SwSectionFmt* pFmt = GetSectionFormat( rNd ); const ULONG nLnNm = GetSectionLineNo( pSet, rNd ); - ASSERT( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." ); + OSL_ENSURE( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." ); if ( pNewPgDescFmt ) { @@ -809,7 +809,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF case RES_FLYFRMFMT: if (bFlyFmt) { - ASSERT(mpParentFrame, "No parent frame, all broken"); + OSL_ENSURE(mpParentFrame, "No parent frame, all broken"); if (mpParentFrame) { @@ -844,7 +844,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF } break; default: - ASSERT( !this, "Was wird hier ausgegeben ??? " ); + OSL_ENSURE( !this, "Was wird hier ausgegeben ??? " ); break; } @@ -1033,7 +1033,7 @@ void WW8AttributeOutput::OutputFKP() void WW8AttributeOutput::ParagraphStyle( USHORT nStyle ) { - ASSERT( !m_rWW8Export.pO->Count(), " pO ist am ZeilenEnde nicht leer" ); + OSL_ENSURE( !m_rWW8Export.pO->Count(), " pO ist am ZeilenEnde nicht leer" ); SVBT16 nSty; ShortToSVBT16( nStyle, nSty ); @@ -1054,7 +1054,7 @@ void WW8AttributeOutput::OutputWW8Attribute( BYTE nId, bool bVal ) void WW8AttributeOutput::OutputWW8AttributeCTL( BYTE nId, bool bVal ) { - ASSERT( nId <= 1, "out of range" ); + OSL_ENSURE( nId <= 1, "out of range" ); if ( !m_rWW8Export.bWrtWW8 || nId > 1 ) return; @@ -1294,7 +1294,7 @@ void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) b = 0; break; default: - ASSERT( rUnderline.GetLineStyle() == UNDERLINE_NONE, "Unhandled underline type" ); + OSL_ENSURE( rUnderline.GetLineStyle() == UNDERLINE_NONE, "Unhandled underline type" ); break; } @@ -1775,7 +1775,7 @@ WW8_WrPlcFld* WW8Export::CurrentFieldPlc() const pFldP = pFldHFTxtBxs; break; default: - ASSERT( !this, "was ist das fuer ein SubDoc-Type?" ); + OSL_ENSURE( !this, "was ist das fuer ein SubDoc-Type?" ); } return pFldP; } @@ -2391,7 +2391,7 @@ void AttributeOutputBase::GetNumberPara( String& rStr, const SwField& rFld ) rStr.APPEND_CONST_ASC("\\*roman "); break; default: - ASSERT(rFld.GetFormat() == SVX_NUM_ARABIC, + OSL_ENSURE(rFld.GetFormat() == SVX_NUM_ARABIC, "Unknown numbering type exported as default\n"); case SVX_NUM_ARABIC: rStr.APPEND_CONST_ASC("\\*Arabic "); @@ -3069,7 +3069,7 @@ void WW8AttributeOutput::ParaVerticalAlign( const SvxParaVertAlignItem& rAlign ) break; default: nVal = 4; - ASSERT( false, "Unknown vert alignment" ); + OSL_ENSURE( false, "Unknown vert alignment" ); break; } m_rWW8Export.InsUInt16( nVal ); @@ -3453,7 +3453,7 @@ void WW8AttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize ) ULONG WW8Export::ReplaceCr( BYTE nChar ) { // Bug #49917# - ASSERT( nChar, "gegen 0 ersetzt bringt WW97/95 zum Absturz" ); + OSL_ENSURE( nChar, "gegen 0 ersetzt bringt WW97/95 zum Absturz" ); bool bReplaced = false; SvStream& rStrm = Strm(); @@ -3521,13 +3521,6 @@ ULONG WW8Export::ReplaceCr( BYTE nChar ) pChpPlc->AppendFkpEntry(rStrm.Tell()); nRetPos = rStrm.Tell(); } -#ifndef DBG_UTIL - else - { - ASSERT( nRetPos || nPos == (ULONG)pFib->fcMin, - "WW8_ReplaceCr an falscher FilePos gerufen" ); - } -#endif return nRetPos; } @@ -3668,7 +3661,7 @@ void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid ) switch ( rGrid.GetGridType() ) { default: - ASSERT(false, "Unknown grid type"); + OSL_ENSURE(false, "Unknown grid type"); case GRID_NONE: nGridType = 0; break; @@ -3831,7 +3824,7 @@ void WW8AttributeOutput::FormatULSpace( const SvxULSpaceItem& rUL ) } else if ( m_rWW8Export.bOutPageDescs ) // Page-UL { - ASSERT( m_rWW8Export.GetCurItemSet(), "Impossible" ); + OSL_ENSURE( m_rWW8Export.GetCurItemSet(), "Impossible" ); if ( !m_rWW8Export.GetCurItemSet() ) return; @@ -3946,7 +3939,7 @@ void WW8AttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori { if ( !m_rWW8Export.mpParentFrame ) { - ASSERT( m_rWW8Export.mpParentFrame, "HoriOrient without mpParentFrame !!" ); + OSL_ENSURE( m_rWW8Export.mpParentFrame, "HoriOrient without mpParentFrame !!" ); return; } @@ -3985,7 +3978,7 @@ void WW8AttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori void WW8AttributeOutput::FormatAnchor( const SwFmtAnchor& rAnchor ) { - ASSERT( m_rWW8Export.mpParentFrame, "Anchor without mpParentFrame !!" ); + OSL_ENSURE( m_rWW8Export.mpParentFrame, "Anchor without mpParentFrame !!" ); if ( m_rWW8Export.bOutFlyFrmAttrs ) { @@ -4151,7 +4144,7 @@ WW8_BRC WW8Export::TranslateBorderLine(const SvxBorderLine& rLine, void WW8Export::Out_BorderLine(WW8Bytes& rO, const SvxBorderLine* pLine, USHORT nDist, sal_uInt16 nSprmNo, bool bShadow) { - ASSERT( ( nSprmNo == 0 ) || + OSL_ENSURE( ( nSprmNo == 0 ) || ( nSprmNo >= 38 && nSprmNo <= 41 ) || ( nSprmNo >= NS_sprm::LN_PBrcTop && nSprmNo <= NS_sprm::LN_PBrcRight ) || ( nSprmNo >= NS_sprm::LN_SBrcTop && nSprmNo <= NS_sprm::LN_SBrcRight ), @@ -4484,7 +4477,7 @@ void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing ) getScriptType(pNd->GetTxt(), 0); } } - ASSERT( pSet, "No attrset for lineheight :-(" ); + OSL_ENSURE( pSet, "No attrset for lineheight :-(" ); if ( pSet ) { nSpace = nSpace + (short)( AttrSetToLineHeight( *GetExport().pDoc, @@ -4625,7 +4618,7 @@ void WW8AttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDir { default: //Can't get an unknown type here - ASSERT(false, "Unknown frame direction"); + OSL_ENSURE(false, "Unknown frame direction"); case FRMDIR_HORI_LEFT_TOP: nTextFlow = 0; break; @@ -4774,8 +4767,8 @@ void SwWW8WrTabu::PutAll(WW8Export& rWrt) { if (!nAdd && !nDel) //It its a no-op return; - ASSERT(nAdd <= 255, "more than 255 added tabstops ?"); - ASSERT(nDel <= 255, "more than 244 removed tabstops ?"); + OSL_ENSURE(nAdd <= 255, "more than 255 added tabstops ?"); + OSL_ENSURE(nDel <= 255, "more than 244 removed tabstops ?"); if (nAdd > 255) nAdd = 255; if (nDel > 255) @@ -5198,7 +5191,7 @@ void AttributeOutputBase::OutputStyleItemSet( const SfxItemSet& rSet, BOOL bDeep const SfxPoolItem* pItem; if ( !bDeep || !pSet->GetParent() ) { - ASSERT( rSet.Count(), "Wurde doch schon behandelt oder?" ); + OSL_ENSURE( rSet.Count(), "Wurde doch schon behandelt oder?" ); SfxItemIter aIter( *pSet ); pItem = aIter.GetCurItem(); do { diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 030f36fa00..6755ac255a 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -230,7 +230,7 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile ) *pD->GetNodes().GetEndOfContent().StartOfSectionNode(), 1); if( !aIdx.GetNode().IsTxtNode() ) { - ASSERT( !this, "wo ist der TextNode?" ); + OSL_ENSURE( !this, "wo ist der TextNode?" ); pD->GetNodes().GoNext( &aIdx ); } SwPaM aPamo( aIdx ); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 295489c049..65f0d4baa6 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -179,7 +179,7 @@ bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz, { if (SVBT16ToShort(pHd->cb) < sizeof(WW8_DPHEAD) + nDataSiz) { - ASSERT( !this, "+Grafik-Element: Size ?" ); + OSL_ENSURE( !this, "+Grafik-Element: Size ?" ); pStrm->SeekRel(SVBT16ToShort(pHd->cb) - sizeof(WW8_DPHEAD)); return false; } @@ -810,7 +810,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, WW8PLCFspecial* pT = pPlcxMan ? pPlcxMan->GetTxbx() : 0; if( !pT ) { - ASSERT( !this, "+Wo ist der Grafik-Text (1) ?" ); + OSL_ENSURE( !this, "+Wo ist der Grafik-Text (1) ?" ); return false; } @@ -823,7 +823,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, void* pT0; if( !pT->Get( rStartCp, pT0 ) ) { - ASSERT( !this, "+Wo ist der Grafik-Text (2) ?" ); + OSL_ENSURE( !this, "+Wo ist der Grafik-Text (2) ?" ); return false; } @@ -835,7 +835,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, (*pT)++; if( !pT->Get( rStartCp, pT0 ) ) { - ASSERT( !this, "+Wo ist der Grafik-Text (2-a) ?" ); + OSL_ENSURE( !this, "+Wo ist der Grafik-Text (2-a) ?" ); return false; } bReusable = (0 != SVBT16ToShort( ((WW8_TXBXS*)pT0)->fReusable )); @@ -844,7 +844,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, (*pT)++; if( !pT->Get( rEndCp, pT0 ) ) { - ASSERT( !this, "+Wo ist der Grafik-Text (3) ?" ); + OSL_ENSURE( !this, "+Wo ist der Grafik-Text (3) ?" ); return false; } @@ -865,7 +865,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, // den ersten Eintrag fuer diese TextBox-Story finden if( !pT->SeekPos( rStartCp ) ) { - ASSERT( !this, "+Wo ist der Grafik-Text (4) ?" ); + OSL_ENSURE( !this, "+Wo ist der Grafik-Text (4) ?" ); return false; } // ggfs. entsprechende Anzahl Eintraege weitergehen @@ -874,7 +874,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, if( (!pT->Get( rStartCp, pT0 )) || ( nMinStartCp > rStartCp ) ) { - ASSERT( !this, "+Wo ist der Grafik-Text (5) ?" ); + OSL_ENSURE( !this, "+Wo ist der Grafik-Text (5) ?" ); return false; } if( rStartCp >= nMaxEndCp ) @@ -885,7 +885,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, if( (!pT->Get( rEndCp, pT0 )) || ( nMaxEndCp < rEndCp-1 ) ) { - ASSERT( !this, "+Wo ist der Grafik-Text (6) ?" ); + OSL_ENSURE( !this, "+Wo ist der Grafik-Text (6) ?" ); return false; } rEndCp -= 1; @@ -906,7 +906,7 @@ bool SwWW8ImplReader::GetRangeAsDrawingString(String& rString, long nStartCp, lo WW8_CP nOffset = pWwFib->GetBaseCp(eType); bool bOk = false; - ASSERT(nStartCp <= nEndCp, "+Wo ist der Grafik-Text (7) ?"); + OSL_ENSURE(nStartCp <= nEndCp, "+Wo ist der Grafik-Text (7) ?"); if (nStartCp == nEndCp) rString.Erase(); // leerer String: durchaus denkbar! else if (nStartCp < nEndCp) @@ -914,7 +914,7 @@ bool SwWW8ImplReader::GetRangeAsDrawingString(String& rString, long nStartCp, lo // den Text einlesen: kann sich ueber mehrere Pieces erstrecken!!! USHORT nLen = pSBase->WW8ReadString(*pStrm, rString, nStartCp + nOffset, nEndCp - nStartCp, GetCurrentCharSet()); - ASSERT(nLen, "+Wo ist der Grafik-Text (8) ?"); + OSL_ENSURE(nLen, "+Wo ist der Grafik-Text (8) ?"); if (nLen) { bOk = true; @@ -1316,7 +1316,7 @@ SdrObject *SwWW8ImplReader::ReadGroup( WW8_DPHEAD* pHd, const WW8_DO* pDo, // #116150# // first add and then set ItemSet SdrObjList *pSubGroup = pObj->GetSubList(); - ASSERT(pSubGroup, "Why no sublist available?"); + OSL_ENSURE(pSubGroup, "Why no sublist available?"); if (pSubGroup) pSubGroup->InsertObject(pObject, 0); pObject->SetMergedItemSetAndBroadcast(aSet); @@ -1374,7 +1374,7 @@ SdrObject* SwWW8ImplReader::ReadGrafPrimitive( short& rLeft, const WW8_DO* pDo, } else { - ASSERT( !this, "+Grafik-Overlap" ); + OSL_ENSURE( !this, "+Grafik-Overlap" ); } rLeft = rLeft - SVBT16ToShort( aHd.cb ); return pRet; @@ -1387,13 +1387,13 @@ void SwWW8ImplReader::ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp ) void* pF0; if( !pPF->Get( nStartFc, pF0 ) ) { - ASSERT( !this, "+Wo ist die Grafik (2) ?" ); + OSL_ENSURE( !this, "+Wo ist die Grafik (2) ?" ); return; } WW8_FDOA* pF = (WW8_FDOA*)pF0; if( !SVBT32ToUInt32( pF->fc ) ) { - ASSERT( !this, "+Wo ist die Grafik (3) ?" ); + OSL_ENSURE( !this, "+Wo ist die Grafik (3) ?" ); return; } WW8_DO aDo; @@ -1497,7 +1497,7 @@ const WW8_BordersSO &WW8_BordersSO::Get0x01LineMatch(eBorderCode eCode) /*18*/ { DEF_LINE_WIDTH_5, 0, 0, DOTTED } }; size_t nPos = static_cast<size_t>(eCode); - ASSERT(nPos < sizeof(aLineTabVer8), "Impossible"); + OSL_ENSURE(nPos < sizeof(aLineTabVer8), "Impossible"); if (nPos >= sizeof(aLineTabVer8)) eCode = single0; return aLineTabVer8[eCode]; @@ -1654,7 +1654,7 @@ INT32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor, break; // erroneously not implemented line style is set default: - ASSERT(!this, "eLineStyle is not (yet) implemented!"); + OSL_ENSURE(!this, "eLineStyle is not (yet) implemented!"); break; } @@ -2250,7 +2250,7 @@ bool SwWW8ImplReader::MiserableRTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord, WW8_FSPA *pFSPA, SfxItemSet &rFlySet, bool /*bOrgObjectWasReplace*/) { - ASSERT(pRecord || pFSPA, "give me something! to work with for anchoring"); + OSL_ENSURE(pRecord || pFSPA, "give me something! to work with for anchoring"); if (!pRecord && !pFSPA) return FLY_AT_PAGE; @@ -2495,7 +2495,7 @@ bool SwWW8ImplReader::IsObjectLayoutInTableCell( const UINT32 nLayoutInTableCell case 0x0000: // version 8 aka Microsoft Word 97 { bIsObjectLayoutInTableCell = false; - ASSERT( nLayoutInTableCell == 0xFFFFFFFF, + OSL_ENSURE( nLayoutInTableCell == 0xFFFFFFFF, "no explicit object attribute layout in table cell excepted." ); } break; @@ -2523,7 +2523,7 @@ bool SwWW8ImplReader::IsObjectLayoutInTableCell( const UINT32 nLayoutInTableCell break; default: { - ASSERT( false, + OSL_ENSURE( false, "unknown version." ); } } @@ -2547,7 +2547,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) WW8PLCFspecial* pPF = pPlcxMan->GetFdoa(); if( !pPF ) { - ASSERT( !this, "Where is the grapic (1) ?" ); + OSL_ENSURE( !this, "Where is the grapic (1) ?" ); return 0; } @@ -2568,7 +2568,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) WW8_FC nStartFc; void* pF0; if( !pPF->Get( nStartFc, pF0 ) ){ - ASSERT( !this, "+Wo ist die Grafik (2) ?" ); + OSL_ENSURE( !this, "+Wo ist die Grafik (2) ?" ); return 0; } @@ -2583,7 +2583,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) #endif // defined __WW8_NEEDS_COPY if( !pF->nSpId ) { - ASSERT( !this, "+Wo ist die Grafik (3) ?" ); + OSL_ENSURE( !this, "+Wo ist die Grafik (3) ?" ); return 0; } @@ -2609,7 +2609,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) if (!bOk) { - ASSERT( !this, "Where is the Shape ?" ); + OSL_ENSURE( !this, "Where is the Shape ?" ); return 0; } @@ -2688,7 +2688,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) // eingelesenes Objekt (kann eine ganze Gruppe sein) jetzt korrekt // positionieren usw. - ASSERT(!((aData.GetRecCount() != 1) && bReplaceable), + OSL_ENSURE(!((aData.GetRecCount() != 1) && bReplaceable), "Replaceable drawing with > 1 entries ?"); if (aData.GetRecCount() != 1) @@ -2709,7 +2709,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) pRecord = 0; } - ASSERT(pRecord, "how did that happen?"); + OSL_ENSURE(pRecord, "how did that happen?"); if (!pRecord) return 0; @@ -2803,7 +2803,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) pRetFrmFmt = rDoc.Insert(*pPaM, *pObject, &aFlySet, NULL); - ASSERT(pRetFrmFmt->GetAnchor().GetAnchorId() == + OSL_ENSURE(pRetFrmFmt->GetAnchor().GetAnchorId() == eAnchor, "Not the anchor type requested!"); /* @@ -2996,7 +2996,7 @@ SwFlyFrmFmt* SwWW8ImplReader::ConvertDrawTextToFly(SdrObject* &rpObject, rFlySet.Put(SvxFrameDirectionItem(FRMDIR_VERT_TOP_RIGHT, RES_FRAMEDIR)); pRetFrmFmt = rDoc.MakeFlySection(eAnchor, pPaM->GetPoint(), &rFlySet); - ASSERT(pRetFrmFmt->GetAnchor().GetAnchorId() == eAnchor, + OSL_ENSURE(pRetFrmFmt->GetAnchor().GetAnchorId() == eAnchor, "Not the anchor type requested!"); // if everything is OK, find pointer on new object and correct @@ -3202,7 +3202,7 @@ void SwWW8ImplReader::GrafikCtor() // Fuer SVDraw und VCControls und Escher rDoc.GetOrCreateDrawModel(); // <-- pDrawModel = rDoc.GetDrawModel(); - ASSERT(pDrawModel, "Kann DrawModel nicht anlegen"); + OSL_ENSURE(pDrawModel, "Kann DrawModel nicht anlegen"); pDrawPg = pDrawModel->GetPage(0); pMSDffManager = new SwMSDffManager(*this); @@ -3227,7 +3227,7 @@ void SwWW8ImplReader::GrafikDtor() void SwWW8FltAnchorStack::AddAnchor(const SwPosition& rPos, SwFrmFmt *pFmt) { - ASSERT(pFmt->GetAnchor().GetAnchorId() != FLY_AS_CHAR, + OSL_ENSURE(pFmt->GetAnchor().GetAnchorId() != FLY_AS_CHAR, "Don't use fltanchors with inline frames, slap!"); NewAttr(rPos, SwFltAnchor(pFmt)); } diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 81a26dc10f..818ac57643 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -68,7 +68,7 @@ wwZOrderer::wwZOrderer(const sw::util::SetLayer &rSetLayer, SdrPage* pDrawPg, mpShapeOrders(pShapeOrders) { mnNoInitialObjects = mpDrawPg->GetObjCount(); - ASSERT(mpDrawPg,"Missing draw page impossible!"); + OSL_ENSURE(mpDrawPg,"Missing draw page impossible!"); } void wwZOrderer::InsideEscher(ULONG nSpId) @@ -208,7 +208,7 @@ void wwZOrderer::InsertTextLayerObject(SdrObject* pObject) ++aIter; } - ASSERT(aEnd != maEscherLayer.end(), "Something very wrong here"); + OSL_ENSURE(aEnd != maEscherLayer.end(), "Something very wrong here"); if (aEnd != maEscherLayer.end()) { aEnd->mnNoInlines++; @@ -357,7 +357,7 @@ void SwWW8ImplReader::ReplaceObj(const SdrObject &rReplaceObj, } else { - ASSERT( !this, "Impossible!"); + OSL_ENSURE( !this, "Impossible!"); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 958b857edd..22a96e7545 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -293,7 +293,7 @@ SdrObject* SwMSDffManager::ImportOLE( long nOLEId, { SvStorageRef xSrc = xSrcStg->OpenSotStorage( sStorageName, STREAM_READWRITE| STREAM_SHARE_DENYALL ); - ASSERT(rReader.pFormImpl, "No Form Implementation!"); + OSL_ENSURE(rReader.pFormImpl, "No Form Implementation!"); STAR_REFERENCE( drawing::XShape ) xShape; if ( (!(rReader.bIsHeader || rReader.bIsFooter)) && rReader.pFormImpl->ReadOCXStream(xSrc,&xShape,true)) @@ -312,7 +312,7 @@ SdrObject* SwMSDffManager::ImportOLE( long nOLEId, void SwMSDffManager::DisableFallbackStream() { - ASSERT(!pFallbackStream || !pOldEscherBlipCache, + OSL_ENSURE(!pFallbackStream || !pOldEscherBlipCache, "if you're recursive, you're broken"); pFallbackStream = pStData2; pOldEscherBlipCache = pEscherBlipCache; @@ -877,9 +877,9 @@ void SwWW8ImplReader::Read_Majority( USHORT, const BYTE* , short ) void SwWW8FltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr) { - ASSERT(RES_TXTATR_FIELD != rAttr.Which(), "probably don't want to put" + OSL_ENSURE(RES_TXTATR_FIELD != rAttr.Which(), "probably don't want to put" "fields into the control stack"); - ASSERT(RES_FLTR_REDLINE != rAttr.Which(), "probably don't want to put" + OSL_ENSURE(RES_FLTR_REDLINE != rAttr.Which(), "probably don't want to put" "redlines into the control stack"); SwFltControlStack::NewAttr(rPos, rAttr); } @@ -909,7 +909,7 @@ void SwWW8FltControlStack::SetAttr(const SwPosition& rPos, USHORT nAttrId, long GetListFirstLineIndent(const SwNumFmt &rFmt) { - ASSERT( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION, + OSL_ENSURE( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION, "<GetListFirstLineIndent> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION" ); SvxAdjust eAdj = rFmt.GetNumAdjust(); @@ -926,7 +926,7 @@ long GetListFirstLineIndent(const SwNumFmt &rFmt) long lcl_GetTrueMargin(const SvxLRSpaceItem &rLR, const SwNumFmt &rFmt, long &rFirstLinePos) { - ASSERT( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION, + OSL_ENSURE( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION, "<lcl_GetTrueMargin> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION" ); const long nBodyIndent = rLR.GetTxtLeft(); @@ -1055,7 +1055,7 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, } break; case RES_TXTATR_FIELD: - ASSERT(!this, "What is a field doing in the control stack," + OSL_ENSURE(!this, "What is a field doing in the control stack," "probably should have been in the endstack"); break; case RES_TXTATR_INETFMT: @@ -1221,7 +1221,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos, break; default: case RES_FLTR_BOOKMARK: - ASSERT(!this, "EndStck used with non field, not what we want"); + OSL_ENSURE(!this, "EndStck used with non field, not what we want"); SwFltEndStack::SetAttrInDoc(rTmpPos, pEntry); break; } @@ -1768,7 +1768,7 @@ void SwWW8ImplReader::Read_HdFtTextAsHackedFrame(long nStart, long nLen, SwFrmFmt &rHdFtFmt, sal_uInt16 nPageWidth) { const SwNodeIndex* pSttIdx = rHdFtFmt.GetCntnt().GetCntntIdx(); - ASSERT(pSttIdx, "impossible"); + OSL_ENSURE(pSttIdx, "impossible"); if (!pSttIdx) return; @@ -1785,7 +1785,7 @@ void SwWW8ImplReader::Read_HdFtTextAsHackedFrame(long nStart, long nLen, // --> OD 2005-02-28 #i43427# - send frame for header/footer into background. pFrame->SetFmtAttr( SvxOpaqueItem( RES_OPAQUE, false ) ); SdrObject* pFrmObj = CreateContactObject( pFrame ); - ASSERT( pFrmObj, + OSL_ENSURE( pFrmObj, "<SwWW8ImplReader::Read_HdFtTextAsHackedFrame(..)> - missing SdrObject instance" ); if ( pFrmObj ) { @@ -1959,7 +1959,7 @@ void wwSectionManager::SetHdFt(wwSection &rSection, int nSect, if (!rSection.maSep.grpfIhdt) return; - ASSERT(rSection.mpPage, "makes no sense to call with a main page"); + OSL_ENSURE(rSection.mpPage, "makes no sense to call with a main page"); if (rSection.mpPage) { mrReader.Read_HdFt(false, nSect, pPrevious ? pPrevious->mpPage : 0, @@ -2119,7 +2119,7 @@ void SwWW8ImplReader::EndSpecial() if (maApos[0] == true) StopApo(); - ASSERT(!nInTable, "unclosed table!"); + OSL_ENSURE(!nInTable, "unclosed table!"); } bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) @@ -2130,7 +2130,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) rbReSync = false; - ASSERT(nInTable >= 0,"nInTable < 0!"); + OSL_ENSURE(nInTable >= 0,"nInTable < 0!"); // TabRowEnd bool bTableRowEnd = (pPlcxMan->HasParaSprm(bVer67 ? 25 : 0x2417) != 0 ); @@ -2455,7 +2455,7 @@ sal_Size Custom8BitToUnicode(rtl_TextToUnicodeConverter hConverter, pOut+nDestChars, nOutLen-nDestChars, nFlags, &nInfo, &nThisConverted); - ASSERT(nInfo == 0, "A character conversion failed!"); + OSL_ENSURE(nInfo == 0, "A character conversion failed!"); nConverted += nThisConverted; @@ -2532,7 +2532,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs) nLen = writer_cast<xub_StrLen>(nEnd - rPos); else nLen = STRING_MAXLEN-1; - ASSERT(nLen, "String is 0"); + OSL_ENSURE(nLen, "String is 0"); if (!nLen) return true; @@ -2602,7 +2602,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs) aTest[0] = static_cast< sal_Char >((nUCode & 0xFF00) >> 8); aTest[1] = static_cast< sal_Char >(nUCode & 0x00FF); String aTemp(aTest, 2, eSrcCJKCharSet); - ASSERT(aTemp.Len() == 1, "so much for that theory"); + OSL_ENSURE(aTemp.Len() == 1, "so much for that theory"); *pWork = aTemp.GetChar(0); } else @@ -2864,7 +2864,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) if (!pResult) { cInsert = ' '; - ASSERT(!bObj && !bEmbeddObj && !nObjLocFc, + OSL_ENSURE(!bObj && !bEmbeddObj && !nObjLocFc, "WW8: Please report this document, it may have a " "missing graphic"); } @@ -2984,20 +2984,20 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTxtPos, bool& rbStartLine) long nSkipChars = 0; WW8PLCFManResult aRes; - ASSERT(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); + OSL_ENSURE(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); bool bStartAttr = pPlcxMan->Get(&aRes); // hole Attribut-Pos aRes.nAktCp = rTxtPos; // Akt. Cp-Pos bool bNewSection = (aRes.nFlags & MAN_MASK_NEW_SEP) && !bIgnoreText; if ( bNewSection ) // neue Section { - ASSERT(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); + OSL_ENSURE(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); // PageDesc erzeugen und fuellen maSectionManager.CreateSep(rTxtPos, bPgSecBreak); // -> 0xc war ein Sectionbreak, aber // kein Pagebreak; bPgSecBreak = false; // PageDesc erzeugen und fuellen - ASSERT(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); + OSL_ENSURE(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); } // neuer Absatz ueber Plcx.Fkp.papx @@ -3174,7 +3174,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) while ( l<nStartCp+nTextLen ) { ReadAttrs( nNext, l, bStartLine );// behandelt auch Section-Breaks - ASSERT(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); + OSL_ENSURE(pPaM->GetNode()->GetTxtNode(), "Missing txtnode"); if (mpPostProcessAttrsInfo != NULL) PostProcessAttrs(); @@ -3437,7 +3437,7 @@ void SwWW8ImplReader::DeleteStk(SwFltControlStack* pStck) } else { - ASSERT( !this, "WW-Stack bereits geloescht" ); + OSL_ENSURE( !this, "WW-Stack bereits geloescht" ); } } @@ -3508,7 +3508,7 @@ void wwSectionManager::SetUseOn(wwSection &rSection) if (!bEven) eUse = (UseOnPage)(eUse | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE); - ASSERT(rSection.mpPage, "Makes no sense to call me with no pages to set"); + OSL_ENSURE(rSection.mpPage, "Makes no sense to call me with no pages to set"); if (rSection.mpPage) rSection.mpPage->WriteUseOn(eUse); if (rSection.mpTitlePage) @@ -3533,7 +3533,7 @@ void GiveNodePageDesc(SwNodeIndex &rIdx, const SwFmtPageDesc &rPgDesc, SwTable& rTable = rIdx.GetNode().GetTableNode()->GetTable(); SwFrmFmt* pApply = rTable.GetFrmFmt(); - ASSERT(pApply, "impossible"); + OSL_ENSURE(pApply, "impossible"); if (pApply) pApply->SetFmtAttr(rPgDesc); } @@ -3568,7 +3568,7 @@ SwFmtPageDesc wwSectionManager::SetSwFmtPageDesc(mySegIter &rIter, , 0, false); rIter->mpTitlePage = &mrReader.rDoc._GetPageDesc(nPos); } - ASSERT(rIter->mpTitlePage, "no page!"); + OSL_ENSURE(rIter->mpTitlePage, "no page!"); if (!rIter->mpTitlePage) return aEmpty; @@ -3588,7 +3588,7 @@ SwFmtPageDesc wwSectionManager::SetSwFmtPageDesc(mySegIter &rIter, rIter->mpTitlePage, false); rIter->mpPage = &mrReader.rDoc._GetPageDesc(nPos); } - ASSERT(rIter->mpPage, "no page!"); + OSL_ENSURE(rIter->mpPage, "no page!"); if (!rIter->mpPage) return aEmpty; @@ -3632,6 +3632,14 @@ void wwSectionManager::InsertSegments() mySegIter aStart = maSegments.begin(); for (mySegIter aIter = aStart; aIter != aEnd; ++aIter) { + // If the section is of type "New column" (0x01), then simply insert a column break + if ( aIter->maSep.bkc == 1 ) + { + SwPaM start( aIter->maStart ); + mrReader.rDoc.InsertPoolItem( start, SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK), 0); + continue; + } + mySegIter aNext = aIter+1; mySegIter aPrev = (aIter == aStart) ? aIter : aIter-1; @@ -3643,11 +3651,12 @@ void wwSectionManager::InsertSegments() bool bInsertSection = (aIter != aStart) ? (aIter->IsContinous() && bThisAndPreviousAreCompatible): false; bool bInsertPageDesc = !bInsertSection; bool bProtected = SectionIsProtected(*aIter); // do we really need this ?? I guess I have a different logic in editshell which disales this... - if (bUseEnhFields && mrReader.pWDop->fProtEnabled && aIter->IsNotProtected()) { - // here we have the special case that the whole document is protected, with the execption of this section. - // I want to address this when I do the section rework, so for the moment we disable the overall protection then... - mrReader.rDoc.set(IDocumentSettingAccess::PROTECT_FORM, false ); - } + if (bUseEnhFields && mrReader.pWDop->fProtEnabled && aIter->IsNotProtected()) + { + // here we have the special case that the whole document is protected, with the execption of this section. + // I want to address this when I do the section rework, so for the moment we disable the overall protection then... + mrReader.rDoc.set(IDocumentSettingAccess::PROTECT_FORM, false ); + } if (bInsertPageDesc) @@ -4501,7 +4510,7 @@ ULONG SwWW8ImplReader::SetSubStreams(SvStorageStreamRef &rTableStream, case 8: if(!pStg) { - ASSERT( pStg, "Version 8 muss immer einen Storage haben!" ); + OSL_ENSURE( pStg, "Version 8 muss immer einen Storage haben!" ); nErrRet = ERR_SWG_READ_ERROR; break; } @@ -4526,7 +4535,7 @@ ULONG SwWW8ImplReader::SetSubStreams(SvStorageStreamRef &rTableStream, break; default: // Programm-Fehler! - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); nErrRet = ERR_SWG_READ_ERROR; break; } @@ -4912,7 +4921,7 @@ void SwWW8ImplReader::SetOutLineStyles() } // <-- - ASSERT(mpChosenOutlineNumRule, "Impossible"); + OSL_ENSURE(mpChosenOutlineNumRule, "Impossible"); if (mpChosenOutlineNumRule) aOutlineRule = *mpChosenOutlineNumRule; @@ -5113,7 +5122,7 @@ ULONG SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss) break; default: nErrRet = ERR_WW8_NO_WW8_FILE_ERR; - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); break; } @@ -5149,7 +5158,7 @@ ULONG WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const St nVersion = 6; else { - ASSERT(!this, "WinWord 95 Reader-Read ohne Stream"); + OSL_ENSURE(!this, "WinWord 95 Reader-Read ohne Stream"); nRet = ERR_SWG_READ_ERROR; } } @@ -5167,7 +5176,7 @@ ULONG WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const St } else { - ASSERT(!this, "WinWord 95/97 Reader-Read ohne Storage"); + OSL_ENSURE(!this, "WinWord 95/97 Reader-Read ohne Storage"); nRet = ERR_SWG_READ_ERROR; } } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 3966867d9e..5b6656181a 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -277,8 +277,8 @@ void sw::util::RedlineStack::close( const SwPosition& rPos, { if( pTabDesc && pTabDesc->getOldRedlineStack() ) { -#ifdef DBG_UTIL - ASSERT( pTabDesc->getOldRedlineStack()->close(rPos, eType), "close without open!"); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( pTabDesc->getOldRedlineStack()->close(rPos, eType), "close without open!"); #else pTabDesc->getOldRedlineStack()->close( rPos, eType ); #endif @@ -289,7 +289,7 @@ void sw::util::RedlineStack::close( const SwPosition& rPos, void wwSectionManager::SetCurrentSectionHasFootnote() { - ASSERT(!maSegments.empty(), + OSL_ENSURE(!maSegments.empty(), "should not be possible, must be at least one segment"); if (!maSegments.empty()) maSegments.back().mbHasFootnote = true; @@ -297,7 +297,7 @@ void wwSectionManager::SetCurrentSectionHasFootnote() bool wwSectionManager::CurrentSectionIsVertical() const { - ASSERT(!maSegments.empty(), + OSL_ENSURE(!maSegments.empty(), "should not be possible, must be at least one segment"); if (!maSegments.empty()) return maSegments.back().IsVertical(); @@ -306,7 +306,7 @@ bool wwSectionManager::CurrentSectionIsVertical() const bool wwSectionManager::CurrentSectionIsProtected() const { - ASSERT(!maSegments.empty(), + OSL_ENSURE(!maSegments.empty(), "should not be possible, must be at least one segment"); if (!maSegments.empty()) return SectionIsProtected(maSegments.back()); @@ -353,7 +353,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() return 0; } - ASSERT(!maFtnStack.empty(), "footnote end without start"); + OSL_ENSURE(!maFtnStack.empty(), "footnote end without start"); if (maFtnStack.empty()) return 0; @@ -378,7 +378,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() SwFmtFtn aFtn(rDesc.meType == MAN_EDN); pFN = pTxt->InsertItem(aFtn, nPos, nPos); } - ASSERT(pFN, "Probleme beim Anlegen des Fussnoten-Textes"); + OSL_ENSURE(pFN, "Probleme beim Anlegen des Fussnoten-Textes"); if (pFN) { @@ -388,7 +388,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() WW8PLCFMan* pOldPlcxMan = pPlcxMan; const SwNodeIndex* pSttIdx = ((SwTxtFtn*)pFN)->GetStartNode(); - ASSERT(pSttIdx, "Probleme beim Anlegen des Fussnoten-Textes"); + OSL_ENSURE(pSttIdx, "Probleme beim Anlegen des Fussnoten-Textes"); ((SwTxtFtn*)pFN)->SetSeqNo( rDoc.GetFtnIdxs().Count() ); @@ -400,7 +400,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() bFtEdOk = true; bFtnEdn = bOld; - ASSERT(sChar.Len()==1 && ((rDesc.mbAutoNum == (sChar.GetChar(0) == 2))), + OSL_ENSURE(sChar.Len()==1 && ((rDesc.mbAutoNum == (sChar.GetChar(0) == 2))), "footnote autonumbering must be 0x02, and everthing else must not be"); // If no automatic numbering use the following char from the main text @@ -503,7 +503,7 @@ bool SwWW8ImplReader::SearchRowEnd(WW8PLCFx_Cp_FKP* pPap, WW8_CP &rStartCp, } else { - ASSERT(!nLevel || pLevel, "sublevel without level sprm"); + OSL_ENSURE(!nLevel || pLevel, "sublevel without level sprm"); return true; // RowEnd found } } @@ -587,7 +587,7 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd, { if (!pTableDesc) { - ASSERT(pTableDesc, "What!"); + OSL_ENSURE(pTableDesc, "What!"); bTestAllowed = false; } else @@ -1475,8 +1475,8 @@ void WW8TabBandDesc::ProcessDirection(const BYTE* pParams) sal_uInt8 nEndCell = *pParams++; sal_uInt16 nCode = SVBT16ToShort(pParams); - ASSERT(nStartCell < nEndCell, "not as I thought"); - ASSERT(nEndCell < MAX_COL + 1, "not as I thought"); + OSL_ENSURE(nStartCell < nEndCell, "not as I thought"); + OSL_ENSURE(nEndCell < MAX_COL + 1, "not as I thought"); if (nStartCell > MAX_COL) return; if (nEndCell > MAX_COL + 1) @@ -1489,19 +1489,19 @@ void WW8TabBandDesc::ProcessDirection(const BYTE* pParams) void WW8TabBandDesc::ProcessSpacing(const BYTE* pParams) { BYTE nLen = pParams ? *(pParams - 1) : 0; - ASSERT(nLen == 6, "Unexpected spacing len"); + OSL_ENSURE(nLen == 6, "Unexpected spacing len"); if (nLen != 6) return; mbHasSpacing=true; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BYTE nWhichCell = *pParams; - ASSERT(nWhichCell == 0, "Expected cell to be 0!"); + OSL_ENSURE(nWhichCell == 0, "Expected cell to be 0!"); #endif ++pParams; //Skip which cell ++pParams; //unknown byte BYTE nSideBits = *pParams++; - ASSERT(nSideBits < 0x10, "Unexpected value for nSideBits"); + OSL_ENSURE(nSideBits < 0x10, "Unexpected value for nSideBits"); ++pParams; //unknown byte USHORT nValue = SVBT16ToShort( pParams ); for (int i = wwTOP; i <= wwRIGHT; i++) @@ -1523,7 +1523,7 @@ void WW8TabBandDesc::ProcessSpacing(const BYTE* pParams) case 0: break; default: - ASSERT(!this, "Impossible"); + OSL_ENSURE(!this, "Impossible"); break; } } @@ -1532,24 +1532,24 @@ void WW8TabBandDesc::ProcessSpacing(const BYTE* pParams) void WW8TabBandDesc::ProcessSpecificSpacing(const BYTE* pParams) { BYTE nLen = pParams ? *(pParams - 1) : 0; - ASSERT(nLen == 6, "Unexpected spacing len"); + OSL_ENSURE(nLen == 6, "Unexpected spacing len"); if (nLen != 6) return; BYTE nWhichCell = *pParams++; - ASSERT(nWhichCell < MAX_COL + 1, "Cell out of range in spacings"); + OSL_ENSURE(nWhichCell < MAX_COL + 1, "Cell out of range in spacings"); if (nWhichCell >= MAX_COL + 1) return; ++pParams; //unknown byte BYTE nSideBits = *pParams++; - ASSERT(nSideBits < 0x10, "Unexpected value for nSideBits"); + OSL_ENSURE(nSideBits < 0x10, "Unexpected value for nSideBits"); nOverrideSpacing[nWhichCell] |= nSideBits; - ASSERT(nOverrideSpacing[nWhichCell] < 0x10, + OSL_ENSURE(nOverrideSpacing[nWhichCell] < 0x10, "Unexpected value for nSideBits"); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 BYTE nUnknown2 = *pParams; - ASSERT(nUnknown2 == 0x3, "Unexpected value for spacing2"); + OSL_ENSURE(nUnknown2 == 0x3, "Unexpected value for spacing2"); #endif ++pParams; USHORT nValue = SVBT16ToShort( pParams ); @@ -2315,7 +2315,7 @@ void WW8TabDesc::CalcDefaults() } } - ASSERT(i,"no columns in row ?"); + OSL_ENSURE(i,"no columns in row ?"); /* #96345# @@ -2356,7 +2356,7 @@ void WW8TabDesc::CalcDefaults() bOk = false; pActBand = pFirstBand; nAktBandRow = 0; - ASSERT( pActBand, "pActBand ist 0" ); + OSL_ENSURE( pActBand, "pActBand ist 0" ); } void WW8TabDesc::SetSizePosition(SwFrmFmt* pFrmFmt) @@ -2364,7 +2364,7 @@ void WW8TabDesc::SetSizePosition(SwFrmFmt* pFrmFmt) SwFrmFmt* pApply = pFrmFmt; if (!pApply ) pApply = pTable->GetFrmFmt(); - ASSERT(pApply,"No frame"); + OSL_ENSURE(pApply,"No frame"); pApply->SetFmtAttr(aItemSet); if (pFrmFmt) { @@ -2379,7 +2379,7 @@ void WW8TabDesc::SetSizePosition(SwFrmFmt* pFrmFmt) void wwSectionManager::PrependedInlineNode(const SwPosition &rPos, const SwNode &rNode) { - ASSERT(!maSegments.empty(), + OSL_ENSURE(!maSegments.empty(), "should not be possible, must be at least one segment"); if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode)) maSegments.back().maStart = SwNodeIndex(rNode); @@ -2437,12 +2437,12 @@ void WW8TabDesc::CreateSwTable() SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 0 ), *pTmpPos, nBands, nDefaultSwCols, eOri, 0, 0, FALSE, TRUE ); - ASSERT(pTable && pTable->GetFrmFmt(), "insert table failed"); + OSL_ENSURE(pTable && pTable->GetFrmFmt(), "insert table failed"); if (!pTable || !pTable->GetFrmFmt()) return; SwTableNode* pTableNode = pTable->GetTableNode(); - ASSERT(pTableNode, "no table node!"); + OSL_ENSURE(pTableNode, "no table node!"); if (pTableNode) { pIo->maSectionManager.PrependedInlineNode(*pIo->pPaM->GetPoint(), @@ -2547,7 +2547,7 @@ void WW8TabDesc::UseSwTable() pTblNd = (SwTableNode*)(*pTabLines)[0]->GetTabBoxes()[0]-> GetSttNd()->FindTableNode(); - ASSERT( pTblNd, "wo ist mein TabellenNode" ); + OSL_ENSURE( pTblNd, "wo ist mein TabellenNode" ); // --> mloiseleur 2007-10-10 #i69519# Restrict rows to repeat to a decent value if ( nRowsToRepeat == static_cast<USHORT>(nRows) ) @@ -2587,7 +2587,7 @@ void WW8TabDesc::MergeCells() // // ggfs. eine neue Merge-Gruppe beginnen // - ASSERT(nRow < pTabLines->Count(), + OSL_ENSURE(nRow < pTabLines->Count(), "Too few lines, table ended early"); if (nRow >= pTabLines->Count()) return; @@ -2597,7 +2597,7 @@ void WW8TabDesc::MergeCells() USHORT nCol = pActBand->nTransCell[ i ]; if (!pActBand->bExist[i]) //#113434# continue; - ASSERT(nCol < pTabBoxes->Count(), + OSL_ENSURE(nCol < pTabBoxes->Count(), "Too few columns, table ended early"); if (nCol >= pTabBoxes->Count()) return; @@ -2728,7 +2728,7 @@ void WW8TabDesc::ParkPaM() void WW8TabDesc::MoveOutsideTable() { - ASSERT(pTmpPos && pIo, "I've forgotten where the table is anchored"); + OSL_ENSURE(pTmpPos && pIo, "I've forgotten where the table is anchored"); if (pTmpPos && pIo) *pIo->pPaM->GetPoint() = *pTmpPos; } @@ -2861,7 +2861,7 @@ bool WW8TabDesc::InFirstParaInCell() const //e.g. #i19718# if (!pTabBox || !pTabBox->GetSttNd()) { - ASSERT(false, "Problem with table"); + OSL_ENSURE(false, "Problem with table"); return false; } @@ -2876,7 +2876,7 @@ bool WW8TabDesc::InFirstParaInCell() const void WW8TabDesc::StartMiserableHackForUnsupportedDirection(short nWwCol) { - ASSERT(pActBand, "Impossible"); + OSL_ENSURE(pActBand, "Impossible"); if (pActBand && pActBand->maDirections[nWwCol] == 3) { pIo->pCtrlStck->NewAttr(*pIo->pPaM->GetPoint(), @@ -2886,20 +2886,20 @@ void WW8TabDesc::StartMiserableHackForUnsupportedDirection(short nWwCol) void WW8TabDesc::EndMiserableHackForUnsupportedDirection(short nWwCol) { - ASSERT(pActBand, "Impossible"); + OSL_ENSURE(pActBand, "Impossible"); if (pActBand && pActBand->maDirections[nWwCol] == 3) pIo->pCtrlStck->SetAttr(*pIo->pPaM->GetPoint(), RES_CHRATR_ROTATE); } bool WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) { - ASSERT( pActBand, "pActBand ist 0" ); + OSL_ENSURE( pActBand, "pActBand ist 0" ); USHORT nCol = pActBand->nTransCell[nWwCol]; if ((USHORT)nAktRow >= pTabLines->Count()) { - ASSERT(!this, "Actual row bigger than expected." ); + OSL_ENSURE(!this, "Actual row bigger than expected." ); if (bPam) MoveOutsideTable(); return false; @@ -2934,7 +2934,7 @@ bool WW8TabDesc::SetPamInCell(short nWwCol, bool bPam) pTabBox = (*pTabBoxes)[nCol]; if( !pTabBox->GetSttNd() ) { - ASSERT(pTabBox->GetSttNd(), "Probleme beim Aufbau der Tabelle"); + OSL_ENSURE(pTabBox->GetSttNd(), "Probleme beim Aufbau der Tabelle"); if (bPam) MoveOutsideTable(); return false; @@ -3101,7 +3101,7 @@ SvxFrameDirection MakeDirection(sal_uInt16 nCode, BOOL bIsBiDi) switch (nCode) { default: - ASSERT(eDir == 4, "unknown direction code, maybe its a bitfield"); + OSL_ENSURE(eDir == 4, "unknown direction code, maybe its a bitfield"); case 3: // --> FME/Alan Yaniger: 2006-09-15 #i38158# Consider RTL tables: eDir = bIsBiDi ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP; @@ -3164,8 +3164,8 @@ void WW8TabDesc::AdjustNewBand() InsertCells( pActBand->nSwCols - nDefaultSwCols ); SetPamInCell( 0, false); - ASSERT( pTabBoxes && pTabBoxes->Count() == (USHORT)pActBand->nSwCols, - "Falsche Spaltenzahl in Tabelle" ) + OSL_ENSURE( pTabBoxes && pTabBoxes->Count() == (USHORT)pActBand->nSwCols, + "Falsche Spaltenzahl in Tabelle" ); if( bClaimLineFmt ) { @@ -3298,7 +3298,7 @@ void WW8TabDesc::TableCellEnd() nAktCol = 0; nAktRow++; nAktBandRow++; - ASSERT( pActBand , "pActBand ist 0" ); + OSL_ENSURE( pActBand , "pActBand ist 0" ); if( pActBand ) { if( nAktRow >= nRows ) // am Tabellenende gibt's nichts sinnvolles @@ -3309,7 +3309,7 @@ void WW8TabDesc::TableCellEnd() { // neues Band noetig ? pActBand = pActBand->pNextBand; // nAktBandRow = 0; - ASSERT( pActBand, "pActBand ist 0" ); + OSL_ENSURE( pActBand, "pActBand ist 0" ); AdjustNewBand(); } else @@ -3476,7 +3476,7 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp) int nNewInTable = nInTable + 1; if (InEqualApo(nNewInTable)) { - ASSERT(pSFlyPara->pFlyFmt, + OSL_ENSURE(pSFlyPara->pFlyFmt, "how could we be in a local apo and have no apo"); } @@ -3494,7 +3494,7 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp) aItemSet.Put( aAnchor ); pTableDesc->pFlyFmt = rDoc.MakeFlySection( eAnchor, pTableDesc->pParentPos, &aItemSet); - ASSERT( pTableDesc->pFlyFmt->GetAnchor().GetAnchorId() == eAnchor, + OSL_ENSURE( pTableDesc->pFlyFmt->GetAnchor().GetAnchorId() == eAnchor, "Not the anchor type requested!" ); // <-- MoveInsideFly(pTableDesc->pFlyFmt); @@ -3630,7 +3630,7 @@ void SwWW8ImplReader::StopTable() { maTracer.LeaveEnvironment(sw::log::eTable); - ASSERT(pTableDesc, "Panic, stop table with no table!"); + OSL_ENSURE(pTableDesc, "Panic, stop table with no table!"); if (!pTableDesc) return; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index bbf36bfbc7..b86545ed69 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -224,7 +224,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeNoTextFieldBookmark( *pPaM, aBookmarkName, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_FORMCHECKBOX )) ) ); - ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + OSL_ENSURE(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); if (pFieldmark!=NULL) { IFieldmark::parameter_map_t* const pParameters = pFieldmark->GetParameters(); ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(pFieldmark); @@ -297,7 +297,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, String& rStr) IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeNoTextFieldBookmark( *pPaM, aBookmarkName, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_FORMDROPDOWN )) ) ); - ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + OSL_ENSURE(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); if ( pFieldmark != NULL ) { uno::Sequence< ::rtl::OUString > vListEntries(aFormula.maListEntries.size()); @@ -628,7 +628,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, } } } - ASSERT(bDone, "tab setting in numbering is " + OSL_ENSURE(bDone, "tab setting in numbering is " "of unexpected configuration"); } if ( rNumFmt.GetPositionAndSpaceMode() == @@ -872,7 +872,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, break; default: // undefied value - ASSERT( !this, "Value of aLVL.nAlign is not supported" ); + OSL_ENSURE( !this, "Value of aLVL.nAlign is not supported" ); // take default eAdj = SVX_ADJUST_LEFT; break; @@ -1289,7 +1289,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) // 2.2.1 eine neue NumRule fuer diese Liste anlegen // SwNumRule* pParentNumRule = pLFOInfo->pNumRule; - ASSERT(pParentNumRule, "ww: Impossible lists, please report"); + OSL_ENSURE(pParentNumRule, "ww: Impossible lists, please report"); if( !pParentNumRule ) break; // Nauemsprefix aufbauen: fuer NumRule-Name (eventuell) @@ -1566,7 +1566,7 @@ SwNumRule* WW8ListManager::GetNumRuleForActivation(sal_uInt16 nLFOPosition, if (pLFOInfo->bOverride && nLevel < pLFOInfo->nLfoLvl) { WW8LSTInfo* pParentListInfo = GetLSTByListId(pLFOInfo->nIdLst); - ASSERT(pParentListInfo, "ww: Impossible lists, please report"); + OSL_ENSURE(pParentListInfo, "ww: Impossible lists, please report"); if (pParentListInfo && pParentListInfo->pNumRule) { const WW8LFOLVL &rOverride = pLFOInfo->maOverrides[nLevel]; @@ -1630,7 +1630,7 @@ bool SwWW8ImplReader::SetTxtFmtCollAndListLevel(const SwPaM& rRg, bRes = rDoc.SetTxtFmtColl(rRg, (SwTxtFmtColl*)rStyleInfo.pFmt) ? true : false; SwTxtNode* pTxtNode = pPaM->GetNode()->GetTxtNode(); - ASSERT( pTxtNode, "No Text-Node at PaM-Position" ); + OSL_ENSURE( pTxtNode, "No Text-Node at PaM-Position" ); // --> OD 2006-10-19 #134160# - make code robust if ( !pTxtNode ) { @@ -1715,7 +1715,7 @@ void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO, SwWW8StyInf &rStyleInf = pCollA[nStyle]; if (rStyleInf.bValid) { - ASSERT(pAktColl, "Cannot be called outside of style import"); + OSL_ENSURE(pAktColl, "Cannot be called outside of style import"); // Phase 1: Nummerierungsattribute beim Einlesen einer StyleDef if( pAktColl ) { @@ -1798,7 +1798,7 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO, { std::vector<sal_uInt8> aParaSprms; SwTxtNode* pTxtNd = pPaM->GetNode()->GetTxtNode(); - ASSERT(pTxtNd, "Kein Text-Node an PaM-Position"); + OSL_ENSURE(pTxtNd, "Kein Text-Node an PaM-Position"); const SwNumRule* pRule = bSetAttr ? pLstManager->GetNumRuleForActivation( nActLFO, nActLevel, @@ -1870,7 +1870,7 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO, RES_LR_SPACE); const SvxLRSpaceItem *pItem = (const SvxLRSpaceItem*)( GetFmtAttr(RES_LR_SPACE)); - ASSERT(pItem, "impossible"); + OSL_ENSURE(pItem, "impossible"); if (pItem) aListIndent.Put(*pItem); @@ -1897,7 +1897,7 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO, const SvxLRSpaceItem *pLR = HasItem<SvxLRSpaceItem>(aListIndent, RES_LR_SPACE); - ASSERT(pLR, "Impossible"); + OSL_ENSURE(pLR, "Impossible"); if (pLR) { pCtrlStck->NewAttr(*pPaM->GetPoint(), *pLR); @@ -2212,7 +2212,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, nChecked = false; break; default: - ASSERT(!this, "unknown option, please report to cmc"); + OSL_ENSURE(!this, "unknown option, please report to cmc"); break; } } @@ -2273,7 +2273,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, bAllOk = false; *pDataStream >> nNoStrings; } - ASSERT(bAllOk, + OSL_ENSURE(bAllOk, "Unknown formfield dropdown list structure. Report to cmc"); if (!bAllOk) //Not as expected, don't risk it at all. nNoStrings = 0; @@ -2324,7 +2324,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const String &rString, { bool bSet = true; const SfxPoolItem* pItem = GetFmtAttr( pMap->nWhichId ); - ASSERT(pItem, "Impossible"); + OSL_ENSURE(pItem, "Impossible"); if (!pItem) continue; @@ -2417,7 +2417,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const String &rString, } // now calculate the size of the control OutputDevice* pOut = Application::GetDefaultDevice(); - ASSERT(pOut, "Impossible"); + OSL_ENSURE(pOut, "Impossible"); if (pOut) { pOut->Push( PUSH_FONT | PUSH_MAPMODE ); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index e684458bf4..6a46b8f59e 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -98,7 +98,7 @@ static bool SwWw8ReadScaling(long& rX, long& rY, SvStorageRef& rSrc1) pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); pS->Seek( STREAM_SEEK_TO_END ); - ASSERT( pS->Tell() >= 76, "+OLE-PIC-Stream is shorter than 76 Byte" ); + OSL_ENSURE( pS->Tell() >= 76, "+OLE-PIC-Stream is shorter than 76 Byte" ); INT32 nOrgWidth, nOrgHeight, @@ -123,7 +123,7 @@ static bool SwWw8ReadScaling(long& rX, long& rY, SvStorageRef& rSrc1) rY = nOrgHeight - nCropTop - nCropBottom; if (10 > nScaleX || 65536 < nScaleX || 10 > nScaleY || 65536 < nScaleY) { - ASSERT( !pS, "+OLE-Scalinginformation in PIC-Stream wrong" ); + OSL_ENSURE( !pS, "+OLE-Scalinginformation in PIC-Stream wrong" ); return false; } else @@ -154,23 +154,23 @@ static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp, if( pMfp->mm == 94 || pMfp->mm == 99 ) { - ASSERT( !pSt, "+OLE: Falscher Metafile-Typ" ); + OSL_ENSURE( !pSt, "+OLE: Falscher Metafile-Typ" ); return false; } if( pMfp->mm != 8 ) { - ASSERT( !pSt, "+OLE: Falscher Metafile-Typ ( nicht Anisotropic )" ); + OSL_ENSURE( !pSt, "+OLE: Falscher Metafile-Typ ( nicht Anisotropic )" ); } if( !pMfp->xExt || !pMfp->yExt ) { - ASSERT( !pSt, "+OLE: Groesse von 0 ???" ); + OSL_ENSURE( !pSt, "+OLE: Groesse von 0 ???" ); return false; } bool bOk = ReadWindowMetafile( *pSt, rWMF, NULL ) ? true : false; // WMF lesen // *pSt >> aWMF geht nicht ohne placable Header if (!bOk || pSt->GetError() || rWMF.GetActionCount() == 0) { - ASSERT( !pSt, "+OLE: Konnte Metafile nicht lesen" ); + OSL_ENSURE( !pSt, "+OLE: Konnte Metafile nicht lesen" ); return false; } @@ -219,7 +219,7 @@ SwFlyFrmFmt* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject, const SfxItemSet &rFlySet, const SfxItemSet &rGrfSet) { SfxObjectShell *pPersist = rDoc.GetPersist(); - ASSERT(pPersist, "No persist, cannot insert objects correctly"); + OSL_ENSURE(pPersist, "No persist, cannot insert objects correctly"); if (!pPersist) return 0; @@ -252,7 +252,7 @@ SwFlyFrmFmt* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject, ::rtl::OUString sNewName; bool bSuccess = aOLEObj.TransferToDoc(sNewName); - ASSERT(bSuccess, "Insert OLE failed"); + OSL_ENSURE(bSuccess, "Insert OLE failed"); if (bSuccess) { const SfxItemSet *pFlySet = pMathFlySet ? pMathFlySet : &rFlySet; @@ -356,7 +356,7 @@ SdrObject* SwWW8ImplReader::ImportOleBase( Graphic& rGraph, const Graphic* pGrf, const SfxItemSet* pFlySet, const Rectangle& aVisArea ) { SdrObject* pRet = 0; - ASSERT( pStg, "ohne storage geht hier fast gar nichts!" ); + OSL_ENSURE( pStg, "ohne storage geht hier fast gar nichts!" ); ::SetProgressState( nProgress, rDoc.GetDocShell() ); // Update @@ -414,11 +414,11 @@ SdrObject* SwWW8ImplReader::ImportOleBase( Graphic& rGraph, { //Can't put them in headers/footers :-( uno::Reference< drawing::XShape > xRef; - ASSERT(pFormImpl, "Impossible"); + OSL_ENSURE(pFormImpl, "Impossible"); if (pFormImpl && pFormImpl->ReadOCXStream(xSrc1, &xRef, false)) { pRet = GetSdrObjectFromXShape(xRef); - ASSERT(pRet, "Impossible"); + OSL_ENSURE(pRet, "Impossible"); if (pRet) pRet->SetLogicRect(aRect); return pRet; diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index b80cdcfc7d..8076326f07 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -321,7 +321,7 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) WW8PLCFx_Book* pB = pPlcxMan->GetBook(); if( !pB ) { - ASSERT( pB, "WW8PLCFx_Book - Pointer nicht da" ); + OSL_ENSURE( pB, "WW8PLCFx_Book - Pointer nicht da" ); return 0; } @@ -564,7 +564,7 @@ bool SwWW8ImplReader::ForceFieldLanguage(SwField &rFld, USHORT nLang) const SvxLanguageItem *pLang = (const SvxLanguageItem*)GetFmtAttr(RES_CHRATR_LANGUAGE); - ASSERT(pLang, "impossible"); + OSL_ENSURE(pLang, "impossible"); USHORT nDefault = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US; if (nLang != nDefault) @@ -613,7 +613,7 @@ short SwWW8ImplReader::GetTimeDatePara(String& rStr, sal_uInt32& rFormat, } RES_CHRATR eLang = bRTL ? RES_CHRATR_CTL_LANGUAGE : RES_CHRATR_LANGUAGE; const SvxLanguageItem *pLang = (SvxLanguageItem*)GetFmtAttr( static_cast< USHORT >(eLang)); - ASSERT(pLang, "impossible"); + OSL_ENSURE(pLang, "impossible"); rLang = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US; SvNumberFormatter* pFormatter = rDoc.GetNumberFormatter(); @@ -677,14 +677,14 @@ sal_uInt16 SwWW8ImplReader::End_Field() { sal_uInt16 nRet = 0; WW8PLCFx_FLD* pF = pPlcxMan->GetFld(); - ASSERT(pF, "WW8PLCFx_FLD - Pointer nicht da"); + OSL_ENSURE(pF, "WW8PLCFx_FLD - Pointer nicht da"); if (!pF || !pF->EndPosIsFieldEnd()) return nRet; const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); - ASSERT(!maFieldStack.empty(), "Empty field stack\n"); + OSL_ENSURE(!maFieldStack.empty(), "Empty field stack\n"); if (!maFieldStack.empty()) { /* @@ -702,7 +702,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( ); IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeFieldBookmark( aFldPam, maFieldStack.back().GetBookmarkName(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMTEXT )) ) ); - ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + OSL_ENSURE(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); if (pFieldmark!=NULL) { const IFieldmark::parameter_map_t& pParametersToAdd = maFieldStack.back().getParameters(); pFieldmark->GetParameters()->insert(pParametersToAdd.begin(), pParametersToAdd.end()); @@ -719,7 +719,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() SwPosition aEndPos = *pPaM->GetPoint(); SwPaM aFldPam( maFieldStack.back().GetPtNode(), maFieldStack.back().GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex()); SwFieldBookmark *pFieldmark=(SwFieldBookmark*)rDoc.makeFieldBookmark(aFldPam, maFieldStack.back().GetBookmarkName(), maFieldStack.back().GetBookmarkType()); - ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); + OSL_ENSURE(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); if (pFieldmark!=NULL) { const IFieldmark::parameter_map_t& pParametersToAdd = maFieldStack.back().getParameters(); pFieldmark->GetParameters()->insert(pParameters.begin(), pParameters.end()); @@ -1003,11 +1003,11 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) &SwWW8ImplReader::Read_F_Shape, // 95 0 // eMax - Dummy leer Methode }; - ASSERT( ( sizeof( aWW8FieldTab ) / sizeof( *aWW8FieldTab ) == eMax+1 ), + OSL_ENSURE( ( sizeof( aWW8FieldTab ) / sizeof( *aWW8FieldTab ) == eMax+1 ), "FeldFunc-Tabelle stimmt nicht" ); WW8PLCFx_FLD* pF = pPlcxMan->GetFld(); - ASSERT(pF, "WW8PLCFx_FLD - Pointer nicht da"); + OSL_ENSURE(pF, "WW8PLCFx_FLD - Pointer nicht da"); if (!pF || !pF->StartPosIsFieldStart()) return 0; @@ -1027,7 +1027,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) WW8FieldDesc aF; bool bOk = pF->GetPara(pRes->nCp2OrIdx, aF); - ASSERT(bOk, "WW8: Bad Field!\n"); + OSL_ENSURE(bOk, "WW8: Bad Field!\n"); if (aF.nId == 33) aF.bCodeNest=false; //#124716#: do not recurse into nested page fields bool bCodeNest = aF.bCodeNest; if ( aF.nId == 6 ) bCodeNest = false; // We can handle them and loose the inner data @@ -1384,7 +1384,7 @@ the appropiate set/ask field. long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF, String &rOrigName, const String &rData) { - ASSERT(pPlcxMan,"No pPlcxMan"); + OSL_ENSURE(pPlcxMan,"No pPlcxMan"); long nNo; /* If there was no bookmark associated with this set field, then we create a @@ -1449,7 +1449,7 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pFld, String SwWW8ImplReader::GetMappedBookmark(const String &rOrigName) { String sName(BookmarkToWriter(rOrigName)); - ASSERT(pPlcxMan,"no pPlcxMan"); + OSL_ENSURE(pPlcxMan,"no pPlcxMan"); pPlcxMan->GetBook()->MapName(sName); //See if there has been a variable set with this name, if so get @@ -1908,7 +1908,7 @@ eF_ResT SwWW8ImplReader::Read_F_FileName(WW8FieldDesc*, String &rStr) aReadParam.SkipToNextToken(); break; default: - ASSERT(!this, "unknown option in FileName field"); + OSL_ENSURE(!this, "unknown option in FileName field"); break; } } @@ -2468,11 +2468,11 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, String& rStr SwSection *const pSection = rDoc.InsertSwSection(*pPaM, aSection, 0, 0, false); - ASSERT(pSection, "no section inserted"); + OSL_ENSURE(pSection, "no section inserted"); if (!pSection) return FLD_TEXT; const SwSectionNode* pSectionNode = pSection->GetFmt()->GetSectionNode(); - ASSERT(pSectionNode, "no section node!"); + OSL_ENSURE(pSectionNode, "no section node!"); if (!pSectionNode) return FLD_TEXT; @@ -3384,7 +3384,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr ) } break; default: - ASSERT(!this, "Unhandled toc options!"); + OSL_ENSURE(!this, "Unhandled toc options!"); break; } } @@ -3392,7 +3392,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr ) case TOX_USER: break; default: - ASSERT(!this, "Unhandled toc options!"); + OSL_ENSURE(!this, "Unhandled toc options!"); break; } // ToxBase fertig @@ -3440,7 +3440,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr ) //for future page/section segment insertion SwPaM aRegion(*pPaM); aRegion.Move(fnMoveBackward); - ASSERT(rDoc.GetCurTOX(*aRegion.GetPoint()), "Misunderstood how toc works"); + OSL_ENSURE(rDoc.GetCurTOX(*aRegion.GetPoint()), "Misunderstood how toc works"); if (SwTOXBase* pBase2 = (SwTOXBase*)rDoc.GetCurTOX(*aRegion.GetPoint())) { if(nIndexCols>1) @@ -3530,7 +3530,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) break; case 'h': case 'm': - ASSERT( !this, "Auswertung fehlt noch - Daten unbekannt" ); + OSL_ENSURE( !this, "Auswertung fehlt noch - Daten unbekannt" ); case 's': //worthless fake anchor option bOptions = true; break; @@ -3539,7 +3539,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) } // das Resultat uebernehmen - ASSERT((sURL.Len() || sMark.Len()), "WW8: Empty URL") + OSL_ENSURE((sURL.Len() || sMark.Len()), "WW8: Empty URL"); if( sMark.Len() ) ( sURL += INET_MARK_TOKEN ) += sMark; @@ -3600,7 +3600,7 @@ void lcl_ImportTox(SwDoc &rDoc, SwPaM &rPaM, const String &rStr, bool bIdx) break; } - ASSERT( rDoc.GetTOXTypeCount( eTox ), "Doc.GetTOXTypeCount() == 0 :-(" ); + OSL_ENSURE( rDoc.GetTOXTypeCount( eTox ), "Doc.GetTOXTypeCount() == 0 :-(" ); const SwTOXType* pT = rDoc.GetTOXType( eTox, 0 ); SwTOXMark aM( pT ); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 9fa9f82123..74bf894eb2 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -178,7 +178,7 @@ void wwSection::SetDirection() switch (maSep.wTextFlow) { default: - ASSERT(!this, "Unknown layout type"); + OSL_ENSURE(!this, "Unknown layout type"); case 0: meDir=FRMDIR_HORI_LEFT_TOP; break; @@ -253,7 +253,7 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection) eType = GRID_NONE; break; default: - ASSERT(!this, "Unknown grid type"); + OSL_ENSURE(!this, "Unknown grid type"); case 3: eType = GRID_LINES_CHARS; aGrid.SetSnapToChars(sal_True); @@ -686,7 +686,7 @@ SwSectionFmt *wwSectionManager::InsertSection( rSection.mpSection = mrReader.rDoc.InsertSwSection( rMyPaM, aSection, 0, & aSet ); - ASSERT(rSection.mpSection, "section not inserted!"); + OSL_ENSURE(rSection.mpSection, "section not inserted!"); if (!rSection.mpSection) return 0; @@ -698,7 +698,7 @@ SwSectionFmt *wwSectionManager::InsertSection( break; } - ASSERT(pPage, "no page outside this section!"); + OSL_ENSURE(pPage, "no page outside this section!"); if (!pPage) pPage = &mrReader.rDoc._GetPageDesc(0); @@ -707,7 +707,7 @@ SwSectionFmt *wwSectionManager::InsertSection( return 0; SwSectionFmt *pFmt = rSection.mpSection->GetFmt(); - ASSERT(pFmt, "impossible"); + OSL_ENSURE(pFmt, "impossible"); if (!pFmt) return 0; @@ -816,7 +816,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) return; WW8PLCFx_SEPX* pSep = mrReader.pPlcxMan->GetSepPLCF(); - ASSERT(pSep, "impossible!"); + OSL_ENSURE(pSep, "impossible!"); if (!pSep) return; @@ -933,7 +933,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) //sprmSDxaColWidth const BYTE* pSW = pSep->HasSprm( (eVer <= ww::eWW7 ? 136 : 0xF203), BYTE( i ) ); - ASSERT( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" ); + OSL_ENSURE( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" ); sal_uInt16 nWidth = pSW ? SVBT16ToShort(pSW + 1) : 1440; aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth; @@ -943,7 +943,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) //sprmSDxaColSpacing const BYTE* pSD = pSep->HasSprm( (eVer <= ww::eWW7 ? 137 : 0xF204), BYTE( i ) ); - ASSERT( pSD, "+Sprm 137 (bzw. 0xF204) (Colspacing) fehlt" ); + OSL_ENSURE( pSD, "+Sprm 137 (bzw. 0xF204) (Colspacing) fehlt" ); if( pSD ) { nWidth = SVBT16ToShort(pSD + 1); @@ -1271,7 +1271,7 @@ BYTE lcl_ReadBorders(bool bVer67, WW8_BRC* brc, WW8PLCFx_Cp_FKP* pPap, nBorder |= (_SetWW8_BRC( bVer67, brc[ i ], pSty->HasParaSprm( *pIds )))<<i; } else { - ASSERT( pSty || pPap, "WW8PLCFx_Cp_FKP and WW8RStyle " + OSL_ENSURE( pSty || pPap, "WW8PLCFx_Cp_FKP and WW8RStyle " "and WW8PLCFx_SEPX is 0" ); } } @@ -1898,7 +1898,7 @@ bool WW8FlyPara::IsEmpty() const #107103# if wrong, so given that the empty is 2, if we are 0 then set empty to 0 to make 0 equiv to 2 for empty checking */ - ASSERT(aEmpty.nSp37 == 2, "this is not what we expect for nSp37"); + OSL_ENSURE(aEmpty.nSp37 == 2, "this is not what we expect for nSp37"); if (this->nSp37 == 0) aEmpty.nSp37 = 0; if (aEmpty == *this) @@ -2336,7 +2336,7 @@ void SwWW8ImplReader::MoveInsideFly(const SwFrmFmt *pFlyFmt) // Setze Pam in den FlyFrame const SwFmtCntnt& rCntnt = pFlyFmt->GetCntnt(); - ASSERT( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." ); pPaM->GetPoint()->nNode = rCntnt.GetCntntIdx()->GetIndex() + 1; pPaM->GetPoint()->nContent.Assign( pPaM->GetCntntNode(), 0 ); @@ -2411,7 +2411,7 @@ WW8FlyPara *SwWW8ImplReader::ConstructApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos) { WW8FlyPara *pRet = 0; - ASSERT(rApo.HasFrame() || pTabPos, + OSL_ENSURE(rApo.HasFrame() || pTabPos, "If no frame found, *MUST* be in a table"); pRet = new WW8FlyPara(bVer67, rApo.mpStyleApo); @@ -2489,7 +2489,7 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, pSFlyPara->pFlyFmt = rDoc.MakeFlySection( pSFlyPara->eAnchor, pPaM->GetPoint(), &aFlySet ); - ASSERT(pSFlyPara->pFlyFmt->GetAnchor().GetAnchorId() == + OSL_ENSURE(pSFlyPara->pFlyFmt->GetAnchor().GetAnchorId() == pSFlyPara->eAnchor, "Not the anchor type requested!"); if (pSFlyPara->pFlyFmt) @@ -2559,7 +2559,7 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr) void SwWW8ImplReader::StopApo() { - ASSERT(pWFlyPara, "no pWFlyPara to close"); + OSL_ENSURE(pWFlyPara, "no pWFlyPara to close"); if (!pWFlyPara) return; if (pWFlyPara->bGrafApo) @@ -2573,8 +2573,8 @@ void SwWW8ImplReader::StopApo() { if (!pSFlyPara->pMainTextPos || !pWFlyPara) { - ASSERT( pSFlyPara->pMainTextPos, "StopApo: pMainTextPos ist 0" ); - ASSERT( pWFlyPara, "StopApo: pWFlyPara ist 0" ); + OSL_ENSURE( pSFlyPara->pMainTextPos, "StopApo: pMainTextPos ist 0" ); + OSL_ENSURE( pWFlyPara, "StopApo: pWFlyPara ist 0" ); return; } @@ -2685,7 +2685,7 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo, { if( !pWFlyPara ) { - ASSERT( pWFlyPara, " Wo ist mein pWFlyPara ? " ); + OSL_ENSURE( pWFlyPara, " Wo ist mein pWFlyPara ? " ); return true; } @@ -2716,7 +2716,7 @@ void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr, { if (pAktColl) { - ASSERT(rAttr.Which() != RES_FLTR_REDLINE, "redline in style!"); + OSL_ENSURE(rAttr.Which() != RES_FLTR_REDLINE, "redline in style!"); pAktColl->SetFmtAttr(rAttr); } else if (pAktItemSet) @@ -3024,7 +3024,7 @@ void SwWW8ImplReader::Read_BoldBiDiUsw(USHORT nId, const BYTE* pData, else nI = static_cast< BYTE >(nId - 0x085C); - ASSERT(nI <= 1, "not happening"); + OSL_ENSURE(nI <= 1, "not happening"); if (nI > 1) return; @@ -3096,7 +3096,7 @@ void SwWW8ImplReader::SetToggleBiDiAttr(BYTE nAttrId, bool bOn) } break; default: - ASSERT(!this, "Unhandled unknown bidi toggle attribute"); + OSL_ENSURE(!this, "Unhandled unknown bidi toggle attribute"); break; } @@ -3147,7 +3147,7 @@ void SwWW8ImplReader::SetToggleAttr(BYTE nAttrId, bool bOn) : STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ) ); break; default: - ASSERT(!this, "Unhandled unknown toggle attribute"); + OSL_ENSURE(!this, "Unhandled unknown toggle attribute"); break; } } @@ -3294,7 +3294,7 @@ void SwWW8ImplReader::Read_SubSuperProp( USHORT, const BYTE* pData, short nLen ) INT32 nPos2 = nPos * ( 10 * 100 ); // HalfPoints in 100 * tw const SvxFontHeightItem* pF = (const SvxFontHeightItem*)GetFmtAttr(RES_CHRATR_FONTSIZE); - ASSERT(pF, "Expected to have the fontheight available here"); + OSL_ENSURE(pF, "Expected to have the fontheight available here"); // #i59022: Check ensure nHeight != 0. Div by zero otherwise. INT32 nHeight = 240; @@ -3659,14 +3659,14 @@ bool SwWW8ImplReader::SetNewFontAttr(USHORT nFCode, bool bSetEnums, void SwWW8ImplReader::ResetCharSetVars() { - ASSERT(!maFontSrcCharSets.empty(),"no charset to remove"); + OSL_ENSURE(!maFontSrcCharSets.empty(),"no charset to remove"); if (!maFontSrcCharSets.empty()) maFontSrcCharSets.pop(); } void SwWW8ImplReader::ResetCJKCharSetVars() { - ASSERT(!maFontSrcCJKCharSets.empty(),"no charset to remove"); + OSL_ENSURE(!maFontSrcCJKCharSets.empty(),"no charset to remove"); if (!maFontSrcCJKCharSets.empty()) maFontSrcCJKCharSets.pop(); } @@ -3903,7 +3903,7 @@ void SwWW8ImplReader::Read_TxtBackColor(USHORT, const BYTE* pData, short nLen ) } else { - ASSERT(nLen == 10, "Len of para back colour not 10!"); + OSL_ENSURE(nLen == 10, "Len of para back colour not 10!"); if (nLen != 10) return; Color aColour(ExtractColour(pData, bVer67)); @@ -4263,7 +4263,7 @@ void SwWW8ImplReader::Read_UL( USHORT nId, const BYTE* pData, short nLen ) // im Style "Normal" eingefuegt, der // gar nicht da ist. Ueber das IniFlag WW8FL_NO_STY_DYA laesst sich dieses // Verhalten auch fuer andere WW-Versionen erzwingen -// ASSERT( !bStyNormal || bWWBugNormal, "+Dieses Doc deutet evtl. auf einen +// OSL_ENSURE( !bStyNormal || bWWBugNormal, "+Dieses Doc deutet evtl. auf einen // Fehler in der benutzten WW-Version hin. Wenn sich die Styles <Standard> bzw. // <Normal> zwischen WW und SW im Absatz- oder Zeilenabstand unterscheiden, // dann bitte dieses Doc SH zukommen lassen." ); @@ -4419,7 +4419,7 @@ void SwWW8ImplReader::Read_BoolItem( USHORT nId, const BYTE* pData, short nLen ) nId = RES_PARATR_SCRIPTSPACE; break; default: - ASSERT( !this, "wrong Id" ); + OSL_ENSURE( !this, "wrong Id" ); return ; } @@ -4565,14 +4565,14 @@ void SwWW8ImplReader::Read_TxtAnim(USHORT /*nId*/, const BYTE* pData, short nLen SwWW8Shade::SwWW8Shade(bool bVer67, const WW8_SHD& rSHD) { BYTE b = rSHD.GetFore(); - ASSERT(b < 17, "ww8: colour out of range"); + OSL_ENSURE(b < 17, "ww8: colour out of range"); if (b >= 17) b = 0; ColorData nFore(SwWW8ImplReader::GetCol(b)); b = rSHD.GetBack(); - ASSERT(b < 17, "ww8: colour out of range"); + OSL_ENSURE(b < 17, "ww8: colour out of range"); if( b >= 17 ) b = 0; @@ -4739,7 +4739,7 @@ void SwWW8ImplReader::Read_ParaBackColor(USHORT, const BYTE* pData, short nLen) } else { - ASSERT(nLen == 10, "Len of para back colour not 10!"); + OSL_ENSURE(nLen == 10, "Len of para back colour not 10!"); if (nLen != 10) return; NewAttr(SvxBrushItem(Color(ExtractColour(pData, bVer67)), RES_BACKGROUND)); @@ -4748,12 +4748,14 @@ void SwWW8ImplReader::Read_ParaBackColor(USHORT, const BYTE* pData, short nLen) sal_uInt32 SwWW8ImplReader::ExtractColour(const BYTE* &rpData, bool -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 bVer67 #endif ) { - ASSERT(bVer67 == false, "Impossible"); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE(bVer67 == false, "Impossible"); +#endif sal_uInt32 nFore = wwUtility::BGRToRGB(SVBT32ToUInt32(rpData)); rpData+=4; sal_uInt32 nBack = wwUtility::BGRToRGB(SVBT32ToUInt32(rpData)); @@ -4764,7 +4766,7 @@ sal_uInt32 SwWW8ImplReader::ExtractColour(const BYTE* &rpData, //background through, it merely acts like white if (nBack == 0xFF000000) nBack = COL_AUTO; - ASSERT(nBack == COL_AUTO || !(nBack & 0xFF000000), + OSL_ENSURE(nBack == COL_AUTO || !(nBack & 0xFF000000), "ww8: don't know what to do with such a transparent bg colour, report"); SwWW8Shade aShade(nFore, nBack, nIndex); return aShade.aColor.GetColor(); @@ -4931,7 +4933,7 @@ void SwWW8ImplReader::Read_AlignFont( USHORT, const BYTE* pData, short nLen ) break; default: nVal = SvxParaVertAlignItem::AUTOMATIC; - ASSERT(!this,"Unknown paragraph vertical align"); + OSL_ENSURE(!this,"Unknown paragraph vertical align"); break; } NewAttr( SvxParaVertAlignItem( nVal, RES_PARATR_VERTALIGN ) ); @@ -6233,7 +6235,7 @@ short SwWW8ImplReader::ImportSprm(const BYTE* pPos,USHORT nId) nId = mpSprmParser->GetSprmId(pPos); #if OSL_DEBUG_LEVEL > 1 - ASSERT( nId != 0xff, "Sprm FF !!!!" ); + OSL_ENSURE( nId != 0xff, "Sprm FF !!!!" ); #endif const SprmReadInfo& rSprm = GetSprmReadInfo(nId); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 51990243a5..1bcfadc539 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -40,7 +40,7 @@ #ifdef DUMP #define ERR_SWG_READ_ERROR 1234 -#define ASSERT( a, b ) +#define OSL_ENSURE( a, b ) #else // dump #include <swerror.h> // ERR_WW6_... @@ -57,7 +57,7 @@ #include <stdio.h> #define ASSERT_RET_ON_FAIL( aCon, aError, aRet ) \ - ASSERT(aCon, aError); \ + OSL_ENSURE(aCon, aError); \ if (!(aCon)) \ return aRet; @@ -784,7 +784,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher() wwSprmParser::wwSprmParser(ww::WordVersion eVersion) : meVersion(eVersion) { - ASSERT((meVersion >= ww::eWW2 && meVersion <= ww::eWW8), + OSL_ENSURE((meVersion >= ww::eWW2 && meVersion <= ww::eWW8), "Impossible value for version"); mnDelta = (ww::IsSevenMinus(meVersion)) ? 0 : 1; @@ -805,7 +805,7 @@ SprmInfo wwSprmParser::GetSprmInfo(sal_uInt16 nId) const const SprmInfo* pFound = mpKnownSprms->search(aSrch); if (pFound == 0) { - ASSERT(ww::IsEightPlus(meVersion), + OSL_ENSURE(ww::IsEightPlus(meVersion), "Unknown ww7- sprm, dangerous, report to development"); aSrch.nId = 0; @@ -1190,7 +1190,7 @@ WW8PLCFx& WW8PLCFx_PCD::operator ++( int ) if (pPcdI) (*pPcdI)++; else { - ASSERT( !this, "pPcdI fehlt"); + OSL_ENSURE( !this, "pPcdI fehlt"); } return *this; } @@ -1202,11 +1202,11 @@ WW8_FC WW8PLCFx_PCD::AktPieceStartCp2Fc( WW8_CP nCp ) if ( !pPcdI->Get(nCpStart, nCpEnd, pData) ) { - ASSERT( !this, "AktPieceStartCp2Fc() with false Cp found (1)" ); + OSL_ENSURE( !this, "AktPieceStartCp2Fc() with false Cp found (1)" ); return WW8_FC_MAX; } - ASSERT( nCp >= nCpStart && nCp < nCpEnd, + OSL_ENSURE( nCp >= nCpStart && nCp < nCpEnd, "AktPieceCp2Fc() with false Cp found (2)" ); if( nCp < nCpStart ) @@ -1240,7 +1240,7 @@ WW8_CP WW8PLCFx_PCD::AktPieceStartFc2Cp( WW8_FC nStartPos ) void* pData; if ( !pPcdI->Get( nCpStart, nCpEnd, pData ) ) { - ASSERT( !this, "AktPieceStartFc2Cp() - Fehler" ); + OSL_ENSURE( !this, "AktPieceStartFc2Cp() - Fehler" ); return WW8_CP_MAX; } bool bIsUnicode = false; @@ -1496,7 +1496,7 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const void* pData; if( !pPieceIter->Get( nCpStart, nCpEnd, pData ) ) { // ausserhalb PLCFfpcd ? - ASSERT( !this, "PLCFpcd-WW8Fc2Cp() ging schief" ); + OSL_ENSURE( !this, "PLCFpcd-WW8Fc2Cp() ging schief" ); break; } INT32 nFcStart = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc ); @@ -1571,7 +1571,7 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, if( pTestFlag ) *pTestFlag = false; else { - ASSERT( !this, "Falscher CP an WW8Cp2Fc() uebergeben" ); + OSL_ENSURE( !this, "Falscher CP an WW8Cp2Fc() uebergeben" ); } return WW8_FC_MAX; } @@ -1582,7 +1582,7 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode, if( pTestFlag ) *pTestFlag = false; else { - ASSERT( !this, "PLCFfpcd-Get ging schief" ); + OSL_ENSURE( !this, "PLCFfpcd-Get ging schief" ); } return WW8_FC_MAX; } @@ -1680,7 +1680,7 @@ WW8PLCFpcd* WW8ScannerBase::OpenPieceTable( SvStream* pStr, const WW8Fib* pWwF ) } else *pStr >> nPLCFfLen; - ASSERT( 65536 > nPLCFfLen, "PLCFfpcd ueber 64 k" ); + OSL_ENSURE( 65536 > nPLCFfLen, "PLCFfpcd ueber 64 k" ); return new WW8PLCFpcd( pStr, pStr->Tell(), nPLCFfLen, 8 ); } @@ -1814,7 +1814,7 @@ WW8ScannerBase::WW8ScannerBase( SvStream* pSt, SvStream* pTblSt, break; default: - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); break; } @@ -2250,7 +2250,7 @@ bool WW8PLCFspecial::GetData(long nInIdx, WW8_CP& rPos, void*& rpValue) const WW8PLCF::WW8PLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF, int nStruct, WW8_CP nStartPos ) : pPLCF_PosArray(0), nIdx(0), nStru(nStruct) { - ASSERT( nPLCF, "WW8PLCF: nPLCF ist Null!" ); + OSL_ENSURE( nPLCF, "WW8PLCF: nPLCF ist Null!" ); nIMax = ( nPLCF - 4 ) / ( 4 + nStruct ); @@ -2311,7 +2311,7 @@ void WW8PLCF::ReadPLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF ) pSt->Seek( nOldPos ); - ASSERT( !failure, "Document has corrupt PLCF, ignoring it" ); + OSL_ENSURE( !failure, "Document has corrupt PLCF, ignoring it" ); if (failure) MakeFailedPLCF(); @@ -2328,7 +2328,7 @@ void WW8PLCF::MakeFailedPLCF() void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN ) { - ASSERT( nIMax < ncpN, "Pcl.Fkp: Warum ist PLCF zu gross ?" ); + OSL_ENSURE( nIMax < ncpN, "Pcl.Fkp: Warum ist PLCF zu gross ?" ); bool failure = false; nIMax = ncpN; @@ -2383,7 +2383,7 @@ void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN ) } } - ASSERT( !failure, "Document has corrupt PLCF, ignoring it" ); + OSL_ENSURE( !failure, "Document has corrupt PLCF, ignoring it" ); if (failure) MakeFailedPLCF(); @@ -2658,7 +2658,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt, } break; default: - ASSERT(false, "sweet god, what have you done!"); + OSL_ENSURE(false, "sweet god, what have you done!"); break; } } @@ -2829,7 +2829,7 @@ bool WW8PLCFx_Fc_FKP::WW8Fkp::HasSprm(USHORT nId, //----------------------------------------- void WW8PLCFx::GetSprms( WW8PLCFxDesc* p ) { - ASSERT( !this, "Falsches GetSprms gerufen" ); + OSL_ENSURE( !this, "Falsches GetSprms gerufen" ); p->nStartPos = p->nEndPos = WW8_CP_MAX; p->pMemPos = 0; p->nSprmsLen = 0; @@ -2839,7 +2839,7 @@ void WW8PLCFx::GetSprms( WW8PLCFxDesc* p ) long WW8PLCFx::GetNoSprms( WW8_CP& rStart, WW8_CP& rEnd, sal_Int32& rLen ) { - ASSERT( !this, "Falsches GetNoSprms gerufen" ); + OSL_ENSURE( !this, "Falsches GetNoSprms gerufen" ); rStart = rEnd = WW8_CP_MAX; rLen = 0; return 0; @@ -2900,7 +2900,7 @@ bool WW8PLCFx_Fc_FKP::NewFkp() break; default: // Programm-Fehler! - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); return false; } @@ -3353,7 +3353,7 @@ void WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc* p) { if( !pPieceIter->Get( nCpStart, nCpEnd, pData ) ) { - ASSERT( !this, "piece iter broken!" ); + OSL_ENSURE( !this, "piece iter broken!" ); break; } bIsUnicode = false; @@ -3854,7 +3854,7 @@ WW8PLCFx& WW8PLCFx_FLD::operator ++( int ) bool WW8PLCFx_FLD::GetPara(long nIdx, WW8FieldDesc& rF) { - ASSERT( pPLCF, "Aufruf ohne Feld PLCFspecial" ); + OSL_ENSURE( pPLCF, "Aufruf ohne Feld PLCFspecial" ); if( !pPLCF ) return false; @@ -3951,7 +3951,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, UINT32 nStart, INT32 nLen, BYTE nBChar; if( nLen2 != nLen ) { - ASSERT( nLen2 == nLen, "Fib length and read length are different" ); + OSL_ENSURE( nLen2 == nLen, "Fib length and read length are different" ); if (nLen > USHRT_MAX) nLen = USHRT_MAX; else if (nLen < 2 ) @@ -4125,14 +4125,14 @@ long WW8PLCFx_Book::GetLen() const { if( nIsEnd ) { - ASSERT( !this, "Falscher Aufruf (1) von PLCF_Book::GetLen()" ); + OSL_ENSURE( !this, "Falscher Aufruf (1) von PLCF_Book::GetLen()" ); return 0; } void * p; WW8_CP nStartPos; if( !pBook[0]->Get( nStartPos, p ) ) { - ASSERT( !this, "Falscher Aufruf (2) von PLCF_Book::GetLen()" ); + OSL_ENSURE( !this, "Falscher Aufruf (2) von PLCF_Book::GetLen()" ); return 0; } USHORT nEndIdx = SVBT16ToShort( *((SVBT16*)p) ); @@ -4143,7 +4143,7 @@ long WW8PLCFx_Book::GetLen() const void WW8PLCFx_Book::SetStatus(USHORT nIndex, eBookStatus eStat ) { - ASSERT(nIndex < nIMax, "set status of non existing bookmark!"); + OSL_ENSURE(nIndex < nIMax, "set status of non existing bookmark!"); pStatus[nIndex] = (eBookStatus)( pStatus[nIndex] | eStat ); } @@ -4187,7 +4187,7 @@ String WW8PLCFx_Book::GetBookmark(long nStart,long nEnd, USHORT &nIndex) nEndIdx = SVBT16ToShort( *((SVBT16*)p) ); else { - ASSERT( !this, "Bookmark-EndIdx nicht lesbar" ); + OSL_ENSURE( !this, "Bookmark-EndIdx nicht lesbar" ); nEndIdx = i; } @@ -4244,7 +4244,7 @@ bool WW8PLCFx_Book::MapName(String& rName) nEndIdx = SVBT16ToShort( *((SVBT16*)p) ); else { - ASSERT( !this, "Bookmark-EndIdx nicht lesbar" ); + OSL_ENSURE( !this, "Bookmark-EndIdx nicht lesbar" ); nEndIdx = i; } nEndAkt = pBook[1]->GetPos( nEndIdx ); @@ -4321,7 +4321,7 @@ void WW8PLCFMan::AdjustEnds( WW8PLCFxDesc& rDesc ) void WW8PLCFxDesc::ReduceByOffset() { - ASSERT((WW8_CP_MAX == nStartPos) || (nStartPos <= nEndPos), + OSL_ENSURE((WW8_CP_MAX == nStartPos) || (nStartPos <= nEndPos), "Attr-Anfang und -Ende ueber Kreuz" ); if( nStartPos != WW8_CP_MAX ) @@ -4339,7 +4339,7 @@ void WW8PLCFxDesc::ReduceByOffset() } if( nEndPos != WW8_CP_MAX ) { - ASSERT(nCpOfs <= nEndPos, + OSL_ENSURE(nCpOfs <= nEndPos, "oh oh, so much for the subdocument piece theory"); nEndPos -= nCpOfs; } @@ -4360,7 +4360,7 @@ void WW8PLCFMan::GetNewNoSprms( WW8PLCFxDesc& rDesc ) rDesc.nCp2OrIdx = rDesc.pPLCFx->GetNoSprms(rDesc.nStartPos, rDesc.nEndPos, rDesc.nSprmsLen); - ASSERT((WW8_CP_MAX == rDesc.nStartPos) || (rDesc.nStartPos <= rDesc.nEndPos), + OSL_ENSURE((WW8_CP_MAX == rDesc.nStartPos) || (rDesc.nStartPos <= rDesc.nEndPos), "Attr-Anfang und -Ende ueber Kreuz" ); rDesc.ReduceByOffset(); @@ -4574,7 +4574,7 @@ WW8PLCFMan::~WW8PLCFMan() // 2. CP, wo ist naechste Attr.-Aenderung USHORT WW8PLCFMan::WhereIdx(bool* pbStart, long* pPos) const { - ASSERT(nPLCF,"What the hell"); + OSL_ENSURE(nPLCF,"What the hell"); long nNext = LONG_MAX; // SuchReihenfolge: USHORT nNextIdx = nPLCF;// first ending found ( CHP, PAP, ( SEP ) ), bool bStart = true; // dann Anfaenge finden ( ( SEP ), PAP, CHP ) @@ -4699,7 +4699,7 @@ void WW8PLCFMan::GetSprmEnd( short nIdx, WW8PLCFManResult* pRes ) const pRes->nSprmId = p->pIdStk->top(); // get end position else { - ASSERT( !this, "No Id on the Stack" ); + OSL_ENSURE( !this, "No Id on the Stack" ); pRes->nSprmId = 0; } } @@ -4870,7 +4870,7 @@ void WW8PLCFMan::AdvSprm(short nIdx, bool bStart) p->nSprmsLen = 0; GetNewSprms( *p ); } - ASSERT( p->nStartPos <= p->nEndPos, "Attribut ueber Kreuz" ); + OSL_ENSURE( p->nStartPos <= p->nEndPos, "Attribut ueber Kreuz" ); } } } @@ -4961,7 +4961,7 @@ bool WW8PLCFMan::Get(WW8PLCFManResult* pRes) const if( nIdx >= nPLCF ) { - ASSERT( !this, "Position not found" ); + OSL_ENSURE( !this, "Position not found" ); return true; } @@ -4999,7 +4999,7 @@ USHORT WW8PLCFMan::GetColl() const return pPap->pPLCFx->GetIstd(); else { - ASSERT( !this, "GetColl ohne PLCF_Pap" ); + OSL_ENSURE( !this, "GetColl ohne PLCF_Pap" ); return 0; } } @@ -5245,7 +5245,7 @@ WW8Fib::WW8Fib(SvStream& rSt, BYTE nWantedVersion, UINT32 nOffset) nFibMin = 0; // Programm-Fehler! nFibMax = 0; nFib = 1; - ASSERT( !this, "Es wurde vergessen, nVersion zu kodieren!" ); + OSL_ENSURE( !this, "Es wurde vergessen, nVersion zu kodieren!" ); break; } if ( (nFib < nFibMin) || (nFib > nFibMax) ) @@ -5979,7 +5979,7 @@ bool WW8Fib::Write(SvStream& rStrm) rtl_TextEncoding WW8Fib::GetFIBCharset(UINT16 chs) { - ASSERT(chs <= 0x100, "overflowed winword charset set"); + OSL_ENSURE(chs <= 0x100, "overflowed winword charset set"); rtl_TextEncoding eCharSet = (0x0100 == chs) ? RTL_TEXTENCODING_APPLE_ROMAN @@ -6183,7 +6183,7 @@ WW8_STD* WW8Style::Read1Style( short& rSkip, String* pString, short* pcbStd ) } break; default: - ASSERT(!this, "Es wurde vergessen, nVersion zu kodieren!"); + OSL_ENSURE(!this, "Es wurde vergessen, nVersion zu kodieren!"); break; } } @@ -6264,7 +6264,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) // always in ANSI, even if eStructCharSet == CHARSET_MAC !! if( rFib.lcbSttbfffn <= 2 ) { - ASSERT( !this, "Fonttabelle kaputt! (rFib.lcbSttbfffn < 2)" ); + OSL_ENSURE( !this, "Fonttabelle kaputt! (rFib.lcbSttbfffn < 2)" ); pFontA = 0; nMax = 0; return; @@ -7255,7 +7255,7 @@ USHORT WW8DopTypography::GetConvertedLang() const nLang = LANGUAGE_CHINESE_TRADITIONAL; break; default: - ASSERT(!this, "Unknown MS Asian Typography language, report"); + OSL_ENSURE(!this, "Unknown MS Asian Typography language, report"); nLang = LANGUAGE_CHINESE; break; case 0: @@ -7312,7 +7312,7 @@ USHORT wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm) nL = static_cast< USHORT >(SVBT16ToShort( &pSprm[1 + mnDelta] ) + aSprm.nLen - 1); break; default: - ASSERT(!this, "Unknown sprm varient"); + OSL_ENSURE(!this, "Unknown sprm varient"); break; } break; diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 25acb83103..cf6541fa86 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -40,7 +40,7 @@ #include <tools/datetime.hxx> #include <tools/stream.hxx> #include <tools/string.hxx> -#include <errhdl.hxx> // ASSERT() +#include <errhdl.hxx> // OSL_ENSURE() #include "hash_wrap.hxx" #include "sortedarray.hxx" diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index c9ea0bdcbc..01e2ff6e40 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -157,7 +157,7 @@ void XTextRangeOrNodeIndexPosition::SetAsNodeIndex( // SwXTextRange -> PaM SwUnoInternalPaM aPaM(*pDoc); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool bSuccess = #endif ::sw::XTextRangeToSwPaM(aPaM, rRange); @@ -175,7 +175,7 @@ void XTextRangeOrNodeIndexPosition::CopyPositionInto(SwPosition& rPos) if (NULL == pIndex) { SwUnoInternalPaM aUnoPaM(*GetDoc()); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool bSuccess = #endif ::sw::XTextRangeToSwPaM(aUnoPaM, xRange); @@ -685,9 +685,9 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) if( nPoint < pRedlineInfo->pContentIndex->GetIndex() || nPoint > pRedlineInfo->pContentIndex->GetNode().EndOfSectionIndex() ) pRedline->SetContentIdx(pRedlineInfo->pContentIndex); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 else - ASSERT( false, "Recursive change tracking" ); + OSL_ENSURE( false, "Recursive change tracking" ); #endif } diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index cebcaa634c..9e3efe4c93 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -255,7 +255,7 @@ sal_Int32 ReadThroughComponent( } else { - ASSERT( bMustBeSuccessfull, "Warnings are not supported" ); + OSL_ENSURE( bMustBeSuccessfull, "Warnings are not supported" ); return *new StringErrorInfo( ERR_FORMAT_ROWCOL, sErr, ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ); } @@ -537,7 +537,7 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S // Get service factory uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) return ERR_SWG_READ_ERROR; @@ -576,11 +576,11 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S // Get the docshell, the model, and finally the model's component SwDocShell *pDocSh = rDoc.GetDocShell(); - ASSERT( pDocSh, "XMLReader::Read: got no doc shell" ); + OSL_ENSURE( pDocSh, "XMLReader::Read: got no doc shell" ); if( !pDocSh ) return ERR_SWG_READ_ERROR; uno::Reference< lang::XComponent > xModelComp( pDocSh->GetModel(), UNO_QUERY ); - ASSERT( xModelComp.is(), + OSL_ENSURE( xModelComp.is(), "XMLReader::Read: got no model" ); if( !xModelComp.is() ) return ERR_SWG_READ_ERROR; @@ -1083,7 +1083,7 @@ USHORT XMLReader::GetSectionList( SfxMedium& rMedium, { uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); uno::Reference < embed::XStorage > xStg2; if( xServiceFactory.is() && ( xStg2 = rMedium.GetStorage() ).is() ) @@ -1101,7 +1101,7 @@ USHORT XMLReader::GetSectionList( SfxMedium& rMedium, // get parser uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ); - ASSERT( xXMLParser.is(), + OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); if( xXMLParser.is() ) { diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index ac31a6b000..e705a81bff 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -92,7 +92,7 @@ sal_uInt32 SwXMLWriter::_Write( SfxMedium* pTargetMedium ) // Get service factory uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "SwXMLWriter::Write: got no service manager" ); if( !xServiceFactory.is() ) return ERR_SWG_WRITE_ERROR; @@ -105,7 +105,7 @@ sal_uInt32 SwXMLWriter::_Write( SfxMedium* pTargetMedium ) uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; - ASSERT( xStg.is(), "Where is my storage?" ); + OSL_ENSURE( xStg.is(), "Where is my storage?" ); pGraphicHelper = SvXMLGraphicHelper::Create( xStg, GRAPHICHELPER_MODE_WRITE, sal_False ); @@ -314,7 +314,7 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, //Get model uno::Reference< lang::XComponent > xModelComp( pDoc->GetDocShell()->GetModel(), UNO_QUERY ); - ASSERT( xModelComp.is(), "XMLWriter::Write: got no model" ); + OSL_ENSURE( xModelComp.is(), "XMLWriter::Write: got no model" ); if( !xModelComp.is() ) return ERR_SWG_WRITE_ERROR; @@ -611,9 +611,9 @@ sal_Bool SwXMLWriter::WriteThroughComponent( const Sequence<Any> & rArguments, const Sequence<PropertyValue> & rMediaDesc ) { - ASSERT( xOutputStream.is(), "I really need an output stream!" ); - ASSERT( xComponent.is(), "Need component!" ); - ASSERT( NULL != pServiceName, "Need component name!" ); + OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" ); + OSL_ENSURE( xComponent.is(), "Need component!" ); + OSL_ENSURE( NULL != pServiceName, "Need component name!" ); RTL_LOGFILE_CONTEXT_AUTHOR( aFilterLog, "sw", LOGFILE_AUTHOR, "SwXMLWriter::WriteThroughComponent" ); @@ -624,7 +624,7 @@ sal_Bool SwXMLWriter::WriteThroughComponent( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "com.sun.star.xml.sax.Writer")) ), UNO_QUERY ); - ASSERT( xSaxWriter.is(), "can't instantiate XML writer" ); + OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML writer" ); if(!xSaxWriter.is()) return sal_False; @@ -644,7 +644,7 @@ sal_Bool SwXMLWriter::WriteThroughComponent( uno::Reference< document::XExporter > xExporter( rFactory->createInstanceWithArguments( OUString::createFromAscii(pServiceName), aArgs), UNO_QUERY); - ASSERT( xExporter.is(), + OSL_ENSURE( xExporter.is(), "can't instantiate export filter component" ); if( !xExporter.is() ) return sal_False; diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 345c93d948..959483b345 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -195,7 +195,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); - ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); if( !xTextTunnel.is() ) return ERR_SWG_WRITE_ERROR; @@ -221,7 +221,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) SwXText *pText = reinterpret_cast< SwXText * >( sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() ))); - ASSERT( pText, "SwXText missing" ); + OSL_ENSURE( pText, "SwXText missing" ); if( !pText ) return ERR_SWG_WRITE_ERROR; @@ -252,7 +252,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) { const SvXMLAttrContainerItem *pUnknown = PTR_CAST( SvXMLAttrContainerItem, pItem ); - ASSERT( pUnknown, "illegal attribute container item" ); + OSL_ENSURE( pUnknown, "illegal attribute container item" ); if( pUnknown && (pUnknown->GetAttrCount() > 0) ) { sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex(); @@ -412,7 +412,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) if( pEmbeddedResolver ) SvXMLEmbeddedObjectHelper::Destroy( pEmbeddedResolver ); - ASSERT( !pTableLines, "there are table columns infos left" ); + OSL_ENSURE( !pTableLines, "there are table columns infos left" ); return nRet; } @@ -452,7 +452,7 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) { Reference< XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) return; @@ -478,12 +478,12 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); - ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); if( xTextTunnel.is() ) { pText = reinterpret_cast< SwXText * >( sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId()) )); - ASSERT( pText, "SwXText missing" ); + OSL_ENSURE( pText, "SwXText missing" ); } } @@ -498,7 +498,7 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) pDoc->GetDocShell()->GetVisArea( ASPECT_CONTENT ); sal_Bool bTwip = pDoc->GetDocShell()->GetMapUnit ( ) == MAP_TWIP; - ASSERT ( bTwip, "Map unit for visible area is not in TWIPS!" ); + OSL_ENSURE( bTwip, "Map unit for visible area is not in TWIPS!" ); pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaTop") ); pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.Top() ) : rRect.Top(); @@ -574,12 +574,12 @@ void SwXMLExport::SetBodyAttributes() // export use of soft page breaks { Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); - ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); if( xTextTunnel.is() ) { SwXText *pText = reinterpret_cast< SwXText * >( sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() ))); - ASSERT( pText, "SwXText missing" ); + OSL_ENSURE( pText, "SwXText missing" ); if( pText ) { SwDoc *pDoc = pText->GetDoc(); @@ -949,7 +949,7 @@ void SwXMLExport::ExportCurPaM( sal_Bool bExportWholePaM ) aNextNumInfo.Set( *pNd ); ExportListChange( aPrevNumInfo, aNextNumInfo ); - ASSERT( !(pNd->IsGrfNode() || pNd->IsOLENode()), + OSL_ENSURE( !(pNd->IsGrfNode() || pNd->IsOLENode()), "SwXMLExport::exportCurPaM: grf or OLE node unexpected" ); if( pNd->IsTxtNode() ) { diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 1d5ce7d1bc..785852790c 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -416,7 +416,7 @@ void SwXMLTextStyleContext_Impl::Finish( sal_Bool bOverwrite ) const SwDoc *pDoc = pStyle->GetDoc(); SwTxtFmtColl *pColl = pDoc->FindTxtFmtCollByName( pStyle->GetStyleName() ); - ASSERT( pColl, "Text collection not found" ); + OSL_ENSURE( pColl, "Text collection not found" ); if( !pColl || RES_CONDTXTFMTCOLL != pColl->Which() ) return; @@ -435,7 +435,7 @@ void SwXMLTextStyleContext_Impl::Finish( sal_Bool bOverwrite ) sal_True); sName = aString; SwTxtFmtColl* pCondColl = pDoc->FindTxtFmtCollByName( sName ); - ASSERT( pCondColl, + OSL_ENSURE( pCondColl, "SwXMLItemSetStyleContext_Impl::ConnectConditions: cond coll missing" ); if( pCondColl ) { @@ -542,7 +542,7 @@ SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext( sal_uInt16 nPrefix, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - ASSERT( !pItemSet, + OSL_ENSURE( !pItemSet, "SwXMLItemSetStyleContext_Impl::CreateItemSetContext: item set exists" ); SvXMLImportContext *pContext = 0; @@ -565,7 +565,7 @@ SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext( pItemSet = new SfxItemSet( rItemPool, aTableBoxSetRange ); break; default: - ASSERT( !this, + OSL_ENSURE( !this, "SwXMLItemSetStyleContext_Impl::CreateItemSetContext: unknown family" ); break; } diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index e420044947..a18c43e320 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -83,15 +83,15 @@ void SwXMLExport::ExportFmt( const SwFmt& rFmt, enum XMLTokenEnum eFamily ) if( eFamily != XML_TOKEN_INVALID ) AddAttribute( XML_NAMESPACE_STYLE, XML_FAMILY, eFamily ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // style:parent-style-name="..." (if its not the default only) const SwFmt* pParent = rFmt.DerivedFrom(); // Parent-Namen nur uebernehmen, wenn kein Default - ASSERT( !pParent || pParent->IsDefault(), "unexpected parent" ); + OSL_ENSURE( !pParent || pParent->IsDefault(), "unexpected parent" ); - ASSERT( USHRT_MAX == rFmt.GetPoolFmtId(), "pool ids arent'supported" ); - ASSERT( USHRT_MAX == rFmt.GetPoolHelpId(), "help ids arent'supported" ); - ASSERT( USHRT_MAX == rFmt.GetPoolHelpId() || + OSL_ENSURE( USHRT_MAX == rFmt.GetPoolFmtId(), "pool ids arent'supported" ); + OSL_ENSURE( USHRT_MAX == rFmt.GetPoolHelpId(), "help ids arent'supported" ); + OSL_ENSURE( USHRT_MAX == rFmt.GetPoolHelpId() || UCHAR_MAX == rFmt.GetPoolHlpFileId(), "help file ids aren't supported" ); #endif diff --git a/sw/source/filter/xml/xmlfonte.cxx b/sw/source/filter/xml/xmlfonte.cxx index 01a6e7a43f..c86306cfa8 100644 --- a/sw/source/filter/xml/xmlfonte.cxx +++ b/sw/source/filter/xml/xmlfonte.cxx @@ -60,13 +60,13 @@ SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl( Reference < XTextDocument > xTextDoc( _rExport.GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); - ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); if( !xTextTunnel.is() ) return; SwXText *pText = reinterpret_cast< SwXText *>( sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() ))); - ASSERT( pText, "SwXText missing" ); + OSL_ENSURE( pText, "SwXText missing" ); if( !pText ) return; diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index a4ce7ea6c9..4cecf9d705 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -558,12 +558,12 @@ sal_Int64 SAL_CALL SwXMLImport::getSomething( const Sequence< sal_Int8 >& rId ) OTextCursorHelper *lcl_xml_GetSwXTextCursor( const Reference < XTextCursor >& rTextCursor ) { Reference<XUnoTunnel> xCrsrTunnel( rTextCursor, UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); if( !xCrsrTunnel.is() ) return 0; OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper *>( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); return pTxtCrsr; } @@ -688,12 +688,12 @@ void SwXMLImport::startDocument( void ) if( IMPORT_ALL == getImportFlags() ) { pTxtCrsr = lcl_xml_GetSwXTextCursor( xTextCursor ); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); if( !pTxtCrsr ) return; pDoc = pTxtCrsr->GetDoc(); - ASSERT( pDoc, "SwDoc missing" ); + OSL_ENSURE( pDoc, "SwDoc missing" ); if( !pDoc ) return; @@ -721,12 +721,12 @@ void SwXMLImport::startDocument( void ) if( !pTxtCrsr ) pTxtCrsr = lcl_xml_GetSwXTextCursor( xTextCursor ); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); if( !pTxtCrsr ) return; SwDoc *pDoc = pTxtCrsr->GetDoc(); - ASSERT( pDoc, "SwDoc missing" ); + OSL_ENSURE( pDoc, "SwDoc missing" ); if( !pDoc ) return; @@ -809,10 +809,10 @@ void SwXMLImport::endDocument( void ) { Reference<XUnoTunnel> xCrsrTunnel( GetTextImport()->GetCursor(), UNO_QUERY); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper *>( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); SwPaM *pPaM = pTxtCrsr->GetPaM(); if( IsInsertMode() && pSttNdIdx->GetIndex() ) { @@ -833,12 +833,12 @@ void SwXMLImport::endDocument( void ) pTxtNode->GetTxt().Len() ); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 // !!! This should be impossible !!!! - ASSERT( pSttNdIdx->GetIndex()+1 != + OSL_ENSURE( pSttNdIdx->GetIndex()+1 != pPaM->GetBound( sal_True ).nNode.GetIndex(), "PaM.Bound1 point to new node " ); - ASSERT( pSttNdIdx->GetIndex()+1 != + OSL_ENSURE( pSttNdIdx->GetIndex()+1 != pPaM->GetBound( sal_False ).nNode.GetIndex(), "PaM.Bound2 points to new node" ); @@ -1077,13 +1077,13 @@ void SwXMLImport::SetViewSettings(const Sequence < PropertyValue > & aViewProps) Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); - ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); if( !xTextTunnel.is() ) return; SwXText *pText = reinterpret_cast< SwXText *>( sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() ))); - ASSERT( pText, "SwXText missing" ); + OSL_ENSURE( pText, "SwXText missing" ); if( !pText ) return; @@ -1445,12 +1445,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); - ASSERT( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" ); if( xTextTunnel.is() ) { SwXText *pText = reinterpret_cast< SwXText *>( sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() ))); - ASSERT( pText, "SwXText missing" ); + OSL_ENSURE( pText, "SwXText missing" ); if( pText ) { SwDoc *pDoc = pText->GetDoc(); @@ -1695,10 +1695,10 @@ SwDoc* SwImport::GetDocFromXMLImport( SvXMLImport& rImport ) uno::Reference<lang::XUnoTunnel> xModelTunnel( rImport.GetModel(), uno::UNO_QUERY ); SwXTextDocument *pTxtDoc = reinterpret_cast< SwXTextDocument *>( sal::static_int_cast< sal_IntPtr >( xModelTunnel->getSomething(SwXTextDocument::getUnoTunnelId() ))); - ASSERT( pTxtDoc, "Where is my model?" ) - ASSERT( pTxtDoc->GetDocShell(), "Where is my shell?" ) + OSL_ENSURE( pTxtDoc, "Where is my model?" ); + OSL_ENSURE( pTxtDoc->GetDocShell(), "Where is my shell?" ); SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc(); - ASSERT( pDoc, "Where is my document?" ) + OSL_ENSURE( pDoc, "Where is my document?" ); return pDoc; } diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 4f1c6bc675..fd7fde749c 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -137,7 +137,7 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : pLines( &rLines ), nWidth( 0UL ) { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_uInt16 nEndCPos = 0U; #endif sal_uInt16 nLines = rLines.Count(); @@ -164,30 +164,26 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : if( nBox==nBoxes-1U ) { - ASSERT( nLine==0U && nWidth==0UL, + OSL_ENSURE( nLine==0U && nWidth==0UL, "parent width will be lost" ); nWidth = nCPos; } } else { -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_uInt16 nCheckPos = nCPos + (sal_uInt16)SwWriteTable::GetBoxWidth( pBox ); if( !nEndCPos ) { nEndCPos = nCheckPos; } - else - { - - } #endif nCPos = (sal_uInt16)nWidth; -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 SwXMLTableColumn_Impl aCol( (sal_uInt16)nWidth ); - ASSERT( aCols.Seek_Entry(&aCol), "couldn't find last column" ); - ASSERT( SwXMLTableColumn_Impl(nCheckPos) == + OSL_ENSURE( aCols.Seek_Entry(&aCol), "couldn't find last column" ); + OSL_ENSURE( SwXMLTableColumn_Impl(nCheckPos) == SwXMLTableColumn_Impl(nCPos), "rows have different total widths" ); #endif @@ -690,11 +686,13 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, // Und ihren Index sal_uInt16 nOldCol = nCol; SwXMLTableColumn_Impl aCol( nCPos ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool bFound = #endif pLines->GetColumns().Seek_Entry( &aCol, &nCol ); - ASSERT( bFound, "couldn't find column" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bFound, "couldn't find column" ); +#endif const SwStartNode *pBoxSttNd = pBox->GetSttNd(); if( pBoxSttNd ) @@ -980,18 +978,20 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, const sal_uInt16 nOldCol = nCol; { SwXMLTableColumn_Impl aCol( nCPos ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 const sal_Bool bFound = #endif rLines.GetColumns().Seek_Entry( &aCol, &nCol ); - ASSERT( bFound, "couldn't find column" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ENSURE( bFound, "couldn't find column" ); +#endif } // --> OD 2009-03-19 #i95726# // Some fault tolerance, if table is somehow corrupted. if ( nCol < nOldCol ) { - ASSERT( false, "table and/or table information seems to be corrupted." ); + OSL_ENSURE( false, "table and/or table information seems to be corrupted." ); if ( nBox == nBoxes - 1 ) { nCol = rLines.GetColumns().Count() - 1; @@ -1024,7 +1024,7 @@ void SwXMLExport::ExportTableLines( const SwTableLines& rLines, SwXMLTableInfo_Impl& rTblInfo, USHORT nHeaderRows ) { - ASSERT( pTableLines && pTableLines->Count(), + OSL_ENSURE( pTableLines && pTableLines->Count(), "SwXMLExport::ExportTableLines: table columns infos missing" ); if( !pTableLines || 0 == pTableLines->Count() ) return; @@ -1039,9 +1039,9 @@ void SwXMLExport::ExportTableLines( const SwTableLines& rLines, break; } } - ASSERT( pLines, + OSL_ENSURE( pLines, "SwXMLExport::ExportTableLines: table columns info missing" ); - ASSERT( 0==nInfoPos, + OSL_ENSURE( 0==nInfoPos, "SwXMLExport::ExportTableLines: table columns infos are unsorted" ); if( !pLines ) return; @@ -1212,16 +1212,16 @@ void SwXMLTextParagraphExport::exportTable( { pXTable = reinterpret_cast< SwXTextTable * >( sal::static_int_cast< sal_IntPtr >( xTableTunnel->getSomething( SwXTextTable::getUnoTunnelId() ))); - ASSERT( pXTable, "SwXTextTable missing" ); + OSL_ENSURE( pXTable, "SwXTextTable missing" ); } if( pXTable ) { SwFrmFmt *pFmt = pXTable->GetFrmFmt(); - ASSERT( pFmt, "table format missing" ); + OSL_ENSURE( pFmt, "table format missing" ); const SwTable *pTbl = SwTable::FindTable( pFmt ); - ASSERT( pTbl, "table missing" ); + OSL_ENSURE( pTbl, "table missing" ); const SwTableNode *pTblNd = pTbl->GetTableNode(); - ASSERT( pTblNd, "table node missing" ); + OSL_ENSURE( pTblNd, "table node missing" ); if( bAutoStyles ) { SwNodeIndex aIdx( *pTblNd ); diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index f81800566f..685a4e0467 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -336,7 +336,7 @@ SwXMLTableRow_Impl::SwXMLTableRow_Impl( const OUString& rStyleName, { if( pDfltCellStyleName ) aDfltCellStyleName = *pDfltCellStyleName; - ASSERT( nCells <= USHRT_MAX, + OSL_ENSURE( nCells <= USHRT_MAX, "SwXMLTableRow_Impl::SwXMLTableRow_Impl: too many cells" ); if( nCells > USHRT_MAX ) nCells = USHRT_MAX; @@ -349,18 +349,17 @@ SwXMLTableRow_Impl::SwXMLTableRow_Impl( const OUString& rStyleName, inline SwXMLTableCell_Impl *SwXMLTableRow_Impl::GetCell( sal_uInt32 nCol ) const { - ASSERT( nCol < USHRT_MAX, + OSL_ENSURE( nCol < USHRT_MAX, "SwXMLTableRow_Impl::GetCell: column number is to big" ); - // --> OD 2009-03-19 #i95726# - some fault tolerance - ASSERT( nCol < aCells.Count(), + // #i95726# - some fault tolerance + OSL_ENSURE( nCol < aCells.Count(), "SwXMLTableRow_Impl::GetCell: column number is out of bound" ); return nCol < aCells.Count() ? aCells[(sal_uInt16)nCol] : 0; - // <-- } void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, sal_Bool bOneCell ) { - ASSERT( nCells <= USHRT_MAX, + OSL_ENSURE( nCells <= USHRT_MAX, "SwXMLTableRow_Impl::Expand: too many cells" ); if( nCells > USHRT_MAX ) nCells = USHRT_MAX; @@ -374,7 +373,7 @@ void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, sal_Bool bOneCell ) nColSpan--; } - ASSERT( nCells<=aCells.Count(), + OSL_ENSURE( nCells<=aCells.Count(), "SwXMLTableRow_Impl::Expand: wrong number of cells" ); } @@ -576,7 +575,7 @@ inline void SwXMLTableCellContext_Impl::_InsertContent() inline void SwXMLTableCellContext_Impl::InsertContent() { - ASSERT( !HasContent(), "content already there" ); + OSL_ENSURE( !HasContent(), "content already there" ); bHasTextContent = sal_True; _InsertContent(); } @@ -676,10 +675,10 @@ void SwXMLTableCellContext_Impl::EndElement() // Until we have an API for copying we have to use the core. Reference<XUnoTunnel> xSrcCrsrTunnel( xSrcTxtCursor, UNO_QUERY); - ASSERT( xSrcCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xSrcCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pSrcTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xSrcCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pSrcTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pSrcTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = pSrcTxtCrsr->GetDoc(); const SwPaM *pSrcPaM = pSrcTxtCrsr->GetPaM(); @@ -689,11 +688,11 @@ void SwXMLTableCellContext_Impl::EndElement() Reference<XUnoTunnel> xDstCrsrTunnel( GetImport().GetTextImport()->GetCursor(), UNO_QUERY); - ASSERT( xDstCrsrTunnel.is(), + OSL_ENSURE( xDstCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pDstTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xDstCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )) ); - ASSERT( pDstTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pDstTxtCrsr, "SwXTextCursor missing" ); SwPaM aSrcPaM( *pSrcPaM->GetPoint(), *pSrcPaM->GetMark() ); SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() ); @@ -1358,13 +1357,13 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, const SwXTextTable *pXTable = 0; Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(), UNO_QUERY ); - ASSERT( xFactory.is(), "factory missing" ); + OSL_ENSURE( xFactory.is(), "factory missing" ); if( xFactory.is() ) { OUString sService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextTable" ) ); Reference<XInterface> xIfc = xFactory->createInstance( sService ); - ASSERT( xIfc.is(), "Couldn't create a table" ); + OSL_ENSURE( xIfc.is(), "Couldn't create a table" ); if( xIfc.is() ) xTable = Reference< XTextTable > ( xIfc, UNO_QUERY ); @@ -1396,7 +1395,7 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, { pXTable = reinterpret_cast< SwXTextTable * >( sal::static_int_cast< sal_IntPtr >( xTableTunnel->getSomething( SwXTextTable::getUnoTunnelId() ))); - ASSERT( pXTable, "SwXTextTable missing" ); + OSL_ENSURE( pXTable, "SwXTextTable missing" ); } Reference < XCellRange > xCellRange( xTable, UNO_QUERY ); @@ -1411,11 +1410,11 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, if( pXTable ) { SwFrmFmt *pTblFrmFmt = pXTable->GetFrmFmt(); - ASSERT( pTblFrmFmt, "table format missing" ); + OSL_ENSURE( pTblFrmFmt, "table format missing" ); SwTable *pTbl = SwTable::FindTable( pTblFrmFmt ); - ASSERT( pTbl, "table missing" ); + OSL_ENSURE( pTbl, "table missing" ); pTableNode = pTbl->GetTableNode(); - ASSERT( pTableNode, "table node missing" ); + OSL_ENSURE( pTableNode, "table node missing" ); pTblFrmFmt->SetName( sTblName ); @@ -1525,7 +1524,7 @@ SvXMLImportContext *SwXMLTableContext::CreateChildContext( sal_uInt16 nPrefix, void SwXMLTableContext::InsertColumn( sal_Int32 nWidth2, sal_Bool bRelWidth2, const OUString *pDfltCellStyleName ) { - ASSERT( nCurCol < USHRT_MAX, + OSL_ENSURE( nCurCol < USHRT_MAX, "SwXMLTableContext::InsertColumn: no space left" ); if( nCurCol >= USHRT_MAX ) return; @@ -1588,17 +1587,17 @@ void SwXMLTableContext::InsertCell( const OUString& rStyleName, double fValue, sal_Bool bTextValue ) { - ASSERT( nCurCol < GetColumnCount(), + OSL_ENSURE( nCurCol < GetColumnCount(), "SwXMLTableContext::InsertCell: row is full" ); - ASSERT( nCurRow < USHRT_MAX, + OSL_ENSURE( nCurRow < USHRT_MAX, "SwXMLTableContext::InsertCell: table is full" ); if( nCurCol >= USHRT_MAX || nCurRow > USHRT_MAX ) return; - ASSERT( nRowSpan >=1UL, "SwXMLTableContext::InsertCell: row span is 0" ); + OSL_ENSURE( nRowSpan >=1UL, "SwXMLTableContext::InsertCell: row span is 0" ); if( 0UL == nRowSpan ) nRowSpan = 1UL; - ASSERT( nColSpan >=1UL, "SwXMLTableContext::InsertCell: col span is 0" ); + OSL_ENSURE( nColSpan >=1UL, "SwXMLTableContext::InsertCell: col span is 0" ); if( 0UL == nColSpan ) nColSpan = 1UL; @@ -1697,7 +1696,7 @@ void SwXMLTableContext::InsertRow( const OUString& rStyleName, sal_Bool bInHead, const OUString & i_rXmlId ) { - ASSERT( nCurRow < USHRT_MAX, + OSL_ENSURE( nCurRow < USHRT_MAX, "SwXMLTableContext::InsertRow: no space left" ); if( nCurRow >= USHRT_MAX ) return; @@ -1819,7 +1818,7 @@ const SwStartNode *SwXMLTableContext::GetPrevStartNode( sal_uInt32 nRow, // <-- pSttNd = pPrevCell->GetSubTable()->GetLastStartNode(); - ASSERT( pSttNd != 0, + OSL_ENSURE( pSttNd != 0, "table corrupt" ); } @@ -2253,7 +2252,7 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, sal_Bool bSplitted = sal_False; while( !bSplitted ) { - ASSERT( nCol < nRightCol, "Zu weit gelaufen" ); + OSL_ENSURE( nCol < nRightCol, "Zu weit gelaufen" ); // Kann hinter der aktuellen HTML-Tabellen-Spalte gesplittet // werden? Wenn ja, koennte der enstehende Bereich auch noch @@ -2299,7 +2298,7 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, // --> OD 2009-03-19 #i95726# - some fault tolerance if ( pCell == 0 ) { - ASSERT( false, "table seems to be corrupt." ); + OSL_ENSURE( false, "table seems to be corrupt." ); break; } // <-- @@ -2309,22 +2308,22 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, bSplit = 1UL == pCell->GetColSpan(); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( nCol == nRightCol-1UL ) { - ASSERT( bSplit, "Split-Flag falsch" ); + OSL_ENSURE( bSplit, "Split-Flag falsch" ); if ( bHasSubTables ) { - ASSERT( !bHoriSplitMayContinue, + OSL_ENSURE( !bHoriSplitMayContinue, "HoriSplitMayContinue-Flag falsch" ); SwXMLTableCell_Impl *pTmpCell = GetCell( nTopRow, nStartCol ); - ASSERT( pTmpCell->GetRowSpan() != (nBottomRow-nTopRow) || + OSL_ENSURE( pTmpCell->GetRowSpan() != (nBottomRow-nTopRow) || !bHoriSplitPossible, "HoriSplitPossible-Flag falsch" ); } } #endif - ASSERT( !bHasSubTables || !bHoriSplitMayContinue || bHoriSplitPossible, + OSL_ENSURE( !bHasSubTables || !bHoriSplitMayContinue || bHoriSplitPossible, "bHoriSplitMayContinue, aber nicht bHoriSplitPossible" ); if( bSplit ) @@ -2383,9 +2382,9 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, // the split at the last split position we remembered. if( bHoriSplitPossible || nSplitCol > nCol+1 ) { - ASSERT( !bHoriSplitMayContinue, + OSL_ENSURE( !bHoriSplitMayContinue, "bHoriSplitMayContinue==sal_True" ); - ASSERT( bHoriSplitPossible || nSplitCol == nRightCol, + OSL_ENSURE( bHoriSplitPossible || nSplitCol == nRightCol, "bHoriSplitPossible-Flag sollte gesetzt sein" ); nSplitCol = nCol + 1UL; @@ -2396,7 +2395,7 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, bSplitted = sal_True; } - ASSERT( bHasSubTables || pBox, "Colspan trouble" ) + OSL_ENSURE( bHasSubTables || pBox, "Colspan trouble" ); if( pBox ) rBoxes.C40_INSERT( SwTableBox, pBox, rBoxes.Count() ); @@ -2681,7 +2680,7 @@ void SwXMLTableContext::MakeTable() // #i97274# handle invalid tables if (!pRows || !pRows->Count() || !GetColumnCount()) { - ASSERT(false, "invalid table: no cells; deleting..."); + OSL_ENSURE(false, "invalid table: no cells; deleting..."); pTableNode->GetDoc()->DeleteSection( pTableNode ); pTableNode = 0; pBox1 = 0; @@ -2875,10 +2874,10 @@ const SwStartNode *SwXMLTableContext::InsertTableSection( const SwStartNode *pStNd; Reference<XUnoTunnel> xCrsrTunnel( GetImport().GetTextImport()->GetCursor(), UNO_QUERY); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); if( bFirstSection ) { @@ -2896,7 +2895,7 @@ const SwStartNode *SwXMLTableContext::InsertTableSection( : pTableNode->EndOfSectionNode(); // --> OD 2007-07-02 #i78921# - make code robust #if OSL_DEBUG_LEVEL > 1 - ASSERT( pDoc, "<SwXMLTableContext::InsertTableSection(..)> - no <pDoc> at <SwXTextCursor> instance - <SwXTextCurosr> doesn't seem to be registered at a <SwUnoCrsr> instance." ); + OSL_ENSURE( pDoc, "<SwXMLTableContext::InsertTableSection(..)> - no <pDoc> at <SwXTextCursor> instance - <SwXTextCurosr> doesn't seem to be registered at a <SwUnoCrsr> instance." ); #endif if ( !pDoc ) { diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index 7c872cd9df..4a2bcfaa42 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -92,10 +92,10 @@ SwNoTxtNode *SwXMLTextParagraphExport::GetNoTxtNode( const Reference < XPropertySet >& rPropSet ) const { Reference<XUnoTunnel> xCrsrTunnel( rPropSet, UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" ); SwXFrame *pFrame = reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( SwXFrame::getUnoTunnelId() ))); - ASSERT( pFrame, "SwXFrame missing" ); + OSL_ENSURE( pFrame, "SwXFrame missing" ); SwFrmFmt *pFrmFmt = pFrame->GetFrmFmt(); const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt(); const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx(); @@ -118,7 +118,7 @@ void SwXMLTextParagraphExport::exportStyleContent( const SwDoc *pDoc = pStyle->GetDoc(); const SwTxtFmtColl *pColl = pDoc->FindTxtFmtCollByName( pStyle->GetStyleName() ); - ASSERT( pColl, "There is the text collection?" ); + OSL_ENSURE( pColl, "There is the text collection?" ); if( pColl && RES_CONDTXTFMTCOLL == pColl->Which() ) { const SwFmtCollConditions& rConditions = @@ -648,7 +648,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded( } break; default: - ASSERT( !this, "unknown object type! Base class should have been called!" ); + OSL_ENSURE( !this, "unknown object type! Base class should have been called!" ); } { @@ -660,7 +660,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded( if( (rXMLExport.getExportFlags() & EXPORT_EMBEDDED) != 0 ) { Reference < XEmbeddedObjectSupplier > xEOS( rPropSet, UNO_QUERY ); - ASSERT( xEOS.is(), "no embedded object supplier for own object" ); + OSL_ENSURE( xEOS.is(), "no embedded object supplier for own object" ); Reference < XComponent > xComp = xEOS->getEmbeddedObject(); rXMLExport.ExportEmbeddedOwnObject( xComp ); } diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index e01c1fb0ae..161e659b81 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -201,10 +201,10 @@ sal_Bool SwXMLTextImportHelper::IsInHeaderFooter() const { uno::Reference<XUnoTunnel> xCrsrTunnel( ((SwXMLTextImportHelper *)this)->GetCursor(), UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = pTxtCrsr->GetDoc(); return pDoc && pDoc->IsInHeaderFooter( pTxtCrsr->GetPaM()->GetPoint()->nNode ); @@ -219,7 +219,7 @@ SwOLENode *lcl_GetOLENode( const SwFrmFmt *pFrmFmt ) const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx(); pOLENd = pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetOLENode(); } - ASSERT( pOLENd, "Where is the OLE node" ); + OSL_ENSURE( pOLENd, "Where is the OLE node" ); return pOLENd; } @@ -245,10 +245,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( return xPropSet; uno::Reference<XUnoTunnel> xCrsrTunnel( GetCursor(), UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = SwImport::GetDocFromXMLImport( rImport ); SfxItemSet aItemSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, @@ -385,7 +385,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt(); const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx(); SwOLENode *pOLENode = pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetOLENode(); - ASSERT( pOLENode, "Where is the OLE node" ); + OSL_ENSURE( pOLENode, "Where is the OLE node" ); OUStringBuffer aBuffer( rTblName.getLength() ); sal_Bool bQuoted = sal_False; @@ -467,7 +467,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( UniReference < SvXMLImportPropertyMapper > xImpPrMap = pStyle->GetStyles() ->GetImportPropertyMapper(pStyle->GetFamily()); - ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" ); + OSL_ENSURE( xImpPrMap.is(), "Where is the import prop mapper?" ); if( xImpPrMap.is() ) { UniReference<XMLPropertySetMapper> rPropMapper = @@ -555,10 +555,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink( uno::Reference < XPropertySet > xPropSet; uno::Reference<XUnoTunnel> xCrsrTunnel( GetCursor(), UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = SwImport::GetDocFromXMLImport( rImport ); SfxItemSet aItemSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, @@ -643,10 +643,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertApplet( uno::Reference < XPropertySet > xPropSet; uno::Reference<XUnoTunnel> xCrsrTunnel( GetCursor(), UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = pTxtCrsr->GetDoc(); SfxItemSet aItemSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, @@ -688,10 +688,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertPlugin( { uno::Reference < XPropertySet > xPropSet; uno::Reference<XUnoTunnel> xCrsrTunnel( GetCursor(), UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = pTxtCrsr->GetDoc(); SfxItemSet aItemSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, @@ -770,10 +770,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra uno::Reference < XPropertySet > xPropSet; uno::Reference<XUnoTunnel> xCrsrTunnel( GetCursor(), UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - ASSERT( pTxtCrsr, "SwXTextCursor missing" ); + OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); SwDoc *pDoc = pTxtCrsr->GetDoc(); SfxItemSet aItemSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, @@ -793,7 +793,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra UniReference < SvXMLImportPropertyMapper > xImpPrMap = pStyle->GetStyles() ->GetImportPropertyMapper(pStyle->GetFamily()); - ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" ); + OSL_ENSURE( xImpPrMap.is(), "Where is the import prop mapper?" ); if( xImpPrMap.is() ) { UniReference<XMLPropertySetMapper> rPropMapper = @@ -920,10 +920,10 @@ void SwXMLTextImportHelper::endAppletOrPlugin( SolarMutexGuard aGuard; uno::Reference<XUnoTunnel> xCrsrTunnel( rPropSet, UNO_QUERY ); - ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" ); + OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" ); SwXFrame *pFrame = reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( SwXFrame::getUnoTunnelId() ))); - ASSERT( pFrame, "SwXFrame missing" ); + OSL_ENSURE( pFrame, "SwXFrame missing" ); SwFrmFmt *pFrmFmt = pFrame->GetFrmFmt(); const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt(); const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx(); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 2c0b64f4bf..c6ac31da3e 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1181,12 +1181,14 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, } } catch(Exception& -#if OSL_DEBUG_LEVEL > 0 +#if OSL_DEBUG_LEVEL > 1 aExcept #endif ) { +#if OSL_DEBUG_LEVEL > 1 OSL_ENSURE(false, ByteString(String(aExcept.Message), gsl_getSystemTextEncoding()).GetBuffer()); +#endif } } diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 7623e844fb..a3bad20429 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -1219,11 +1219,11 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) } xTempDocShell->DoClose(); -#if OSL_DEBUG_LEVEL > 0 +#if OSL_DEBUG_LEVEL > 1 sal_Int32 nTarget = -#endif rConfigItem.MoveResultSet(rInfo.nDBRow); OSL_ENSURE( nTarget == rInfo.nDBRow, "row of current document could not be selected"); +#endif OSL_ENSURE( sEMailColumn.Len(), "No email column selected"); ::rtl::OUString sEMail = lcl_GetColumnValueOf(sEMailColumn, xColAccess); SwMailDescriptor aDesc; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index af6d37b92f..1319a7d3e4 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -583,13 +583,15 @@ long AbstractMailMergeWizard_Impl::GetResult() return pDlg->GetResult(); } -#if OSL_DEBUG_LEVEL > 0 +#if OSL_DEBUG_LEVEL > 1 IMPL_LINK( AbstractMailMergeWizard_Impl, EndDialogHdl, SwMailMergeWizard*, pDialog ) #else IMPL_LINK( AbstractMailMergeWizard_Impl, EndDialogHdl, SwMailMergeWizard*, EMPTYARG ) #endif { +#if OSL_DEBUG_LEVEL > 1 OSL_ENSURE( pDialog == pDlg, "wrong dialog passed to EndDialogHdl!" ); +#endif aEndDlgHdl.Call( this ); aEndDlgHdl = Link(); diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 3afba671b0..ff68fb3679 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -138,10 +138,6 @@ #include <PostItMgr.hxx> -//TODO: This one could most probably be removed -#if defined(DBG_UTIL) && (OSL_DEBUG_LEVEL > 1) -#endif - using namespace sw::mark; using namespace ::com::sun::star; diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx index 0963cde6ad..37a0b0eeaf 100644 --- a/sw/source/ui/docvw/srcedtw.cxx +++ b/sw/source/ui/docvw/srcedtw.cxx @@ -660,13 +660,13 @@ void SwSrcEditWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff ) // optimiert das die TextEngine. USHORT nLastEnd = 0; -#if OSL_DEBUG_LEVEL > 0 - USHORT nLine = aPortionList[0].nLine; -#endif for ( USHORT i = 0; i < nCount; i++ ) { SwTextPortion& r = aPortionList[i]; +#if OSL_DEBUG_LEVEL > 1 + USHORT nLine = aPortionList[0].nLine; OSL_ENSURE( r.nLine == nLine, "doch mehrere Zeilen ?" ); +#endif if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoeben continue; diff --git a/sw/source/ui/inc/misc.hrc b/sw/source/ui/inc/misc.hrc index 72db977303..6e71237edf 100644 --- a/sw/source/ui/inc/misc.hrc +++ b/sw/source/ui/inc/misc.hrc @@ -96,6 +96,7 @@ #define MN_REDLINE_POPUP (RC_MISC_BEGIN + 61) #define STR_REMOVE_WARNING (RC_MISC_BEGIN + 62) #define STRRES_NUMTYPES (RC_MISC_BEGIN + 63) +#define STR_MY_AUTOTEXT (RC_MISC_BEGIN + 64) #define MISC_ACT_END STRRES_NUMTYPES diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index e9453332da..bdd330c850 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -742,6 +742,9 @@ void SwGlossaryDlg::Init() SvLBoxEntry* pSelEntry = 0; const String sSelStr(::GetCurrGlosGroup()->GetToken(0, GLOS_DELIM)); const sal_uInt16 nSelPath = static_cast< sal_uInt16 >(::GetCurrGlosGroup()->GetToken(1, GLOS_DELIM).ToInt32()); + // #i66304# - "My AutoText" comes from mytexts.bau, but should be translated + const String sMyAutoTextEnglish(RTL_CONSTASCII_USTRINGPARAM("My AutoText")); + const String sMyAutoTextTranslated(SW_RESSTR(STR_MY_AUTOTEXT)); for(sal_uInt16 nId = 0; nId < nCnt; ++nId ) { String sTitle; @@ -750,6 +753,8 @@ void SwGlossaryDlg::Init() continue; if(!sTitle.Len()) sTitle = sGroupName.GetToken( 0, GLOS_DELIM ); + if(sTitle == sMyAutoTextEnglish) + sTitle = sMyAutoTextTranslated; SvLBoxEntry* pEntry = aCategoryBox.InsertEntry( sTitle ); sal_uInt16 nPath = static_cast< sal_uInt16 >(sGroupName.GetToken( 1, GLOS_DELIM ).ToInt32()); diff --git a/sw/source/ui/misc/glossary.src b/sw/source/ui/misc/glossary.src index 12d6ab9e81..88f4ea0c88 100644 --- a/sw/source/ui/misc/glossary.src +++ b/sw/source/ui/misc/glossary.src @@ -372,92 +372,7 @@ InfoBox MSG_NO_GLOSSARIES Message [ en-US ] = "There is no AutoText in this file."; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +String STR_MY_AUTOTEXT +{ + Text[ en-US ] = "My AutoText"; +}; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 2fcab44ec4..3ef80c8b60 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -158,7 +158,7 @@ __EXPORT SwDrawTextShell::~SwDrawTextShell() //Dann wird vor dem Flush wieder ein DrawTextShell gepusht und der Mode ist //eingeschaltet. In diesem Moment wird der Dispatcher geflusht und die alte //DrawTextShell zerstoert. -// ASSERT( !pSdrView->IsTextEdit(), "TextEdit in DTor DrwTxtSh?" ); +// OSL_ENSURE( !pSdrView->IsTextEdit(), "TextEdit in DTor DrwTxtSh?" ); // if (pSdrView->IsTextEdit()) // GetShell().EndTextEdit(); // Danebengeklickt, Ende mit Edit diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 4cb9cb04fa..d8eb6abccd 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -1109,30 +1109,15 @@ void SwTextShell::Execute(SfxRequest &rReq) SwEditWin& rEditWin = GetView().GetEditWin(); rEditWin.SetTextColor(aSet); SwApplyTemplate* pApply = rEditWin.GetApplyTemplate(); - SvxColorItem aItem(aSet, RES_CHRATR_COLOR); - // besteht eine Selektion, wird sie gleich gefaerbt - if(!pApply && rWrtSh.HasSelection()) + // If there is a selection, then set the color on it + // otherwise, it'll be the color for the next text to be typed + if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT) { rWrtSh.SetAttr(SvxColorItem (aSet, RES_CHRATR_COLOR)); } - else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT) - { - GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_EXT); - } rReq.Done(); -/* OS 22.02.97 18:40 Das alte Verhalten ist unerwuenscht - SwEditWin& rEdtWin = GetView().GetEditWin(); - - SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - SvxColorItem aItem(aSet, RES_CHRATR_COLOR); - - if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT) - { - GetShell().SetAttr(aItem); - } -*/ } } break; diff --git a/sw/source/ui/table/swtablerep.cxx b/sw/source/ui/table/swtablerep.cxx index 478245441e..1bcd52b1e4 100644 --- a/sw/source/ui/table/swtablerep.cxx +++ b/sw/source/ui/table/swtablerep.cxx @@ -77,7 +77,7 @@ void DbgTColumn(TColumn* pTColumn, USHORT nCount) String sMsg(i); sMsg += pTColumn[i].bVisible ? " v " : " h "; sMsg += pTColumn[i].nWidth; - OSL_ENSURE(false, sMsg) + OSL_ENSURE(false, sMsg); } } #endif diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 4e02802542..8115b8ec89 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -81,8 +81,8 @@ using namespace ::com::sun::star; #ifdef DEBUG_TBLDLG void DbgTblRep(SwTableRep* pRep) { - OSL_ENSURE(false, String(pRep->GetColCount())) - OSL_ENSURE(false, String(pRep->GetAllColCount())) + OSL_ENSURE(false, String(pRep->GetColCount())); + OSL_ENSURE(false, String(pRep->GetAllColCount())); SwTwips nSum = 0; for(USHORT i = 0; i < pRep->GetAllColCount(); i++) { @@ -90,23 +90,23 @@ void DbgTblRep(SwTableRep* pRep) sMsg += pRep->GetColumns()[i].bVisible ? " v " : " h "; sMsg += pRep->GetColumns()[i].nWidth; nSum +=pRep->GetColumns()[i].nWidth; - OSL_ENSURE(false, sMsg) + OSL_ENSURE(false, sMsg); } String sMsg("Column sum: "); sMsg += nSum; sMsg += " table width: "; sMsg += pRep->GetWidth(); - OSL_ENSURE(false, sMsg) + OSL_ENSURE(false, sMsg); sMsg = "Gesamt/Links/Rechts: "; sMsg += pRep->GetSpace(); sMsg += '/'; sMsg += pRep->GetLeftSpace(); sMsg += '/'; sMsg += pRep->GetRightSpace(); - OSL_ENSURE(false, sMsg) + OSL_ENSURE(false, sMsg); sMsg = "Align: "; sMsg += pRep->GetAlign(); - OSL_ENSURE(false, sMsg) + OSL_ENSURE(false, sMsg); }; diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 3ad3fc0ab9..4088abeae7 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -157,7 +157,7 @@ SHL2OBJS= $(SLO)$/swdetect.obj \ $(SLO)$/detreg.obj \ $(SLO)$/iodetect.obj -.IF "$(dbgutil)"!="" +.IF "$(DBG_LEVEL)">="2" SHL2OBJS+= \ $(SLO)$/errhdl.obj .ENDIF |