diff options
-rw-r--r-- | offapi/com/sun/star/drawing/framework/XConfigurationController.idl | 6 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/Impress.xcu | 22 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Impress.xcs | 44 | ||||
-rw-r--r-- | sd/source/ui/framework/configuration/ConfigurationController.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/framework/module/ResourceManager.cxx | 24 | ||||
-rw-r--r-- | sd/source/ui/framework/module/ResourceManager.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/framework/module/SlideSorterModule.cxx | 31 | ||||
-rw-r--r-- | sd/source/ui/framework/module/SlideSorterModule.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/ConfigurationController.hxx | 3 | ||||
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/Package_inc.mk | 1 | ||||
-rw-r--r-- | svtools/inc/svtools/slidesorterbaropt.hxx | 83 | ||||
-rw-r--r-- | svtools/source/config/slidesorterbaropt.cxx | 496 |
13 files changed, 711 insertions, 15 deletions
diff --git a/offapi/com/sun/star/drawing/framework/XConfigurationController.idl b/offapi/com/sun/star/drawing/framework/XConfigurationController.idl index 4c0fd46d72b1..1e7cdb245d21 100644 --- a/offapi/com/sun/star/drawing/framework/XConfigurationController.idl +++ b/offapi/com/sun/star/drawing/framework/XConfigurationController.idl @@ -154,6 +154,12 @@ 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/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/officecfg/registry/data/org/openoffice/Office/Impress.xcu index 6101ceffada5..ff44549e801d 100644 --- a/officecfg/registry/data/org/openoffice/Office/Impress.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Impress.xcu @@ -28,6 +28,28 @@ <!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd"> <oor:component-data oor:name="Impress" oor:package="org.openoffice.Office" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <node oor:name="MultiPaneGUI"> + <node oor:name="SlideSorterBar"> + <node oor:name="Visible"> + <prop oor:name="ImpressView"> + <value>true</value> + </prop> + <prop oor:name="OutlineView"> + <value>true</value> + </prop> + <prop oor:name="NotesView"> + <value>true</value> + </prop> + <prop oor:name="HandoutView"> + <value>false</value> + </prop> + <prop oor:name="SlideSorterView"> + <value>false</value> + </prop> + <prop oor:name="DrawView"> + <value>true</value> + </prop> + </node> + </node> <node oor:name="Framework"> <node oor:name="ResourceFactories"> <node oor:name="F0" oor:op="replace"> diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs index 094cee5a3530..cb8c31a92e62 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs @@ -1402,11 +1402,53 @@ </info> </set> </group> - <group oor:name="SlideSorter"> + <group oor:name="SlideSorterBar"> <info> <desc>Values related to the slide sorter.</desc> <label>Slide Sorter Options</label> </info> + <group oor:name="Visible"> + <info> + <desc>Options that control the visibility of the slide sorter.</desc> + <label>Slide Sorter Visibility</label> + </info> + <prop oor:name="ImpressView" oor:type="xs:boolean"> + <info> + <desc>Visibility of the Slide Sorter in the Impress view.</desc> + <label>Slide Sorter Visibility ImpressView</label> + </info> + </prop> + <prop oor:name="OutlineView" oor:type="xs:boolean"> + <info> + <desc>Visibility of the Slide Sorter in the Outline view.</desc> + <label>Slide Sorter Visibility OutlineView</label> + </info> + </prop> + <prop oor:name="NotesView" oor:type="xs:boolean"> + <info> + <desc>Visibility of the Slide Sorter in the Notes view.</desc> + <label>Slide Sorter Visibility NotesView</label> + </info> + </prop> + <prop oor:name="HandoutView" oor:type="xs:boolean"> + <info> + <desc>Visibility of the Slide Sorter in the HandOut view.</desc> + <label>Slide Sorter Visibility HandOutView</label> + </info> + </prop> + <prop oor:name="SlideSorterView" oor:type="xs:boolean"> + <info> + <desc>Visibility of the Slide Sorter in the SlideSorter view.</desc> + <label>Slide Sorter Visibility SlideSorterView</label> + </info> + </prop> + <prop oor:name="DrawView" oor:type="xs:boolean"> + <info> + <desc>Visibility of the Slide Sorter in the Draw view.</desc> + <label>Slide Sorter Visibility DrawView</label> + </info> + </prop> + </group> <group oor:name="PreviewCache"> <info> <desc>Values for tuning the preview cache of the slide sorter.</desc> 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. diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 2dcec425cc86..c5f3e835be2d 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -89,6 +89,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/config/itemholder2 \ svtools/source/config/menuoptions \ svtools/source/config/miscopt \ + svtools/source/config/slidesorterbaropt \ svtools/source/config/optionsdrawinglayer \ svtools/source/config/printoptions \ svtools/source/contnr/DocumentInfoPreview \ diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index 70a5b40b7381..b9102d1c73fb 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -107,6 +107,7 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/langtab.hxx,svtools/la $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/localresaccess.hxx,svtools/localresaccess.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/menuoptions.hxx,svtools/menuoptions.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/miscopt.hxx,svtools/miscopt.hxx)) +$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/slidesorterbaropt.hxx,svtools/slidesorterbaropt.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/optionsdrawinglayer.hxx,svtools/optionsdrawinglayer.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/parhtml.hxx,svtools/parhtml.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/parrtf.hxx,svtools/parrtf.hxx)) diff --git a/svtools/inc/svtools/slidesorterbaropt.hxx b/svtools/inc/svtools/slidesorterbaropt.hxx new file mode 100644 index 000000000000..29e2b808ab97 --- /dev/null +++ b/svtools/inc/svtools/slidesorterbaropt.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * 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_SVTOOLS_SLIDESORTERBAROPT_HXX +#define INCLUDED_SVTOOLS_SLIDESORTERBAROPT_HXX + +#include "svtools/svtdllapi.h" +#include <sal/types.h> +#include <osl/mutex.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <rtl/ustring.hxx> +#include <unotools/options.hxx> + + /*@short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation!*/ +class SvtSlideSorterBarOptions_Impl; +class Link; + + /*@short collect informations about sidebar group + @ATTENTION This class is partially threadsafe. + @devstatus ready to use*/ +class SVT_DLLPUBLIC SvtSlideSorterBarOptions: public utl::detail::Options +{ + public: + /*@short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + @seealso member m_nRefCount + @seealso member m_pDataContainer*/ + SvtSlideSorterBarOptions(); + virtual ~SvtSlideSorterBarOptions(); + + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); + + sal_Bool GetVisibleImpressView() const; + void SetVisibleImpressView( sal_Bool bVisible ); + sal_Bool GetVisibleOutlineView() const; + void SetVisibleOutlineView( sal_Bool bVisible ); + sal_Bool GetVisibleNotesView() const; + void SetVisibleNotesView( sal_Bool bVisible ); + sal_Bool GetVisibleHandoutView() const; + void SetVisibleHandoutView( sal_Bool bVisible ); + sal_Bool GetVisibleSlideSorterView() const; + void SetVisibleSlideSorterView( sal_Bool bVisible ); + sal_Bool GetVisibleDrawView() const; + void SetVisibleDrawView( sal_Bool bVisible ); + + + private: + /*@short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + @return A reference to a static mutex member.*/ + SVT_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + static SvtSlideSorterBarOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtSlideSorterBarOptions + +#endif // #ifndef INCLUDED_SVTOOLS_SLIDESORTERBAROPT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/slidesorterbaropt.cxx b/svtools/source/config/slidesorterbaropt.cxx new file mode 100644 index 000000000000..0d84ef7f71ab --- /dev/null +++ b/svtools/source/config/slidesorterbaropt.cxx @@ -0,0 +1,496 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * 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/. + */ +#include <svtools/slidesorterbaropt.hxx> +#include <unotools/configmgr.hxx> +#include <unotools/configitem.hxx> +#include <tools/debug.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <tools/link.hxx> + +#include <rtl/logfile.hxx> +#include <rtl/instance.hxx> +#include "itemholder2.hxx" + +#include <svtools/imgdef.hxx> +#include <vcl/svapp.hxx> + +#include <list> + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star; + +#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) +#define ROOTNODE_SLIDESORTERBAR ASCII_STR("Office.Impress/MultiPaneGUI/SlideSorterBar/Visible") + +#define PROPERTYNAME_VISIBLE_IMPRESSVIEW ASCII_STR("ImpressView") +#define PROPERTYHANDLE_VISIBLE_IMPRESSVIEW 0 +#define PROPERTYNAME_VISIBLE_OUTLINEVIEW ASCII_STR("OutlineView") +#define PROPERTYHANDLE_VISIBLE_OUTLINEVIEW 1 +#define PROPERTYNAME_VISIBLE_NOTESVIEW ASCII_STR("NotesView") +#define PROPERTYHANDLE_VISIBLE_NOTESVIEW 2 +#define PROPERTYNAME_VISIBLE_HANDOUTVIEW ASCII_STR("HandoutView") +#define PROPERTYHANDLE_VISIBLE_HANDOUTVIEW 3 +#define PROPERTYNAME_VISIBLE_SLIDESORTERVIEW ASCII_STR("SlideSorterView") +#define PROPERTYHANDLE_VISIBLE_SLIDESORTERVIEW 4 +#define PROPERTYNAME_VISIBLE_DRAWVIEW ASCII_STR("DrawView") +#define PROPERTYHANDLE_VISIBLE_DRAWVIEW 5 + +#define PROPERTYCOUNT 6 + +class SvtSlideSorterBarOptions_Impl : public ConfigItem +{ + private: + ::std::list<Link> aList; + sal_Bool m_bVisibleImpressView; + sal_Bool m_bVisibleOutlineView; + sal_Bool m_bVisibleNotesView; + sal_Bool m_bVisibleHandoutView; + sal_Bool m_bVisibleSlideSorterView; + sal_Bool m_bVisibleDrawView; + + public: + + SvtSlideSorterBarOptions_Impl(); + ~SvtSlideSorterBarOptions_Impl(); + + /*@short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + @seealso baseclass ConfigItem + @param "seqPropertyNames" is the list of properties which should be updated.*/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /** loads required data from the configuration. It's called in the constructor to + read all entries and form ::Notify to re-read changed setting */ + void Load( const Sequence< OUString >& rPropertyNames ); + + /*@short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + @seealso baseclass ConfigItem*/ + virtual void Commit(); + + // public interface + void SetVisibleImpressView( sal_Bool bSet ) + { m_bVisibleImpressView = bSet; SetModified(); } + + sal_Bool GetVisibleImpressView() const + { return m_bVisibleImpressView; } + + void SetVisibleOutlineView( sal_Bool bSet ) + { m_bVisibleOutlineView = bSet; SetModified(); } + + sal_Bool GetVisibleOutlineView() const + { return m_bVisibleOutlineView; } + + void SetVisibleNotesView( sal_Bool bSet ) + { m_bVisibleNotesView = bSet; SetModified(); } + + sal_Bool GetVisibleNotesView() const + { return m_bVisibleNotesView; } + + void SetVisibleHandoutView( sal_Bool bSet ) + { m_bVisibleHandoutView = bSet; SetModified(); } + + sal_Bool GetVisibleHandoutView() const + { return m_bVisibleHandoutView; } + + void SetVisibleSlideSorterView( sal_Bool bSet ) + { m_bVisibleSlideSorterView = bSet; SetModified(); } + + sal_Bool GetVisibleSlideSorterView() const + { return m_bVisibleSlideSorterView; } + + void SetVisibleDrawView( sal_Bool bSet ) + { m_bVisibleDrawView = bSet; SetModified(); } + + sal_Bool GetVisibleDrawView() const + { return m_bVisibleDrawView; } + + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); + void CallListeners(); + + private: + /*@short return list of key names of our configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + @return A list of needed configuration keys is returned.*/ + static Sequence< OUString > GetPropertyNames(); + + protected: +}; + +SvtSlideSorterBarOptions_Impl::SvtSlideSorterBarOptions_Impl() + // Init baseclasses first + : ConfigItem( ROOTNODE_SLIDESORTERBAR ) + + , m_bVisibleImpressView( sal_False ) + , m_bVisibleOutlineView( sal_False ) + , m_bVisibleNotesView( sal_False ) + , m_bVisibleHandoutView( sal_False ) + , m_bVisibleSlideSorterView( sal_False ) + , m_bVisibleDrawView( sal_False ) + +{ + // Use our static list of configuration keys to get his values. + Sequence< OUString > seqNames = GetPropertyNames ( ); + Load( seqNames ); + Sequence< Any > seqValues = GetProperties ( seqNames ); + Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtSlideSorterBarOptions_Impl::SvtSlideSorterBarOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to our internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) + { + if (seqValues[nProperty].hasValue()==sal_False) + continue; + switch( nProperty ) + { + case PROPERTYHANDLE_VISIBLE_IMPRESSVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleImpressView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleImpressView\"!" ); + break; + } + case PROPERTYHANDLE_VISIBLE_OUTLINEVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleOutlineView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleOutlineView\"!" ); + break; + } + case PROPERTYHANDLE_VISIBLE_NOTESVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleNotesView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleNotesView\"!" ); + break; + } + case PROPERTYHANDLE_VISIBLE_HANDOUTVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleHandoutView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleHandoutView\"!" ); + break; + } + case PROPERTYHANDLE_VISIBLE_SLIDESORTERVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleSlideSorterView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleSlideSorterView\"!" ); + break; + } + case PROPERTYHANDLE_VISIBLE_DRAWVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleDrawView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleDrawView\"!" ); + break; + } + } + } + + // Enable notification mechanism of our baseclass. + // We need it to get information about changes outside these class on our used configuration keys! + EnableNotification( seqNames ); +} + +SvtSlideSorterBarOptions_Impl::~SvtSlideSorterBarOptions_Impl() +{ + // We must save our current values .. if user forgets it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +static int lcl_MapPropertyName( const ::rtl::OUString rCompare, + const uno::Sequence< ::rtl::OUString>& aInternalPropertyNames) +{ + for(int nProp = 0; nProp < aInternalPropertyNames.getLength(); ++nProp) + { + if( aInternalPropertyNames[nProp] == rCompare ) + return nProp; + } + return -1; +} + +void SvtSlideSorterBarOptions_Impl::Load( const Sequence< OUString >& rPropertyNames ) +{ + const uno::Sequence< ::rtl::OUString> aInternalPropertyNames( GetPropertyNames()); + Sequence< Any > seqValues = GetProperties( rPropertyNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(rPropertyNames.getLength()!=seqValues.getLength()), "SvtSlideSorterBarOptions_Impl::SvtSlideSorterBarOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to our internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) + { + if (seqValues[nProperty].hasValue()==sal_False) + continue; + switch( lcl_MapPropertyName(rPropertyNames[nProperty], aInternalPropertyNames) ) + { + case PROPERTYHANDLE_VISIBLE_IMPRESSVIEW: + { + if( !(seqValues[nProperty] >>= m_bVisibleImpressView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleImpressView\"!" ); + } + break; + case PROPERTYHANDLE_VISIBLE_OUTLINEVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleOutlineView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleOutlineView\"!" ); + } + break; + case PROPERTYHANDLE_VISIBLE_NOTESVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleNotesView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleNotesView\"!" ); + } + break; + case PROPERTYHANDLE_VISIBLE_HANDOUTVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleHandoutView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleHandoutView\"!" ); + } + break; + case PROPERTYHANDLE_VISIBLE_SLIDESORTERVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleSlideSorterView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleSlideSorterView\"!" ); + } + break; + + case PROPERTYHANDLE_VISIBLE_DRAWVIEW : + { + if( !(seqValues[nProperty] >>= m_bVisibleDrawView) ) + OSL_FAIL("Wrong type of \"SlideSorterBar\\VisibleDrawView\"!" ); + } + break; + } + } +} + +void SvtSlideSorterBarOptions_Impl::AddListenerLink( const Link& rLink ) +{ + aList.push_back( rLink ); +} + +void SvtSlideSorterBarOptions_Impl::RemoveListenerLink( const Link& rLink ) +{ + for ( ::std::list<Link>::iterator iter = aList.begin(); iter != aList.end(); ++iter ) + { + if ( *iter == rLink ) + { + aList.erase(iter); + break; + } + } +} + +void SvtSlideSorterBarOptions_Impl::CallListeners() +{ + for ( ::std::list<Link>::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); +} + +void SvtSlideSorterBarOptions_Impl::Notify( const Sequence< OUString >& rPropertyNames ) +{ + Load( rPropertyNames ); + CallListeners(); +} + +void SvtSlideSorterBarOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = GetPropertyNames (); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) + { + switch( nProperty ) + { + case PROPERTYHANDLE_VISIBLE_IMPRESSVIEW: + { + seqValues[nProperty] <<= m_bVisibleImpressView; + break; + } + case PROPERTYHANDLE_VISIBLE_OUTLINEVIEW: + { + seqValues[nProperty] <<= m_bVisibleOutlineView; + break; + } + case PROPERTYHANDLE_VISIBLE_NOTESVIEW: + { + seqValues[nProperty] <<= m_bVisibleNotesView; + break; + } + case PROPERTYHANDLE_VISIBLE_HANDOUTVIEW: + { + seqValues[nProperty] <<= m_bVisibleHandoutView; + break; + } + case PROPERTYHANDLE_VISIBLE_SLIDESORTERVIEW: + { + seqValues[nProperty] <<= m_bVisibleSlideSorterView; + break; + } + case PROPERTYHANDLE_VISIBLE_DRAWVIEW: + { + seqValues[nProperty] <<= m_bVisibleDrawView; + break; + } + + } + } + // Set properties in configuration. + PutProperties( seqNames, seqValues ); +} + +Sequence< OUString > SvtSlideSorterBarOptions_Impl::GetPropertyNames() +{ + // Build list of configuration key names. + const OUString pProperties[] = + { + PROPERTYNAME_VISIBLE_IMPRESSVIEW, + PROPERTYNAME_VISIBLE_OUTLINEVIEW, + PROPERTYNAME_VISIBLE_NOTESVIEW, + PROPERTYNAME_VISIBLE_HANDOUTVIEW, + PROPERTYNAME_VISIBLE_SLIDESORTERVIEW, + PROPERTYNAME_VISIBLE_DRAWVIEW, + }; + + // Initialize return sequence with these list and run + const Sequence< OUString > seqPropertyNames( pProperties, SAL_N_ELEMENTS( pProperties ) ); + return seqPropertyNames; +} + +// initialize static member, see definition for further information +// DON'T DO IT IN YOUR HEADER! +SvtSlideSorterBarOptions_Impl* SvtSlideSorterBarOptions::m_pDataContainer = NULL ; +sal_Int32 SvtSlideSorterBarOptions::m_nRefCount = 0 ; + +SvtSlideSorterBarOptions::SvtSlideSorterBarOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetInitMutex() ); + ++m_nRefCount; + // ... and initialize our data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSlideSorterBarOptions_Impl::ctor()"); + m_pDataContainer = new SvtSlideSorterBarOptions_Impl; + } +} + +SvtSlideSorterBarOptions::~SvtSlideSorterBarOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetInitMutex() ); + --m_nRefCount; + // If last instance was deleted we must destroy our static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +sal_Bool SvtSlideSorterBarOptions::GetVisibleImpressView() const +{ + return m_pDataContainer->GetVisibleImpressView(); +} + +void SvtSlideSorterBarOptions::SetVisibleImpressView(sal_Bool bVisible) +{ + return m_pDataContainer->SetVisibleImpressView(bVisible); +} + +sal_Bool SvtSlideSorterBarOptions::GetVisibleOutlineView() const +{ + return m_pDataContainer->GetVisibleOutlineView(); +} + +void SvtSlideSorterBarOptions::SetVisibleOutlineView(sal_Bool bVisible) +{ + return m_pDataContainer->SetVisibleOutlineView(bVisible); +} + +sal_Bool SvtSlideSorterBarOptions::GetVisibleNotesView() const +{ + return m_pDataContainer->GetVisibleNotesView(); +} + +void SvtSlideSorterBarOptions::SetVisibleNotesView(sal_Bool bVisible) +{ + return m_pDataContainer->SetVisibleNotesView(bVisible); +} + +sal_Bool SvtSlideSorterBarOptions::GetVisibleHandoutView() const +{ + return m_pDataContainer->GetVisibleHandoutView(); +} + +void SvtSlideSorterBarOptions::SetVisibleHandoutView(sal_Bool bVisible) +{ + return m_pDataContainer->SetVisibleHandoutView(bVisible); +} + +sal_Bool SvtSlideSorterBarOptions::GetVisibleSlideSorterView() const +{ + return m_pDataContainer->GetVisibleSlideSorterView(); +} + +void SvtSlideSorterBarOptions::SetVisibleSlideSorterView(sal_Bool bVisible) +{ + return m_pDataContainer->SetVisibleSlideSorterView(bVisible); +} + +sal_Bool SvtSlideSorterBarOptions::GetVisibleDrawView() const +{ + return m_pDataContainer->GetVisibleDrawView(); +} + +void SvtSlideSorterBarOptions::SetVisibleDrawView(sal_Bool bVisible) +{ + return m_pDataContainer->SetVisibleDrawView(bVisible); +} + +namespace +{ + class theSvtSlideSorterBarOptionsMutex : + public rtl::Static< osl::Mutex, theSvtSlideSorterBarOptionsMutex > {}; +} + +Mutex & SvtSlideSorterBarOptions::GetInitMutex() +{ + return theSvtSlideSorterBarOptionsMutex::get(); +} + +void SvtSlideSorterBarOptions::AddListenerLink( const Link& rLink ) +{ + m_pDataContainer->AddListenerLink( rLink ); +} + +void SvtSlideSorterBarOptions::RemoveListenerLink( const Link& rLink ) +{ + m_pDataContainer->RemoveListenerLink( rLink ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |