[Libreoffice-commits] core.git: sd/source

Eike Rathke erack at redhat.com
Tue Apr 19 16:31:56 UTC 2016


 sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx |    9 ++--
 sd/source/ui/framework/configuration/ConfigurationClassifier.cxx     |   18 +++++++++
 sd/source/ui/framework/configuration/ConfigurationClassifier.hxx     |   19 ++++++++++
 sd/source/ui/framework/configuration/ConfigurationController.cxx     |    2 -
 sd/source/ui/framework/configuration/ConfigurationUpdater.cxx        |    8 ++--
 sd/source/ui/framework/configuration/debugtrace.hxx                  |   18 +++++++++
 6 files changed, 65 insertions(+), 9 deletions(-)

New commits:
commit 563638f2e52b8ea6408422de7861ad82594b9842
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Apr 19 18:26:21 2016 +0200

    introduce DEBUG_SD_CONFIGURATION_TRACE instead of OSL_DEBUG_LEVEL>=2
    
    ... and partly revert the corresponding pieces of
    3d2f43438d4fe6947965a98262b0db42c8d5e680 that removed them as unused
    code.
    
    Change-Id: Ib5418df6a675004d0822b77ef12a77564d3348c8

diff --git a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx
index 74b2e57..9e116b8 100644
--- a/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx
+++ b/sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "debugtrace.hxx"
 #include "ChangeRequestQueueProcessor.hxx"
 #include "ConfigurationTracer.hxx"
 
@@ -34,7 +35,7 @@ using namespace ::com::sun::star::drawing::framework;
 
 namespace {
 
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
 
 void TraceRequest (const Reference<XConfigurationChangeRequest>& rxRequest)
 {
@@ -80,7 +81,7 @@ void ChangeRequestQueueProcessor::AddRequest (
 {
     ::osl::MutexGuard aGuard (maMutex);
 
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
     if (maQueue.empty())
     {
         SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": Adding requests to empty queue");
@@ -140,7 +141,7 @@ void ChangeRequestQueueProcessor::ProcessOneEvent()
         // Execute the change request.
         if (xRequest.is())
         {
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
             TraceRequest(xRequest);
 #endif
             xRequest->execute(mxConfiguration);
@@ -153,7 +154,7 @@ void ChangeRequestQueueProcessor::ProcessOneEvent()
             // its state.
             if (mpConfigurationUpdater.get() != nullptr)
             {
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
                 ConfigurationTracer::TraceConfiguration (
                     mxConfiguration, "updating to configuration");
 #endif
diff --git a/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx
index a7a77e8..f0ed767 100644
--- a/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx
@@ -162,6 +162,24 @@ void ConfigurationClassifier::CopyResources (
     }
 }
 
+#if DEBUG_SD_CONFIGURATION_TRACE
+
+void ConfigurationClassifier::TraceResourceIdVector (
+    const sal_Char* pMessage,
+    const ResourceIdVector& rResources)
+{
+
+    SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": " << pMessage);
+    ResourceIdVector::const_iterator iResource;
+    for (iResource=rResources.begin(); iResource!=rResources.end(); ++iResource)
+    {
+        OUString sResource (FrameworkHelper::ResourceIdToString(*iResource));
+        SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": " <<
+            OUStringToOString(sResource, RTL_TEXTENCODING_UTF8).getStr());
+    }
+}
+
+#endif
 
 } } // end of namespace sd::framework
 
diff --git a/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx b/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx
index a40247d..c262633 100644
--- a/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx
+++ b/sd/source/ui/framework/configuration/ConfigurationClassifier.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_CONFIGURATIONCLASSIFIER_HXX
 #define INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_CONFIGURATIONCLASSIFIER_HXX
 
+#include "debugtrace.hxx"
+
 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
 
 #include <vector>
@@ -73,6 +75,23 @@ public:
     */
     const ResourceIdVector& GetC2minusC1() const { return maC2minusC1;}
 
+#if DEBUG_SD_CONFIGURATION_TRACE
+
+    /** Return the resources that belong to both the configurations that
+        where given to the constructor.
+        @return
+            A reference to the, possibly empty, list of resources is
+            returned.  This reference remains valid as long as the called
+            ConfigurationClassifier object stays alive.
+    */
+    const ResourceIdVector& GetC1andC2() const { return maC1andC2;}
+
+    static void TraceResourceIdVector (
+        const sal_Char* pMessage,
+        const ResourceIdVector& rResources);
+
+#endif
+
 private:
     css::uno::Reference<css::drawing::framework::XConfiguration> mxConfiguration1;
     css::uno::Reference<css::drawing::framework::XConfiguration> mxConfiguration2;
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx
index 1116652..b15ca31 100644
--- a/sd/source/ui/framework/configuration/ConfigurationController.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx
@@ -430,7 +430,7 @@ void SAL_CALL ConfigurationController::restoreConfiguration (
 #endif
     ConfigurationClassifier aClassifier (rxNewConfiguration, xCurrentConfiguration);
     aClassifier.Partition();
-#if OSL_DEBUG_LEVEL >=2
+#if DEBUG_SD_CONFIGURATION_TRACE
     aClassifier.TraceResourceIdVector(
         "requested but not current resources:\n", aClassifier.GetC1minusC2());
     aClassifier.TraceResourceIdVector(
diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
index 3866130..4bbeb6d 100644
--- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
@@ -141,7 +141,7 @@ void ConfigurationUpdater::UpdateConfiguration()
         ConfigurationClassifier aClassifier(mxRequestedConfiguration, mxCurrentConfiguration);
         if (aClassifier.Partition())
         {
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
             SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationUpdater::UpdateConfiguration(");
             ConfigurationTracer::TraceConfiguration(
                 mxRequestedConfiguration, "requested configuration");
@@ -174,7 +174,7 @@ void ConfigurationUpdater::UpdateConfiguration()
         else
         {
             SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": nothing to do");
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
             ConfigurationTracer::TraceConfiguration(
                 mxRequestedConfiguration, "requested configuration");
             ConfigurationTracer::TraceConfiguration(
@@ -236,7 +236,7 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie
 {
     try
     {
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
         rClassifier.TraceResourceIdVector(
             "requested but not current resources:", rClassifier.GetC1minusC2());
         rClassifier.TraceResourceIdVector(
@@ -252,7 +252,7 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie
         mpResourceManager->DeactivateResources(rClassifier.GetC2minusC1(), mxCurrentConfiguration);
         mpResourceManager->ActivateResources(rClassifier.GetC1minusC2(), mxCurrentConfiguration);
 
-#if OSL_DEBUG_LEVEL >= 2
+#if DEBUG_SD_CONFIGURATION_TRACE
         SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::UpdateConfiguration)");
         ConfigurationTracer::TraceConfiguration(
             mxRequestedConfiguration, "requested configuration");
diff --git a/sd/source/ui/framework/configuration/debugtrace.hxx b/sd/source/ui/framework/configuration/debugtrace.hxx
new file mode 100644
index 0000000..b998870
--- /dev/null
+++ b/sd/source/ui/framework/configuration/debugtrace.hxx
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_DEBUGTRACE_HXX
+#define INCLUDED_SD_SOURCE_UI_FRAMEWORK_CONFIGURATION_DEBUGTRACE_HXX
+
+/// Centrally define activation of configuration debug traces.
+#define DEBUG_SD_CONFIGURATION_TRACE 0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list