diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-11-22 09:34:46 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-11-22 09:41:47 +0100 |
commit | 70a6b9ffbd676a1384433a86205d2cd4f2d4f4b1 (patch) | |
tree | ffb31ef817b5f2037cf7c332da422b9179d613d5 /sfx2/source/control | |
parent | f2972242673cc9608960e9ca70e82766be5275e3 (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/source/control')
-rw-r--r-- | sfx2/source/control/bindings.cxx | 56 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 37 | ||||
-rw-r--r-- | sfx2/source/control/shell.cxx | 28 |
3 files changed, 34 insertions, 87 deletions
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) |