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