[Libreoffice-commits] .: offapi/com sd/source

Michael Stahl mst at kemper.freedesktop.org
Fri Jul 27 06:20:01 PDT 2012


 offapi/com/sun/star/drawing/framework/XConfigurationController.idl |    6 ---
 sd/source/ui/framework/configuration/ConfigurationController.cxx   |   17 +-------
 sd/source/ui/framework/module/ResourceManager.cxx                  |   19 ++--------
 sd/source/ui/framework/module/ResourceManager.hxx                  |    1 
 sd/source/ui/inc/framework/ConfigurationController.hxx             |    3 -
 5 files changed, 8 insertions(+), 38 deletions(-)

New commits:
commit 8eeddcdbb5baac2ee3378df38a198b0cdffa0495
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 27 15:01:19 2012 +0200

    fdo#35973: XConfigurationController:
    
    Remove that horrible IsDisposing method, much easier to just put the
    call to SaveResourceState into the disposing() handler that is called
    anyway (well, should be called now, previously the ResourceManager
    wasn't registered...))
    
    Change-Id: Ia81f6bf47602b195c0326f2151393542f5f8b9ec

diff --git a/offapi/com/sun/star/drawing/framework/XConfigurationController.idl b/offapi/com/sun/star/drawing/framework/XConfigurationController.idl
index 1e7cdb2..4c0fd46 100644
--- a/offapi/com/sun/star/drawing/framework/XConfigurationController.idl
+++ b/offapi/com/sun/star/drawing/framework/XConfigurationController.idl
@@ -154,12 +154,6 @@ interface XConfigurationController
     interface XConfigurationControllerBroadcaster;
     interface XResourceFactoryManager;
 
-    /** Check if the ConfigurationController is disposing
-        @return
-            When the ConfigurationController is disposing then true else false
-    */
-    boolean IsDisposing ();
-
     /** Request the activation of a resource.
         <p>The request is processed asynchronously.  Notifications about
         configuration changes are sent after this call returns.</p>
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx
index 6eb4299..0eafd67 100644
--- a/sd/source/ui/framework/configuration/ConfigurationController.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx
@@ -153,32 +153,22 @@ ConfigurationController::Lock::~Lock (void)
 //===== ConfigurationController ===============================================
 
 ConfigurationController::ConfigurationController (void) throw()
-    : ConfigurationControllerInterfaceBase(MutexOwner::maMutex),
-      mpImplementation(),
-      mbIsDisposed(false),
-      mbIsDisposing(false)
+    : ConfigurationControllerInterfaceBase(MutexOwner::maMutex)
+    , mpImplementation()
+    , mbIsDisposed(false)
 {
 }
 
-
-
-
 ConfigurationController::~ConfigurationController (void) throw()
 {
 }
 
-sal_Bool ConfigurationController::IsDisposing (void) throw (com::sun::star::uno::RuntimeException)
-{
-    return mbIsDisposing;
-}
-
 
 void SAL_CALL ConfigurationController::disposing (void)
 {
     if (mpImplementation.get() == NULL)
         return;
 
-    mbIsDisposing = true;
     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::disposing");
     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ":     requesting empty configuration");
     // To destroy all resources an empty configuration is requested and then,
@@ -191,7 +181,6 @@ void SAL_CALL ConfigurationController::disposing (void)
     // Now that all resources have been deactivated, mark the controller as
     // disposed.
     mbIsDisposed = true;
-    mbIsDisposing = false;
 
     // Release the listeners.
     lang::EventObject aEvent;
diff --git a/sd/source/ui/framework/module/ResourceManager.cxx b/sd/source/ui/framework/module/ResourceManager.cxx
index 548d596..0cf323c 100644
--- a/sd/source/ui/framework/module/ResourceManager.cxx
+++ b/sd/source/ui/framework/module/ResourceManager.cxx
@@ -66,8 +66,7 @@ ResourceManager::ResourceManager (
       mxMainViewAnchorId(FrameworkHelper::Instance(rxController)->CreateResourceId(
           FrameworkHelper::msCenterPaneURL)),
       msCurrentMainViewURL(),
-      mbIsEnabled(true),
-      mbConfigurationControllerIsDisposing(false)
+      mbIsEnabled(true)
 {
     Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
     if (xControllerManager.is())
@@ -76,6 +75,9 @@ ResourceManager::ResourceManager (
 
         if (mxConfigurationController.is())
         {
+            uno::Reference<lang::XComponent> const xComppnent(
+                    mxConfigurationController, UNO_QUERY_THROW);
+            xComppnent->addEventListener(this);
             mxConfigurationController->addConfigurationChangeListener(
                 this,
                 FrameworkHelper::msResourceActivationRequestEvent,
@@ -152,8 +154,6 @@ void SAL_CALL ResourceManager::notifyConfigurationChange (
 
     sal_Int32 nEventType = 0;
     rEvent.UserData >>= nEventType;
-    if (!mxConfigurationController->IsDisposing())
-        mbConfigurationControllerIsDisposing = false;
     switch (nEventType)
     {
         case ResourceActivationRequestEvent:
@@ -186,11 +186,6 @@ void SAL_CALL ResourceManager::notifyConfigurationChange (
         case ResourceDeactivationRequestEvent:
             if (rEvent.ResourceId->compareTo(mxMainViewAnchorId) == 0)
             {
-                if (mxConfigurationController->IsDisposing() && !mbConfigurationControllerIsDisposing)
-                {
-                    mbConfigurationControllerIsDisposing = true;
-                    SaveResourceState();
-                }
                 HandleMainViewSwitch(
                     OUString(),
                     rEvent.Configuration,
@@ -198,11 +193,6 @@ void SAL_CALL ResourceManager::notifyConfigurationChange (
             }
             else if (rEvent.ResourceId->compareTo(mxResourceId) == 0)
             {
-                if (mxConfigurationController->IsDisposing() && !mbConfigurationControllerIsDisposing)
-                {
-                    mbConfigurationControllerIsDisposing = true;
-                    SaveResourceState();
-                }
                 // The resource managed by this ResourceManager has been
                 // explicitly been requested to be hidden (maybe by us).
                 // Remember this setting.
@@ -296,6 +286,7 @@ void SAL_CALL ResourceManager::disposing (
     if (mxConfigurationController.is()
         && rEvent.Source == mxConfigurationController)
     {
+        SaveResourceState();
         // Without the configuration controller this class can do nothing.
         mxConfigurationController = NULL;
         dispose();
diff --git a/sd/source/ui/framework/module/ResourceManager.hxx b/sd/source/ui/framework/module/ResourceManager.hxx
index caffc98..cd69661 100644
--- a/sd/source/ui/framework/module/ResourceManager.hxx
+++ b/sd/source/ui/framework/module/ResourceManager.hxx
@@ -109,7 +109,6 @@ private:
 
     ::rtl::OUString msCurrentMainViewURL;
     bool mbIsEnabled;
-    bool mbConfigurationControllerIsDisposing;
 
     void HandleMainViewSwitch (
         const ::rtl::OUString& rsViewURL,
diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx
index 05ae745..93c73fc 100644
--- a/sd/source/ui/inc/framework/ConfigurationController.hxx
+++ b/sd/source/ui/inc/framework/ConfigurationController.hxx
@@ -71,8 +71,6 @@ public:
     ConfigurationController (void) throw();
     virtual ~ConfigurationController (void) throw();
 
-    sal_Bool IsDisposing (void) throw (com::sun::star::uno::RuntimeException);
-
     virtual void SAL_CALL disposing (void);
 
     void ProcessEvent (void);
@@ -206,7 +204,6 @@ private:
     class Implementation;
     ::boost::scoped_ptr<Implementation> mpImplementation;
     bool mbIsDisposed;
-    bool mbIsDisposing;
 
     /** When the called object has already been disposed this method throws
         an exception and does not return.


More information about the Libreoffice-commits mailing list