diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/framework/module/ImpressModule.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/framework/module/ToolPanelModule.cxx | 155 | ||||
-rw-r--r-- | sd/source/ui/framework/module/ToolPanelModule.hxx | 28 |
3 files changed, 72 insertions, 115 deletions
diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index 1e7810ba8d8e..50e9cfb67f45 100644 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -45,7 +45,9 @@ void ImpressModule::Initialize (Reference<frame::XController>& rxController) new SlideSorterModule( rxController, FrameworkHelper::msLeftImpressPaneURL); - ToolPanelModule::Initialize(rxController); + new ToolPanelModule( + rxController, + FrameworkHelper::msRightPaneURL); new ToolBarModule(rxController); new ShellStackGuard(rxController); } diff --git a/sd/source/ui/framework/module/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx index 3397d5ce67ac..880a49d2ffe7 100644 --- a/sd/source/ui/framework/module/ToolPanelModule.cxx +++ b/sd/source/ui/framework/module/ToolPanelModule.cxx @@ -19,136 +19,75 @@ #include "ToolPanelModule.hxx" -#include "ReadOnlyModeObserver.hxx" -#include "framework/FrameworkHelper.hxx" -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include "framework/FrameworkHelper.hxx" +#include <com/sun/star/drawing/framework/XTabBar.hpp> +#include <com/sun/star/drawing/framework/TabBarButton.hpp> -#include <comphelper/processfactory.hxx> -#include <cppuhelper/compbase1.hxx> -#include <boost/enable_shared_from_this.hpp> +#include "strings.hrc" +#include "sdresid.hxx" +#include "svtools/toolpanelopt.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; + using ::rtl::OUString; using ::sd::framework::FrameworkHelper; namespace sd { namespace framework { -namespace { - -typedef ::cppu::WeakComponentImplHelper1 < - ::com::sun::star::frame::XStatusListener - > LocalReadOnlyModeObserverInterfaceBase; - -/** This local class enables or disables the ResourceManager of a - ToolPanelModule. It connects to a ReadOnlyModeObserver and is called - when the state of the .uno:EditDoc command changes. When either the - ResourceManager or the ReadOnlyModeObserver are disposed then the - LocalReadOnlyModeObserver disposes itself. The link - between the ResourceManager and the ReadOnlyModeObserver is removed and - the ReadOnlyModeObserver typically looses its last reference and is - destroyed. -*/ -class LocalReadOnlyModeObserver - : private MutexOwner, - public LocalReadOnlyModeObserverInterfaceBase -{ -public: - LocalReadOnlyModeObserver ( - const Reference<frame::XController>& rxController, - const ::rtl::Reference<ResourceManager>& rpResourceManager) - : MutexOwner(), - LocalReadOnlyModeObserverInterfaceBase(maMutex), - mpResourceManager(rpResourceManager), - mpObserver(new ReadOnlyModeObserver(rxController)) - { - mpObserver->AddStatusListener(this); - Reference<lang::XComponent> xComponent ( - static_cast<XWeak*>(mpResourceManager.get()), UNO_QUERY); - if (xComponent.is()) - xComponent->addEventListener(this); - } +//===== ToolPanelModule ================================================== - ~LocalReadOnlyModeObserver (void) - { - } - - virtual void SAL_CALL disposing (void) - { - Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpObserver.get()), UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - - xComponent = Reference<lang::XComponent>( - static_cast<XWeak*>(mpResourceManager.get()), UNO_QUERY); - if (xComponent.is()) - xComponent->removeEventListener(this); - - } - - virtual void SAL_CALL disposing (const com::sun::star::lang::EventObject& rEvent) - throw(RuntimeException) - { - if (rEvent.Source == Reference<XInterface>(static_cast<XWeak*>(mpObserver.get()))) - { - mpObserver = NULL; - } - else if (rEvent.Source == Reference<XInterface>( - static_cast<XWeak*>(mpResourceManager.get()))) - { - mpResourceManager = NULL; - } - dispose(); - } - - virtual void SAL_CALL statusChanged (const com::sun::star::frame::FeatureStateEvent& rEvent) - throw(RuntimeException) +ToolPanelModule::ToolPanelModule ( + const Reference<frame::XController>& rxController, + const OUString& rsRightPaneURL) + : ResourceManager(rxController, + FrameworkHelper::CreateResourceId(FrameworkHelper::msTaskPaneURL, rsRightPaneURL)), + mxControllerManager(rxController,UNO_QUERY) +{ + if (mxConfigurationController.is()) { - bool bReadWrite (true); - if (rEvent.IsEnabled) - rEvent.State >>= bReadWrite; - - if (bReadWrite) - mpResourceManager->Enable(); - else - mpResourceManager->Disable(); + if (SvtToolPanelOptions().GetVisibleImpressView()==sal_True) + AddActiveMainView(FrameworkHelper::msImpressViewURL); + if (SvtToolPanelOptions().GetVisibleOutlineView()==sal_True) + AddActiveMainView(FrameworkHelper::msOutlineViewURL); + if (SvtToolPanelOptions().GetVisibleNotesView()==sal_True) + AddActiveMainView(FrameworkHelper::msNotesViewURL); + if (SvtToolPanelOptions().GetVisibleHandoutView()==sal_True) + AddActiveMainView(FrameworkHelper::msHandoutViewURL); + if (SvtToolPanelOptions().GetVisibleSlideSorterView()==sal_True) + AddActiveMainView(FrameworkHelper::msSlideSorterURL); + + mxConfigurationController->addConfigurationChangeListener( + this, + FrameworkHelper::msResourceActivationEvent, + Any()); } - -private: - ::rtl::Reference<ResourceManager> mpResourceManager; - ::rtl::Reference<ReadOnlyModeObserver> mpObserver; - -}; } - - - -//===== ToolPanelModule ==================================================== - -void ToolPanelModule::Initialize (const Reference<frame::XController>& rxController) +ToolPanelModule::~ToolPanelModule (void) { - ::rtl::Reference<ResourceManager> pResourceManager ( - new ResourceManager( - rxController, - FrameworkHelper::CreateResourceId( - FrameworkHelper::msTaskPaneURL, - FrameworkHelper::msRightPaneURL))); - pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL); - pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL); - pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL); - pResourceManager->AddActiveMainView(FrameworkHelper::msSlideSorterURL); - - new LocalReadOnlyModeObserver(rxController, pResourceManager); } +void ToolPanelModule::SaveResourceState (void) +{ + SvtToolPanelOptions().SetVisibleImpressView(IsResourceActive(FrameworkHelper::msImpressViewURL)); + SvtToolPanelOptions().SetVisibleOutlineView(IsResourceActive(FrameworkHelper::msOutlineViewURL)); + SvtToolPanelOptions().SetVisibleNotesView(IsResourceActive(FrameworkHelper::msNotesViewURL)); + SvtToolPanelOptions().SetVisibleHandoutView(IsResourceActive(FrameworkHelper::msHandoutViewURL)); + SvtToolPanelOptions().SetVisibleSlideSorterView(IsResourceActive(FrameworkHelper::msSlideSorterURL)); +} - +void SAL_CALL ToolPanelModule::notifyConfigurationChange ( + const ConfigurationChangeEvent& rEvent) + throw (RuntimeException) +{ + if (!rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent)) + ResourceManager::notifyConfigurationChange(rEvent); +} } } // end of namespace sd::framework diff --git a/sd/source/ui/framework/module/ToolPanelModule.hxx b/sd/source/ui/framework/module/ToolPanelModule.hxx index 90b78fa5b366..cfc1f7c32b97 100644 --- a/sd/source/ui/framework/module/ToolPanelModule.hxx +++ b/sd/source/ui/framework/module/ToolPanelModule.hxx @@ -17,22 +17,38 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX -#define SD_FRAMEWORK_TOOL_PANEL_MODULE_HXX +#ifndef SD_FRAMEWORK_TOOLPANEL_MODULE_HXX +#define SD_FRAMEWORK_TOOLPANEL_MODULE_HXX #include "ResourceManager.hxx" -#include <rtl/ref.hxx> +#include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include <com/sun/star/drawing/framework/XTabBar.hpp> + +namespace css = ::com::sun::star; namespace sd { namespace framework { -/** This module is responsible for showing the task pane. +/** This module is responsible for showing the toolpanel bar. */ class ToolPanelModule + : public ResourceManager { public: - static void Initialize ( - const ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController); + ToolPanelModule ( + const css::uno::Reference<css::frame::XController>& rxController, + const ::rtl::OUString& rsRightPaneURL); + virtual ~ToolPanelModule (void); + + virtual void SaveResourceState (void); + // XConfigurationChangeListener + + virtual void SAL_CALL notifyConfigurationChange ( + const css::drawing::framework::ConfigurationChangeEvent& rEvent) + throw (css::uno::RuntimeException); + +private: + css::uno::Reference<css::drawing::framework::XControllerManager> mxControllerManager; }; } } // end of namespace sd::framework |