diff options
author | Rob Snelders <programming@ertai.nl> | 2012-05-25 17:31:11 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2012-07-26 21:38:47 +0200 |
commit | 61679f9b7afa2f585d47bf08a3317ddc02f2fbca (patch) | |
tree | a690f3e5dd16728637d9210a9c10710297f90768 /sd | |
parent | e7dec2887e511a18a5f9927884c1a1df45fc35f0 (diff) |
fd0#35973 - [EasyHack] Remember the state of the sidebar pane in Impress
Change-Id: Ie287bc1c545bd8986ee3509181c878bdcd0d1942
Diffstat (limited to 'sd')
6 files changed, 59 insertions, 14 deletions
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index 0f49baee6bb9..6eb42998eaff 100644 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -155,7 +155,8 @@ ConfigurationController::Lock::~Lock (void) ConfigurationController::ConfigurationController (void) throw() : ConfigurationControllerInterfaceBase(MutexOwner::maMutex), mpImplementation(), - mbIsDisposed(false) + mbIsDisposed(false), + mbIsDisposing(false) { } @@ -166,7 +167,10 @@ ConfigurationController::~ConfigurationController (void) throw() { } - +sal_Bool ConfigurationController::IsDisposing (void) throw (com::sun::star::uno::RuntimeException) +{ + return mbIsDisposing; +} void SAL_CALL ConfigurationController::disposing (void) @@ -174,6 +178,7 @@ 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, @@ -186,6 +191,7 @@ 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 ba2439af4f21..548d596baf6b 100644 --- a/sd/source/ui/framework/module/ResourceManager.cxx +++ b/sd/source/ui/framework/module/ResourceManager.cxx @@ -66,7 +66,8 @@ ResourceManager::ResourceManager ( mxMainViewAnchorId(FrameworkHelper::Instance(rxController)->CreateResourceId( FrameworkHelper::msCenterPaneURL)), msCurrentMainViewURL(), - mbIsEnabled(true) + mbIsEnabled(true), + mbConfigurationControllerIsDisposing(false) { Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY); if (xControllerManager.is()) @@ -103,8 +104,15 @@ void ResourceManager::AddActiveMainView ( mpActiveMainViewContainer->insert(rsMainViewURL); } +sal_Bool ResourceManager::IsResourceActive ( + const OUString& rsMainViewURL) +{ + return (mpActiveMainViewContainer->find(rsMainViewURL) != mpActiveMainViewContainer->end()); +} - +void ResourceManager::SaveResourceState (void) +{ +} void SAL_CALL ResourceManager::disposing (void) { @@ -144,6 +152,8 @@ void SAL_CALL ResourceManager::notifyConfigurationChange ( sal_Int32 nEventType = 0; rEvent.UserData >>= nEventType; + if (!mxConfigurationController->IsDisposing()) + mbConfigurationControllerIsDisposing = false; switch (nEventType) { case ResourceActivationRequestEvent: @@ -176,6 +186,11 @@ void SAL_CALL ResourceManager::notifyConfigurationChange ( case ResourceDeactivationRequestEvent: if (rEvent.ResourceId->compareTo(mxMainViewAnchorId) == 0) { + if (mxConfigurationController->IsDisposing() && !mbConfigurationControllerIsDisposing) + { + mbConfigurationControllerIsDisposing = true; + SaveResourceState(); + } HandleMainViewSwitch( OUString(), rEvent.Configuration, @@ -183,6 +198,11 @@ 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. diff --git a/sd/source/ui/framework/module/ResourceManager.hxx b/sd/source/ui/framework/module/ResourceManager.hxx index 199b87b320b2..caffc98c9b51 100644 --- a/sd/source/ui/framework/module/ResourceManager.hxx +++ b/sd/source/ui/framework/module/ResourceManager.hxx @@ -62,6 +62,8 @@ public: activate the resource managed by the called object. */ void AddActiveMainView (const ::rtl::OUString& rsMainViewURL); + sal_Bool IsResourceActive (const ::rtl::OUString& rsMainViewURL); + virtual void SaveResourceState (void); virtual void SAL_CALL disposing (void); @@ -107,6 +109,7 @@ private: ::rtl::OUString msCurrentMainViewURL; bool mbIsEnabled; + bool mbConfigurationControllerIsDisposing; void HandleMainViewSwitch ( const ::rtl::OUString& rsViewURL, diff --git a/sd/source/ui/framework/module/SlideSorterModule.cxx b/sd/source/ui/framework/module/SlideSorterModule.cxx index 2bbf7aa407b4..7852136b537d 100644 --- a/sd/source/ui/framework/module/SlideSorterModule.cxx +++ b/sd/source/ui/framework/module/SlideSorterModule.cxx @@ -26,6 +26,7 @@ #include "strings.hrc" #include "sdresid.hxx" +#include "svtools/slidesorterbaropt.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -54,11 +55,18 @@ SlideSorterModule::SlideSorterModule ( { UpdateViewTabBar(NULL); - AddActiveMainView(FrameworkHelper::msImpressViewURL); - AddActiveMainView(FrameworkHelper::msOutlineViewURL); - AddActiveMainView(FrameworkHelper::msNotesViewURL); - - AddActiveMainView(FrameworkHelper::msDrawViewURL); + if (SvtSlideSorterBarOptions().GetVisibleImpressView()==sal_True) + AddActiveMainView(FrameworkHelper::msImpressViewURL); + if (SvtSlideSorterBarOptions().GetVisibleOutlineView()==sal_True) + AddActiveMainView(FrameworkHelper::msOutlineViewURL); + if (SvtSlideSorterBarOptions().GetVisibleNotesView()==sal_True) + AddActiveMainView(FrameworkHelper::msNotesViewURL); + if (SvtSlideSorterBarOptions().GetVisibleHandoutView()==sal_True) + AddActiveMainView(FrameworkHelper::msHandoutViewURL); + if (SvtSlideSorterBarOptions().GetVisibleSlideSorterView()==sal_True) + AddActiveMainView(FrameworkHelper::msSlideSorterURL); + if (SvtSlideSorterBarOptions().GetVisibleDrawView()==sal_True) + AddActiveMainView(FrameworkHelper::msDrawViewURL); mxConfigurationController->addConfigurationChangeListener( this, @@ -74,7 +82,15 @@ SlideSorterModule::~SlideSorterModule (void) { } - +void SlideSorterModule::SaveResourceState (void) +{ + SvtSlideSorterBarOptions().SetVisibleImpressView(IsResourceActive(FrameworkHelper::msImpressViewURL)); + SvtSlideSorterBarOptions().SetVisibleOutlineView(IsResourceActive(FrameworkHelper::msOutlineViewURL)); + SvtSlideSorterBarOptions().SetVisibleNotesView(IsResourceActive(FrameworkHelper::msNotesViewURL)); + SvtSlideSorterBarOptions().SetVisibleHandoutView(IsResourceActive(FrameworkHelper::msHandoutViewURL)); + SvtSlideSorterBarOptions().SetVisibleSlideSorterView(IsResourceActive(FrameworkHelper::msSlideSorterURL)); + SvtSlideSorterBarOptions().SetVisibleDrawView(IsResourceActive(FrameworkHelper::msDrawViewURL)); +} void SAL_CALL SlideSorterModule::notifyConfigurationChange ( @@ -106,9 +122,6 @@ void SAL_CALL SlideSorterModule::notifyConfigurationChange ( } } - - - void SlideSorterModule::UpdateViewTabBar (const Reference<XTabBar>& rxTabBar) { if ( ! mxControllerManager.is()) diff --git a/sd/source/ui/framework/module/SlideSorterModule.hxx b/sd/source/ui/framework/module/SlideSorterModule.hxx index 920b95381c2f..c183954d00cb 100644 --- a/sd/source/ui/framework/module/SlideSorterModule.hxx +++ b/sd/source/ui/framework/module/SlideSorterModule.hxx @@ -41,7 +41,7 @@ public: const ::rtl::OUString& rsLeftPaneURL); virtual ~SlideSorterModule (void); - + virtual void SaveResourceState (void); // XConfigurationChangeListener virtual void SAL_CALL notifyConfigurationChange ( diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx index 93c73fcc8e7a..05ae74599af5 100644 --- a/sd/source/ui/inc/framework/ConfigurationController.hxx +++ b/sd/source/ui/inc/framework/ConfigurationController.hxx @@ -71,6 +71,8 @@ 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); @@ -204,6 +206,7 @@ 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. |