[Libreoffice-commits] core.git: 4 commits - cui/inc cui/source desktop/source framework/inc framework/qa framework/source framework/util linguistic/source odk/examples offapi/com offapi/UnoApi_offapi.mk sc/inc sfx2/inc sfx2/source solenv/bin sw/inc sw/source unotools/source vbahelper/source vcl/inc vcl/source

Matúš Kukan matus.kukan at collabora.com
Thu Feb 6 03:08:39 PST 2014


 cui/inc/pch/precompiled_cui.hxx                                           |    4 
 cui/source/customize/cfg.cxx                                              |    8 
 cui/source/options/optpath.cxx                                            |    6 
 desktop/source/app/app.cxx                                                |    4 
 framework/inc/pch/precompiled_fwk.hxx                                     |    4 
 framework/inc/services/layoutmanager.hxx                                  |    1 
 framework/inc/uiconfiguration/windowstateconfiguration.hxx                |  112 ----
 framework/inc/uiconfiguration/windowstateproperties.hxx                   |   42 +
 framework/inc/uifactory/menubarfactory.hxx                                |   43 +
 framework/inc/uifactory/statusbarfactory.hxx                              |   51 --
 framework/inc/uifactory/toolboxfactory.hxx                                |   50 --
 framework/qa/complex/path_settings/PathSettingsTest.java                  |   14 
 framework/source/accelerators/presethandler.cxx                           |    6 
 framework/source/layoutmanager/layoutmanager.cxx                          |    6 
 framework/source/layoutmanager/toolbarlayoutmanager.cxx                   |    2 
 framework/source/layoutmanager/toolbarlayoutmanager.hxx                   |    1 
 framework/source/register/registerservices.cxx                            |    8 
 framework/source/services/pathsettings.cxx                                |  179 +++----
 framework/source/uiconfiguration/windowstateconfiguration.cxx             |  231 ++++++----
 framework/source/uielement/toolbarsmenucontroller.cxx                     |    6 
 framework/source/uifactory/menubarfactory.cxx                             |   45 -
 framework/source/uifactory/statusbarfactory.cxx                           |   73 +--
 framework/source/uifactory/toolboxfactory.cxx                             |   76 +--
 framework/util/fwk.component                                              |   14 
 linguistic/source/misc2.cxx                                               |    4 
 odk/examples/DevelopersGuide/GUI/SystemDialog.java                        |    6 
 odk/examples/DevelopersGuide/GUI/UnoDialogSample.java                     |    3 
 odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java |    6 
 offapi/UnoApi_offapi.mk                                                   |    2 
 offapi/com/sun/star/ui/WindowStateConfiguration.idl                       |   25 -
 offapi/com/sun/star/ui/theWindowStateConfiguration.idl                    |   63 ++
 offapi/com/sun/star/util/PathSettings.idl                                 |   14 
 offapi/com/sun/star/util/thePathSettings.idl                              |   52 ++
 sc/inc/pch/precompiled_vbaobj.hxx                                         |    2 
 sfx2/inc/pch/precompiled_sfx.hxx                                          |    2 
 sfx2/source/dialog/dockwin.cxx                                            |    4 
 solenv/bin/native-code.py                                                 |    1 
 sw/inc/pch/precompiled_vbaswobj.hxx                                       |    2 
 sw/source/ui/vba/vbaoptions.cxx                                           |    6 
 unotools/source/config/pathoptions.cxx                                    |    4 
 vbahelper/source/vbahelper/vbacommandbarhelper.cxx                        |    4 
 vcl/inc/pch/precompiled_vcl.hxx                                           |    2 
 vcl/source/window/dialog.cxx                                              |    4 
 43 files changed, 581 insertions(+), 611 deletions(-)

New commits:
commit 53052e5bfa6509395fa17b7517463c57f44999fe
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Jan 9 16:38:11 2014 +0100

    fwk: Constructor feature for single-instance WindowStateConfiguration.
    
    Change-Id: I0537d7a30b6c6807bf746a52dbd2c7fc66607ae2

diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index 167f954..569a1a8 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -29,7 +29,6 @@
 #include <properties.h>
 #include <stdtypes.h>
 #include <uielement/menubarmanager.hxx>
-#include <uiconfiguration/windowstateconfiguration.hxx>
 #include <framework/addonsoptions.hxx>
 #include <uielement/uielement.hxx>
 #include <helper/ilayoutnotifications.hxx>
diff --git a/framework/inc/uiconfiguration/windowstateconfiguration.hxx b/framework/inc/uiconfiguration/windowstateconfiguration.hxx
deleted file mode 100644
index 092d7a5..0000000
--- a/framework/inc/uiconfiguration/windowstateconfiguration.hxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_FRAMEWORK_INC_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX
-#define INCLUDED_FRAMEWORK_INC_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX
-
-/** Attention: stl headers must(!) be included at first. Otherwise it can make trouble
-               with solaris headers ...
-*/
-#include <vector>
-#include <list>
-#include <boost/unordered_map.hpp>
-
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
-#include <stdtypes.h>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/frame/XModuleManager2.hpp>
-
-#include <cppuhelper/implbase2.hxx>
-#include <rtl/ustring.hxx>
-
-namespace framework
-{
-
-#define WINDOWSTATE_PROPERTY_LOCKED         "Locked"
-#define WINDOWSTATE_PROPERTY_DOCKED         "Docked"
-#define WINDOWSTATE_PROPERTY_VISIBLE        "Visible"
-#define WINDOWSTATE_PROPERTY_DOCKINGAREA    "DockingArea"
-#define WINDOWSTATE_PROPERTY_DOCKPOS        "DockPos"
-#define WINDOWSTATE_PROPERTY_DOCKSIZE       "DockSize"
-#define WINDOWSTATE_PROPERTY_POS            "Pos"
-#define WINDOWSTATE_PROPERTY_SIZE           "Size"
-#define WINDOWSTATE_PROPERTY_UINAME         "UIName"
-#define WINDOWSTATE_PROPERTY_INTERNALSTATE  "InternalState"
-#define WINDOWSTATE_PROPERTY_STYLE          "Style"
-#define WINDOWSTATE_PROPERTY_CONTEXT        "ContextSensitive"
-#define WINDOWSTATE_PROPERTY_HIDEFROMENU    "HideFromToolbarMenu"
-#define WINDOWSTATE_PROPERTY_NOCLOSE        "NoClose"
-#define WINDOWSTATE_PROPERTY_SOFTCLOSE      "SoftClose"
-#define WINDOWSTATE_PROPERTY_CONTEXTACTIVE  "ContextActive"
-
-class WindowStateConfiguration :  private ThreadHelpBase                        ,   // Struct for right initalization of mutex member! Must be first of baseclasses.
-                                  public ::cppu::WeakImplHelper2< css::container::XNameAccess, css::lang::XServiceInfo>
-{
-    public:
-        WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
-        virtual ~WindowStateConfiguration();
-
-        //  XInterface, XTypeProvider, XServiceInfo
-        DECLARE_XSERVICEINFO
-
-        // XNameAccess
-        virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
-            throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
-        virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
-            throw (::com::sun::star::uno::RuntimeException);
-
-        virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
-            throw (::com::sun::star::uno::RuntimeException);
-
-        // XElementAccess
-        virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
-            throw (::com::sun::star::uno::RuntimeException);
-        virtual sal_Bool SAL_CALL hasElements()
-            throw (::com::sun::star::uno::RuntimeException);
-
-        typedef ::boost::unordered_map< OUString,
-                                 OUString,
-                                 OUStringHash,
-                                 ::std::equal_to< OUString > > ModuleToWindowStateFileMap;
-
-        typedef ::boost::unordered_map< OUString,
-                                 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >,
-                                 OUStringHash,
-                                 ::std::equal_to< OUString > > ModuleToWindowStateConfigHashMap;
-
-    private:
-        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>         m_xContext;
-        ModuleToWindowStateFileMap                                                          m_aModuleToFileHashMap;
-        ModuleToWindowStateConfigHashMap                                                    m_aModuleToWindowStateHashMap;
-        ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >        m_xModuleManager;
-};
-
-} // namespace framework
-
-#endif // __FRAMEWORK_UIELEMENT_WINDOWSTATECONFIGURATION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/inc/uiconfiguration/windowstateproperties.hxx b/framework/inc/uiconfiguration/windowstateproperties.hxx
new file mode 100644
index 0000000..b4653c4
--- /dev/null
+++ b/framework/inc/uiconfiguration/windowstateproperties.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FRAMEWORK_INC_UICONFIGURATION_WINDOWSTATEPROPERTIES_HXX
+#define INCLUDED_FRAMEWORK_INC_UICONFIGURATION_WINDOWSTATEPROPERTIES_HXX
+
+#define WINDOWSTATE_PROPERTY_LOCKED         "Locked"
+#define WINDOWSTATE_PROPERTY_DOCKED         "Docked"
+#define WINDOWSTATE_PROPERTY_VISIBLE        "Visible"
+#define WINDOWSTATE_PROPERTY_DOCKINGAREA    "DockingArea"
+#define WINDOWSTATE_PROPERTY_DOCKPOS        "DockPos"
+#define WINDOWSTATE_PROPERTY_DOCKSIZE       "DockSize"
+#define WINDOWSTATE_PROPERTY_POS            "Pos"
+#define WINDOWSTATE_PROPERTY_SIZE           "Size"
+#define WINDOWSTATE_PROPERTY_UINAME         "UIName"
+#define WINDOWSTATE_PROPERTY_INTERNALSTATE  "InternalState"
+#define WINDOWSTATE_PROPERTY_STYLE          "Style"
+#define WINDOWSTATE_PROPERTY_CONTEXT        "ContextSensitive"
+#define WINDOWSTATE_PROPERTY_HIDEFROMENU    "HideFromToolbarMenu"
+#define WINDOWSTATE_PROPERTY_NOCLOSE        "NoClose"
+#define WINDOWSTATE_PROPERTY_SOFTCLOSE      "SoftClose"
+#define WINDOWSTATE_PROPERTY_CONTEXTACTIVE  "ContextActive"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 906b1aa..b5ce84c 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -24,12 +24,12 @@
 #include <framework/sfxhelperfunctions.hxx>
 #include <uielement/menubarwrapper.hxx>
 #include <framework/addonsoptions.hxx>
-#include <uiconfiguration/windowstateconfiguration.hxx>
 #include <classes/fwkresid.hxx>
 #include <classes/resource.hrc>
 #include <toolkit/helper/convert.hxx>
 #include <uielement/progressbarwrapper.hxx>
 #include <uiconfiguration/globalsettings.hxx>
+#include <uiconfiguration/windowstateproperties.hxx>
 #include <toolbarlayoutmanager.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 35e903c..71a29b4 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -18,13 +18,13 @@
  */
 
 #include <toolbarlayoutmanager.hxx>
+#include <uiconfiguration/windowstateproperties.hxx>
 #include <uielement/addonstoolbarwrapper.hxx>
 #include <helpers.hxx>
 #include <services.h>
 #include <services/layoutmanager.hxx>
 #include <classes/resource.hrc>
 #include <classes/fwkresid.hxx>
-#include <uiconfiguration/windowstateconfiguration.hxx>
 
 #include <com/sun/star/awt/PosSize.hpp>
 #include <com/sun/star/awt/Toolkit.hpp>
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index 7c475f2..4c2a64c 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -36,7 +36,6 @@
 #include <stdtypes.h>
 #include <properties.h>
 #include <uiconfiguration/globalsettings.hxx>
-#include <uiconfiguration/windowstateconfiguration.hxx>
 #include <framework/addonsoptions.hxx>
 #include <uielement/uielement.hxx>
 #include <helper/ilayoutnotifications.hxx>
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 5e12cb7..829b594 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -34,14 +34,12 @@
                              )
 =================================================================================================================*/
 #include <services/desktop.hxx>
-#include "uiconfiguration/windowstateconfiguration.hxx"
 #include <services/sessionlistener.hxx>
 
 #include <services/ContextChangeEventMultiplexer.hxx>
 
 COMPONENTGETFACTORY ( fwk,
                         IFFACTORY( ::framework::Desktop                                 )   else
-                        IFFACTORY( ::framework::WindowStateConfiguration                )   else
                         IFFACTORY( ::framework::SessionListener                         )   else
                         IFFACTORY( ::framework::SessionListener                         )   else
                         IFFACTORY( ::framework::ContextChangeEventMultiplexer           )
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index dc3b9aa..a0c3060 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -17,11 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "uiconfiguration/windowstateconfiguration.hxx"
-#include <threadhelp/resetableguard.hxx>
-#include "services.h"
-
-#include "helper/mischelper.hxx"
+#include <uiconfiguration/windowstateproperties.hxx>
+#include <helper/mischelper.hxx>
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -29,19 +26,23 @@
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/frame/XModuleManager2.hpp>
 #include <com/sun/star/awt/Point.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/ui/DockingArea.hpp>
 #include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
-#include <rtl/ustrbuf.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <tools/debug.hxx>
 
-//_________________________________________________________________________________________________________________
-//  Defines
-//_________________________________________________________________________________________________________________
+#include <vector>
+#include <boost/unordered_map.hpp>
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -51,32 +52,11 @@ using namespace com::sun::star::configuration;
 using namespace com::sun::star::container;
 using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star::ui;
+using namespace framework;
 
 #undef WINDOWSTATE_MASK_POS
 
-//_________________________________________________________________________________________________________________
-//  Namespace
-//_________________________________________________________________________________________________________________
-
-static const char CONFIGURATION_ROOT_ACCESS[]               = "/org.openoffice.Office.UI.";
-static const char CONFIGURATION_WINDOWSTATE_ACCESS[]        = "/UIElements/States";
-
-static const char CONFIGURATION_PROPERTY_LOCKED[]           = WINDOWSTATE_PROPERTY_LOCKED;
-static const char CONFIGURATION_PROPERTY_DOCKED[]           = WINDOWSTATE_PROPERTY_DOCKED;
-static const char CONFIGURATION_PROPERTY_VISIBLE[]          = WINDOWSTATE_PROPERTY_VISIBLE;
-static const char CONFIGURATION_PROPERTY_DOCKINGAREA[]      = WINDOWSTATE_PROPERTY_DOCKINGAREA;
-static const char CONFIGURATION_PROPERTY_DOCKPOS[]          = WINDOWSTATE_PROPERTY_DOCKPOS;
-static const char CONFIGURATION_PROPERTY_DOCKSIZE[]         = WINDOWSTATE_PROPERTY_DOCKSIZE;
-static const char CONFIGURATION_PROPERTY_POS[]              = WINDOWSTATE_PROPERTY_POS;
-static const char CONFIGURATION_PROPERTY_SIZE[]             = WINDOWSTATE_PROPERTY_SIZE;
-static const char CONFIGURATION_PROPERTY_UINAME[]           = WINDOWSTATE_PROPERTY_UINAME;
-static const char CONFIGURATION_PROPERTY_INTERNALSTATE[]    = WINDOWSTATE_PROPERTY_INTERNALSTATE;
-static const char CONFIGURATION_PROPERTY_STYLE[]            = WINDOWSTATE_PROPERTY_STYLE;
-static const char CONFIGURATION_PROPERTY_CONTEXT[]          = WINDOWSTATE_PROPERTY_CONTEXT;
-static const char CONFIGURATION_PROPERTY_HIDEFROMMENU[]     = WINDOWSTATE_PROPERTY_HIDEFROMENU;
-static const char CONFIGURATION_PROPERTY_NOCLOSE[]          = WINDOWSTATE_PROPERTY_NOCLOSE;
-static const char CONFIGURATION_PROPERTY_SOFTCLOSE[]        = WINDOWSTATE_PROPERTY_SOFTCLOSE;
-static const char CONFIGURATION_PROPERTY_CONTEXTACTIVE[]    = WINDOWSTATE_PROPERTY_CONTEXTACTIVE;
+namespace {
 
 // Zero based indexes, order must be the same as WindowStateMask && CONFIGURATION_PROPERTIES!
 static const sal_Int16 PROPERTY_LOCKED                  = 0;
@@ -99,36 +79,30 @@ static const sal_Int16 PROPERTY_DOCKSIZE                = 15;
 // Order must be the same as WindowStateMask!!
 static const char* CONFIGURATION_PROPERTIES[]           =
 {
-    CONFIGURATION_PROPERTY_LOCKED,
-    CONFIGURATION_PROPERTY_DOCKED,
-    CONFIGURATION_PROPERTY_VISIBLE,
-    CONFIGURATION_PROPERTY_CONTEXT,
-    CONFIGURATION_PROPERTY_HIDEFROMMENU,
-    CONFIGURATION_PROPERTY_NOCLOSE,
-    CONFIGURATION_PROPERTY_SOFTCLOSE,
-    CONFIGURATION_PROPERTY_CONTEXTACTIVE,
-    CONFIGURATION_PROPERTY_DOCKINGAREA,
-    CONFIGURATION_PROPERTY_POS,
-    CONFIGURATION_PROPERTY_SIZE,
-    CONFIGURATION_PROPERTY_UINAME,
-    CONFIGURATION_PROPERTY_INTERNALSTATE,
-    CONFIGURATION_PROPERTY_STYLE,
-    CONFIGURATION_PROPERTY_DOCKPOS,
-    CONFIGURATION_PROPERTY_DOCKSIZE,
+    WINDOWSTATE_PROPERTY_LOCKED,
+    WINDOWSTATE_PROPERTY_DOCKED,
+    WINDOWSTATE_PROPERTY_VISIBLE,
+    WINDOWSTATE_PROPERTY_CONTEXT,
+    WINDOWSTATE_PROPERTY_HIDEFROMENU,
+    WINDOWSTATE_PROPERTY_NOCLOSE,
+    WINDOWSTATE_PROPERTY_SOFTCLOSE,
+    WINDOWSTATE_PROPERTY_CONTEXTACTIVE,
+    WINDOWSTATE_PROPERTY_DOCKINGAREA,
+    WINDOWSTATE_PROPERTY_POS,
+    WINDOWSTATE_PROPERTY_SIZE,
+    WINDOWSTATE_PROPERTY_UINAME,
+    WINDOWSTATE_PROPERTY_INTERNALSTATE,
+    WINDOWSTATE_PROPERTY_STYLE,
+    WINDOWSTATE_PROPERTY_DOCKPOS,
+    WINDOWSTATE_PROPERTY_DOCKSIZE,
     0
 };
 
-namespace framework
-{
-
 //*****************************************************************************************************************
 //  Configuration access class for WindowState supplier implementation
 //*****************************************************************************************************************
 
-class ConfigurationAccess_WindowState : // Order is necessary for right initialization!
-                                        private ThreadHelpBase                           ,
-                                        // interfaces
-                                        public  ::cppu::WeakImplHelper2< XNameContainer, XContainerListener >
+class ConfigurationAccess_WindowState : public  ::cppu::WeakImplHelper2< XNameContainer, XContainerListener >
 {
     public:
                                   ConfigurationAccess_WindowState( const OUString& aWindowStateConfigFile, const Reference< XComponentContext >& rxContext );
@@ -236,6 +210,7 @@ class ConfigurationAccess_WindowState : // Order is necessary for right initiali
                                  OUStringHash,
                                  ::std::equal_to< OUString > > ResourceURLToInfoCache;
 
+        osl::Mutex m_aMutex;
         OUString                     m_aConfigWindowAccess;
         Reference< XMultiServiceFactory > m_xConfigProvider;
         Reference< XNameAccess >          m_xConfigAccess;
@@ -249,14 +224,13 @@ class ConfigurationAccess_WindowState : // Order is necessary for right initiali
 //*****************************************************************************************************************
 
 ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( const OUString& aModuleName, const Reference< XComponentContext >& rxContext ) :
-    ThreadHelpBase(),
-    m_aConfigWindowAccess( CONFIGURATION_ROOT_ACCESS ),
+    m_aConfigWindowAccess( "/org.openoffice.Office.UI." ),
     m_bConfigAccessInitialized( sal_False ),
     m_bModified( sal_False )
 {
     // Create configuration hierachical access name
     m_aConfigWindowAccess += aModuleName;
-    m_aConfigWindowAccess += CONFIGURATION_WINDOWSTATE_ACCESS;
+    m_aConfigWindowAccess += "/UIElements/States";
     m_xConfigProvider = theDefaultProvider::get( rxContext );
 
     // Initialize access array with property names.
@@ -271,7 +245,7 @@ ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( const OUString
 ConfigurationAccess_WindowState::~ConfigurationAccess_WindowState()
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(m_aMutex);
     Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
     if ( xContainer.is() )
         xContainer->removeContainerListener(m_xConfigListener);
@@ -282,7 +256,7 @@ Any SAL_CALL ConfigurationAccess_WindowState::getByName( const OUString& rResour
 throw ( NoSuchElementException, WrappedTargetException, RuntimeException)
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(m_aMutex);
 
     ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     if ( pIter != m_aResourceURLToInfoCache.end() )
@@ -301,7 +275,7 @@ Sequence< OUString > SAL_CALL ConfigurationAccess_WindowState::getElementNames()
 throw ( RuntimeException )
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(m_aMutex);
 
     if ( !m_bConfigAccessInitialized )
     {
@@ -319,7 +293,7 @@ sal_Bool SAL_CALL ConfigurationAccess_WindowState::hasByName( const OUString& rR
 throw (::com::sun::star::uno::RuntimeException)
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(m_aMutex);
 
     ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     if ( pIter != m_aResourceURLToInfoCache.end() )
@@ -345,7 +319,7 @@ sal_Bool SAL_CALL ConfigurationAccess_WindowState::hasElements()
 throw ( RuntimeException )
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(m_aMutex);
 
     if ( !m_bConfigAccessInitialized )
     {
@@ -364,7 +338,7 @@ void SAL_CALL ConfigurationAccess_WindowState::removeByName( const OUString& rRe
 throw( NoSuchElementException, WrappedTargetException, RuntimeException )
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::ResettableMutexGuard g(m_aMutex);
 
     ResourceURLToInfoCache::iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     if ( pIter != m_aResourceURLToInfoCache.end() )
@@ -382,7 +356,7 @@ throw( NoSuchElementException, WrappedTargetException, RuntimeException )
         Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
         if ( xNameContainer.is() )
         {
-            aLock.unlock();
+            g.clear();
 
             xNameContainer->removeByName( rResourceURL );
             Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
@@ -399,7 +373,7 @@ void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& rRe
 throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException )
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::ResettableMutexGuard g(m_aMutex);
 
     Sequence< PropertyValue > aPropSet;
     if ( aPropertySet >>= aPropSet )
@@ -431,7 +405,7 @@ throw( IllegalArgumentException, ElementExistException, WrappedTargetException,
                     if ( xNameContainer.is() )
                     {
                         Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
-                        aLock.unlock();
+                        g.clear();
 
                         try
                         {
@@ -464,7 +438,7 @@ void SAL_CALL ConfigurationAccess_WindowState::replaceByName( const OUString& rR
 throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException )
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    osl::ResettableMutexGuard g(m_aMutex);
 
     Sequence< PropertyValue > aPropSet;
     if ( aPropertySet >>= aPropSet )
@@ -507,7 +481,7 @@ throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException,
                 WindowStateInfo aWinStateInfo( pIter->second );
                 OUString        aResourceURL( pIter->first );
                 m_bModified = sal_False;
-                aLock.unlock();
+                g.clear();
 
                 try
                 {
@@ -550,7 +524,7 @@ void SAL_CALL ConfigurationAccess_WindowState::disposing( const EventObject& aEv
 {
     // SAFE
     // remove our reference to the config access
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(m_aMutex);
 
     Reference< XInterface > xIfac1( aEvent.Source, UNO_QUERY );
     Reference< XInterface > xIfac2( m_xConfigAccess, UNO_QUERY );
@@ -1269,8 +1243,7 @@ sal_Bool ConfigurationAccess_WindowState::impl_initializeConfigAccess()
         aArgs[1] <<= aPropValue;
 
         m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
-                                                        SERVICENAME_CFGUPDATEACCESS, aArgs ),
-                                                    UNO_QUERY );
+                    "com.sun.star.configuration.ConfigurationUpdateAccess", aArgs ), UNO_QUERY );
         if ( m_xConfigAccess.is() )
         {
             // Add as container listener
@@ -1294,28 +1267,79 @@ sal_Bool ConfigurationAccess_WindowState::impl_initializeConfigAccess()
     return sal_False;
 }
 
+typedef ::cppu::WeakComponentImplHelper2< css::container::XNameAccess,
+        css::lang::XServiceInfo> WindowStateConfiguration_BASE;
 
-//*****************************************************************************************************************
-//  XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2(   WindowStateConfiguration                    ,
-                                            ::cppu::OWeakObject                         ,
-                                            "com.sun.star.ui.WindowStateConfiguration"  ,
-                                            IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION
-                                        )
+class WindowStateConfiguration : private osl::Mutex,
+                                 public WindowStateConfiguration_BASE
+{
+public:
+    WindowStateConfiguration( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+    virtual ~WindowStateConfiguration();
+
+    virtual OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException)
+    {
+        return OUString("com.sun.star.comp.framework.WindowStateConfiguration");
+    }
+
+    virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException)
+    {
+        return cppu::supportsService(this, ServiceName);
+    }
+
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException)
+    {
+        css::uno::Sequence< OUString > aSeq(1);
+        aSeq[0] = OUString("com.sun.star.ui.WindowStateConfiguration");
+        return aSeq;
+    }
+
+    // XNameAccess
+    virtual css::uno::Any SAL_CALL getByName( const OUString& aName )
+        throw ( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
 
-DEFINE_INIT_SERVICE                     (   WindowStateConfiguration, {} )
+    virtual css::uno::Sequence< OUString > SAL_CALL getElementNames()
+        throw (css::uno::RuntimeException);
+
+    virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
+        throw (css::uno::RuntimeException);
+
+    // XElementAccess
+    virtual css::uno::Type SAL_CALL getElementType()
+        throw (css::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL hasElements()
+        throw (css::uno::RuntimeException);
+
+    typedef ::boost::unordered_map< OUString,
+                             OUString,
+                             OUStringHash,
+                             ::std::equal_to< OUString > > ModuleToWindowStateFileMap;
+
+    typedef ::boost::unordered_map< OUString,
+                             css::uno::Reference< css::container::XNameAccess >,
+                             OUStringHash,
+                             ::std::equal_to< OUString > > ModuleToWindowStateConfigHashMap;
+
+private:
+    css::uno::Reference< css::uno::XComponentContext>         m_xContext;
+    ModuleToWindowStateFileMap                                m_aModuleToFileHashMap;
+    ModuleToWindowStateConfigHashMap                          m_aModuleToWindowStateHashMap;
+};
 
 WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentContext >& rxContext ) :
-    ThreadHelpBase(),
+    WindowStateConfiguration_BASE(*static_cast<osl::Mutex *>(this)),
     m_xContext( rxContext )
 {
-    m_xModuleManager = ModuleManager::create( m_xContext );
+    css::uno::Reference< css::frame::XModuleManager2 > xModuleManager =
+        ModuleManager::create( m_xContext );
     Reference< XNameAccess > xEmptyNameAccess;
     Sequence< OUString > aElementNames;
     try
     {
-        aElementNames = m_xModuleManager->getElementNames();
+        aElementNames = xModuleManager->getElementNames();
     }
     catch (const ::com::sun::star::uno::RuntimeException &)
     {
@@ -1326,7 +1350,7 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentC
     for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
     {
         aModuleIdentifier = aElementNames[i];
-        if ( m_xModuleManager->getByName( aModuleIdentifier ) >>= aSeq )
+        if ( xModuleManager->getByName( aModuleIdentifier ) >>= aSeq )
         {
             OUString aWindowStateFileStr;
             for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
@@ -1354,7 +1378,7 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentC
 
 WindowStateConfiguration::~WindowStateConfiguration()
 {
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
     m_aModuleToFileHashMap.clear();
     m_aModuleToWindowStateHashMap.clear();
 }
@@ -1362,7 +1386,7 @@ WindowStateConfiguration::~WindowStateConfiguration()
 Any SAL_CALL WindowStateConfiguration::getByName( const OUString& aModuleIdentifier )
 throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
 {
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     ModuleToWindowStateFileMap::const_iterator pIter = m_aModuleToFileHashMap.find( aModuleIdentifier );
     if ( pIter != m_aModuleToFileHashMap.end() )
@@ -1394,7 +1418,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la
 Sequence< OUString > SAL_CALL WindowStateConfiguration::getElementNames()
 throw (::com::sun::star::uno::RuntimeException)
 {
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     Sequence< OUString > aSeq( m_aModuleToFileHashMap.size() );
 
@@ -1412,7 +1436,7 @@ throw (::com::sun::star::uno::RuntimeException)
 sal_Bool SAL_CALL WindowStateConfiguration::hasByName( const OUString& aName )
 throw (::com::sun::star::uno::RuntimeException)
 {
-    ResetableGuard aLock( m_aLock );
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     ModuleToWindowStateFileMap::const_iterator pIter = m_aModuleToFileHashMap.find( aName );
     return ( pIter != m_aModuleToFileHashMap.end() );
@@ -1432,6 +1456,31 @@ throw (::com::sun::star::uno::RuntimeException)
     return sal_True;
 }
 
-} // namespace framework
+struct Instance {
+    explicit Instance(
+        css::uno::Reference<css::uno::XComponentContext> const & context):
+        instance(static_cast<cppu::OWeakObject *>(
+                    new WindowStateConfiguration(context)))
+    {
+    }
+
+    css::uno::Reference<css::uno::XInterface> instance;
+};
+
+struct Singleton:
+    public rtl::StaticWithArg<
+        Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
+{};
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_WindowStateConfiguration_get_implementation(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(static_cast<cppu::OWeakObject *>(
+                Singleton::get(context).instance.get()));
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 9553572..2e2f633 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -25,9 +25,9 @@
 #include "services.h"
 #include <classes/resource.hrc>
 #include <classes/fwkresid.hxx>
-#include <uiconfiguration/windowstateconfiguration.hxx>
 #include <framework/imageproducer.hxx>
 #include <framework/sfxhelperfunctions.hxx>
+#include <uiconfiguration/windowstateproperties.hxx>
 
 #include <com/sun/star/awt/XDevice.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 4948866..0db78c8 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -167,7 +167,8 @@
     <service name="com.sun.star.ui.WindowContentFactoryManager"/>
     <singleton name="com.sun.star.ui.theWindowContentFactoryManager"/>
   </implementation>
-  <implementation name="com.sun.star.comp.framework.WindowStateConfiguration">
+  <implementation name="com.sun.star.comp.framework.WindowStateConfiguration"
+      constructor="com_sun_star_comp_framework_WindowStateConfiguration_get_implementation">
     <service name="com.sun.star.ui.WindowStateConfiguration"/>
     <singleton name="com.sun.star.ui.theWindowStateConfiguration"/>
   </implementation>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 8dd033b..f16f98f 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -64,6 +64,7 @@ core_constructor_list = [
     "com_sun_star_comp_framework_UIConfigurationManager_get_implementation",
     "com_sun_star_comp_framework_UIElementFactoryManager_get_implementation",
     "com_sun_star_comp_framework_URLTransformer_get_implementation",
+    "com_sun_star_comp_framework_WindowStateConfiguration_get_implementation",
 # i18npool/util/i18npool.component
     "com_sun_star_i18n_BreakIterator_get_implementation",
     "com_sun_star_i18n_BreakIterator_Unicode_get_implementation",
commit 4ff873bda2a3af12e5c4848843ea6b7d9592bb6b
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Sun Feb 2 16:53:49 2014 +0100

    Introduce com.sun.star.ui.theWindowStateConfiguration singleton.
    
    Change-Id: I50861ac8952d54cb1a45846ea72a2ecac4f83409

diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx
index f04baba..940d8dc 100644
--- a/cui/inc/pch/precompiled_cui.hxx
+++ b/cui/inc/pch/precompiled_cui.hxx
@@ -214,7 +214,7 @@
 #include <com/sun/star/ui/theUICategoryDescription.hpp>
 #include <com/sun/star/ui/UIConfigurationManager.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/ui/XModuleUIConfigurationManager.hpp>
 #include <com/sun/star/ui/XUIConfiguration.hpp>
 #include <com/sun/star/ui/XUIConfigurationListener.hpp>
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 1d5349d..fb64911 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -86,7 +86,7 @@
 #include <com/sun/star/ui/XUIElement.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
 #include <com/sun/star/ui/ImageType.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
@@ -3603,7 +3603,7 @@ ToolbarSaveInData::ToolbarSaveInData(
     uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
     // Initialize the m_xPersistentWindowState variable which is used
     // to get the default properties of system toolbars such as name
-    uno::Reference< container::XNameAccess > xPWSS = css::ui::WindowStateConfiguration::create( xContext );
+    uno::Reference< container::XNameAccess > xPWSS = css::ui::theWindowStateConfiguration::get( xContext );
 
     xPWSS->getByName( aModuleId ) >>= m_xPersistentWindowState;
 }
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index e16697b..d017984 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -70,7 +70,7 @@
 #include <com/sun/star/document/XEventListener.hpp>
 #include <com/sun/star/frame/theUICommandDescription.hpp>
 #include <com/sun/star/ui/theUIElementFactoryManager.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/frame/XUIControllerRegistration.hpp>
 #include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
 #include <com/sun/star/office/Quickstart.hpp>
@@ -2133,7 +2133,7 @@ void Desktop::PreloadConfigurationData()
     }
 
     // preload window state configuration
-    xNameAccess = WindowStateConfiguration::create( xContext );
+    xNameAccess = theWindowStateConfiguration::get( xContext );
     Reference< XNameAccess > xWindowAccess;
     try
     {
diff --git a/framework/inc/pch/precompiled_fwk.hxx b/framework/inc/pch/precompiled_fwk.hxx
index 2452b62..ed9ceea 100644
--- a/framework/inc/pch/precompiled_fwk.hxx
+++ b/framework/inc/pch/precompiled_fwk.hxx
@@ -207,7 +207,7 @@
 #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/theUIElementFactoryManager.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XStatusbarItem.hdl>
 #include <com/sun/star/ui/XUIConfiguration.hpp>
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index ce5d134..906b1aa 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -48,7 +48,7 @@
 #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/ui/theUIElementFactoryManager.hpp>
 #include <com/sun/star/container/XNameReplace.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
@@ -124,7 +124,7 @@ LayoutManager::LayoutManager( const Reference< XComponentContext >& xContext ) :
         , m_pInplaceMenuBar( NULL )
         , m_xModuleManager( ModuleManager::create( xContext ))
         , m_xUIElementFactoryManager( ui::theUIElementFactoryManager::get(xContext) )
-        , m_xPersistentWindowStateSupplier( ui::WindowStateConfiguration::create( xContext ) )
+        , m_xPersistentWindowStateSupplier( ui::theWindowStateConfiguration::get( xContext ) )
         , m_pGlobalSettings( 0 )
         , m_aListenerContainer( m_aLock.getShareableOslMutex() )
         , m_pToolbarManager( 0 )
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 9230df8..9553572 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -42,7 +42,7 @@
 #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 
 #include <vcl/menu.hxx>
 #include <vcl/svapp.hxx>
@@ -820,7 +820,7 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume
         if ( m_bInitialized )
         {
             Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
-            Reference< XNameAccess > xPersistentWindowStateSupplier = ::com::sun::star::ui::WindowStateConfiguration::create( m_xContext );
+            Reference< XNameAccess > xPersistentWindowStateSupplier = ::com::sun::star::ui::theWindowStateConfiguration::get( m_xContext );
 
             // Retrieve persistent window state reference for our module
             OUString aModuleIdentifier;
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 463a328..4948866 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -169,6 +169,7 @@
   </implementation>
   <implementation name="com.sun.star.comp.framework.WindowStateConfiguration">
     <service name="com.sun.star.ui.WindowStateConfiguration"/>
+    <singleton name="com.sun.star.ui.theWindowStateConfiguration"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.jobs.JobDispatch"
       constructor="com_sun_star_comp_framework_jobs_JobDispatch_get_implementation">
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 9aaf26b..2e1f2d7 100755
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -428,6 +428,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/ui,\
 	theUICategoryDescription \
     theUIElementFactoryManager \
     theWindowContentFactoryManager \
+	theWindowStateConfiguration \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/ui/dialogs,\
 	AddressBookSourcePilot \
diff --git a/offapi/com/sun/star/ui/WindowStateConfiguration.idl b/offapi/com/sun/star/ui/WindowStateConfiguration.idl
index 47ae92b..562490e 100644
--- a/offapi/com/sun/star/ui/WindowStateConfiguration.idl
+++ b/offapi/com/sun/star/ui/WindowStateConfiguration.idl
@@ -26,27 +26,10 @@
 module com { module sun { module star { module ui {
 
 
-/** a service which provides window based information about user interface
-    elements.
-
-    <p>
-    OpenOffice.org has an amount of user interface elements that can be positioned,
-    resized, closed and their style can be changed. This service provides access
-    to the window based information of available user interface elements which are
-    part of OpenOffice.org modules, like Writer or Calc.
-    </p>
-
-    Provides access to window based information about user interface elements
-   of all installed application modules.
-
-    <p>
-    To access the window based information of a module, a unique module specifier
-    must be provided to com::sun::star::container::XNameAccess::getByName() function.
-    The module specifier can be retrieved from the com::sun::star::frame::ModuleManager
-    service. The interface provides references to a com::sun:star::ui::ModuleWindowStateConfiguration.
-    </p>
-
-    @see com::sun::star::frame::ModuleManager
+/**
+    A legacy (single-instance) service-variant of theWindowStateConfiguration singleton.
+
+    @deprecated Use theWindowStateConfiguration singleton instead.
 
     @since OOo 2.0
 */
diff --git a/offapi/com/sun/star/ui/theWindowStateConfiguration.idl b/offapi/com/sun/star/ui/theWindowStateConfiguration.idl
new file mode 100644
index 0000000..b8d257b
--- /dev/null
+++ b/offapi/com/sun/star/ui/theWindowStateConfiguration.idl
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __com_sun_star_ui_theWindowStateConfiguration_idl__
+#define __com_sun_star_ui_theWindowStateConfiguration_idl__
+
+#include <com/sun/star/container/XNameAccess.idl>
+
+
+module com { module sun { module star { module ui {
+
+
+/** a singleton which provides window based information about user interface
+    elements.
+
+    <p>
+    OpenOffice.org has an amount of user interface elements that can be positioned,
+    resized, closed and their style can be changed. This singleton provides access
+    to the window based information of available user interface elements which are
+    part of OpenOffice.org modules, like Writer or Calc.
+    </p>
+
+    Provides access to window based information about user interface elements
+    of all installed application modules.
+
+    <p>
+    To access the window based information of a module, a unique module specifier
+    must be provided to com::sun::star::container::XNameAccess::getByName() function.
+    The module specifier can be retrieved from the com::sun::star::frame::ModuleManager
+    service. The interface provides references to a com::sun:star::ui::ModuleWindowStateConfiguration.
+    </p>
+
+    Prior to LibreOffice 4.3, this singleton was only available as a
+    (single-instance) WindowStateConfiguration service.
+
+    @see com::sun::star::frame::ModuleManager
+
+    @since LibreOffice 4.3
+*/
+
+singleton theWindowStateConfiguration : com::sun::star::container::XNameAccess;
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx
index 577a8d4..298bde3 100644
--- a/sfx2/inc/pch/precompiled_sfx.hxx
+++ b/sfx2/inc/pch/precompiled_sfx.hxx
@@ -446,7 +446,7 @@
 #include <com/sun/star/ui/theUIElementFactoryManager.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
 #include <com/sun/star/ui/theWindowContentFactoryManager.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/ui/XDockingAreaAcceptor.hpp>
 #include <com/sun/star/ui/XImageManager.hpp>
 #include <com/sun/star/ui/XToolPanel.hpp>
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 5b73ec1..35c1607 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -45,7 +45,7 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/ui/theWindowContentFactoryManager.hpp>
 
 #define MAX_TOGGLEAREA_WIDTH        20
@@ -177,7 +177,7 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
         uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration );
         if ( !xWindowStateConfiguration.is() )
         {
-            xWindowStateConfiguration = ui::WindowStateConfiguration::create( xContext );
+            xWindowStateConfiguration = ui::theWindowStateConfiguration::get( xContext );
             m_xWindowStateConfiguration = xWindowStateConfiguration;
         }
 
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
index a162cbf..117b3ef 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
@@ -24,7 +24,7 @@
 #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
 #include <com/sun/star/ui/XUIElement.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
-#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <comphelper/processfactory.hxx>
 #include <vbahelper/vbahelper.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -115,7 +115,7 @@ void VbaCommandBarHelper::Init( ) throw (css::uno::RuntimeException)
 
     m_xAppCfgMgr.set( xUICfgMgrSupp->getUIConfigurationManager( maModuleId ), uno::UNO_QUERY_THROW );
 
-    css::uno::Reference< css::container::XNameAccess > xNameAccess = css::ui::WindowStateConfiguration::create( mxContext );
+    css::uno::Reference< css::container::XNameAccess > xNameAccess = css::ui::theWindowStateConfiguration::get( mxContext );
 
     m_xWindowState.set( xNameAccess->getByName( maModuleId ), uno::UNO_QUERY_THROW );
 }
commit 813b0f60e86de5e0ebf678691a9ff405e293bf86
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Jan 9 20:36:26 2014 +0100

    fwk: Constructor feature for single-instance FooBarFactories.
    
    Converted them as usual service implementations.
    Otherwise - if static singletons are used -
    it does not show menu for some reason.
    
    Change-Id: I0673d0bfbba268728a3fa676f2af95aa6c74bbb2

diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx
index ff03a96..ce9ea19 100644
--- a/framework/inc/uifactory/menubarfactory.hxx
+++ b/framework/inc/uifactory/menubarfactory.hxx
@@ -20,36 +20,48 @@
 #ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_MENUBARFACTORY_HXX
 #define INCLUDED_FRAMEWORK_INC_UIFACTORY_MENUBARFACTORY_HXX
 
-#include <stdtypes.h>
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
-
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/ui/XUIElementFactory.hpp>
 #include <com/sun/star/frame/XModuleManager2.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <toolkit/awt/vclxmenu.hxx>
 #include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <rtl/ustring.hxx>
 
 namespace framework
 {
-    class MenuBarFactory :  protected ThreadHelpBase                                    ,   // Struct for right initalization of mutex member! Must be first of baseclasses.
-                            public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
-                                                            ::com::sun::star::ui::XUIElementFactory>
+typedef ::cppu::WeakImplHelper2<
+    css::lang::XServiceInfo,
+    css::ui::XUIElementFactory> MenuBarFactory_BASE;
+
+    class MenuBarFactory : public MenuBarFactory_BASE
     {
         public:
             MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
             virtual ~MenuBarFactory();
 
-            //  XInterface, XTypeProvider, XServiceInfo
-            DECLARE_XSERVICEINFO
+            virtual OUString SAL_CALL getImplementationName()
+                throw (css::uno::RuntimeException)
+            {
+                return OUString("com.sun.star.comp.framework.MenuBarFactory");
+            }
+
+            virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+                throw (css::uno::RuntimeException)
+            {
+                return cppu::supportsService(this, ServiceName);
+            }
+
+            virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+                throw (css::uno::RuntimeException)
+            {
+                css::uno::Sequence< OUString > aSeq(1);
+                aSeq[0] = OUString("com.sun.star.ui.UIElementFactory");
+                return aSeq;
+            }
 
             // XUIElementFactory
             virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
@@ -63,10 +75,7 @@ namespace framework
                         ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
 
         protected:
-            MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,bool );
-
             ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >     m_xContext;
-            ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >     m_xModuleManager;
     };
 }
 
diff --git a/framework/inc/uifactory/statusbarfactory.hxx b/framework/inc/uifactory/statusbarfactory.hxx
deleted file mode 100644
index 3bbfbf4..0000000
--- a/framework/inc/uifactory/statusbarfactory.hxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_STATUSBARFACTORY_HXX
-#define INCLUDED_FRAMEWORK_INC_UIFACTORY_STATUSBARFACTORY_HXX
-
-#include <stdtypes.h>
-
-#include <macros/xserviceinfo.hxx>
-#include <services.h>
-#include <uifactory/menubarfactory.hxx>
-
-#include <rtl/ustring.hxx>
-
-namespace framework
-{
-
-class StatusBarFactory :  public MenuBarFactory
-{
-    public:
-        StatusBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
-
-        //  XInterface, XTypeProvider, XServiceInfo
-        DECLARE_XSERVICEINFO
-
-        // XUIElementFactory
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
-
-};
-
-}
-
-#endif // INCLUDED_FRAMEWORK_INC_UIFACTORY_STATUSBARFACTORY_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/inc/uifactory/toolboxfactory.hxx b/framework/inc/uifactory/toolboxfactory.hxx
deleted file mode 100644
index deccecb..0000000
--- a/framework/inc/uifactory/toolboxfactory.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_TOOLBOXFACTORY_HXX
-#define INCLUDED_FRAMEWORK_INC_UIFACTORY_TOOLBOXFACTORY_HXX
-
-#include <stdtypes.h>
-#include <macros/xserviceinfo.hxx>
-#include <services.h>
-#include <uifactory/menubarfactory.hxx>
-
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
-
-namespace framework
-{
-
-class ToolBoxFactory :  public MenuBarFactory
-{
-    public:
-        ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
-
-        //  XInterface, XTypeProvider, XServiceInfo
-        DECLARE_XSERVICEINFO
-
-        // XUIElementFactory
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
-};
-
-}
-
-#endif // SFX_TOOLBOXFACTORY_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index b66c1b9..5e12cb7 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -34,20 +34,14 @@
                              )
 =================================================================================================================*/
 #include <services/desktop.hxx>
-#include <uifactory/menubarfactory.hxx>
-#include <uifactory/toolboxfactory.hxx>
 #include "uiconfiguration/windowstateconfiguration.hxx"
-#include <uifactory/statusbarfactory.hxx>
 #include <services/sessionlistener.hxx>
 
 #include <services/ContextChangeEventMultiplexer.hxx>
 
 COMPONENTGETFACTORY ( fwk,
                         IFFACTORY( ::framework::Desktop                                 )   else
-                        IFFACTORY( ::framework::MenuBarFactory                          )   else
-                        IFFACTORY( ::framework::ToolBoxFactory                          )   else
                         IFFACTORY( ::framework::WindowStateConfiguration                )   else
-                        IFFACTORY( ::framework::StatusBarFactory                        )   else
                         IFFACTORY( ::framework::SessionListener                         )   else
                         IFFACTORY( ::framework::SessionListener                         )   else
                         IFFACTORY( ::framework::ContextChangeEventMultiplexer           )
diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx
index b973960..3395854 100644
--- a/framework/source/uifactory/menubarfactory.cxx
+++ b/framework/source/uifactory/menubarfactory.cxx
@@ -19,26 +19,20 @@
 
 #include <uifactory/menubarfactory.hxx>
 
-#include <threadhelp/resetableguard.hxx>
-#include "services.h"
 #include <uielement/menubarwrapper.hxx>
 
-#include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <vcl/menu.hxx>
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
 
-//_________________________________________________________________________________________________________________
-//  Defines
-//_________________________________________________________________________________________________________________
-
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::frame;
@@ -49,27 +43,8 @@ using namespace ::com::sun::star::ui;
 namespace framework
 {
 
-//*****************************************************************************************************************
-//  XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2(   MenuBarFactory                                  ,
-                                            ::cppu::OWeakObject                             ,
-                                            SERVICENAME_MENUBARFACTORY                      ,
-                                            IMPLEMENTATIONNAME_MENUBARFACTORY
-                                        )
-
-DEFINE_INIT_SERVICE                     (   MenuBarFactory, {} )
-
-MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
-    ThreadHelpBase()
-    , m_xContext( xContext )
-    , m_xModuleManager( ModuleManager::create( xContext ) )
-{
-}
-MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,bool ) :
-    ThreadHelpBase(&Application::GetSolarMutex())
-    , m_xContext( xContext )
-    , m_xModuleManager( ModuleManager::create( xContext ) )
+MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext )
+    : m_xContext( xContext )
 {
 }
 
@@ -84,11 +59,11 @@ Reference< XUIElement > SAL_CALL MenuBarFactory::createUIElement(
 throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    SolarMutexClearableGuard g;
     MenuBarWrapper* pMenuBarWrapper = new MenuBarWrapper( m_xContext );
     Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY );
-    Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager;
-    aLock.unlock();
+    Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
+    g.clear();
     CreateUIElement(ResourceURL, Args, "MenuOnly", "private:resource/menubar/", xMenuBar, xModuleManager, m_xContext);
     return xMenuBar;
 }
@@ -184,4 +159,12 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL
 
 } // namespace framework
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_MenuBarFactory_get_implementation(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new framework::MenuBarFactory(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx
index 729e1b7..ac30f93 100644
--- a/framework/source/uifactory/statusbarfactory.cxx
+++ b/framework/source/uifactory/statusbarfactory.cxx
@@ -17,27 +17,15 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <uifactory/statusbarfactory.hxx>
-#include <uifactory/menubarfactory.hxx>
+#include <com/sun/star/frame/ModuleManager.hpp>
 
+#include <uifactory/menubarfactory.hxx>
 #include <uielement/statusbarwrapper.hxx>
-#include <threadhelp/resetableguard.hxx>
-
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-
-#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 
+#include <cppuhelper/supportsservice.hxx>
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
 
-//_________________________________________________________________________________________________________________
-//  Defines
-//_________________________________________________________________________________________________________________
-
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::frame;
@@ -45,22 +33,41 @@ using namespace com::sun::star::beans;
 using namespace com::sun::star::util;
 using namespace ::com::sun::star::ui;
 
-namespace framework
+using namespace framework;
+
+namespace {
+
+class StatusBarFactory :  public MenuBarFactory
 {
+public:
+    StatusBarFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+
+    virtual OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException)
+    {
+        return OUString("com.sun.star.comp.framework.StatusBarFactory");
+    }
+
+    virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException)
+    {
+        return cppu::supportsService(this, ServiceName);
+    }
 
-//*****************************************************************************************************************
-//  XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2(   StatusBarFactory                                ,
-                                            ::cppu::OWeakObject                             ,
-                                            SERVICENAME_STATUSBARFACTORY                    ,
-                                            IMPLEMENTATIONNAME_STATUSBARFACTORY
-                                        )
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException)
+    {
+        css::uno::Sequence< OUString > aSeq(1);
+        aSeq[0] = OUString("com.sun.star.ui.StatusBarFactory");
+        return aSeq;
+    }
 
-DEFINE_INIT_SERVICE                     (   StatusBarFactory, {} )
+    // XUIElementFactory
+    virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const css::uno::Sequence< css::beans::PropertyValue >& Args ) throw ( css::container::NoSuchElementException, css::lang::IllegalArgumentException, css::uno::RuntimeException );
+};
 
 StatusBarFactory::StatusBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
-    MenuBarFactory( xContext,true )
+    MenuBarFactory( xContext )
 {
 }
 
@@ -71,15 +78,23 @@ Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement(
 throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
 {
     // SAFE
-    ResetableGuard aLock( m_aLock );
+    SolarMutexClearableGuard g;
     StatusBarWrapper* pWrapper = new StatusBarWrapper( m_xContext );
     Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
-    Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager;
-    aLock.unlock();
+    Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
+    g.clear();
     MenuBarFactory::CreateUIElement(ResourceURL, Args, NULL, "private:resource/statusbar/", xMenuBar, xModuleManager, m_xContext );
     return xMenuBar;
 }
 
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_StatusBarFactory_get_implementation(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new StatusBarFactory(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uifactory/toolboxfactory.cxx b/framework/source/uifactory/toolboxfactory.cxx
index fe0104c..ad64f4b 100644
--- a/framework/source/uifactory/toolboxfactory.cxx
+++ b/framework/source/uifactory/toolboxfactory.cxx
@@ -17,25 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <uifactory/toolboxfactory.hxx>
-
-#include <uielement/toolbarwrapper.hxx>
-#include <threadhelp/resetableguard.hxx>
-
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-
-#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
 
+#include <cppuhelper/supportsservice.hxx>
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
-
-//_________________________________________________________________________________________________________________
-//  Defines
-//_________________________________________________________________________________________________________________
+#include <uielement/toolbarwrapper.hxx>
+#include <uifactory/menubarfactory.hxx>
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -43,23 +31,43 @@ using namespace com::sun::star::frame;
 using namespace com::sun::star::beans;
 using namespace com::sun::star::util;
 using namespace ::com::sun::star::ui;
+using namespace framework;
 
-namespace framework
+namespace {
+
+class ToolBoxFactory :  public MenuBarFactory
 {
+public:
+    ToolBoxFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+
+    virtual OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException)
+    {
+        return OUString("com.sun.star.comp.framework.ToolBarFactory");
+    }
+
+    virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException)
+    {
+        return cppu::supportsService(this, ServiceName);
+    }
 
-//*****************************************************************************************************************
-//  XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2(   ToolBoxFactory                                  ,
-                                            ::cppu::OWeakObject                             ,
-                                            SERVICENAME_TOOLBARFACTORY                      ,
-                                            IMPLEMENTATIONNAME_TOOLBARFACTORY
-                                        )
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException)
+    {
+        css::uno::Sequence< OUString > aSeq(1);
+        aSeq[0] = OUString("com.sun.star.ui.ToolBarFactory");
+        return aSeq;
+    }
 
-DEFINE_INIT_SERVICE                     (   ToolBoxFactory, {} )
+    // XUIElementFactory
+    virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL createUIElement(
+            const OUString& ResourceURL, const css::uno::Sequence< css::beans::PropertyValue >& Args )
+        throw ( css::container::NoSuchElementException, css::lang::IllegalArgumentException, css::uno::RuntimeException );
+};
 
 ToolBoxFactory::ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
-    MenuBarFactory( xContext,true )
+    MenuBarFactory( xContext )
 {
 }
 
@@ -69,15 +77,23 @@ Reference< XUIElement > SAL_CALL ToolBoxFactory::createUIElement(
     const Sequence< PropertyValue >& Args )
 throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
 {
-    ResetableGuard aLock( m_aLock );
+    SolarMutexClearableGuard g;
     ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xContext );
     Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
-    Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager;
-    aLock.unlock();
+    Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create(m_xContext);
+    g.clear();
     CreateUIElement(ResourceURL, Args, "PopupMode", "private:resource/toolbar/", xMenuBar, xModuleManager, m_xContext);
     return xMenuBar;
 }
 
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_ToolBarFactory_get_implementation(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new ToolBoxFactory(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 3c93163..463a328 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -70,7 +70,8 @@
       constructor="com_sun_star_comp_framework_LayoutManager_get_implementation">
     <service name="com.sun.star.frame.LayoutManager"/>
   </implementation>
-  <implementation name="com.sun.star.comp.framework.MenuBarFactory">
+  <implementation name="com.sun.star.comp.framework.MenuBarFactory"
+      constructor="com_sun_star_comp_framework_MenuBarFactory_get_implementation">
     <service name="com.sun.star.ui.UIElementFactory"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.ModuleAcceleratorConfiguration"
@@ -117,7 +118,8 @@
     <service name="com.sun.star.frame.StatusbarControllerFactory"/>
     <singleton name="com.sun.star.frame.theStatusbarControllerFactory"/>
   </implementation>
-  <implementation name="com.sun.star.comp.framework.StatusBarFactory">
+  <implementation name="com.sun.star.comp.framework.StatusBarFactory"
+      constructor="com_sun_star_comp_framework_StatusBarFactory_get_implementation">
     <service name="com.sun.star.ui.StatusBarFactory"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.StatusIndicatorFactory"
@@ -133,7 +135,8 @@
     <service name="com.sun.star.frame.ToolbarControllerFactory"/>
     <singleton name="com.sun.star.frame.theToolbarControllerFactory"/>
   </implementation>
-  <implementation name="com.sun.star.comp.framework.ToolBarFactory">
+  <implementation name="com.sun.star.comp.framework.ToolBarFactory"
+      constructor="com_sun_star_comp_framework_ToolBarFactory_get_implementation">
     <service name="com.sun.star.ui.ToolBarFactory"/>
   </implementation>
   <implementation name="com.sun.star.comp.framework.UICategoryDescription"
commit 094f92bb789ecd24793c5843bfae13e79122fc5a
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Mon Jan 27 09:51:58 2014 +0100

    Introduce com.sun.star.util.thePathSettings singleton.
    
    To replace single-instance com.sun.star.util.PathSettings service,
    incorrectly converted in 89b0017b22889af6a8afe28b94c06e7095dc8c6f
    
    Keeping util::PathSettings::create in
    sc/source/ui/vba/vbaapplication.cxx because for some reason
    util::thePathSettings::get does not work in sc_macros_test
    while testing sc/qa/extras/testdocuments/Ranges.xls.
    
    Change-Id: I75b68ae56ac5b58f72416070dba100ab3ab70fe8

diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx
index 42a1560..f04baba 100644
--- a/cui/inc/pch/precompiled_cui.hxx
+++ b/cui/inc/pch/precompiled_cui.hxx
@@ -242,7 +242,7 @@
 #include <com/sun/star/uno/Sequence.h>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/util/PathSettings.hpp>
+#include <com/sun/star/util/thePathSettings.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/util/XChangesBatch.hpp>
 #include <com/sun/star/util/XFlushable.hpp>
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index d4f5361..1d5349d 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -90,7 +90,7 @@
 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-#include <com/sun/star/util/PathSettings.hpp>
+#include <com/sun/star/util/thePathSettings.hpp>
 
 #include "dlgname.hxx"
 
@@ -4927,7 +4927,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( Window *pWindow,
         graphic::GraphicProvider::create( xComponentContext ) );
 
     uno::Reference< css::util::XPathSettings > xPathSettings =
-        css::util::PathSettings::create( xComponentContext );
+        css::util::thePathSettings::get( xComponentContext );
 
 
     OUString aDirectory = xPathSettings->getUserConfig();
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index af138e3..5aa07b4 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -47,7 +47,7 @@
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
 #include <com/sun/star/ui/dialogs/FolderPicker.hpp>
-#include <com/sun/star/util/PathSettings.hpp>
+#include <com/sun/star/util/thePathSettings.hpp>
 #include <officecfg/Office/Common.hxx>
 #include "optHeaderTabListbox.hxx"
 #include <vcl/help.hxx>
@@ -722,7 +722,7 @@ void SvxPathTabPage::GetPathList(
         if ( !pImpl->m_xPathSettings.is() )
         {
             Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
-            pImpl->m_xPathSettings = css::util::PathSettings::create( xContext );
+            pImpl->m_xPathSettings = css::util::thePathSettings::get( xContext );
         }
 
         // load internal paths
@@ -791,7 +791,7 @@ void SvxPathTabPage::SetPathList(
         if ( !pImpl->m_xPathSettings.is() )
         {
             Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
-            pImpl->m_xPathSettings = css::util::PathSettings::create( xContext );
+            pImpl->m_xPathSettings = css::util::thePathSettings::get( xContext );
         }
 
         // save user paths
diff --git a/framework/inc/pch/precompiled_fwk.hxx b/framework/inc/pch/precompiled_fwk.hxx
index 32b8d6d..2452b62 100644
--- a/framework/inc/pch/precompiled_fwk.hxx
+++ b/framework/inc/pch/precompiled_fwk.hxx
@@ -225,7 +225,7 @@
 #include <com/sun/star/uri/XUriReference.hpp>
 #include <com/sun/star/uri/XUriReferenceFactory.hpp>
 #include <com/sun/star/util/Color.hpp>
-#include <com/sun/star/util/PathSettings.hpp>
+#include <com/sun/star/util/thePathSettings.hpp>
 #include <com/sun/star/util/PathSubstitution.hpp>
 #include <com/sun/star/util/URL.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
diff --git a/framework/qa/complex/path_settings/PathSettingsTest.java b/framework/qa/complex/path_settings/PathSettingsTest.java
index a36c753..599b76d 100644
--- a/framework/qa/complex/path_settings/PathSettingsTest.java
+++ b/framework/qa/complex/path_settings/PathSettingsTest.java
@@ -25,9 +25,9 @@ import com.sun.star.beans.XPropertiesChangeListener;
 import com.sun.star.beans.XPropertyChangeListener;
 import com.sun.star.beans.XVetoableChangeListener;
 import com.sun.star.lang.WrappedTargetException;
-import com.sun.star.lang.XMultiServiceFactory;
 import com.sun.star.uno.UnoRuntime;
 import com.sun.star.uno.AnyConverter;
+import com.sun.star.util.thePathSettings;
 
 // ---------- junit imports -----------------
 import java.util.ArrayList;
@@ -43,7 +43,6 @@ import static org.junit.Assert.*;
 public class PathSettingsTest
 {
 
-    private static XMultiServiceFactory xMSF;
     // the test object: an instance of the tested service
     private static Object aPathSettings = null;
     // the properties of the service
@@ -111,9 +110,8 @@ public class PathSettingsTest
     {
         try
         {
-            xMSF = getMSF();
-            aPathSettings = xMSF.createInstance("com.sun.star.comp.framework.PathSettings");
-            assertNotNull("Can't instantiate com.sun.star.util.PathSettings.", aPathSettings);
+            aPathSettings = thePathSettings.get(connection.getComponentContext());
+            assertNotNull("Can't instantiate com.sun.star.util.thePathSettings.", aPathSettings);
 //            System.out.println("Implementation: " + util.utils.getImplName(aPathSettings));
 //            System.out.println("Service:        ");
             util.dbg.getSuppServices(aPathSettings);
@@ -954,12 +952,6 @@ public class PathSettingsTest
         }
     }
 
-    private XMultiServiceFactory getMSF()
-    {
-        final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
-        return xMSF1;
-    }
-
     // setup and close connections
     @BeforeClass
     public static void setUpConnection() throws Exception
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index efde565..2500667 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -34,7 +34,7 @@
 #include <com/sun/star/embed/XTransactedObject.hpp>
 #include <com/sun/star/embed/FileSystemStorageFactory.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/util/PathSettings.hpp>
+#include <com/sun/star/util/thePathSettings.hpp>
 
 #include <vcl/svapp.hxx>
 #include <cppuhelper/exc_hlp.hxx>
@@ -216,7 +216,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
     // <- SAFE ----------------------------------
 
     css::uno::Reference< css::util::XPathSettings > xPathSettings =
-        css::util::PathSettings::create( xContext );
+        css::util::thePathSettings::get( xContext );
 
     OUString sShareLayer = xPathSettings->getBasePathShareLayer();
 
@@ -274,7 +274,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
     // <- SAFE ----------------------------------
 
     css::uno::Reference< css::util::XPathSettings > xPathSettings =
-        css::util::PathSettings::create( xContext );
+        css::util::thePathSettings::get( xContext );
 
     OUString sUserLayer = xPathSettings->getBasePathUserLayer();
 
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 472fac3..dad1a43 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -17,18 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <threadhelp/readguard.hxx>
-#include <threadhelp/writeguard.hxx>
-#include <threadhelp/threadhelpbase.hxx>
 #include <properties.h>
 #include <stdtypes.h>
-
-#include "helper/mischelper.hxx"
+#include <helper/mischelper.hxx>
 
 #include <com/sun/star/beans/Property.hpp>
 #include <com/sun/star/beans/XProperty.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/container/XContainer.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/util/XChangesNotifier.hpp>
 #include <com/sun/star/util/PathSubstitution.hpp>
@@ -42,12 +37,10 @@
 #include <rtl/ustrbuf.hxx>
 
 #include <cppuhelper/propshlp.hxx>
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/compbase3.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/sequence.hxx>
-#include <comphelper/sequenceasvector.hxx>
 #include <comphelper/configurationhelper.hxx>
-#include <comphelper/processfactory.hxx>
 #include <unotools/configitem.hxx>
 #include <unotools/configpaths.hxx>
 
@@ -85,18 +78,15 @@ sal_Int32 impl_getPropGroup(sal_Int32 nID)
    disable it in case only the new schema must be used.
  */
 
-typedef ::cppu::WeakImplHelper3<
-                         css::lang::XServiceInfo,
-                         css::util::XChangesListener,               // => XEventListener
-                         css::util::XPathSettings>                  // => XPropertySet
-        PathSettings_BASE;
-
-class PathSettings : // base classes
-                     // Order is necessary for right initialization!
-                     private ThreadHelpBase                       ,
-                     public  ::cppu::OBroadcastHelper             ,
-                     public  ::cppu::OPropertySetHelper           , // => XPropertySet / XFastPropertySet / XMultiPropertySet
-                     public  PathSettings_BASE
+typedef ::cppu::WeakComponentImplHelper3<
+            css::lang::XServiceInfo,
+            css::util::XChangesListener,    // => XEventListener
+            css::util::XPathSettings>       // => XPropertySet
+                PathSettings_BASE;
+
+class PathSettings : private osl::Mutex
+                   , public  PathSettings_BASE
+                   , public  ::cppu::OPropertySetHelper
 {
     struct PathInfo
     {
@@ -231,9 +221,6 @@ public:
     virtual void SAL_CALL disposing(const css::lang::EventObject& aSource)
         throw(css::uno::RuntimeException);
 
-    using ::cppu::OPropertySetHelper::disposing;
-
-
     /**
      * XPathSettings attribute methods
      */
@@ -342,8 +329,6 @@ public:
     virtual void SAL_CALL setBasePathUserLayer(const OUString& p1) throw (css::uno::RuntimeException)
         { setStringProperty("UserConfig", p1); }
 
-
-
     /**
      * overrides to resolve inheritance ambiguity
      */
@@ -365,11 +350,11 @@ public:
     virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2)
         throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException)
         { ::cppu::OPropertySetHelper::removeVetoableChangeListener(p1, p2); }
-
     /** read all configured paths and create all needed internal structures. */
     void impl_readAll();
 
 private:
+    virtual void SAL_CALL disposing() SAL_OVERRIDE;
 
     OUString getStringProperty(const OUString& p1)
         throw(css::uno::RuntimeException);
@@ -450,17 +435,20 @@ private:
 
 
     //  OPropertySetHelper
-    virtual sal_Bool                                            SAL_CALL convertFastPropertyValue        (       css::uno::Any&  aConvertedValue ,
-                                                                                                                 css::uno::Any&  aOldValue       ,
-                                                                                                                 sal_Int32       nHandle         ,
-                                                                                                           const css::uno::Any&  aValue          ) throw(css::lang::IllegalArgumentException);
-    virtual void                                                SAL_CALL setFastPropertyValue_NoBroadcast(       sal_Int32       nHandle         ,
-                                                                                                           const css::uno::Any&  aValue          ) throw(css::uno::Exception);
+    virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any&  aConvertedValue,
+            css::uno::Any& aOldValue,
+            sal_Int32 nHandle,
+            const css::uno::Any& aValue ) throw(css::lang::IllegalArgumentException);
+    virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
+            const css::uno::Any&  aValue ) throw(css::uno::Exception);
+    virtual void SAL_CALL getFastPropertyValue( css::uno::Any&  aValue,
+            sal_Int32 nHandle ) const;
+    // Avoid:
+    // warning: ‘virtual com::sun::star::uno::Any cppu::OPropertySetHelper::getFastPropertyValue(sal_Int32)’ was hidden [-Woverloaded-virtual]
+    // warning:   by ‘virtual void {anonymous}::PathSettings::getFastPropertyValue(com::sun::star::uno::Any&, sal_Int32) const’ [-Woverloaded-virtual]
     using cppu::OPropertySetHelper::getFastPropertyValue;
-    virtual void                                                SAL_CALL getFastPropertyValue            (       css::uno::Any&  aValue          ,
-                                                                                                                 sal_Int32       nHandle         ) const;
-    virtual ::cppu::IPropertyArrayHelper&                       SAL_CALL getInfoHelper                   (                                       );
-    virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo              (                                       ) throw(::css::uno::RuntimeException);
+    virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+    virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::css::uno::RuntimeException);
 
     /** factory methods to guarantee right (but on demand) initialized members ... */
     css::uno::Reference< css::util::XStringSubstitution > fa_getSubstitution();
@@ -470,14 +458,8 @@ private:
 
 //-----------------------------------------------------------------------------
 PathSettings::PathSettings( const css::uno::Reference< css::uno::XComponentContext >& xContext )
-    //  Init baseclasses first
-    //  Attention: Don't change order of initialization!
-    //      ThreadHelpBase is a struct with a lock as member. We can't use a lock as direct member!
-    //      We must garant right initialization and a valid value of this to initialize other baseclasses!
-    :   ThreadHelpBase()
-    ,   ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >(m_aLock.getShareableOslMutex())
-    ,   ::cppu::OPropertySetHelper(*(static_cast< ::cppu::OBroadcastHelper* >(this)))
-    // Init member
+    : PathSettings_BASE(*(static_cast<osl::Mutex *>(this)))
+    , ::cppu::OPropertySetHelper(cppu::WeakComponentImplHelperBase::rBHelper)
     ,   m_xContext (xContext)
     ,   m_pPropHelp(0    )
     ,  m_bIgnoreEvents(sal_False)
@@ -487,11 +469,25 @@ PathSettings::PathSettings( const css::uno::Reference< css::uno::XComponentConte
 //-----------------------------------------------------------------------------
 PathSettings::~PathSettings()
 {
-    css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfgNew, css::uno::UNO_QUERY);
+    disposing();
+}
+
+void SAL_CALL PathSettings::disposing()
+{
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
+
+    css::uno::Reference< css::util::XChangesNotifier >
+        xBroadcaster(m_xCfgNew, css::uno::UNO_QUERY);
     if (xBroadcaster.is())
         xBroadcaster->removeChangesListener(m_xCfgNewListener);
-    if (m_pPropHelp)
-       delete m_pPropHelp;
+
+    m_xSubstitution.clear();
+    m_xCfgOld.clear();
+    m_xCfgNew.clear();
+    m_xCfgNewListener.clear();
+
+    delete m_pPropHelp;
+    m_pPropHelp = 0;
 }
 
 //------------------------------------------------------------------
@@ -500,11 +496,11 @@ css::uno::Any SAL_CALL PathSettings::queryInterface( const css::uno::Type& _rTyp
 {
     css::uno::Any aRet = PathSettings_BASE::queryInterface( _rType );
     if ( !aRet.hasValue() )
-        aRet = OPropertySetHelper::queryInterface( _rType );
+        aRet = ::cppu::OPropertySetHelper::queryInterface( _rType );
     return aRet;
 }
 
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------
 css::uno::Sequence< css::uno::Type > SAL_CALL PathSettings::getTypes(  )
     throw(css::uno::RuntimeException)
 {
@@ -549,12 +545,10 @@ void SAL_CALL PathSettings::changesOccurred(const css::util::ChangesEvent& aEven
 void SAL_CALL PathSettings::disposing(const css::lang::EventObject& aSource)
     throw(css::uno::RuntimeException)
 {
-    WriteGuard aWriteLock(m_aLock);
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     if (aSource.Source == m_xCfgNew)
         m_xCfgNew.clear();
-
-    aWriteLock.unlock();
 }
 
 //-----------------------------------------------------------------------------
@@ -750,7 +744,7 @@ PathSettings::EChangeOp PathSettings::impl_updatePath(const OUString& sPath
                                                             sal_Bool         bNotifyListener)
 {
     // SAFE ->
-    WriteGuard aWriteLock(m_aLock);
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     PathSettings::PathInfo* pPathOld = 0;
     PathSettings::PathInfo* pPathNew = 0;
@@ -1096,7 +1090,7 @@ void PathSettings::impl_purgeKnownPaths(const PathSettings::PathInfo& rPath,
 void PathSettings::impl_rebuildPropertyDescriptor()
 {
     // SAFE ->
-    WriteGuard aWriteLock(m_aLock);
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     sal_Int32 c = (sal_Int32)m_lPaths.size();
     sal_Int32 i = 0;
@@ -1146,11 +1140,9 @@ void PathSettings::impl_rebuildPropertyDescriptor()
         ++i;
     }
 
-    if (m_pPropHelp)
-       delete m_pPropHelp;
+    delete m_pPropHelp;
     m_pPropHelp = new ::cppu::OPropertyArrayHelper(m_lPropDesc, sal_False); // false => not sorted ... must be done inside helper
 
-    aWriteLock.unlock();
     // <- SAFE
 }
 
@@ -1349,7 +1341,7 @@ OUString impl_extractBaseFromPropName(const OUString& sPropName)
 PathSettings::PathInfo* PathSettings::impl_getPathAccess(sal_Int32 nHandle)
 {
     // SAFE ->
-    ReadGuard aReadLock(m_aLock);
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     if (nHandle > (m_lPropDesc.getLength()-1))
         return 0;
@@ -1369,7 +1361,7 @@ PathSettings::PathInfo* PathSettings::impl_getPathAccess(sal_Int32 nHandle)
 const PathSettings::PathInfo* PathSettings::impl_getPathAccessConst(sal_Int32 nHandle) const
 {
     // SAFE ->
-    ReadGuard aReadLock(m_aLock);
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
     if (nHandle > (m_lPropDesc.getLength()-1))
         return 0;
@@ -1428,18 +1420,18 @@ void SAL_CALL PathSettings::getFastPropertyValue(css::uno::Any& aValue ,
 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL PathSettings::getPropertySetInfo()
     throw(css::uno::RuntimeException)
 {
-    return css::uno::Reference< css::beans::XPropertySetInfo >(createPropertySetInfo(getInfoHelper()));
+    return css::uno::Reference< css::beans::XPropertySetInfo >(
+            ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()));
 }
 
 //-----------------------------------------------------------------------------
 css::uno::Reference< css::util::XStringSubstitution > PathSettings::fa_getSubstitution()
 {
-    // SAFE ->
-    ReadGuard aReadLock(m_aLock);
-    css::uno::Reference< css::uno::XComponentContext >  xContext  = m_xContext;
-    css::uno::Reference< css::util::XStringSubstitution >  xSubst = m_xSubstitution;
-    aReadLock.unlock();
-    // <- SAFE
+    css::uno::Reference< css::util::XStringSubstitution > xSubst;
+    { // SAFE ->
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
+    xSubst = m_xSubstitution;
+    }
 
     if (! xSubst.is())
     {
@@ -1447,12 +1439,12 @@ css::uno::Reference< css::util::XStringSubstitution > PathSettings::fa_getSubsti
         // We must replace all used variables inside readed path values.
         // In case we can't do so ... the whole office can't work really.
         // That's why it seams to be OK to throw a RuntimeException then.
-        xSubst = css::util::PathSubstitution::create(xContext);
+        xSubst = css::util::PathSubstitution::create(m_xContext);
 
-        // SAFE ->
-        WriteGuard aWriteLock(m_aLock);
+        { // SAFE ->
+        osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
         m_xSubstitution = xSubst;
-        aWriteLock.unlock();
+        }
     }
 
     return xSubst;
@@ -1463,26 +1455,25 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgOld()
 {
     const OUString CFG_NODE_OLD("org.openoffice.Office.Common/Path/Current");
 
-    // SAFE ->
-    ReadGuard aReadLock(m_aLock);
-    css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
-    css::uno::Reference< css::container::XNameAccess >     xCfg  = m_xCfgOld;
-    aReadLock.unlock();
-    // <- SAFE
+    css::uno::Reference< css::container::XNameAccess > xCfg;
+    { // SAFE ->
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
+    xCfg = m_xCfgOld;
+    } // <- SAFE
 
     if (! xCfg.is())
     {
         xCfg = css::uno::Reference< css::container::XNameAccess >(
                    ::comphelper::ConfigurationHelper::openConfig(
-                        xContext,
+                        m_xContext,
                         CFG_NODE_OLD,
                         ::comphelper::ConfigurationHelper::E_STANDARD), // not readonly! Sometimes we need write access there !!!
                    css::uno::UNO_QUERY_THROW);
 
-        // SAFE ->
-        WriteGuard aWriteLock(m_aLock);
+        { // SAFE ->
+        osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
         m_xCfgOld = xCfg;
-        aWriteLock.unlock();
+        }
     }
 
     return xCfg;
@@ -1493,29 +1484,26 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgNew()
 {
     const OUString CFG_NODE_NEW("org.openoffice.Office.Paths/Paths");
 
-    // SAFE ->
-    ReadGuard aReadLock(m_aLock);
-    css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
-    css::uno::Reference< css::container::XNameAccess >     xCfg  = m_xCfgNew;
-    if (xCfg.is())
-       return xCfg;
-    aReadLock.unlock();
-    // <- SAFE
+    css::uno::Reference< css::container::XNameAccess > xCfg;
+    { // SAFE ->
+    osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
+    xCfg = m_xCfgNew;
+    } // <- SAFE
 
     if (! xCfg.is())
     {
         xCfg = css::uno::Reference< css::container::XNameAccess >(
                    ::comphelper::ConfigurationHelper::openConfig(
-                        xContext,
+                        m_xContext,
                         CFG_NODE_NEW,
                         ::comphelper::ConfigurationHelper::E_STANDARD),
                    css::uno::UNO_QUERY_THROW);
 
-        // SAFE ->
-        WriteGuard aWriteLock(m_aLock);
+        { // SAFE ->
+        osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
         m_xCfgNew = xCfg;
         m_xCfgNewListener = new WeakChangesListener(this);
-        aWriteLock.unlock();
+        }
 
         css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(xCfg, css::uno::UNO_QUERY_THROW);
         xBroadcaster->addChangesListener(m_xCfgNewListener);
@@ -1550,9 +1538,8 @@ com_sun_star_comp_framework_PathSettings_get_implementation(
     css::uno::XComponentContext *context,
     css::uno::Sequence<css::uno::Any> const &)
 {
-    css::uno::XInterface *inst = Singleton::get(context).instance.get();
-    inst->acquire();
-    return inst;
+    return cppu::acquire(static_cast<cppu::OWeakObject *>(
+                Singleton::get(context).instance.get()));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index fc94a5e..3c93163 100644
--- a/framework/util/fwk.component

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list