summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-11-22 09:34:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2011-11-22 09:41:47 +0100
commit70a6b9ffbd676a1384433a86205d2cd4f2d4f4b1 (patch)
treeffb31ef817b5f2037cf7c332da422b9179d613d5 /sfx2
parentf2972242673cc9608960e9ca70e82766be5275e3 (diff)
New sal/log.h obsoletes osl/diagnose.h and tools/debug.hxx.
* New SAL_INFO..., SAL_WARN... macros. * New SAL_STREAM supersedes OSL_FORMAT. * oustringostreaminserter.hxx moved from unotest to rtl (and always UTF-8 now). * TODO to enable GCC __attribute__((format)) in sal/log.h (requires call-site cleanup). * Further functionality in tools/debug.hxx (DBG_MEMTEST, DBG_CTOR, etc.) not yet addressed. * Some replacements tools String -> rtl::OUString.
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/objface.hxx4
-rw-r--r--sfx2/source/appl/module.cxx12
-rw-r--r--sfx2/source/control/bindings.cxx56
-rw-r--r--sfx2/source/control/dispatch.cxx37
-rw-r--r--sfx2/source/control/shell.cxx28
5 files changed, 43 insertions, 94 deletions
diff --git a/sfx2/inc/sfx2/objface.hxx b/sfx2/inc/sfx2/objface.hxx
index d867bd065f2b..7e43c19b1226 100644
--- a/sfx2/inc/sfx2/objface.hxx
+++ b/sfx2/inc/sfx2/objface.hxx
@@ -29,6 +29,8 @@
#define _SFXOBJFACE_HXX
#include "sal/config.h"
+
+#include "rtl/ustring.hxx"
#include "sfx2/dllapi.h"
#include "sal/types.h"
#include <tools/string.hxx>
@@ -79,7 +81,7 @@ public:
const char* GetClassName() const { return pName; }
int HasName() const { return 0 != aNameResId.GetId(); }
- String GetName() const
+ rtl::OUString GetName() const
{ return String(aNameResId); }
ResMgr* GetResMgr() const
{ return aNameResId.GetResMgr(); }
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 6883e90f5ff5..a4fc06dea36e 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -50,6 +50,7 @@
#include "sfx2/taskpane.hxx"
#include <tools/diagnose_ex.h>
#include <rtl/strbuf.hxx>
+#include <sal/log.h>
#define SfxModule
#include "sfxslots.hxx"
@@ -208,7 +209,7 @@ void SfxModule::RegisterChildWindow(SfxChildWinFactory *pFact)
if (pFact->nId == (*pImpl->pFactArr)[nFactory]->nId)
{
pImpl->pFactArr->Remove( nFactory );
- OSL_FAIL("ChildWindow registered multiple times!");
+ SAL_WARN("sfx2", "ChildWindow registered multiple times!");
return;
}
}
@@ -391,11 +392,10 @@ FieldUnit SfxModule::GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com
SfxPoolItem const * pItem = pModule->GetItem( SID_ATTR_METRIC );
if ( pItem == NULL )
{
- OSL_FAIL(
- OSL_FORMAT(
- ("SfxModule::GetFieldUnit: no metric item in the module"
- " implemented by '%s'!"),
- typeid(*pModule).name()));
+ SAL_WARN_S(
+ "sfx2",
+ "SfxModule::GetFieldUnit: no metric item in the module implemented"
+ " by '" << typeid(*pModule).name() << "'!");
return FUNIT_100TH_MM;
}
return (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 9d176c43ffd2..671f79fff095 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -28,8 +28,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sfx2.hxx"
+#include "sal/config.h"
+
+#include <iomanip>
#include <boost/unordered_map.hpp>
+#include <sal/log.h>
#include <svl/itempool.hxx>
#include <svl/itemiter.hxx>
#include <svl/eitem.hxx>
@@ -1741,26 +1745,12 @@ sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine)
(void)pFile;
(void)nLine;
DBG_MEMTEST();
-#ifdef DBG_UTIL
- rtl::OStringBuffer aMsg;
- sal_uInt16 nSpaces = Min(nRegLevel, sal_uInt16(8));
- while (nSpaces--)
- aMsg.append(' ');
- aMsg.append(RTL_CONSTASCII_STRINGPARAM("this = "));
- aMsg.append(reinterpret_cast<sal_Int64>(this));
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(" Level = "));
- aMsg.append(static_cast<sal_Int32>(nRegLevel));
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(
- " SfxBindings::EnterRegistrations "));
- if (pFile)
- {
- aMsg.append(RTL_CONSTASCII_STRINGPARAM("File: "));
- aMsg.append(pFile);
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(" Line: "));
- aMsg.append(static_cast<sal_Int32>(nLine));
- }
- DbgTrace(aMsg.getStr());
-#endif
+ SAL_INFO_S(
+ "sfx2",
+ std::setw(Min(nRegLevel, sal_uInt16(8))) << ' ' << "this = " << this
+ << " Level = " << nRegLevel << " SfxBindings::EnterRegistrations "
+ << (pFile
+ ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : ""));
// When bindings are locked, also lock sub bindings.
if ( pImp->pSubBindings )
@@ -1858,26 +1848,12 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int
}
}
-#ifdef DBG_UTIL
- rtl::OStringBuffer aMsg;
- sal_uInt16 nSpaces = Min(nRegLevel, sal_uInt16(8));
- while (nSpaces--)
- aMsg.append(' ');
- aMsg.append(RTL_CONSTASCII_STRINGPARAM("this = "));
- aMsg.append(reinterpret_cast<sal_Int64>(this));
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(" Level = "));
- aMsg.append(static_cast<sal_Int32>(nRegLevel));
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(
- " SfxBindings::LeaveRegistrations "));
- if (pFile)
- {
- aMsg.append(RTL_CONSTASCII_STRINGPARAM("File: "));
- aMsg.append(pFile);
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(" Line: "));
- aMsg.append(static_cast<sal_Int32>(nLine));
- }
- DbgTrace(aMsg.getStr());
-#endif
+ SAL_INFO_S(
+ "sfx2",
+ std::setw(Min(nRegLevel, sal_uInt16(8))) << ' ' << "this = " << this
+ << " Level = " << nRegLevel << " SfxBindings::LeaveRegistrations "
+ << "File: " << (pFile ? pFile : "--") << " Line: "
+ << (pFile ? nLine : 0));
}
//--------------------------------------------------------------------
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 8df3b4a00a6a..c26229146af0 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -476,25 +476,13 @@ void SfxDispatcher::Pop
SfxApplication *pSfxApp = SFX_APP();
-#ifdef DBG_UTIL
- rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("-SfxDispatcher("));
- aMsg.append(reinterpret_cast<sal_Int64>(this));
- if (bPush)
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(")::Push("));
- else
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(")::Pop("));
- if (rShell.GetInterface())
- aMsg.append(rShell.GetInterface()->GetClassName());
- else
- aMsg.append(reinterpret_cast<sal_Int64>(&rShell));
- if (bDelete)
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(") with delete"));
- else
- aMsg.append(')');
- if (bUntil)
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(" (up to)"));
- DbgTrace(aMsg.getStr());
-#endif
+ SAL_INFO_S(
+ "sfx2",
+ "-SfxDispatcher(" << this << (bPush ? ")::Push(" : ")::Pop(")
+ << (rShell.GetInterface()
+ ? rShell.GetInterface()->GetClassName() : SAL_STREAM(&rShell))
+ << (bDelete ? ") with delete" : ")")
+ << (bUntil ? " (up to)" : ""));
// same shell as on top of the to-do stack?
if ( pImp->aToDoStack.Count() && pImp->aToDoStack.Top().pCluster == &rShell )
@@ -1705,12 +1693,6 @@ void SfxDispatcher::FlushImpl()
OSL_TRACE("Flushing dispatcher!");
-#ifdef DBG_UTIL
- rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("SfxDispatcher("));
- aMsg.append(reinterpret_cast<sal_Int64>(this));
- aMsg.append(RTL_CONSTASCII_STRINGPARAM(")::Flush()"));
-#endif
-
pImp->aTimer.Stop();
if ( pImp->pParent )
@@ -1821,10 +1803,7 @@ void SfxDispatcher::FlushImpl()
for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++)
pImp->aFixedObjBars[n].nResId = 0;
-#ifdef DBG_UTIL
- aMsg.append(RTL_CONSTASCII_STRINGPARAM("done"));
- DbgTrace(aMsg.getStr());
-#endif
+ SAL_INFO_S("sfx2", "SfxDispatcher(" << this << ")::Flush() done");
}
//--------------------------------------------------------------------
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 7a32326ad652..33a6f47e0c18 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -31,6 +31,8 @@
#include <com/sun/star/embed/VerbDescriptor.hpp>
#include <com/sun/star/embed/VerbAttributes.hpp>
#include <basic/sbstar.hxx>
+#include <rtl/oustringostreaminserter.hxx>
+#include <sal/log.h>
#include <svl/itempool.hxx>
#include <svl/undo.hxx>
#include <svtools/itemdel.hxx>
@@ -623,15 +625,10 @@ void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI )
if ( !p_IF )
return;
#endif
-#ifdef DBG_UTIL_VB
- String aMsg("SfxShell::DoActivate() ");
- aMsg += (long)this;
- aMsg += " ";
- aMsg += GetInterface()->GetName();
- aMsg += " bMDI ";
- if ( bMDI ) aMsg += "MDI";
- DbgTrace( aMsg.GetBuffer() );
-#endif
+ SAL_INFO_S(
+ "sfx2.vb",
+ "SfxShell::DoActivate() " << this << " " << GetInterface()->GetName()
+ << " bMDI " << (bMDI ? "MDI" : ""));
if ( bMDI )
{
@@ -664,15 +661,10 @@ void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI )
if ( !p_IF )
return;
#endif
-#ifdef DBG_UTIL_VB
- String aMsg("SfxShell::DoDeactivate()");
- aMsg += (long)this;
- aMsg += " ";
- aMsg += GetInterface()->GetName();
- aMsg += " bMDI ";
- if ( bMDI ) aMsg += "MDI";
- DbgTrace( aMsg.GetBuffer() );
-#endif
+ SAL_INFO_S(
+ "sfx2.vb",
+ "SfxShell::DoDeactivate()" << this << " " << GetInterface()->GetName()
+ << " bMDI " << (bMDI ? "MDI" : ""));
// Only when it comes from a Frame
// (not when for instance by poping BASIC-IDE from AppDisp)