diff options
author | Jacek Wolszczak <shutdownrunner@gmail.com> | 2010-10-07 11:02:05 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-07 11:05:26 +0100 |
commit | 05830ca7adb00846bdcc8171d622930061e3fd2b (patch) | |
tree | 909b7b8e435c895cffb5a73014d4577cbaaeae36 /starmath | |
parent | f97008a9538d3fcfb789bedff3a5deee05bcfbae (diff) |
replace DBG_ASSERT with OSL equivalents
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/accessibility.cxx | 54 | ||||
-rw-r--r-- | starmath/source/cfgitem.cxx | 34 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 78 | ||||
-rw-r--r-- | starmath/source/document.cxx | 12 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 44 | ||||
-rw-r--r-- | starmath/source/format.cxx | 2 | ||||
-rw-r--r-- | starmath/source/math_pch.cxx | 2 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 38 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 40 | ||||
-rw-r--r-- | starmath/source/mathtype.cxx | 14 | ||||
-rw-r--r-- | starmath/source/node.cxx | 104 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 52 | ||||
-rw-r--r-- | starmath/source/rect.cxx | 32 | ||||
-rw-r--r-- | starmath/source/smdetect.hxx | 2 | ||||
-rw-r--r-- | starmath/source/symbol.cxx | 10 | ||||
-rw-r--r-- | starmath/source/toolbox.cxx | 14 | ||||
-rw-r--r-- | starmath/source/types.cxx | 3 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 6 | ||||
-rw-r--r-- | starmath/source/view.cxx | 26 |
19 files changed, 284 insertions, 283 deletions
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index a364d92cd073..828523d6e07f 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -42,7 +42,7 @@ #include <com/sun/star/i18n/WordType.hpp> #include <unotools/accessiblestatesethelper.hxx> #include <comphelper/accessibleeventnotifier.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/unohelp2.hxx> @@ -121,7 +121,7 @@ SmGraphicAccessible::SmGraphicAccessible( SmGraphicWindow *pGraphicWin ) : nClientId (0), pWin (pGraphicWin) { - DBG_ASSERT( pWin, "SmGraphicAccessible: window missing" ); + OSL_ENSURE( pWin, "SmGraphicAccessible: window missing" ); } @@ -131,7 +131,7 @@ SmGraphicAccessible::SmGraphicAccessible( const SmGraphicAccessible &rSmAcc ) : nClientId (0) { pWin = rSmAcc.pWin; - DBG_ASSERT( pWin, "SmGraphicAccessible: window missing" ); + OSL_ENSURE( pWin, "SmGraphicAccessible: window missing" ); } @@ -221,7 +221,7 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getBounds() vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); return lcl_GetBounds( pWin ); } @@ -232,7 +232,7 @@ awt::Point SAL_CALL SmGraphicAccessible::getLocation() vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); awt::Rectangle aRect( lcl_GetBounds( pWin ) ); return awt::Point( aRect.X, aRect.Y ); @@ -244,7 +244,7 @@ awt::Point SAL_CALL SmGraphicAccessible::getLocationOnScreen() vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); return lcl_GetLocationOnScreen( pWin ); } @@ -255,14 +255,14 @@ awt::Size SAL_CALL SmGraphicAccessible::getSize() vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); Size aSz( pWin->GetSizePixel() ); #if OSL_DEBUG_LEVEL > 1 awt::Rectangle aRect( lcl_GetBounds( pWin ) ); Size aSz2( aRect.Width, aRect.Height ); - DBG_ASSERT( aSz == aSz2, "mismatch in width" ); + OSL_ENSURE( aSz == aSz2, "mismatch in width" ); #endif return awt::Size( aSz.Width(), aSz.Height() ); } @@ -326,7 +326,7 @@ Reference< XAccessible > SAL_CALL SmGraphicAccessible::getAccessibleParent() throw RuntimeException(); Window *pAccParent = pWin->GetAccessibleParentWindow(); - DBG_ASSERT( pAccParent, "accessible parent missing" ); + OSL_ENSURE( pAccParent, "accessible parent missing" ); return pAccParent ? pAccParent->GetAccessible() : Reference< XAccessible >(); } @@ -525,8 +525,8 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde if (pNode) { sal_Int32 nAccIndex = pNode->GetAccessibleIndex(); - DBG_ASSERT( nAccIndex >= 0, "invalid accessible index" ); - DBG_ASSERT( nIndex >= nAccIndex, "index out of range" ); + OSL_ENSURE( nAccIndex >= 0, "invalid accessible index" ); + OSL_ENSURE( nIndex >= nAccIndex, "index out of range" ); String aNodeText; pNode->GetAccessibleText( aNodeText ); @@ -613,10 +613,10 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin Rectangle aRect( aTLPos, aSize ); if (aRect.IsInside( aPos )) { - DBG_ASSERT( pNode->IsVisible(), "node is not a leaf" ); + OSL_ENSURE( pNode->IsVisible(), "node is not a leaf" ); String aTxt; pNode->GetAccessibleText( aTxt ); - DBG_ASSERT( aTxt.Len(), "no accessible text available" ); + OSL_ENSURE( aTxt.Len(), "no accessible text available" ); long nNodeX = pNode->GetLeft(); @@ -629,8 +629,8 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin nRes = i; } delete[] pXAry; - DBG_ASSERT( nRes >= 0 && nRes < aTxt.Len(), "index out of range" ); - DBG_ASSERT( pNode->GetAccessibleIndex() >= 0, + OSL_ENSURE( nRes >= 0 && nRes < aTxt.Len(), "index out of range" ); + OSL_ENSURE( pNode->GetAccessibleIndex() >= 0, "invalid accessible index" ); nRes = pNode->GetAccessibleIndex() + nRes; @@ -1017,7 +1017,7 @@ String SmTextForwarder::GetText( const ESelection& rSel ) const SfxItemSet SmTextForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const { EditEngine *pEditEngine = rEditAcc.GetEditEngine(); - DBG_ASSERT( pEditEngine, "EditEngine missing" ); + OSL_ENSURE( pEditEngine, "EditEngine missing" ); if( rSel.nStartPara == rSel.nEndPara ) { sal_uInt8 nFlags = 0; @@ -1047,7 +1047,7 @@ SfxItemSet SmTextForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAt SfxItemSet SmTextForwarder::GetParaAttribs( USHORT nPara ) const { EditEngine *pEditEngine = rEditAcc.GetEditEngine(); - DBG_ASSERT( pEditEngine, "EditEngine missing" ); + OSL_ENSURE( pEditEngine, "EditEngine missing" ); SfxItemSet aSet( pEditEngine->GetParaAttribs( nPara ) ); @@ -1176,7 +1176,7 @@ USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSe for( USHORT nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ ) { struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib ); - DBG_ASSERT( aAttrib.pAttr, "GetCharAttribs gives corrupt data" ); + OSL_ENSURE( aAttrib.pAttr, "GetCharAttribs gives corrupt data" ); const sal_Bool bEmptyPortion = aAttrib.nStart == aAttrib.nEnd; if( (!bEmptyPortion && (aAttrib.nStart >= nEndPos)) || (bEmptyPortion && (aAttrib.nStart > nEndPos)) ) @@ -1648,7 +1648,7 @@ SmEditAccessible::SmEditAccessible( SmEditWindow *pEditWin ) : pTextHelper (0), pWin (pEditWin) { - DBG_ASSERT( pWin, "SmEditAccessible: window missing" ); + OSL_ENSURE( pWin, "SmEditAccessible: window missing" ); } @@ -1657,7 +1657,7 @@ SmEditAccessible::SmEditAccessible( const SmEditAccessible &rSmAcc ) : aAccName ( String(SmResId(STR_CMDBOXWINDOW)) ) { pWin = rSmAcc.pWin; - DBG_ASSERT( pWin, "SmEditAccessible: window missing" ); + OSL_ENSURE( pWin, "SmEditAccessible: window missing" ); } SmEditAccessible::~SmEditAccessible() @@ -1667,7 +1667,7 @@ SmEditAccessible::~SmEditAccessible() void SmEditAccessible::Init() { - DBG_ASSERT( pWin, "SmEditAccessible: window missing" ); + OSL_ENSURE( pWin, "SmEditAccessible: window missing" ); if (pWin) { EditEngine *pEditEngine = pWin->GetEditEngine(); @@ -1747,7 +1747,7 @@ awt::Rectangle SAL_CALL SmEditAccessible::getBounds( ) vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); return lcl_GetBounds( pWin ); } @@ -1758,7 +1758,7 @@ awt::Point SAL_CALL SmEditAccessible::getLocation( ) vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); awt::Rectangle aRect( lcl_GetBounds( pWin ) ); return awt::Point( aRect.X, aRect.Y ); @@ -1770,7 +1770,7 @@ awt::Point SAL_CALL SmEditAccessible::getLocationOnScreen( ) vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); return lcl_GetLocationOnScreen( pWin ); } @@ -1781,14 +1781,14 @@ awt::Size SAL_CALL SmEditAccessible::getSize( ) vos::OGuard aGuard(Application::GetSolarMutex()); if (!pWin) throw RuntimeException(); - DBG_ASSERT(pWin->GetParent()->GetAccessible() == getAccessibleParent(), + OSL_ENSURE(pWin->GetParent()->GetAccessible() == getAccessibleParent(), "mismatch of window parent and accessible parent" ); Size aSz( pWin->GetSizePixel() ); #if OSL_DEBUG_LEVEL > 1 awt::Rectangle aRect( lcl_GetBounds( pWin ) ); Size aSz2( aRect.Width, aRect.Height ); - DBG_ASSERT( aSz == aSz2, "mismatch in width" ); + OSL_ENSURE( aSz == aSz2, "mismatch in width" ); #endif return awt::Size( aSz.Width(), aSz.Height() ); } @@ -1856,7 +1856,7 @@ uno::Reference< XAccessible > SAL_CALL SmEditAccessible::getAccessibleParent( ) throw RuntimeException(); Window *pAccParent = pWin->GetAccessibleParentWindow(); - DBG_ASSERT( pAccParent, "accessible parent missing" ); + OSL_ENSURE( pAccParent, "accessible parent missing" ); return pAccParent ? pAccParent->GetAccessible() : Reference< XAccessible >(); } diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 60e13afe6286..2516c100a8a5 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -302,7 +302,7 @@ void SmFontFormatList::AddFontFormat( const String &rFntFmtId, const SmFontFormat &rFntFmt ) { const SmFontFormat *pFntFmt = GetFontFormat( rFntFmtId ); - DBG_ASSERT( !pFntFmt, "FontFormatId already exists" ); + OSL_ENSURE( !pFntFmt, "FontFormatId already exists" ); if (!pFntFmt) { SmFntFmtListEntry aEntry( rFntFmtId, rFntFmt ); @@ -411,7 +411,7 @@ const String SmFontFormatList::GetNewFontFormatId() const if (!GetFontFormat( aTmpId )) aRes = aTmpId; } - DBG_ASSERT( 0 != aRes.Len(), "failed to create new FontFormatId" ); + OSL_ENSURE( 0 != aRes.Len(), "failed to create new FontFormatId" ); return aRes; } @@ -512,7 +512,7 @@ void SmMathConfig::ReadSymbol( SmSym &rSymbol, if (pValue->hasValue() && (*pValue >>= aTmpStr)) { const SmFontFormat *pFntFmt = GetFontFormatList().GetFontFormat( aTmpStr ); - DBG_ASSERT( pFntFmt, "unknown FontFormat" ); + OSL_ENSURE( pFntFmt, "unknown FontFormat" ); if (pFntFmt) aFont = pFntFmt->GetFont(); } @@ -528,11 +528,11 @@ void SmMathConfig::ReadSymbol( SmSym &rSymbol, { String aTmp; aTmp = GetUiSymbolName( rSymbolName ); - DBG_ASSERT( aTmp.Len(), "localized symbol-name not found" ); + OSL_ENSURE( aTmp.Len(), "localized symbol-name not found" ); if (aTmp.Len()) aUiName = aTmp; aTmp = GetUiSymbolSetName( aSet ); - DBG_ASSERT( aTmp.Len(), "localized symbolset-name not found" ); + OSL_ENSURE( aTmp.Len(), "localized symbolset-name not found" ); if (aTmp.Len()) aUiSetName = aTmp; } @@ -636,13 +636,13 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols ) // FontFormatId SmFontFormat aFntFmt( rSymbol.GetFace() ); String aFntFmtId( GetFontFormatList().GetFontFormatId( aFntFmt, TRUE ) ); - DBG_ASSERT( aFntFmtId.Len(), "FontFormatId not found" ); + OSL_ENSURE( aFntFmtId.Len(), "FontFormatId not found" ); pVal->Name = aNodeNameDelim; pVal->Name += *pName++; pVal->Value <<= OUString( aFntFmtId ); pVal++; } - DBG_ASSERT( pVal - pValues == sal::static_int_cast< ptrdiff_t >(nCount * nSymbolProps), "properties missing" ); + OSL_ENSURE( pVal - pValues == sal::static_int_cast< ptrdiff_t >(nCount * nSymbolProps), "properties missing" ); ReplaceSetProperties( A2OU( SYMBOL_LIST ) , aValues ); StripFontFormatList( rNewSymbols ); @@ -677,7 +677,7 @@ void SmMathConfig::LoadFontFormatList() ReadFontFormat( aFntFmt, pNode[i], A2OU( FONT_FORMAT_LIST ) ); if (!pFontFormatList->GetFontFormat( pNode[i] )) { - DBG_ASSERT( 0 == pFontFormatList->GetFontFormat( pNode[i] ), + OSL_ENSURE( 0 == pFontFormatList->GetFontFormat( pNode[i] ), "FontFormat ID already exists" ); pFontFormatList->AddFontFormat( pNode[i], aFntFmt ); } @@ -746,7 +746,7 @@ void SmMathConfig::ReadFontFormat( SmFontFormat &rFontFormat, bOK = FALSE; ++pValue; - DBG_ASSERT( bOK, "read FontFormat failed" ); + OSL_ENSURE( bOK, "read FontFormat failed" ); } } @@ -811,7 +811,7 @@ void SmMathConfig::SaveFontFormatList() pVal->Value <<= (INT16) aFntFmt.nItalic; pVal++; } - DBG_ASSERT( pVal - pValues == nCount * nSymbolProps, "properties missing" ); + OSL_ENSURE( pVal - pValues == nCount * nSymbolProps, "properties missing" ); ReplaceSetProperties( A2OU( FONT_FORMAT_LIST ) , aValues ); rFntFmtList.SetModified( FALSE ); @@ -828,7 +828,7 @@ void SmMathConfig::StripFontFormatList( const std::vector< SmSym > &rSymbols ) SmFontFormatList aUsedList; for (i = 0; i < nCount; ++i) { - DBG_ASSERT( rSymbols[i].GetName().Len() > 0, "non named symbol" ); + OSL_ENSURE( rSymbols[i].GetName().Len() > 0, "non named symbol" ); aUsedList.GetFontFormatId( SmFontFormat( rSymbols[i].GetFace() ) , TRUE ); } const SmFormat & rStdFmt = GetStandardFormat(); @@ -914,7 +914,7 @@ void SmMathConfig::LoadOther() pOther->bFormulaCursor = bTmp; ++pVal; - DBG_ASSERT( pVal - pValues == nProps, "property mismatch" ); + OSL_ENSURE( pVal - pValues == nProps, "property mismatch" ); SetOtherModified( FALSE ); } } @@ -951,7 +951,7 @@ void SmMathConfig::SaveOther() // View/FormulaCursor *pValue++ <<= (BOOL) pOther->bFormulaCursor; - DBG_ASSERT( pValue - pValues == nProps, "property mismatch" ); + OSL_ENSURE( pValue - pValues == nProps, "property mismatch" ); PutProperties( aNames , aValues ); SetOtherModified( FALSE ); @@ -1028,7 +1028,7 @@ void SmMathConfig::LoadFormat() else { const SmFontFormat *pFntFmt = GetFontFormatList().GetFontFormat( aTmpStr ); - DBG_ASSERT( pFntFmt, "unknown FontFormat" ); + OSL_ENSURE( pFntFmt, "unknown FontFormat" ); if (pFntFmt) aFnt = pFntFmt->GetFont(); } @@ -1039,7 +1039,7 @@ void SmMathConfig::LoadFormat() pFormat->SetFont( i, aFnt, bUseDefaultFont ); } - DBG_ASSERT( pVal - pValues == nProps, "property mismatch" ); + OSL_ENSURE( pVal - pValues == nProps, "property mismatch" ); SetFormatModified( FALSE ); } } @@ -1084,13 +1084,13 @@ void SmMathConfig::SaveFormat() { SmFontFormat aFntFmt( pFormat->GetFont( i ) ); aFntFmtId = GetFontFormatList().GetFontFormatId( aFntFmt, TRUE ); - DBG_ASSERT( aFntFmtId.getLength(), "FontFormatId not found" ); + OSL_ENSURE( aFntFmtId.getLength(), "FontFormatId not found" ); } *pValue++ <<= aFntFmtId; } - DBG_ASSERT( pValue - pValues == nProps, "property mismatch" ); + OSL_ENSURE( pValue - pValues == nProps, "property mismatch" ); PutProperties( aNames , aValues ); SetFormatModified( FALSE ); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 8dcf9b73fe44..ed1b82316f99 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -46,7 +46,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/sfx.hrc> #include <tools/string.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <svx/ucsubset.hxx> @@ -119,7 +119,7 @@ const String & SmFontStyles::GetStyleName( USHORT nIdx ) const // 2 = "bold", 3 = "bold italic" #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( nIdx < GetCount(), "index out of range" ); + OSL_ENSURE( nIdx < GetCount(), "index out of range" ); #endif switch (nIdx) { @@ -153,7 +153,7 @@ void SetFontStyle(const XubString &rStyleName, Font &rFont) if (rStyleName.CompareTo( rStyles.GetStyleName(i) ) == COMPARE_EQUAL) break; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(i < rStyles.GetCount(), "style-name unknown"); + OSL_ENSURE(i < rStyles.GetCount(), "style-name unknown"); #endif nIndex = i; } @@ -769,7 +769,7 @@ void SmDistanceDialog::SetHelpId(MetricField &rField, ULONG nHelpId) const XubString aEmptyText; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(aEmptyText.Len() == 0, "Sm: Ooops..."); + OSL_ENSURE(aEmptyText.Len() == 0, "Sm: Ooops..."); #endif rField.SetHelpId(nHelpId); @@ -789,14 +789,14 @@ void SmDistanceDialog::SetHelpId(MetricField &rField, ULONG nHelpId) void SmDistanceDialog::SetCategory(USHORT nCategory) { #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(/*0 <= nCategory &&*/ nCategory < NOCATEGORIES, - "Sm: falsche Kategorienummer in SmDistanceDialog"); + OSL_ENSURE(/*0 <= nCategory &&*/ nCategory < NOCATEGORIES, + "Sm: wrong category number in SmDistanceDialog"); #endif // array to convert category- and metricfield-number in help ids. // 0 is used in case of unused combinations. #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(NOCATEGORIES == 10, "Sm : Array passt nicht zu Anzahl der Kategorien"); + OSL_ENSURE(NOCATEGORIES == 10, "Sm : array doesn't fit into the number of categories"); #endif ULONG __READONLY_DATA aCatMf2Hid[10][4] = { @@ -1250,8 +1250,8 @@ SmShowSymbolSet::SmShowSymbolSet(Window *pParent, const ResId& rResId) : nColumns--; nRows = sal::static_int_cast< USHORT >(aOutputSize.Height() / nLen); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(nColumns > 0, "Sm : keine Spalten"); - DBG_ASSERT(nRows > 0, "Sm : keine Zeilen"); + OSL_ENSURE(nColumns > 0, "Sm : no columns"); + OSL_ENSURE(nRows > 0, "Sm : no rows"); #endif // genau passend machen @@ -1388,7 +1388,7 @@ IMPL_LINK( SmSymbolDialog, SymbolSetChangeHdl, ListBox *, EMPTYARG pListBox ) { (void) pListBox; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pListBox == &aSymbolSets, "Sm : falsches Argument"); + OSL_ENSURE(pListBox == &aSymbolSets, "Sm : wrong argument"); #endif SelectSymbolSet(aSymbolSets.GetSelectEntry()); @@ -1400,7 +1400,7 @@ IMPL_LINK( SmSymbolDialog, SymbolChangeHdl, SmShowSymbolSet *, EMPTYARG pShowSym { (void) pShowSymbolSet; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pShowSymbolSet == &aSymbolSetDisplay, "Sm : falsches Argument"); + OSL_ENSURE(pShowSymbolSet == &aSymbolSetDisplay, "Sm : wrong argument"); #endif SelectSymbol(aSymbolSetDisplay.GetSelectSymbol()); @@ -1411,7 +1411,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) { (void) pButton; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pButton == &aEditBtn, "Sm : falsches Argument"); + OSL_ENSURE(pButton == &aEditBtn, "Sm : wrong argument"); #endif SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymbolMgr); @@ -1443,7 +1443,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton ) else { // just update display of current symbol set - DBG_ASSERT( aSymSetName == aSymSetName, "unexpected change in symbol set name" ); + OSL_ENSURE( aSymSetName == aSymSetName, "unexpected change in symbol set name" ); aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName ); aSymbolSetDisplay.SetSymbolSet( aSymbolSet ); } @@ -1461,7 +1461,7 @@ IMPL_LINK( SmSymbolDialog, SymbolDblClickHdl, SmShowSymbolSet *, EMPTYARG pShowS { (void) pShowSymbolSet; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pShowSymbolSet == &aSymbolSetDisplay, "Sm : falsches Argument"); + OSL_ENSURE(pShowSymbolSet == &aSymbolSetDisplay, "Sm : wrong argument"); #endif GetClickHdl(&aGetBtn); @@ -1474,7 +1474,7 @@ IMPL_LINK( SmSymbolDialog, GetClickHdl, Button *, EMPTYARG pButton ) { (void) pButton; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pButton == &aGetBtn, "Sm : falscher Button"); + OSL_ENSURE(pButton == &aGetBtn, "Sm : wrong button"); #endif const SmSym *pSym = GetSymbol(); @@ -1497,7 +1497,7 @@ IMPL_LINK_INLINE_START( SmSymbolDialog, CloseClickHdl, Button *, EMPTYARG pButto { (void) pButton; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pButton == &aCloseBtn, "Sm : falscher Button"); + OSL_ENSURE(pButton == &aCloseBtn, "Sm : wrong button"); #endif EndDialog(TRUE); @@ -1682,8 +1682,8 @@ void SmShowChar::SetFont(const Font &rFont) void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, BOOL bDeleteText) { #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, - "Sm : falsche ComboBox"); + OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, + "Sm : wrong ComboBox"); #endif rComboBox.Clear(); @@ -1700,7 +1700,7 @@ void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, BOOL bDeleteText) void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, BOOL bDeleteText) { #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets, + OSL_ENSURE(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets, "Sm : falsche ComboBox"); #endif @@ -1748,7 +1748,7 @@ void SmSymDefineDialog::FillStyles(BOOL bDeleteText) aStyles.InsertEntry( rStyles.GetStyleName(i) ); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(aStyles.GetEntryCount() > 0, "Sm : keine Styles vorhanden"); + OSL_ENSURE(aStyles.GetEntryCount() > 0, "Sm : no styles available"); #endif aStyles.SetText( aStyles.GetEntry(0) ); } @@ -1758,8 +1758,8 @@ void SmSymDefineDialog::FillStyles(BOOL bDeleteText) SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox) { #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, - "Sm : falsche ComboBox"); + OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, + "Sm : wrong combobox"); #endif return aSymbolMgrCopy.GetSymbolByName(rComboBox.GetText()); } @@ -1769,7 +1769,7 @@ IMPL_LINK( SmSymDefineDialog, OldSymbolChangeHdl, ComboBox *, EMPTYARG pComboBox { (void) pComboBox; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pComboBox == &aOldSymbols, "Sm : falsches Argument"); + OSL_ENSURE(pComboBox == &aOldSymbols, "Sm : wrong argument"); #endif SelectSymbol(aOldSymbols, aOldSymbols.GetText(), FALSE); return 0; @@ -1780,7 +1780,7 @@ IMPL_LINK( SmSymDefineDialog, OldSymbolSetChangeHdl, ComboBox *, EMPTYARG pCombo { (void) pComboBox; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pComboBox == &aOldSymbolSets, "Sm : falsches Argument"); + OSL_ENSURE(pComboBox == &aOldSymbolSets, "Sm : wrong argument"); #endif SelectSymbolSet(aOldSymbolSets, aOldSymbolSets.GetText(), FALSE); return 0; @@ -1808,7 +1808,7 @@ IMPL_LINK( SmSymDefineDialog, ModifyHdl, ComboBox *, pComboBox ) else { #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(0, "Sm : falsche ComboBox Argument"); + OSL_ENSURE(0, "Sm : wrong combobox argument"); #endif } @@ -1824,7 +1824,7 @@ IMPL_LINK( SmSymDefineDialog, FontChangeHdl, ListBox *, EMPTYARG pListBox ) { (void) pListBox; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pListBox == &aFonts, "Sm : falsches Argument"); + OSL_ENSURE(pListBox == &aFonts, "Sm : wrong argument"); #endif SelectFont(aFonts.GetSelectEntry()); @@ -1852,7 +1852,7 @@ IMPL_LINK( SmSymDefineDialog, StyleChangeHdl, ComboBox *, EMPTYARG pComboBox ) { (void) pComboBox; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pComboBox == &aStyles, "Sm : falsches Argument"); + OSL_ENSURE(pComboBox == &aStyles, "Sm : falsches Argument"); #endif SelectStyle(aStyles.GetText()); @@ -1865,7 +1865,7 @@ IMPL_LINK( SmSymDefineDialog, CharHighlightHdl, Control *, EMPTYARG ) sal_UCS4 cChar = aCharsetDisplay.GetSelectCharacter(); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( pSubsetMap, "SubsetMap missing" ); + OSL_ENSURE( pSubsetMap, "SubsetMap missing" ); #endif if (pSubsetMap) { @@ -1887,8 +1887,8 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, EMPTYARG pButton ) { (void) pButton; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pButton == &aAddBtn, "Sm : falsches Argument"); - DBG_ASSERT(aAddBtn.IsEnabled(), "Sm : Voraussetzungen erfuellt ??"); + OSL_ENSURE(pButton == &aAddBtn, "Sm : wrong argument"); + OSL_ENSURE(aAddBtn.IsEnabled(), "Sm : requirements met ??"); #endif // add symbol @@ -1896,7 +1896,7 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, EMPTYARG pButton ) const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), sal::static_int_cast< sal_Unicode >( aCharsetDisplay.GetSelectCharacter() ), aSymbolSets.GetText() ); - //DBG_ASSERT( aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" ); + //OSL_ENSURE( aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" ); aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol ); // update display of new symbol @@ -1921,8 +1921,8 @@ IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, Button *, EMPTYARG pButton ) { (void) pButton; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pButton == &aChangeBtn, "Sm : falsches Argument"); - DBG_ASSERT(aChangeBtn.IsEnabled(), "Sm : Voraussetzungen erfuellt ??"); + OSL_ENSURE(pButton == &aChangeBtn, "Sm : wrong argument"); + OSL_ENSURE(aChangeBtn.IsEnabled(), "Sm : requirements met ??"); #endif // get new Sybol to use @@ -1965,8 +1965,8 @@ IMPL_LINK( SmSymDefineDialog, DeleteClickHdl, Button *, EMPTYARG pButton ) { (void) pButton; #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(pButton == &aDeleteBtn, "Sm : falsches Argument"); - DBG_ASSERT(aDeleteBtn.IsEnabled(), "Sm : Voraussetzungen erfuellt ??"); + OSL_ENSURE(pButton == &aDeleteBtn, "Sm : wrong argument"); + OSL_ENSURE(aDeleteBtn.IsEnabled(), "Sm : requirements met ??"); #endif if (pOrigSymbol) @@ -2194,8 +2194,8 @@ BOOL SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox, const XubString &rSymbolSetName, BOOL bDeleteText) { #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets, - "Sm : falsche ComboBox"); + OSL_ENSURE(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets, + "Sm : wrong ComboBox"); #endif // 'Normalisieren' des SymbolNamens (ohne leading und trailing Leerzeichen) @@ -2276,8 +2276,8 @@ BOOL SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox, const XubString &rSymbolName, BOOL bDeleteText) { #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, - "Sm : falsche ComboBox"); + OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, + "Sm : wrong ComboBox"); #endif // 'Normalisieren' des SymbolNamens (ohne Leerzeichen) diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 48bb4bba1eeb..dd4d4ffb1e84 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -233,7 +233,7 @@ String SmDocShell::GetAccessibleText() ArrangeFormula(); if (0 == aAccText.Len()) { - DBG_ASSERT( pTree, "Tree missing" ); + OSL_ENSURE( pTree, "Tree missing" ); if (pTree) pTree->GetAccessibleText( aAccText ); } @@ -284,7 +284,7 @@ void SmDocShell::ArrangeFormula() pOutDev->SetMapMode( MapMode(MAP_100TH_MM) ); } } - DBG_ASSERT(pOutDev->GetMapMode().GetMapUnit() == MAP_100TH_MM, + OSL_ENSURE(pOutDev->GetMapMode().GetMapUnit() == MAP_100TH_MM, "Sm : falscher MapMode"); const SmFormat &rFormat = GetFormat(); @@ -429,7 +429,7 @@ SfxItemPool& SmDocShell::GetEditEngineItemPool() if (!pEditEngineItemPool) GetEditEngine(); - DBG_ASSERT( pEditEngineItemPool, "EditEngineItemPool missing" ); + OSL_ENSURE( pEditEngineItemPool, "EditEngineItemPool missing" ); return *pEditEngineItemPool; } @@ -440,7 +440,7 @@ void SmDocShell::Draw(OutputDevice &rDev, Point &rPosition) if (!pTree) Parse(); - DBG_ASSERT(pTree, "Sm : NULL pointer"); + OSL_ENSURE(pTree, "Sm : NULL pointer"); if (!IsFormulaArranged()) ArrangeFormula(); @@ -736,7 +736,7 @@ BOOL SmDocShell::ConvertFrom(SfxMedium &rMedium) BOOL bSuccess = FALSE; const String& rFltName = rMedium.GetFilter()->GetFilterName(); - DBG_ASSERT( !rFltName.EqualsAscii( STAROFFICE_XML ), "Wrong filter!"); + OSL_ENSURE( !rFltName.EqualsAscii( STAROFFICE_XML ), "Wrong filter!"); if ( rFltName.EqualsAscii( MATHML_XML ) ) { @@ -1018,7 +1018,7 @@ void SmDocShell::Execute(SfxRequest& rReq) OutputDevice *pDev = GetPrinter(); if (!pDev || pDev->GetDevFontCount() == 0) pDev = &SM_MOD()->GetDefaultVirtualDev(); - DBG_ASSERT (pDev, "device for font list missing" ); + OSL_ENSURE (pDev, "device for font list missing" ); SmFontTypeDialog *pFontTypeDialog = new SmFontTypeDialog( NULL, pDev ); diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 020376c05dfb..96c9bf00200c 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -296,7 +296,7 @@ void SmEditWindow::Resize() pEditView->SetOutputArea(AdjustScrollBars()); pEditView->ShowCursor(); - DBG_ASSERT( pEditView->GetEditEngine(), "EditEngine missing" ); + OSL_ENSURE( pEditView->GetEditEngine(), "EditEngine missing" ); const long nMaxVisAreaStart = pEditView->GetEditEngine()->GetTextHeight() - pEditView->GetOutputArea().GetHeight(); if (pEditView->GetVisArea().Top() > nMaxVisAreaStart) @@ -429,7 +429,7 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt) // moeglichst nur einmal am Ende aufzurufen. aCursorMoveTimer.Start(); - DBG_ASSERT( pEditView, "EditView missing (NULL pointer)" ); + OSL_ENSURE( pEditView, "EditView missing (NULL pointer)" ); if (!pEditView) CreateEditView(); if ( !pEditView->PostKeyEvent(rKEvt) ) @@ -528,7 +528,7 @@ IMPL_LINK( SmEditWindow, EditStatusHdl, EditStatus *, EMPTYARG /*pStat*/ ) IMPL_LINK_INLINE_START( SmEditWindow, ScrollHdl, ScrollBar *, EMPTYARG /*pScrollBar*/ ) { - DBG_ASSERT(pEditView, "EditView missing"); + OSL_ENSURE(pEditView, "EditView missing"); if (pEditView) { pEditView->SetVisArea(Rectangle(Point(pHScrollBar->GetThumbPos(), @@ -607,7 +607,7 @@ String SmEditWindow::GetText() const { String aText; EditEngine *pEditEngine = const_cast< SmEditWindow* >(this)->GetEditEngine(); - DBG_ASSERT( pEditEngine, "EditEngine missing" ); + OSL_ENSURE( pEditEngine, "EditEngine missing" ); if (pEditEngine) aText = pEditEngine->GetText( LINEEND_LF ); return aText; @@ -617,7 +617,7 @@ String SmEditWindow::GetText() const void SmEditWindow::SetText(const XubString& rText) { EditEngine *pEditEngine = GetEditEngine(); - DBG_ASSERT( pEditEngine, "EditEngine missing" ); + OSL_ENSURE( pEditEngine, "EditEngine missing" ); if (pEditEngine && !pEditEngine->IsModified()) { if (!pEditView) @@ -680,8 +680,8 @@ BOOL SmEditWindow::IsAllSelected() const { BOOL bRes = FALSE; EditEngine *pEditEngine = ((SmEditWindow *) this)->GetEditEngine(); - DBG_ASSERT( pEditView, "NULL pointer" ); - DBG_ASSERT( pEditEngine, "NULL pointer" ); + OSL_ENSURE( pEditView, "NULL pointer" ); + OSL_ENSURE( pEditEngine, "NULL pointer" ); if (pEditEngine && pEditView) { ESelection eSelection( pEditView->GetSelection() ); @@ -701,7 +701,7 @@ BOOL SmEditWindow::IsAllSelected() const void SmEditWindow::SelectAll() { - DBG_ASSERT( pEditView, "NULL pointer" ); + OSL_ENSURE( pEditView, "NULL pointer" ); if (pEditView) { // 0xFFFF as last two parameters refers to the end of the text @@ -711,7 +711,7 @@ void SmEditWindow::SelectAll() void SmEditWindow::InsertCommand(USHORT nCommand) { - DBG_ASSERT( pEditView, "EditView missing" ); + OSL_ENSURE( pEditView, "EditView missing" ); if (pEditView) { //Anfang der Selektion merken und hinterher den Cursor daraufsetzen. Nur so @@ -720,7 +720,7 @@ void SmEditWindow::InsertCommand(USHORT nCommand) aSelection.nEndPos = aSelection.nStartPos; aSelection.nEndPara = aSelection.nStartPara; - DBG_ASSERT( pEditView, "NULL pointer" ); + OSL_ENSURE( pEditView, "NULL pointer" ); String aText = String(SmResId(nCommand)); pEditView->InsertText(aText); @@ -745,7 +745,7 @@ void SmEditWindow::InsertCommand(USHORT nCommand) void SmEditWindow::MarkError(const Point &rPos) { - DBG_ASSERT( pEditView, "EditView missing" ); + OSL_ENSURE( pEditView, "EditView missing" ); if (pEditView) { const xub_StrLen nCol = sal::static_int_cast< xub_StrLen >(rPos.X()); @@ -759,8 +759,8 @@ void SmEditWindow::MarkError(const Point &rPos) void SmEditWindow::SelNextMark() { EditEngine *pEditEngine = GetEditEngine(); - DBG_ASSERT( pEditView, "NULL pointer" ); - DBG_ASSERT( pEditEngine, "NULL pointer" ); + OSL_ENSURE( pEditView, "NULL pointer" ); + OSL_ENSURE( pEditEngine, "NULL pointer" ); if (pEditEngine && pEditView) { ESelection eSelection = pEditView->GetSelection(); @@ -789,8 +789,8 @@ void SmEditWindow::SelNextMark() void SmEditWindow::SelPrevMark() { EditEngine *pEditEngine = GetEditEngine(); - DBG_ASSERT( pEditEngine, "NULL pointer" ); - DBG_ASSERT( pEditView, "NULL pointer" ); + OSL_ENSURE( pEditEngine, "NULL pointer" ); + OSL_ENSURE( pEditView, "NULL pointer" ); if (pEditEngine && pEditView) { ESelection eSelection = pEditView->GetSelection(); @@ -853,7 +853,7 @@ ESelection SmEditWindow::GetSelection() const { // pointer may be 0 when reloading a document and the old view // was already destroyed - //(DBG_ASSERT( pEditView, "NULL pointer" ); + //(OSL_ENSURE( pEditView, "NULL pointer" ); ESelection eSel; if (pEditView) eSel = pEditView->GetSelection(); @@ -862,7 +862,7 @@ ESelection SmEditWindow::GetSelection() const void SmEditWindow::SetSelection(const ESelection &rSel) { - DBG_ASSERT( pEditView, "NULL pointer" ); + OSL_ENSURE( pEditView, "NULL pointer" ); if (pEditView) pEditView->SetSelection(rSel); InvalidateSlots(); @@ -883,7 +883,7 @@ BOOL SmEditWindow::IsSelected() const void SmEditWindow::Cut() { - DBG_ASSERT( pEditView, "EditView missing" ); + OSL_ENSURE( pEditView, "EditView missing" ); if (pEditView) { pEditView->Cut(); @@ -893,14 +893,14 @@ void SmEditWindow::Cut() void SmEditWindow::Copy() { - DBG_ASSERT( pEditView, "EditView missing" ); + OSL_ENSURE( pEditView, "EditView missing" ); if (pEditView) pEditView->Copy(); } void SmEditWindow::Paste() { - DBG_ASSERT( pEditView, "EditView missing" ); + OSL_ENSURE( pEditView, "EditView missing" ); if (pEditView) { pEditView->Paste(); @@ -910,7 +910,7 @@ void SmEditWindow::Paste() void SmEditWindow::Delete() { - DBG_ASSERT( pEditView, "EditView missing" ); + OSL_ENSURE( pEditView, "EditView missing" ); if (pEditView) { pEditView->DeleteSelected(); @@ -920,7 +920,7 @@ void SmEditWindow::Delete() void SmEditWindow::InsertText(const String& Text) { - DBG_ASSERT( pEditView, "EditView missing" ); + OSL_ENSURE( pEditView, "EditView missing" ); if (pEditView) { pEditView->InsertText(Text); diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx index e92d1a5e97aa..c10acf2eddb3 100644 --- a/starmath/source/format.cxx +++ b/starmath/source/format.cxx @@ -81,7 +81,7 @@ static const USHORT aCTLDefFnts[FNT_END] = String GetDefaultFontName( LanguageType nLang, USHORT nIdent ) { - DBG_ASSERT( /*FNT_BEGIN <= nIdent &&*/ nIdent <= FNT_END, + OSL_ENSURE( /*FNT_BEGIN <= nIdent &&*/ nIdent <= FNT_END, "index out opd range" ); if (FNT_MATH == nIdent) diff --git a/starmath/source/math_pch.cxx b/starmath/source/math_pch.cxx index 977f6131134f..e776945e3a8a 100644 --- a/starmath/source/math_pch.cxx +++ b/starmath/source/math_pch.cxx @@ -47,7 +47,7 @@ #include <tools/link.hxx> #include <svl/brdcst.hxx> #include <svl/svarray.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <svl/hint.hxx> #include <svl/smplhint.hxx> #include <sot/sotref.hxx> diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 0f87bb77a5ac..1219ff95bf4d 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -55,7 +55,7 @@ #include <rtl/math.hxx> #include <sfx2/frame.hxx> #include <sfx2/docfile.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <tools/urlobj.hxx> #include <svtools/sfxecode.hxx> #include <unotools/saveopt.hxx> @@ -103,7 +103,7 @@ sal_Bool SmXMLExportWrapper::Export(SfxMedium &rMedium) sal_Bool bRet=sal_True; uno::Reference<lang::XMultiServiceFactory> xServiceFactory(utl::getProcessServiceFactory()); - DBG_ASSERT(xServiceFactory.is(),"got no service manager"); + OSL_ENSURE(xServiceFactory.is(),"got no service manager"); //Get model uno::Reference< lang::XComponent > xModelComp(xModel, uno::UNO_QUERY ); @@ -125,7 +125,7 @@ sal_Bool SmXMLExportWrapper::Export(SfxMedium &rMedium) { if (pDocShell /*&& pDocShell->GetMedium()*/) { - DBG_ASSERT( pDocShell->GetMedium() == &rMedium, + OSL_ENSURE( pDocShell->GetMedium() == &rMedium, "different SfxMedium found" ); SfxItemSet* pSet = rMedium.GetItemSet(); @@ -268,16 +268,16 @@ sal_Bool SmXMLExportWrapper::WriteThroughComponent( Reference<beans::XPropertySet> & rPropSet, const sal_Char* pComponentName ) { - DBG_ASSERT(xOutputStream.is(), "I really need an output stream!"); - DBG_ASSERT(xComponent.is(), "Need component!"); - DBG_ASSERT(NULL != pComponentName, "Need component name!"); + OSL_ENSURE(xOutputStream.is(), "I really need an output stream!"); + OSL_ENSURE(xComponent.is(), "Need component!"); + OSL_ENSURE(NULL != pComponentName, "Need component name!"); // get component Reference< io::XActiveDataSource > xSaxWriter( rFactory->createInstance( OUString::createFromAscii("com.sun.star.xml.sax.Writer") ), UNO_QUERY ); - DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" ); + OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML writer" ); if (!xSaxWriter.is()) return sal_False; @@ -295,7 +295,7 @@ sal_Bool SmXMLExportWrapper::WriteThroughComponent( Reference< document::XExporter > xExporter( rFactory->createInstanceWithArguments( OUString::createFromAscii(pComponentName), aArgs), UNO_QUERY); - DBG_ASSERT( xExporter.is(), + OSL_ENSURE( xExporter.is(), "can't instantiate export filter component" ); if ( !xExporter.is() ) return sal_False; @@ -330,8 +330,8 @@ sal_Bool SmXMLExportWrapper::WriteThroughComponent( sal_Bool bCompress ) { - DBG_ASSERT(xStorage.is(), "Need storage!"); - DBG_ASSERT(NULL != pStreamName, "Need stream name!"); + OSL_ENSURE(xStorage.is(), "Need storage!"); + OSL_ENSURE(NULL != pStreamName, "Need stream name!"); // open stream Reference < io::XStream > xStream; @@ -657,7 +657,7 @@ void SmXMLExport::_ExportContent() (xTunnel->getSomething(SmModel::getUnoTunnelId())); SmDocShell *pDocShell = pModel ? static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0; - DBG_ASSERT( pDocShell, "doc shell missing" ); + OSL_ENSURE( pDocShell, "doc shell missing" ); if (pDocShell) { SmParser &rParser = pDocShell->GetParser(); @@ -786,7 +786,7 @@ void SmXMLExport::ExportExpression(const SmNode *pNode, int nLevel) void SmXMLExport::ExportBinaryVertical(const SmNode *pNode, int nLevel) { - DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Fraction"); + OSL_ENSURE(pNode->GetNumSubNodes()==3,"Bad Fraction"); SvXMLElementExport aFraction(*this, XML_NAMESPACE_MATH, XML_MFRAC, sal_True, sal_True); ExportNodes(pNode->GetSubNode(0), nLevel); ExportNodes(pNode->GetSubNode(2), nLevel); @@ -837,7 +837,7 @@ void SmXMLExport::ExportMath(const SmNode *pNode, int /*nLevel*/) sal_Unicode cTmp = ConvertMathToMathML( nArse[0] ); if (cTmp != 0) nArse[0] = cTmp; - DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol"); + OSL_ENSURE(nArse[0] != 0xffff,"Non existant symbol"); nArse[1] = 0; GetDocHandler()->characters(nArse); } @@ -1040,11 +1040,11 @@ void SmXMLExport::ExportBrace(const SmNode *pNode, int nLevel) nArse[1] = 0; nArse[0] = static_cast< const SmMathSymbolNode* >(pLeft)->GetText().GetChar(0); - DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol"); + OSL_ENSURE(nArse[0] != 0xffff,"Non existant symbol"); AddAttribute(XML_NAMESPACE_MATH, XML_OPEN,nArse); nArse[0] = static_cast< const SmMathSymbolNode* >(pRight)->GetText().GetChar(0); - DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol"); + OSL_ENSURE(nArse[0] != 0xffff,"Non existant symbol"); AddAttribute(XML_NAMESPACE_MATH, XML_CLOSE,nArse); pFences = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MFENCED, sal_True,sal_True); @@ -1185,7 +1185,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) case TSERIF : nSansSerifFixed = 1; break; case TFIXED : nSansSerifFixed = 2; break; default: - DBG_ASSERT( 0, "unexpected case" ); + OSL_ENSURE( 0, "unexpected case" ); } // According to the parser every node that is to be evaluated heres // has a single non-zero subnode at index 1!! Thus we only need to check @@ -1319,7 +1319,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) pText = "monospace"; // no modifiers allowed for monospace ... else { - DBG_ASSERT( 0, "unexpected case" ); + OSL_ENSURE( 0, "unexpected case" ); } AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, A2OU(pText)); } @@ -1359,7 +1359,7 @@ void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel) break; } - DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Vertical Brace"); + OSL_ENSURE(pNode->GetNumSubNodes()==3,"Bad Vertical Brace"); SvXMLElementExport aOver1(*this, XML_NAMESPACE_MATH,which, sal_True, sal_True); {//Scoping // using accents will draw the over-/underbraces too close to the base @@ -1491,7 +1491,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) ExportBlank(pNode, nLevel); break; default: - DBG_ASSERT( 0, "Warning: failed to export a node?" ); + OSL_ENSURE( 0, "Warning: failed to export a node?" ); break; } diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index cde186859fd3..a2ce3905c708 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -51,7 +51,7 @@ one go*/ #include <rtl/math.hxx> #include <sfx2/frame.hxx> #include <sfx2/docfile.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <tools/urlobj.hxx> #include <svtools/sfxecode.hxx> #include <unotools/saveopt.hxx> @@ -99,13 +99,13 @@ ULONG SmXMLImportWrapper::Import(SfxMedium &rMedium) uno::Reference<lang::XMultiServiceFactory> xServiceFactory( utl::getProcessServiceFactory()); - DBG_ASSERT(xServiceFactory.is(), "XMLReader::Read: got no service manager"); + OSL_ENSURE(xServiceFactory.is(), "XMLReader::Read: got no service manager"); if ( !xServiceFactory.is() ) return nError; //Make a model component from our SmModel uno::Reference< lang::XComponent > xModelComp( xModel, uno::UNO_QUERY ); - DBG_ASSERT( xModelComp.is(), "XMLReader::Read: got no model" ); + OSL_ENSURE( xModelComp.is(), "XMLReader::Read: got no model" ); // try to get an XStatusIndicator from the Medium uno::Reference<task::XStatusIndicator> xStatusIndicator; @@ -120,7 +120,7 @@ ULONG SmXMLImportWrapper::Import(SfxMedium &rMedium) static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0; if (pDocShell) { - DBG_ASSERT( pDocShell->GetMedium() == &rMedium, + OSL_ENSURE( pDocShell->GetMedium() == &rMedium, "different SfxMedium found" ); SfxItemSet* pSet = rMedium.GetItemSet(); @@ -260,10 +260,10 @@ ULONG SmXMLImportWrapper::ReadThroughComponent( sal_Bool bEncrypted ) { ULONG nError = ERRCODE_SFX_DOLOADFAILED; - DBG_ASSERT(xInputStream.is(), "input stream missing"); - DBG_ASSERT(xModelComponent.is(), "document missing"); - DBG_ASSERT(rFactory.is(), "factory missing"); - DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!"); + OSL_ENSURE(xInputStream.is(), "input stream missing"); + OSL_ENSURE(xModelComponent.is(), "document missing"); + OSL_ENSURE(rFactory.is(), "factory missing"); + OSL_ENSURE(NULL != pFilterName,"I need a service name for the component!"); // prepare ParserInputSrouce xml::sax::InputSource aParserInput; @@ -274,7 +274,7 @@ ULONG SmXMLImportWrapper::ReadThroughComponent( rFactory->createInstance( OUString::createFromAscii("com.sun.star.xml.sax.Parser") ), UNO_QUERY ); - DBG_ASSERT( xParser.is(), "Can't create parser" ); + OSL_ENSURE( xParser.is(), "Can't create parser" ); if ( !xParser.is() ) return nError; @@ -286,7 +286,7 @@ ULONG SmXMLImportWrapper::ReadThroughComponent( rFactory->createInstanceWithArguments( OUString::createFromAscii(pFilterName), aArgs ), UNO_QUERY ); - DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." ); + OSL_ENSURE( xFilter.is(), "Can't instantiate filter component." ); if ( !xFilter.is() ) return nError; @@ -364,8 +364,8 @@ ULONG SmXMLImportWrapper::ReadThroughComponent( Reference<beans::XPropertySet> & rPropSet, const sal_Char* pFilterName ) { - DBG_ASSERT(xStorage.is(), "Need storage!"); - DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!"); + OSL_ENSURE(xStorage.is(), "Need storage!"); + OSL_ENSURE(NULL != pStreamName, "Please, please, give me a name!"); // open stream (and set parser input) OUString sStreamName = OUString::createFromAscii(pStreamName); @@ -599,7 +599,7 @@ void SmXMLImport::endDocument(void) pDocShell->SetText( aText ); } - DBG_ASSERT(pModel,"So there *was* a uno problem after all"); + OSL_ENSURE(pModel,"So there *was* a uno problem after all"); bSuccess = sal_True; } @@ -1463,7 +1463,7 @@ public: void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup) { /*The <msub> element requires exactly 2 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + OSL_ENSURE(GetSmImport().GetNodeStack().Count() - nElementCount == 2, "Sub has not two arguments"); SmToken aToken; aToken.cMathChar = '\0'; @@ -1522,7 +1522,7 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup aSub,SmSubSup aSup) { /*The <msub> element requires exactly 3 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 3, + OSL_ENSURE(GetSmImport().GetNodeStack().Count() - nElementCount == 3, "SubSup has not three arguments"); SmToken aToken; @@ -1571,7 +1571,7 @@ void SmXMLUnderContext_Impl::StartElement(const uno::Reference< void SmXMLUnderContext_Impl::HandleAccent() { - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + OSL_ENSURE(GetSmImport().GetNodeStack().Count() - nElementCount == 2, "Sub has not two arguments"); /*Just one special case for the underline thing*/ @@ -1647,7 +1647,7 @@ void SmXMLOverContext_Impl::EndElement() void SmXMLOverContext_Impl::HandleAccent() { - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + OSL_ENSURE(GetSmImport().GetNodeStack().Count() - nElementCount == 2, "Sub has not two arguments"); SmToken aToken; aToken.cMathChar = '\0'; @@ -2202,7 +2202,7 @@ void SmXMLFracContext_Impl::EndElement() SmStructureNode *pSNode = new SmBinVerNode(aToken); SmNode *pOper = new SmRectangleNode(aToken); SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - DBG_ASSERT(rNodeStack.Count() - nElementCount == 2, + OSL_ENSURE(rNodeStack.Count() - nElementCount == 2, "Fraction (mfrac) tag is missing component"); if (rNodeStack.Count() - nElementCount == 2) { @@ -2216,7 +2216,7 @@ void SmXMLFracContext_Impl::EndElement() void SmXMLRootContext_Impl::EndElement() { /*The <mroot> element requires exactly 2 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, + OSL_ENSURE(GetSmImport().GetNodeStack().Count() - nElementCount == 2, "Root tag is missing component"); SmToken aToken; @@ -2454,7 +2454,7 @@ void SmXMLMultiScriptsContext_Impl::MiddleElement() { bHasPrescripts=sal_True; - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount > 0, + OSL_ENSURE(GetSmImport().GetNodeStack().Count() - nElementCount > 0, "Sub has no arguments"); SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); if (rNodeStack.Count()-nElementCount > 1) diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 9b5f6d6d2c41..fa2a2005c196 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -31,7 +31,7 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ #include <mathtype.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <sfx2/docfile.hxx> @@ -618,7 +618,7 @@ int MathType::Parse(SotStorage *pStor) //sigh, theres no point! MathType (in some bizarre subvarient) pads //the end of the formula with ENDs (0)'s ULONG nEnd = pS->Tell(); - DBG_ASSERT(nEnd == pS->Seek(STREAM_SEEK_TO_END), + OSL_ENSURE(nEnd == pS->Seek(STREAM_SEEK_TO_END), "Possibly unfully parsed formula"); # endif #endif @@ -1750,7 +1750,7 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, *pS >> nTabType; *pS >> nTabOffset; } - DBG_ASSERT(FALSE,"Not seen in the wild Equation Ruler Field"); + OSL_ENSURE(FALSE,"Not seen in the wild Equation Ruler Field"); break; case FONT: { @@ -2731,14 +2731,14 @@ int MathType::HandleTemplate(int nLevel,sal_uInt8 &rSelector, *pS >> rSelector; *pS >> rVariation; *pS >> nOption; - DBG_ASSERT(rSelector < 48,"Selector out of range"); + OSL_ENSURE(rSelector < 48,"Selector out of range"); if ((rSelector >= 21) && (rSelector <=26)) { - DBG_ASSERT(nOption < 2,"Option out of range"); + OSL_ENSURE(nOption < 2,"Option out of range"); } else if (/*(rSelector >= 0) &&*/ (rSelector <=12)) { - DBG_ASSERT(nOption < 3,"Option out of range"); + OSL_ENSURE(nOption < 3,"Option out of range"); } //For the (broken) case where one subscript template ends, and there is @@ -2846,7 +2846,7 @@ void MathType::HandleEmblishments() APPEND(rRet," breve "); break; default: - DBG_ASSERT(nEmbel < 21,"Embel out of range"); + OSL_ENSURE(nEmbel < 21,"Embel out of range"); break; } if (nVersion < 3) diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 28977793b141..78583d126e23 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -363,7 +363,7 @@ void SmNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) } GetFont() = rFormat.GetFont(FNT_MATH); - DBG_ASSERT( GetFont().GetCharSet() == RTL_TEXTENCODING_UNICODE, + OSL_ENSURE( GetFont().GetCharSet() == RTL_TEXTENCODING_UNICODE, "unexpected CharSet" ); GetFont().SetWeight(WEIGHT_NORMAL); GetFont().SetItalic(ITALIC_NONE); @@ -868,8 +868,8 @@ void SmUnHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmNode *pOper = GetSubNode(bIsPostfix ? 1 : 0), *pBody = GetSubNode(bIsPostfix ? 0 : 1); - DBG_ASSERT(pOper, "Sm: NULL pointer"); - DBG_ASSERT(pBody, "Sm: NULL pointer"); + OSL_ENSURE(pOper, "Sm: NULL pointer"); + OSL_ENSURE(pBody, "Sm: NULL pointer"); pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100)); pOper->Arrange(rDev, rFormat); @@ -907,8 +907,8 @@ void SmRootNode::GetHeightVerOffset(const SmRect &rRect, rVerOffset = (rRect.GetBottom() - rRect.GetAlignB()) / 2; rHeight = rRect.GetHeight() - rVerOffset; - DBG_ASSERT(rHeight >= 0, "Sm : Ooops..."); - DBG_ASSERT(rVerOffset >= 0, "Sm : Ooops..."); + OSL_ENSURE(rHeight >= 0, "Sm : Ooops..."); + OSL_ENSURE(rVerOffset >= 0, "Sm : Ooops..."); } @@ -944,8 +944,8 @@ void SmRootNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmNode *pExtra = GetSubNode(0), *pRootSym = GetSubNode(1), *pBody = GetSubNode(2); - DBG_ASSERT(pRootSym, "Sm: NULL pointer"); - DBG_ASSERT(pBody, "Sm: NULL pointer"); + OSL_ENSURE(pRootSym, "Sm: NULL pointer"); + OSL_ENSURE(pBody, "Sm: NULL pointer"); pBody->Arrange(rDev, rFormat); @@ -1004,9 +1004,9 @@ void SmBinHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmNode *pLeft = GetSubNode(0), *pOper = GetSubNode(1), *pRight = GetSubNode(2); - DBG_ASSERT(pLeft != NULL, "Sm: NULL pointer"); - DBG_ASSERT(pOper != NULL, "Sm: NULL pointer"); - DBG_ASSERT(pRight != NULL, "Sm: NULL pointer"); + OSL_ENSURE(pLeft != NULL, "Sm: NULL pointer"); + OSL_ENSURE(pOper != NULL, "Sm: NULL pointer"); + OSL_ENSURE(pRight != NULL, "Sm: NULL pointer"); pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100)); @@ -1043,9 +1043,9 @@ void SmBinVerNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmNode *pNum = GetSubNode(0), *pLine = GetSubNode(1), *pDenom = GetSubNode(2); - DBG_ASSERT(pNum, "Sm : NULL pointer"); - DBG_ASSERT(pLine, "Sm : NULL pointer"); - DBG_ASSERT(pDenom, "Sm : NULL pointer"); + OSL_ENSURE(pNum, "Sm : NULL pointer"); + OSL_ENSURE(pLine, "Sm : NULL pointer"); + OSL_ENSURE(pDenom, "Sm : NULL pointer"); BOOL bIsTextmode = rFormat.IsTextmode(); if (bIsTextmode) @@ -1127,7 +1127,7 @@ BOOL IsPointInLine(const Point &rPoint1, // ergibt TRUE genau dann, wenn der Punkt 'rPoint1' zu der Gerade gehoert die // durch den Punkt 'rPoint2' geht und den Richtungsvektor 'rHeading2' hat { - DBG_ASSERT(rHeading2 != Point(), "Sm : 0 vector"); + OSL_ENSURE(rHeading2 != Point(), "Sm : 0 vector"); BOOL bRes = FALSE; const double eps = 5.0 * DBL_EPSILON; @@ -1152,8 +1152,8 @@ USHORT GetLineIntersectionPoint(Point &rResult, const Point& rPoint1, const Point &rHeading1, const Point& rPoint2, const Point &rHeading2) { - DBG_ASSERT(rHeading1 != Point(), "Sm : 0 vector"); - DBG_ASSERT(rHeading2 != Point(), "Sm : 0 vector"); + OSL_ENSURE(rHeading1 != Point(), "Sm : 0 vector"); + OSL_ENSURE(rHeading2 != Point(), "Sm : 0 vector"); USHORT nRes = 1; const double eps = 5.0 * DBL_EPSILON; @@ -1324,12 +1324,12 @@ void SmBinDiagonalNode::Arrange(const OutputDevice &rDev, const SmFormat &rForma //! (vgl SmRootNode) SmNode *pLeft = GetSubNode(0), *pRight = GetSubNode(1); - DBG_ASSERT(pLeft, "Sm : NULL pointer"); - DBG_ASSERT(pRight, "Sm : NULL pointer"); + OSL_ENSURE(pLeft, "Sm : NULL pointer"); + OSL_ENSURE(pRight, "Sm : NULL pointer"); - DBG_ASSERT(GetSubNode(2)->GetType() == NPOLYLINE, "Sm : falscher Nodetyp"); + OSL_ENSURE(GetSubNode(2)->GetType() == NPOLYLINE, "Sm : wrong node type"); SmPolyLineNode *pOper = (SmPolyLineNode *) GetSubNode(2); - DBG_ASSERT(pOper, "Sm : NULL pointer"); + OSL_ENSURE(pOper, "Sm : NULL pointer"); //! some routines being called extract some info from the OutputDevice's //! font (eg the space to be used for borders OR the font name(!!)). @@ -1386,11 +1386,11 @@ void SmBinDiagonalNode::Arrange(const OutputDevice &rDev, const SmFormat &rForma void SmSubSupNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) { - DBG_ASSERT(GetNumSubNodes() == 1 + SUBSUP_NUM_ENTRIES, - "Sm: falsche Anzahl von subnodes"); + OSL_ENSURE(GetNumSubNodes() == 1 + SUBSUP_NUM_ENTRIES, + "Sm: wrong number of subnodes"); SmNode *pBody = GetBody(); - DBG_ASSERT(pBody, "Sm: NULL pointer"); + OSL_ENSURE(pBody, "Sm: NULL pointer"); long nOrigHeight = pBody->GetFont().GetSize().Height(); @@ -1483,7 +1483,7 @@ void SmSubSupNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) aPos.Y() -= nDist; break; default : - DBG_ASSERT(FALSE, "Sm: unbekannter Fall"); + OSL_ENSURE(FALSE, "Sm: unknown case"); break; } @@ -1595,9 +1595,9 @@ void SmBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmNode *pLeft = GetSubNode(0), *pBody = GetSubNode(1), *pRight = GetSubNode(2); - DBG_ASSERT(pLeft, "Sm: NULL pointer"); - DBG_ASSERT(pBody, "Sm: NULL pointer"); - DBG_ASSERT(pRight, "Sm: NULL pointer"); + OSL_ENSURE(pLeft, "Sm: NULL pointer"); + OSL_ENSURE(pBody, "Sm: NULL pointer"); + OSL_ENSURE(pRight, "Sm: NULL pointer"); pBody->Arrange(rDev, rFormat); @@ -1637,8 +1637,8 @@ void SmBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) if (bScale) { Size aTmpSize (pLeft->GetFont().GetSize()); - DBG_ASSERT(pRight->GetFont().GetSize() == aTmpSize, - "Sm : unterschiedliche Fontgroessen"); + OSL_ENSURE(pRight->GetFont().GetSize() == aTmpSize, + "Sm : different font sizes"); aTmpSize.Width() = Min((long) nBraceHeight * 60L / 100L, rFormat.GetBaseSize().Height() * 3L / 2L); // correction factor since change from StarMath to OpenSymbol font @@ -1751,9 +1751,9 @@ void SmVerticalBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFor SmNode *pBody = GetSubNode(0), *pBrace = GetSubNode(1), *pScript = GetSubNode(2); - DBG_ASSERT(pBody, "Sm: NULL pointer!"); - DBG_ASSERT(pBrace, "Sm: NULL pointer!"); - DBG_ASSERT(pScript, "Sm: NULL pointer!"); + OSL_ENSURE(pBody, "Sm: NULL pointer!"); + OSL_ENSURE(pBrace, "Sm: NULL pointer!"); + OSL_ENSURE(pScript, "Sm: NULL pointer!"); SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE); aTmpDev.SetFont(GetFont()); @@ -1810,12 +1810,12 @@ void SmVerticalBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFor SmNode * SmOperNode::GetSymbol() { SmNode *pNode = GetSubNode(0); - DBG_ASSERT(pNode, "Sm: NULL pointer!"); + OSL_ENSURE(pNode, "Sm: NULL pointer!"); if (pNode->GetType() == NSUBSUP) pNode = ((SmSubSupNode *) pNode)->GetBody(); - DBG_ASSERT(pNode, "Sm: NULL pointer!"); + OSL_ENSURE(pNode, "Sm: NULL pointer!"); return pNode; } @@ -1853,8 +1853,8 @@ void SmOperNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmNode *pOper = GetSubNode(0); SmNode *pBody = GetSubNode(1); - DBG_ASSERT(pOper, "Sm: Subnode fehlt"); - DBG_ASSERT(pBody, "Sm: Subnode fehlt"); + OSL_ENSURE(pOper, "Sm: missing subnode"); + OSL_ENSURE(pBody, "Sm: missing subnode"); SmNode *pSymbol = GetSymbol(); pSymbol->SetSize(Fraction(CalcSymbolHeight(*pSymbol, rFormat), @@ -1882,7 +1882,7 @@ void SmOperNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) void SmAlignNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) // setzt im ganzen subtree (incl aktuellem node) das alignment { - DBG_ASSERT(GetNumSubNodes() > 0, "Sm: SubNode fehlt"); + OSL_ENSURE(GetNumSubNodes() > 0, "Sm: missing subnode"); SmNode *pNode = GetSubNode(0); @@ -1910,8 +1910,8 @@ void SmAttributNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) { SmNode *pAttr = GetSubNode(0), *pBody = GetSubNode(1); - DBG_ASSERT(pBody, "Sm: Body fehlt"); - DBG_ASSERT(pAttr, "Sm: Attribut fehlt"); + OSL_ENSURE(pBody, "Sm: body missing"); + OSL_ENSURE(pAttr, "Sm: attribute missing"); pBody->Arrange(rDev, rFormat); @@ -2064,7 +2064,7 @@ void SmFontNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) { SmNode *pNode = GetSubNode(1); - DBG_ASSERT(pNode, "Sm: SubNode fehlt"); + OSL_ENSURE(pNode, "Sm: missing subnode"); switch (GetToken().eType) { case TSIZE : @@ -2093,7 +2093,7 @@ void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) case TYELLOW : SetColor(Color(COL_YELLOW)); break; default: - DBG_ASSERT(FALSE, "Sm: unbekannter Fall"); + OSL_ENSURE(FALSE, "Sm: unknown case"); } pNode->Arrange(rDev, rFormat); @@ -2146,7 +2146,7 @@ void SmPolyLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) // // Das Polygon mit den beiden Endpunkten bilden // - DBG_ASSERT(aPoly.GetSize() == 2, "Sm : falsche Anzahl von Punkten"); + OSL_ENSURE(aPoly.GetSize() == 2, "Sm : wrong number of points"); Point aPointA, aPointB; if (GetToken().eType == TWIDESLASH) { @@ -2157,7 +2157,7 @@ void SmPolyLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) } else { - DBG_ASSERT(GetToken().eType == TWIDEBACKSLASH, "Sm : unerwartetes Token"); + OSL_ENSURE(GetToken().eType == TWIDEBACKSLASH, "Sm : unexpected token"); aPointA.X() = aPointA.Y() = nBorderwidth; aPointB.X() = aToSize.Width() - nBorderwidth; @@ -2320,8 +2320,8 @@ void SmRectangleNode::Draw(OutputDevice &rDev, const Point &rPosition) const aTmp.Top() += nTmpBorderWidth; aTmp.Bottom() -= nTmpBorderWidth; - DBG_ASSERT(aTmp.GetHeight() > 0 && aTmp.GetWidth() > 0, - "Sm: leeres Rechteck"); + OSL_ENSURE(aTmp.GetHeight() > 0 && aTmp.GetWidth() > 0, + "Sm: empty rectangle"); //! avoid GROWING AND SHRINKING of drawn rectangle when constantly //! increasing zoomfactor. @@ -2550,7 +2550,7 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) { aLineRect = SmRect(); for (j = 0; j < nNumCols; j++) { SmNode *pTmpNode = GetSubNode(i * nNumCols + j); - DBG_ASSERT(pTmpNode, "Sm: NULL pointer"); + OSL_ENSURE(pTmpNode, "Sm: NULL pointer"); const SmRect &rNodeRect = pTmpNode->GetRect(); @@ -2664,7 +2664,7 @@ void SmMathSymbolNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight) aFntSize.Width() = rDev.GetFontMetric().GetSize().Width(); rDevNC.Pop(); } - DBG_ASSERT(aFntSize.Width() != 0, "Sm: "); + OSL_ENSURE(aFntSize.Width() != 0, "Sm: "); //! however the result is a bit better with 'nHeight' as initial //! font height @@ -2694,9 +2694,9 @@ void SmMathSymbolNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocSh // use same font size as is used for variables GetFont().SetSize( rFormat.GetFont( FNT_VARIABLE ).GetSize() ); - DBG_ASSERT(GetFont().GetCharSet() == RTL_TEXTENCODING_SYMBOL || + OSL_ENSURE(GetFont().GetCharSet() == RTL_TEXTENCODING_SYMBOL || GetFont().GetCharSet() == RTL_TEXTENCODING_UNICODE, - "incorrect charset for character from StarMath/OpenSymbol font"); + "wrong charset for character from StarMath/OpenSymbol font"); Flags() |= FLG_FONT | FLG_ITALIC; }; @@ -2750,7 +2750,7 @@ void SmAttributNode::CreateTextFromNode(String &rText) { SmNode *pNode; USHORT nSize = GetNumSubNodes(); - DBG_ASSERT(nSize == 2, "Node missing members"); + OSL_ENSURE(nSize == 2, "Node missing members"); rText.Append('{'); sal_Unicode nLast=0; if (NULL != (pNode = GetSubNode(0))) @@ -2870,10 +2870,10 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell if (bIsFromGreekSymbolSet) { - DBG_ASSERT( GetText().Len() == 1, "a symbol should only consist of 1 char!" ); + OSL_ENSURE( GetText().Len() == 1, "a symbol should only consist of 1 char!" ); bool bItalic = false; INT16 nStyle = rFormat.GetGreekCharStyle(); - DBG_ASSERT( nStyle >= 0 && nStyle <= 2, "unexpected value for GreekCharStyle" ); + OSL_ENSURE( nStyle >= 0 && nStyle <= 2, "unexpected value for GreekCharStyle" ); if (nStyle == 1) bItalic = true; else if (nStyle == 2) diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 327c133e50f1..89d89ce621c0 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -332,7 +332,7 @@ static const SmTokenTableEntry * GetTokenTableEntry( const String &rName ) BOOL SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos ) // returns 'TRUE' iff cChar is '\0' or a delimeter { - DBG_ASSERT( nPos <= rTxt.Len(), "index out of range" ); + OSL_ENSURE( nPos <= rTxt.Len(), "index out of range" ); sal_Unicode cChar = rTxt.GetChar( nPos ); if(!cChar) @@ -367,7 +367,7 @@ void SmParser::Insert(const String &rText, USHORT nPos) void SmParser::Replace( USHORT nPos, USHORT nLen, const String &rText ) { - DBG_ASSERT( nPos + nLen <= BufferString.Len(), "argument mismatch" ); + OSL_ENSURE( nPos + nLen <= BufferString.Len(), "argument mismatch" ); BufferString.Replace( nPos, nLen, rText ); INT16 nChg = rText.Len() - nLen; @@ -488,7 +488,7 @@ void SmParser::NextToken() || (bNumStart && (aRes.TokenType & KParseType::IDENTNAME))) { INT32 n = aRes.EndPos - nRealStart; - DBG_ASSERT( n >= 0, "length < 0" ); + OSL_ENSURE( n >= 0, "length < 0" ); CurToken.eType = TNUMBER; CurToken.cMathChar = '\0'; CurToken.nGroup = 0; @@ -515,7 +515,7 @@ void SmParser::NextToken() else if (aRes.TokenType & KParseType::IDENTNAME) { INT32 n = aRes.EndPos - nRealStart; - DBG_ASSERT( n >= 0, "length < 0" ); + OSL_ENSURE( n >= 0, "length < 0" ); String aName( BufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) ); const SmTokenTableEntry *pEntry = GetTokenTableEntry( aName ); @@ -673,7 +673,7 @@ void SmParser::NextToken() { //! modifies aRes.EndPos - DBG_ASSERT( rnEndPos >= nBufLen || + OSL_ENSURE( rnEndPos >= nBufLen || '%' != BufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ), "unexpected comment start" ); @@ -706,7 +706,7 @@ void SmParser::NextToken() CurToken.eType = TSPECIAL; CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 ); - DBG_ASSERT( aTmpRes.EndPos > rnEndPos, + OSL_ENSURE( aTmpRes.EndPos > rnEndPos, "empty identifier" ); if (aTmpRes.EndPos > rnEndPos) rnEndPos = aTmpRes.EndPos; @@ -1230,8 +1230,8 @@ void SmParser::Product() void SmParser::SubSup(ULONG nActiveGroup) { - DBG_ASSERT(nActiveGroup == TGPOWER || nActiveGroup == TGLIMIT, - "Sm: falsche Tokengruppe"); + OSL_ENSURE(nActiveGroup == TGPOWER || nActiveGroup == TGLIMIT, + "Sm: wrong token group"); if (!TokenInGroup(nActiveGroup)) // already finish @@ -1279,10 +1279,10 @@ void SmParser::SubSup(ULONG nActiveGroup) case TLSUB : nIndex = (int) LSUB; break; case TLSUP : nIndex = (int) LSUP; break; default : - DBG_ASSERT(FALSE, "Sm: unbekannter Fall"); + OSL_ENSURE(FALSE, "Sm: unknown case"); } nIndex++; - DBG_ASSERT(1 <= nIndex && nIndex <= 1 + SUBSUP_NUM_ENTRIES, + OSL_ENSURE(1 <= nIndex && nIndex <= 1 + SUBSUP_NUM_ENTRIES, "SmParser::Power() : sub-/supscript index falsch"); // set sub-/supscript if not already done @@ -1319,7 +1319,7 @@ void SmParser::Power() void SmParser::Blank() { - DBG_ASSERT(TokenInGroup(TGBLANK), "Sm : falsches Token"); + OSL_ENSURE(TokenInGroup(TGBLANK), "Sm : wrong token"); SmBlankNode *pBlankNode = new SmBlankNode(CurToken); while (TokenInGroup(TGBLANK)) @@ -1495,7 +1495,7 @@ void SmParser::Term() FontAttribut(); // check if casting in following line is ok - DBG_ASSERT(!NodeStack.Top()->IsVisible(), "Sm : Ooops..."); + OSL_ENSURE(!NodeStack.Top()->IsVisible(), "Sm : Ooops..."); aArray[n] = (SmStructureNode *) NodeStack.Pop(); n++; @@ -1652,12 +1652,12 @@ void SmParser::Oper() case TOPER : NextToken(); - DBG_ASSERT(CurToken.eType == TSPECIAL, "Sm: falsches Token"); + OSL_ENSURE(CurToken.eType == TSPECIAL, "Sm: wrong token"); pNode = new SmGlyphSpecialNode(CurToken); break; default : - DBG_ASSERT(0, "Sm: unbekannter Fall"); + OSL_ENSURE(0, "Sm: unknown case"); } NodeStack.Push(pNode); @@ -1667,7 +1667,7 @@ void SmParser::Oper() void SmParser::UnOper() { - DBG_ASSERT(TokenInGroup(TGUNOPER), "Sm: falsches Token"); + OSL_ENSURE(TokenInGroup(TGUNOPER), "Sm: wrong token"); SmToken aNodeToken = CurToken; SmTokenType eType = CurToken.eType; @@ -1753,7 +1753,7 @@ void SmParser::UnOper() void SmParser::Attribut() { - DBG_ASSERT(TokenInGroup(TGATTRIBUT), "Sm: falsche Tokengruppe"); + OSL_ENSURE(TokenInGroup(TGATTRIBUT), "Sm: wrong token group"); SmStructureNode *pSNode = new SmAttributNode(CurToken); SmNode *pAttr; @@ -1789,7 +1789,7 @@ void SmParser::Attribut() void SmParser::FontAttribut() { - DBG_ASSERT(TokenInGroup(TGFONTATTR), "Sm: falsche Tokengruppe"); + OSL_ENSURE(TokenInGroup(TGFONTATTR), "Sm: wrong token group"); switch (CurToken.eType) { @@ -1815,14 +1815,14 @@ void SmParser::FontAttribut() break; default : - DBG_ASSERT(0, "Sm: unbekannter Fall"); + OSL_ENSURE(0, "Sm: unknown case"); } } void SmParser::Color() { - DBG_ASSERT(CurToken.eType == TCOLOR, "Sm : Ooops..."); + OSL_ENSURE(CurToken.eType == TCOLOR, "Sm : Ooops..."); // last color rules, get that one SmToken aToken; @@ -1843,7 +1843,7 @@ void SmParser::Color() void SmParser::Font() { - DBG_ASSERT(CurToken.eType == TFONT, "Sm : Ooops..."); + OSL_ENSURE(CurToken.eType == TFONT, "Sm : Ooops..."); // last font rules, get that one SmToken aToken; @@ -1886,7 +1886,7 @@ BOOL lcl_IsNumber(const UniString& rText) void SmParser::FontSize() { - DBG_ASSERT(CurToken.eType == TSIZE, "Sm : Ooops..."); + OSL_ENSURE(CurToken.eType == TSIZE, "Sm : Ooops..."); USHORT Type; SmFontNode *pFontNode = new SmFontNode(CurToken); @@ -1955,7 +1955,7 @@ void SmParser::FontSize() void SmParser::Brace() { - DBG_ASSERT(CurToken.eType == TLEFT || TokenInGroup(TGLBRACES), + OSL_ENSURE(CurToken.eType == TLEFT || TokenInGroup(TGLBRACES), "Sm: kein Klammer Ausdruck"); SmStructureNode *pSNode = new SmBraceNode(CurToken); @@ -2019,7 +2019,7 @@ void SmParser::Brace() case TLFLOOR : eExpectedType = TRFLOOR; break; case TLCEIL : eExpectedType = TRCEIL; break; default : - DBG_ASSERT(0, "Sm: unbekannter Fall"); + OSL_ENSURE(0, "Sm: unknown case"); } if (CurToken.eType == eExpectedType) @@ -2035,8 +2035,8 @@ void SmParser::Brace() } if (eError == PE_NONE) - { DBG_ASSERT(pLeft, "Sm: NULL pointer"); - DBG_ASSERT(pRight, "Sm: NULL pointer"); + { OSL_ENSURE(pLeft, "Sm: NULL pointer"); + OSL_ENSURE(pRight, "Sm: NULL pointer"); pSNode->SetSubNodes(pLeft, pBody, pRight); pSNode->SetScaleMode(eScaleMode); NodeStack.Push(pSNode); @@ -2304,7 +2304,7 @@ void SmParser::Special() } if (pFrom && pTo) { - DBG_ASSERT( pFrom->Count() == pTo->Count(), + OSL_ENSURE( pFrom->Count() == pTo->Count(), "array length mismatch" ); USHORT nCount = sal::static_int_cast< USHORT >(pFrom->Count()); for (USHORT i = 0; i < nCount; ++i) diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index 248983a393a8..002916627bc0 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -30,7 +30,7 @@ #include <tools/string.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/virdev.hxx> @@ -68,7 +68,7 @@ BOOL SmIsMathAlpha(const XubString &rText) if (rText.Len() == 0) return FALSE; - DBG_ASSERT(rText.Len() == 1, "Sm : String enthaelt nicht genau ein Zeichen"); + OSL_ENSURE(rText.Len() == 1, "Sm : string must be exactly one character long"); xub_Unicode cChar = rText.GetChar(0); // ist es ein griechisches Zeichen ? @@ -94,8 +94,8 @@ BOOL SmIsMathAlpha(const XubString &rText) SmRect::SmRect() // constructs empty rectangle at (0, 0) with width and height 0. { - DBG_ASSERT(aTopLeft == Point(0, 0), "Sm: ooops..."); - DBG_ASSERT(aSize == Size(0, 0), "Sm: ooops..."); + OSL_ENSURE(aTopLeft == Point(0, 0), "Sm: ooops..."); + OSL_ENSURE(aSize == Size(0, 0), "Sm: ooops..."); bHasBaseline = bHasAlignInfo = FALSE; nBaseline = nAlignT = nAlignM = nAlignB = @@ -142,7 +142,7 @@ void SmRect::CopyAlignInfo(const SmRect &rRect) void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat, const XubString &rText, USHORT nBorder) { - DBG_ASSERT(aTopLeft == Point(0, 0), "Sm: Ooops..."); + OSL_ENSURE(aTopLeft == Point(0, 0), "Sm: Ooops..."); aSize = Size(rDev.GetTextWidth(rText), rDev.GetTextHeight()); @@ -229,8 +229,8 @@ void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat, if (nLoAttrFence > GetBottom()) nLoAttrFence = GetBottom(); - DBG_ASSERT(rText.Len() == 0 || !IsEmpty(), - "Sm: leeres Rechteck erzeugt"); + OSL_ENSURE(rText.Len() == 0 || !IsEmpty(), + "Sm: empty rectangle created"); } @@ -245,7 +245,7 @@ void SmRect::Init(const OutputDevice &rDev, const SmFormat *pFormat, SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat, const XubString &rText, long nEBorderWidth) { - DBG_ASSERT( nEBorderWidth >= 0, "BorderWidth negativ" ); + OSL_ENSURE( nEBorderWidth >= 0, "BorderWidth is negative" ); if (nEBorderWidth < 0) nEBorderWidth = 0; Init(rDev, pFormat, rText, (USHORT) nEBorderWidth); @@ -259,7 +259,7 @@ SmRect::SmRect(long nWidth, long nHeight) // as used in 'SmBinVerNode'. : aSize(nWidth, nHeight) { - DBG_ASSERT(aTopLeft == Point(0, 0), "Sm: ooops..."); + OSL_ENSURE(aTopLeft == Point(0, 0), "Sm: ooops..."); bHasBaseline = FALSE; bHasAlignInfo = TRUE; @@ -349,7 +349,7 @@ const Point SmRect::AlignTo(const SmRect &rRect, RectPos ePos, + GetItalicLeftSpace(); break; default : - DBG_ASSERT(FALSE, "Sm: unbekannter Fall"); + OSL_ENSURE(FALSE, "Sm: unknown case"); } // check if horizontal position is already set @@ -386,7 +386,7 @@ const Point SmRect::AlignTo(const SmRect &rRect, RectPos ePos, aPos.Y() += rRect.GetLoAttrFence() - GetTop(); break; default : - DBG_ASSERT(FALSE, "Sm: unbekannter Fall"); + OSL_ENSURE(FALSE, "Sm: unknown case"); } // check if vertical position is already set @@ -403,7 +403,7 @@ const Point SmRect::AlignTo(const SmRect &rRect, RectPos ePos, aPos.X() += rRect.GetItalicRight() - GetItalicRight(); break; default : - DBG_ASSERT(FALSE, "Sm: unbekannter Fall"); + OSL_ENSURE(FALSE, "Sm: unknown case"); } return aPos; @@ -476,7 +476,7 @@ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode) nAlignB = Max(GetAlignB(), rRect.GetAlignB()); nHiAttrFence = Min(GetHiAttrFence(), rRect.GetHiAttrFence()); nLoAttrFence = Max(GetLoAttrFence(), rRect.GetLoAttrFence()); - DBG_ASSERT(HasAlignInfo(), "Sm: ooops..."); + OSL_ENSURE(HasAlignInfo(), "Sm: ooops..."); switch (eCopyMode) { case RCP_THIS: @@ -494,7 +494,7 @@ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode) CopyMBL(rRect); break; default : - DBG_ASSERT(FALSE, "Sm: unbekannter Fall"); + OSL_ENSURE(FALSE, "Sm: unknown case"); } } @@ -509,7 +509,7 @@ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, // align eg "{a over b} over c" correctly where AlignM should not // be (AlignT + AlignB) / 2) { - DBG_ASSERT(HasAlignInfo(), "Sm: keine Align Info"); + OSL_ENSURE(HasAlignInfo(), "Sm: no align info"); ExtendBy(rRect, eCopyMode); nAlignM = nNewAlignM; @@ -743,7 +743,7 @@ BOOL SmGetGlyphBoundRect(const OutputDevice &rDev, aTmp; BOOL bSuccess = pGlyphDev->GetTextBoundRect(aTmp, rText, 0, 0); - DBG_ASSERT( bSuccess, "GetTextBoundRect failed" ); + OSL_ENSURE( bSuccess, "GetTextBoundRect failed" ); if (!aTmp.IsEmpty()) diff --git a/starmath/source/smdetect.hxx b/starmath/source/smdetect.hxx index b9302260d8bd..738ed82fe130 100644 --- a/starmath/source/smdetect.hxx +++ b/starmath/source/smdetect.hxx @@ -29,7 +29,7 @@ #define _SM_TYPEDETECT_HXX #include <rtl/ustring.hxx> -#include <tools/debug.hxx> +#include <osl/diagnose.h> #include <com/sun/star/document/XExtendedFilterDetection.hpp> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/uno/Reference.h> diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 89de89f513df..8c8d7d522637 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -184,7 +184,7 @@ const SymbolPtrVec_t SmSymbolManager::GetSymbols() const SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); for ( ; aIt != m_aSymbols.end(); ++aIt) aRes.push_back( &aIt->second ); -// DBG_ASSERT( sSymbols.size() == m_aSymbols.size(), "number of symbols mismatch " ); +// OSL_ENSURE( sSymbols.size() == m_aSymbols.size(), "number of symbols mismatch " ); return aRes; } @@ -208,11 +208,11 @@ bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChang else if (pFound && !bForceChange && bSymbolConflict) { // TODO: but what ... - DBG_ASSERT( 0, "symbol conflict, different symbol with same name found!" ); + OSL_ENSURE( 0, "symbol conflict, different symbol with same name found!" ); } } - DBG_ASSERT( bAdded, "failed to add symbol" ); + OSL_ENSURE( bAdded, "failed to add symbol" ); if (bAdded) m_bModified = true; @@ -268,7 +268,7 @@ void SmSymbolManager::Load() for (size_t i = 0; i < nSymbolCount; ++i) { const SmSym &rSym = aSymbols[i]; - DBG_ASSERT( rSym.GetName().Len() > 0, "symbol without name!" ); + OSL_ENSURE( rSym.GetName().Len() > 0, "symbol without name!" ); if (rSym.GetName().Len() > 0) AddOrReplaceSymbol( rSym ); } @@ -292,7 +292,7 @@ void SmSymbolManager::Load() // make the new symbol a copy but with ITALIC_NORMAL, and add it to iGreek const SmSym &rSym = *aGreekSymbols[i]; Font aFont( rSym.GetFace() ); - DBG_ASSERT( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." ); + OSL_ENSURE( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." ); aFont.SetItalic( ITALIC_NORMAL ); String aSymbolName( (sal_Unicode)'i' ); aSymbolName += rSym.GetName(); diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx index 337228e2c1df..eb501287038d 100644 --- a/starmath/source/toolbox.cxx +++ b/starmath/source/toolbox.cxx @@ -208,7 +208,7 @@ const ImageList * SmToolBoxWindow::GetImageList( USHORT nResId, BOOL bHighContra pIL = pImgList[ nIndex ]; } - DBG_ASSERT( pIL, "image list not found!" ); + OSL_ENSURE( pIL, "image list not found!" ); return pIL; } @@ -219,7 +219,7 @@ void SmToolBoxWindow::ApplyImageLists( USHORT nCategoryRID ) // set image list for toolbox 'catalog' const ImageList *pImageList = GetImageList( bHighContrast ? RID_ILH_CATALOG : RID_IL_CATALOG, bHighContrast ); - DBG_ASSERT( pImageList, "image list missing" ); + OSL_ENSURE( pImageList, "image list missing" ); if (pImageList) aToolBoxCat.SetImageList( *pImageList ); @@ -227,7 +227,7 @@ void SmToolBoxWindow::ApplyImageLists( USHORT nCategoryRID ) sal_Int16 nIdx = GetToolBoxCategoriesIndex( nCategoryRID ); USHORT nResId = GetImageListRID( nCategoryRID, bHighContrast ); pImageList = GetImageList( nResId, bHighContrast ); - DBG_ASSERT( pImageList && nIdx >= 0, "image list or index missing" ); + OSL_ENSURE( pImageList && nIdx >= 0, "image list or index missing" ); if (pImageList && nIdx >= 0) vToolBoxCategories[ nIdx ]->SetImageList( *pImageList ); } @@ -260,7 +260,7 @@ void SmToolBoxWindow::AdjustPosSize( BOOL bSetPos ) { Size aCatSize( aToolBoxCat.CalcWindowSizePixel( 2 ) ); Size aCmdSize( pToolBoxCmd->CalcWindowSizePixel( 5 ) ); - DBG_ASSERT( aCatSize.Width() == aCmdSize.Width(), "width mismatch" ); + OSL_ENSURE( aCatSize.Width() == aCmdSize.Width(), "width mismatch" ); // catalog settings aToolBoxCat.SetPosPixel( Point(0, 3) ); @@ -286,7 +286,7 @@ void SmToolBoxWindow::AdjustPosSize( BOOL bSetPos ) if (bSetPos) { SmViewShell *pView = GetView(); - DBG_ASSERT( pView, "view shell missing" ); + OSL_ENSURE( pView, "view shell missing" ); Point aPos( 50, 75 ); if (pView) { @@ -347,14 +347,14 @@ void SmToolBoxWindow::SetCategory(USHORT nCategoryRID) pToolBoxCmd->Hide(); sal_Int16 nIdx = GetToolBoxCategoriesIndex( nCategoryRID ); - DBG_ASSERT( nIdx >= 0, "unkown category" ); + OSL_ENSURE( nIdx >= 0, "unkown category" ); if (nIdx >= 0) pToolBoxCmd = vToolBoxCategories[nIdx]; // calculate actual size of window to use Size aCatSize( aToolBoxCat.CalcWindowSizePixel( 2 ) ); Size aCmdSize( pToolBoxCmd->CalcWindowSizePixel( nLines ) ); - DBG_ASSERT( aCatSize.Width() == aCmdSize.Width(), "width mismatch" ); + OSL_ENSURE( aCatSize.Width() == aCmdSize.Width(), "width mismatch" ); // main window settings Size aWndSize ( aCatSize.Width(), pToolBoxCmd->GetPosPixel().Y() + aCmdSize.Height() + 3); SetOutputSizePixel( aWndSize ); diff --git a/starmath/source/types.cxx b/starmath/source/types.cxx index e63d46c79e9b..a227b31ec417 100644 --- a/starmath/source/types.cxx +++ b/starmath/source/types.cxx @@ -30,6 +30,7 @@ #include <types.hxx> +#include <osl/diagnose.h> sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar ) @@ -37,7 +38,7 @@ sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar ) sal_Unicode cRes = cChar; if (IsInPrivateUseArea( cChar )) { - DBG_ASSERT( 0, "Error: private use area characters should no longer be in use!" ); + OSL_ENSURE( 0, "Error: private use area characters should no longer be in use!" ); cRes = (sal_Unicode) '@'; // just some character that should easily be notice as odd in the context } return cRes; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index a595a82d4b39..017c8d828c67 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -81,13 +81,13 @@ using namespace ::com::sun::star::script; SmPrintUIOptions::SmPrintUIOptions() { ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 18, "resource incomplete" ); + OSL_ENSURE( aLocalizedStrings.Count() >= 18, "resource incomplete" ); if( aLocalizedStrings.Count() < 18 ) // bad resource ? return; SmModule *pp = SM_MOD(); SmConfig *pConfig = pp->GetConfig(); - DBG_ASSERT( pConfig, "SmConfig not found" ); + OSL_ENSURE( pConfig, "SmConfig not found" ); if (!pConfig) return; @@ -1039,7 +1039,7 @@ void SAL_CALL SmModel::render( while (pViewSh && pViewSh->GetObjectShell() != pDocSh) pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, sal_False /* search non-visible views as well*/ ); SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh ); - DBG_ASSERT( pView, "SmModel::render : no SmViewShell found" ); + OSL_ENSURE( pView, "SmModel::render : no SmViewShell found" ); if (pView) { diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 891bf8781a37..794d27701e18 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -159,7 +159,7 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt) // set formula-cursor and selection of edit window according to the // position clicked at // - DBG_ASSERT(rMEvt.GetClicks() > 0, "Sm : 0 clicks"); + OSL_ENSURE(rMEvt.GetClicks() > 0, "Sm : 0 clicks"); if ( rMEvt.IsLeft() && pViewShell->GetEditWindow() ) { const SmNode *pTree = pViewShell->GetDoc()->GetFormulaTree(); @@ -294,7 +294,7 @@ const SmNode * SmGraphicWindow::SetCursorPos(USHORT nRow, USHORT nCol) void SmGraphicWindow::Paint(const Rectangle&) { - DBG_ASSERT(pViewShell, "Sm : NULL pointer"); + OSL_ENSURE(pViewShell, "Sm : NULL pointer"); SmDocShell &rDoc = *pViewShell->GetDoc(); Point aPoint; @@ -353,7 +353,7 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt) Point aPos(5, 5); if (rCEvt.IsMouseEvent()) aPos = rCEvt.GetMousePosPixel(); - DBG_ASSERT( pViewShell, "view shell missing" ); + OSL_ENSURE( pViewShell, "view shell missing" ); // added for replaceability of context menus #96085, #93782 pViewShell->GetViewFrame()->GetBindings().GetDispatcher() @@ -1141,7 +1141,7 @@ void SmViewShell::Impl_Print( USHORT SmViewShell::Print(SfxProgress & /*rProgress*/, BOOL /*bIsAPI*/, PrintDialog * /*pPrintDialog*/) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Print" ); - DBG_ASSERT( 0, "SmViewShell::Print: no longer used with new UI print dialog. Should be removed!!" ); + OSL_ENSURE( 0, "SmViewShell::Print: no longer used with new UI print dialog. Should be removed!!" ); return 0; } @@ -1195,7 +1195,7 @@ SmEditWindow *SmViewShell::GetEditWindow() if (pWrapper != NULL) { SmEditWindow *pEditWin = pWrapper->GetEditWindow(); - DBG_ASSERT( pEditWin, "SmEditWindow missing" ); + OSL_ENSURE( pEditWin, "SmEditWindow missing" ); return pEditWin; } @@ -1216,7 +1216,7 @@ void SmViewShell::ShowError( const SmErrorDesc *pErrorDesc ) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::ShowError" ); - DBG_ASSERT(GetDoc(), "Sm : Document missing"); + OSL_ENSURE(GetDoc(), "Sm : Document missing"); if (pErrorDesc || 0 != (pErrorDesc = GetDoc()->GetParser().GetError(0)) ) { SetStatusText( pErrorDesc->Text ); @@ -1230,7 +1230,7 @@ void SmViewShell::NextError() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::NextError" ); - DBG_ASSERT(GetDoc(), "Sm : Document missing"); + OSL_ENSURE(GetDoc(), "Sm : Document missing"); const SmErrorDesc *pErrorDesc = GetDoc()->GetParser().NextError(); if (pErrorDesc) @@ -1242,7 +1242,7 @@ void SmViewShell::PrevError() { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::PrevError" ); - DBG_ASSERT(GetDoc(), "Sm : Document missing"); + OSL_ENSURE(GetDoc(), "Sm : Document missing"); const SmErrorDesc *pErrorDesc = GetDoc()->GetParser().PrevError(); if (pErrorDesc) @@ -1401,7 +1401,7 @@ void SmViewShell::Execute(SfxRequest& rReq) break; case SID_ZOOMOUT: - DBG_ASSERT(aGraphic.GetZoom() >= 25, "Sm: falsches USHORT Argument"); + OSL_ENSURE(aGraphic.GetZoom() >= 25, "Sm: incorrect USHORT argument"); aGraphic.SetZoom(aGraphic.GetZoom() - 25); break; @@ -1596,7 +1596,7 @@ void SmViewShell::Execute(SfxRequest& rReq) if(pFact) { pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); + OSL_ENSURE(pDlg, "Dialogdiet fail!"); } pDlg->SetLimits( MINZOOM, MAXZOOM ); if( pDlg->Execute() != RET_CANCEL ) @@ -1653,7 +1653,7 @@ void SmViewShell::Execute(SfxRequest& rReq) OutputDevice *pDev = pDoc->GetPrinter(); if (!pDev || pDev->GetDevFontCount() == 0) pDev = &SM_MOD()->GetDefaultVirtualDev(); - DBG_ASSERT (pDev, "device for font list missing" ); + OSL_ENSURE (pDev, "device for font list missing" ); SmModule *pp = SM_MOD(); SmSymbolDialog( NULL, pDev, pp->GetSymbolManager(), *this ).Execute(); @@ -1816,8 +1816,8 @@ void SmViewShell::Activate( BOOL bIsMDIActivate ) IMPL_LINK( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg ) { - DBG_ASSERT( _pFileDlg, "SmViewShell::DialogClosedHdl(): no file dialog" ); - DBG_ASSERT( pImpl->pDocInserter, "ScDocShell::DialogClosedHdl(): no document inserter" ); + OSL_ENSURE( _pFileDlg, "SmViewShell::DialogClosedHdl(): no file dialog" ); + OSL_ENSURE( pImpl->pDocInserter, "ScDocShell::DialogClosedHdl(): no document inserter" ); if ( ERRCODE_NONE == _pFileDlg->GetError() ) { |