Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

I have created 2 little patches. The first one is to start on the bug fdo#46390. The other patch solves also some build-errors I got when turning on the debug-mode. Also is rRequestData removed. It isn't defined in the class as far as I can see. It should be the aKey because that holds the SdrPage.

License is on file.

--
Greetings,
Rob Snelders
From 59364eb861dfa8eb4d1a5a630b1a55b42d962e44 Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Mon, 2 Apr 2012 22:54:08 +0200
Subject: [PATCH] Removal of VERBOSE define

---
 sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx  |   21 ++-------
 .../ui/slidesorter/cache/SlsCacheCompactor.cxx     |   14 +-----
 sd/source/ui/view/ToolBarManager.cxx               |   46 +++++---------------
 sd/source/ui/view/ViewShellManager.cxx             |   44 ++++++++-----------
 4 files changed, 35 insertions(+), 90 deletions(-)

diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx 
b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
index f369079..d556c5c 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
@@ -35,11 +35,6 @@
 #include "sdpage.hxx"
 #include "drawdoc.hxx"
 
-// Uncomment the following define for some more OSL_TRACE messages.
-#ifdef DEBUG
-//#define VERBOSE
-#endif
-
 // Define the default value for the maximal cache size that is used for
 // previews that are currently not visible.  The visible previews are all
 // held in memory at all times.  This default is used only when the
@@ -421,9 +416,7 @@ void BitmapCache::ReCalculateTotalCacheSize (void)
     }
     mbIsFull = (mnNormalCacheSize  >= mnMaximalNormalCacheSize);
 
-#ifdef VERBOSE
-    OSL_TRACE("cache size is %d/%d", mnNormalCacheSize, mnPreciousCacheSize);
-#endif
+    SAL_INFO("sd.sls", OSL_THIS_FUNC << ": cache size is " << mnNormalCacheSize << "/" << 
mnPreciousCacheSize);
 }
 
 
@@ -527,9 +520,7 @@ void BitmapCache::UpdateCacheSize (const CacheEntry& rEntry, CacheOperation eOpe
             if ( ! rEntry.IsPrecious() && mnNormalCacheSize>mnMaximalNormalCacheSize)
             {
                 mbIsFull = true;
-#ifdef VERBOSE
-                OSL_TRACE("cache size is %d > %d", mnNormalCacheSize,mnMaximalNormalCacheSize);
-#endif
+                SAL_INFO("sd.sls", OSL_THIS_FUNC << ": cache size is " << mnNormalCacheSize << " > 
" << mnMaximalNormalCacheSize);
                 mpCacheCompactor->RequestCompaction();
             }
             break;
@@ -618,17 +609,13 @@ void BitmapCache::CacheEntry::Compress (const 
::boost::shared_ptr<BitmapCompress
         {
             mpReplacement = rpCompressor->Compress(maPreview);
 
-#ifdef VERBOSE
+#if OSL_DEBUG_LEVEL > 2
             sal_uInt32 nOldSize (maPreview.GetSizeBytes());
             sal_uInt32 nNewSize (mpReplacement.get()!=NULL ? mpReplacement->GetMemorySize() : 0);
             if (nOldSize == 0)
                 nOldSize = 1;
             sal_Int32 nRatio (100L * nNewSize / nOldSize);
-            OSL_TRACE("compressing bitmap for %x from %d to %d bytes (%d%%)",
-                this,
-                nOldSize,
-                nNewSize,
-                nRatio);
+            SAL_INFO("sd.sls", OSL_THIS_FUNC << ": compressing bitmap for " << %x << " from " << 
nOldSize << " to " << nNewSize << " bytes (" << nRatio << "%)");
 #endif
 
             mpCompressor = rpCompressor;
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx 
b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
index 3f8b2b4..3a59eca 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx
@@ -39,11 +39,6 @@
 
 using namespace ::com::sun::star::uno;
 
-// Uncomment the definition of VERBOSE to get some more OSL_TRACE messages.
-#ifdef DEBUG
-//#define VERBOSE
-#endif
-
 namespace {
 
 /** This is a trivial implementation of the CacheCompactor interface class.
@@ -211,10 +206,7 @@ void CacheCompactionByCompression::Run (void)
 {
     if (mrCache.GetSize() > mnMaximalCacheSize)
     {
-#ifdef VERBOSE
-        OSL_TRACE ("bitmap cache uses to much space: %d > %d",
-            mrCache.GetSize(), mnMaximalCacheSize);
-#endif
+        SAL_INFO("sd.sls", OSL_THIS_FUNC << ": bitmap cache uses to much space: " << 
mrCache.GetSize() << " > " << mnMaximalCacheSize);
 
         SAL_WNODEPRECATED_DECLARATIONS_PUSH
         ::std::auto_ptr< ::sd::slidesorter::cache::BitmapCache::CacheIndex> pIndex (
@@ -231,9 +223,7 @@ void CacheCompactionByCompression::Run (void)
                 break;
         }
         mrCache.ReCalculateTotalCacheSize();
-#ifdef VERBOSE
-        OSL_TRACE ("    there are now %d bytes occupied", mrCache.GetSize());
-#endif
+        SAL_INFO("sd.sls", OSL_THIS_FUNC << ":    there are now " << mrCache.GetSize() << " bytes 
occupied");
     }
 }
 
diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx
index 5980f73..d3aff93 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -58,8 +58,6 @@
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
-#undef VERBOSE
-
 #undef OUSTRING // Remove definition made in the SFX
 #define OUSTRING(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
 
@@ -710,9 +708,7 @@ void ToolBarManager::Implementation::ResetToolBars (ToolBarGroup eGroup)
 
 void ToolBarManager::Implementation::ResetAllToolBars (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("resetting all tool bars");
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": resetting all tool bars");
     for (int i=TBG__FIRST; i<=TBG__LAST; ++i)
         ResetToolBars((ToolBarGroup)i);
 }
@@ -802,9 +798,7 @@ void ToolBarManager::Implementation::PreUpdate (void)
     {
         mbPreUpdatePending = false;
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PreUpdate [");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate [");
 
         // Get the list of tool bars that are not used anymore and are to be
         // deactivated.
@@ -816,17 +810,13 @@ void ToolBarManager::Implementation::PreUpdate (void)
         for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
         {
             ::rtl::OUString sFullName (GetToolBarResourceName(*iToolBar));
-#ifdef VERBOSE
-            OSL_TRACE("    turning off tool bar %s",
+            SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning off tool bar " <<
                 ::rtl::OUStringToOString(sFullName, RTL_TEXTENCODING_UTF8).getStr());
-#endif
             mxLayouter->destroyElement(sFullName);
             maToolBarList.MarkToolBarAsNotActive(*iToolBar);
         }
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PreUpdate ]");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate ]");
     }
 }
 
@@ -847,26 +837,20 @@ void ToolBarManager::Implementation::PostUpdate (void)
         NameList aToolBars;
         maToolBarList.GetToolBarsToActivate(aToolBars);
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PostUpdate [");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate [");
 
         // Turn on the tool bars that are visible in the new context.
         NameList::const_iterator iToolBar;
         for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
         {
             ::rtl::OUString sFullName (GetToolBarResourceName(*iToolBar));
-#ifdef VERBOSE
-            OSL_TRACE("    turning on tool bar %s",
+            SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning on tool bar " <<
                 ::rtl::OUStringToOString(sFullName, RTL_TEXTENCODING_UTF8).getStr());
-#endif
             mxLayouter->requestElement(sFullName);
             maToolBarList.MarkToolBarAsActive(*iToolBar);
         }
 
-#ifdef VERBOSE
-        OSL_TRACE("ToolBarManager::PostUpdate ]");
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate ]");
     }
 }
 
@@ -885,9 +869,7 @@ void ToolBarManager::Implementation::LockViewShellManager (void)
 
 void ToolBarManager::Implementation::LockUpdate (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("LockUpdate %d", mnLockCount);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": LockUpdate " << mnLockCount);
     ::osl::MutexGuard aGuard(maMutex);
 
     DBG_ASSERT(mnLockCount<100, "ToolBarManager lock count unusually high");
@@ -905,9 +887,7 @@ void ToolBarManager::Implementation::LockUpdate (void)
 
 void ToolBarManager::Implementation::UnlockUpdate (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("UnlockUpdate %d", mnLockCount);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": UnlockUpdate " << mnLockCount);
     ::osl::MutexGuard aGuard(maMutex);
 
     OSL_ASSERT(mnLockCount>0);
@@ -1122,9 +1102,7 @@ using namespace ::sd;
 LayouterLock::LayouterLock (const Reference<frame::XLayoutManager>& rxLayouter)
     : mxLayouter(rxLayouter)
 {
-#ifdef VERBOSE
-    OSL_TRACE("LayouterLock %d", mxLayouter.is() ? 1 :0);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": LayouterLock " << (mxLayouter.is() ? 1 :0));
     if (mxLayouter.is())
         mxLayouter->lock();
 }
@@ -1134,9 +1112,7 @@ LayouterLock::LayouterLock (const Reference<frame::XLayoutManager>& 
rxLayouter)
 
 LayouterLock::~LayouterLock (void)
 {
-#ifdef VERBOSE
-    OSL_TRACE("~LayouterLock %d", mxLayouter.is() ? 1 :0);
-#endif
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": ~LayouterLock " << (mxLayouter.is() ? 1 :0));
     if (mxLayouter.is())
         mxLayouter->unlock();
 }
diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
index 9f1002b..071ed49 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -41,9 +41,6 @@
 #include <boost/unordered_map.hpp>
 #include <iterator>
 
-#undef VERBOSE
-//#define VERBOSE 2
-
 namespace sd {
 
 namespace {
@@ -228,7 +225,7 @@ private:
 
     DECL_LINK(WindowEventHandler, VclWindowEvent*);
 
-#ifdef VERBOSE
+#if OSL_DEBUG_LEVEL >= 2
     void DumpShellStack (const ShellStack& rStack);
     void DumpSfxShellStack (void);
 #endif
@@ -930,10 +927,10 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
         aSfxShellStack.push_back(mrBase.GetSubShell(nIndex));
 
 
-#ifdef VERBOSE
-    OSL_TRACE("Current SFX Stack\r");
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": Current SFX Stack");
     DumpShellStack(aSfxShellStack);
-    OSL_TRACE("Target Stack\r");
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": Target Stack");
     DumpShellStack(aTargetStack);
 #endif
 
@@ -956,9 +953,7 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
             i != iLast; ++i)
     {
         SfxShell* const pShell = *i;
-#ifdef VERBOSE
-        OSL_TRACE("removing shell %p from stack\r", pShell);
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": removing shell " << pShell << " from stack");
         mrBase.RemoveSubShell(pShell);
     }
     aSfxShellStack.erase(iSfxShell, aSfxShellStack.end());
@@ -968,9 +963,7 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
     mbShellStackIsUpToDate = false;
     while (iTargetShell != aTargetStack.end())
     {
-#ifdef VERBOSE
-        OSL_TRACE("pushing shell %p on stack\r", *iTargetShell);
-#endif
+        SAL_INFO("sd.view", OSL_THIS_FUNC << ": pushing shell " << *iTargetShell << " on stack");
         mrBase.AddSubShell(**iTargetShell);
         ++iTargetShell;
 
@@ -993,8 +986,8 @@ void ViewShellManager::Implementation::UpdateShellStack (void)
     // to) abort and return immediately.
     mbShellStackIsUpToDate = true;
 
-#ifdef VERBOSE
-    OSL_TRACE("New current stack\r");
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << ": New current stack");
     DumpSfxShellStack();
 #endif
 }
@@ -1012,8 +1005,8 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* 
pShe
         ? pTopMostShell->GetUndoManager()
         : NULL;
 
-#ifdef VERBOSE
-    OSL_TRACE("TakeShellsFromStack(%p)\r", pShell);
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << "TakeShellsFromStack( " << pShell << ")");
     DumpSfxShellStack();
 #endif
 
@@ -1049,9 +1042,7 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* 
pShe
         while (true)
         {
             SfxShell* pShellOnStack = mrBase.GetSubShell(0);
-#ifdef VERBOSE
-            OSL_TRACE("removing shell %p from stack\r", pShellOnStack);
-#endif
+            SAL_INFO("sd.view", OSL_THIS_FUNC << "removing shell " << pShellOnStack << " from 
stack");
             mrBase.RemoveSubShell(pShellOnStack);
             if (pShellOnStack == pShell)
                 break;
@@ -1068,8 +1059,9 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* 
pShe
             mpTopShell->SetUndoManager(pUndoManager);
     }
 
-#ifdef VERBOSE
-    OSL_TRACE("Sfx shell stack is:\r");
+
+#if OSL_DEBUG_LEVEL >= 2
+    SAL_INFO("sd.view", OSL_THIS_FUNC << "Sfx shell stack is:");
     DumpSfxShellStack();
 #endif
 }
@@ -1314,17 +1306,17 @@ void ViewShellManager::Implementation::Shutdown (void)
 
 
 
-#ifdef VERBOSE
+#if OSL_DEBUG_LEVEL >= 2
 void ViewShellManager::Implementation::DumpShellStack (const ShellStack& rStack)
 {
     ShellStack::const_reverse_iterator iEntry;
     for (iEntry=rStack.rbegin(); iEntry!=rStack.rend(); ++iEntry)
         if (*iEntry != NULL)
-            OSL_TRACE ("    %p : %s\r",
-                *iEntry,
+            SAL_INFO("sd.view", OSL_THIS_FUNC << ":    " <<
+                *iEntry << " : " <<
                 ::rtl::OUStringToOString((*iEntry)->GetName(),RTL_TEXTENCODING_UTF8).getStr());
         else
-            OSL_TRACE("     null\r");
+            SAL_INFO("sd.view", OSL_THIS_FUNC << "     null");
 }
 
 
-- 
1.7.5.4

From 5671e9008dbca460302b6fef3d091cb8766955fc Mon Sep 17 00:00:00 2001
From: Rob Snelders <programming@ertai.nl>
Date: Tue, 3 Apr 2012 00:04:00 +0200
Subject: [PATCH] SlsRequestQueue updated

---
 sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx |   21 +++++++------------
 sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx |    4 +-
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx 
b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
index 966c5d2..a79ddaf 100644
--- a/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
@@ -31,10 +31,6 @@
 
 #include <set>
 
-
-#undef VERBOSE
-//#define VERBOSE
-
 namespace sd { namespace slidesorter { namespace cache {
 
 /** This class extends the actual request data with additional information
@@ -118,7 +114,7 @@ void RequestQueue::AddRequest (
 
     // If the request is already a member of the queue then remove it so
     // that the following insertion will use the new prioritization.
-#ifdef VERBOSE
+#if OSL_DEBUG_LEVEL >=2
     bool bRemoved =
 #endif
         RemoveRequest(aKey);
@@ -130,13 +126,12 @@ void RequestQueue::AddRequest (
     Request aRequest (aKey, nPriority, eRequestClass);
     mpRequestQueue->insert(aRequest);
 
-    SSCD_SET_REQUEST_CLASS(rRequestData.GetPage(),eRequestClass);
+    SSCD_SET_REQUEST_CLASS(aKey,eRequestClass);
 
-#ifdef VERBOSE
-    OSL_TRACE("%s request for page %d with priority class %d",
-        bRemoved?"replaced":"added",
-        (rRequestData.GetPage()->GetPageNum()-1)/2,
-        eRequestClass);
+#if OSL_DEBUG_LEVEL >=2
+    SAL_INFO("sd.sls", OSL_THIS_FUNC << ": " << (bRemoved?"replaced":"added")
+        << " request for page " << ((aKey->GetPageNum()-1)/2)
+        << " with priority class " << static_cast<int>(eRequestClass));
 #endif
 }
 
@@ -166,7 +161,7 @@ bool RequestQueue::RemoveRequest (
 
             if (bRequestWasRemoved)
             {
-                SSCD_SET_STATUS(rRequest.GetPage(),NONE);
+                SSCD_SET_STATUS(aKey,NONE);
             }
         }
         else
@@ -195,7 +190,7 @@ void RequestQueue::ChangeClass (
     if (iRequest!=mpRequestQueue->end() && iRequest->meClass!=eNewRequestClass)
     {
         AddRequest(aKey, eNewRequestClass, true);
-        SSCD_SET_REQUEST_CLASS(rRequestData.GetPage(),eNewRequestClass);
+        SSCD_SET_REQUEST_CLASS(aKey,eNewRequestClass);
     }
 }
 
diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx 
b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
index e59f7e3..9fe0dda 100644
--- a/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
@@ -52,7 +52,7 @@ public:
     /** Insert a request with highest or lowest priority in its priority
         class.  When the request is already present then it is first
         removed.  This effect is then a re-prioritization.
-        @param rRequestData
+        @param aKey
             The request.
         @param eRequestClass
             The priority class in which to insert the request with highest
@@ -68,7 +68,7 @@ public:
         bool bInsertWithHighestPriority = false);
 
     /** Remove the specified request from the queue.
-        @param rRequestData
+        @param aKey
             It is OK when the specified request is not a member of the
             queue.
         @return
-- 
1.7.5.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.