[Libreoffice-commits] core.git: 4 commits - cppuhelper/source include/sfx2 sax/source sfx2/Library_sfx.mk sfx2/source sfx2/util stoc/source svtools/source svx/source

Matúš Kukan matus.kukan at collabora.com
Tue Jan 14 23:52:32 PST 2014


 cppuhelper/source/servicemanager.cxx                  |   32 -
 cppuhelper/source/servicemanager.hxx                  |    2 
 include/sfx2/appuno.hxx                               |   56 --
 sax/source/expatwrap/sax_expat.cxx                    |    3 
 sax/source/expatwrap/saxwriter.cxx                    |    3 
 sax/source/fastparser/fastparser.cxx                  |    3 
 sfx2/Library_sfx.mk                                   |    2 
 sfx2/source/appl/appdispatchprovider.cxx              |  263 ++++++++++
 sfx2/source/appl/appuno.cxx                           |  460 ------------------
 sfx2/source/appl/macroloader.cxx                      |  349 +++++++++++++
 sfx2/source/inc/macroloader.hxx                       |   94 +++
 sfx2/source/notify/eventsupplier.cxx                  |    2 
 sfx2/util/sfx.component                               |    6 
 stoc/source/defaultregistry/defaultregistry.cxx       |    3 
 stoc/source/implementationregistration/implreg.cxx    |    4 
 stoc/source/loader/dllcomponentloader.cxx             |    4 
 stoc/source/security/access_controller.cxx            |    4 
 stoc/source/security/file_policy.cxx                  |    4 
 stoc/source/servicemanager/servicemanager.cxx         |   12 
 stoc/source/simpleregistry/simpleregistry.cxx         |    3 
 svtools/source/graphic/provider.cxx                   |    3 
 svtools/source/graphic/renderer.cxx                   |    3 
 svtools/source/hatchwindow/documentcloser.cxx         |    7 
 svtools/source/hatchwindow/hatchwindowfactory.cxx     |    3 
 svtools/source/uno/fpicker.cxx                        |   17 
 svx/source/customshapes/EnhancedCustomShapeEngine.cxx |   11 
 svx/source/sdr/primitive2d/primitivefactory2d.cxx     |    3 
 svx/source/sidebar/PanelFactory.cxx                   |    3 
 svx/source/tbxctrls/tbunocontroller.cxx               |   11 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx        |   83 ---
 svx/source/unodraw/UnoGraphicExporter.cxx             |    3 
 svx/source/unodraw/recoveryui.cxx                     |    4 
 svx/source/unodraw/unoctabl.cxx                       |    3 
 svx/source/unodraw/unoshcol.cxx                       |    3 
 svx/source/unogallery/unogalthemeprovider.cxx         |   11 
 svx/source/xml/xmlgrhlp.cxx                           |   22 
 36 files changed, 788 insertions(+), 711 deletions(-)

New commits:
commit 8c6342c25896e515869500f538370de336b123c7
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jan 14 22:12:11 2014 +0100

    sfx: Use constructor feature for SfxAppDispatchProvider.
    
    Change-Id: I2ca8abb284e8441a49c6e96a10cf76b5680e48e2

diff --git a/include/sfx2/appuno.hxx b/include/sfx2/appuno.hxx
index a022328..b14ee6a 100644
--- a/include/sfx2/appuno.hxx
+++ b/include/sfx2/appuno.hxx
@@ -46,27 +46,6 @@
 #include <tools/errcode.hxx>
 #include <sfx2/sfxuno.hxx>
 
-class SfxAppDispatchProvider : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XAppDispatchProvider,
-                                                               ::com::sun::star::lang::XServiceInfo,
-                                                               ::com::sun::star::lang::XInitialization >
-{
-    ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame;
-public:
-                    SfxAppDispatchProvider( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& )
-                    {}
-
-    SFX_DECL_XSERVICEINFO
-    virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL
-                    queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName,
-                    FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ;
-    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
-                    queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
-                        throw( ::com::sun::star::uno::RuntimeException ) ;
-    virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-    virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException);
-    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 ) throw (::com::sun::star::uno::RuntimeException);
-};
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index f6e39b3..bdd6812 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -88,6 +88,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/appl/appchild \
     sfx2/source/appl/appdata \
     sfx2/source/appl/appdde \
+	sfx2/source/appl/appdispatchprovider \
     sfx2/source/appl/appinit \
     sfx2/source/appl/appmain \
     sfx2/source/appl/appmisc \
diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx
new file mode 100644
index 0000000..7774582
--- /dev/null
+++ b/sfx2/source/appl/appdispatchprovider.cxx
@@ -0,0 +1,263 @@
+/* -*- 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 .
+ */
+
+#include <sal/config.h>
+
+#include <com/sun/star/frame/XAppDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+#include <basic/basmgr.hxx>
+#include <basic/sbuno.hxx>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <rtl/ref.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/msg.hxx>
+#include <sfx2/msgpool.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/sfxuno.hxx>
+#include <sfx2/unoctitm.hxx>
+#include <svl/intitem.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::uno;
+
+namespace {
+
+class SfxAppDispatchProvider : public ::cppu::WeakImplHelper2< css::frame::XAppDispatchProvider,
+                                                               css::lang::XServiceInfo>
+{
+    css::uno::WeakReference < css::frame::XFrame > m_xFrame;
+public:
+    SfxAppDispatchProvider( const css::uno::Sequence< css::uno::Any >& aArguments )
+        throw (css::uno::Exception, css::uno::RuntimeException);
+
+    virtual OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException);
+
+    virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException);
+
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException);
+
+    virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL queryDispatch(
+            const css::util::URL& aURL, const OUString& sTargetFrameName,
+            FrameSearchFlags eSearchFlags )
+        throw( css::uno::RuntimeException );
+
+    virtual css::uno::Sequence< css::uno::Reference < css::frame::XDispatch > > SAL_CALL queryDispatches(
+            const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescriptor )
+        throw( css::uno::RuntimeException );
+
+    virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups()
+        throw (css::uno::RuntimeException);
+
+    virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 )
+        throw (css::uno::RuntimeException);
+};
+
+SfxAppDispatchProvider::SfxAppDispatchProvider( const uno::Sequence<uno::Any>& aArguments )
+    throw (uno::Exception, uno::RuntimeException)
+{
+    Reference < XFrame > xFrame;
+    if ( aArguments.getLength() )
+    {
+        aArguments[0] >>= xFrame;
+        m_xFrame = xFrame;
+    }
+}
+
+OUString SAL_CALL SfxAppDispatchProvider::getImplementationName() throw( css::uno::RuntimeException )
+{
+    return OUString( "com.sun.star.comp.sfx2.AppDispatchProvider" );
+}
+
+sal_Bool SAL_CALL SfxAppDispatchProvider::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException )
+{
+    return cppu::supportsService(this, sServiceName);
+}
+
+css::uno::Sequence< OUString > SAL_CALL SfxAppDispatchProvider::getSupportedServiceNames() throw( css::uno::RuntimeException )
+{
+    css::uno::Sequence< OUString > seqServiceNames( 2 );
+    seqServiceNames.getArray()[0] = "com.sun.star.frame.DispatchProvider";
+    seqServiceNames.getArray()[1] = "com.sun.star.frame.AppDispatchProvider";
+    return seqServiceNames;
+}
+
+Reference < XDispatch > SAL_CALL SfxAppDispatchProvider::queryDispatch(
+    const util::URL& aURL,
+    const OUString& /*sTargetFrameName*/,
+    FrameSearchFlags /*eSearchFlags*/ ) throw( RuntimeException )
+{
+    sal_uInt16                  nId( 0 );
+    sal_Bool                bMasterCommand( sal_False );
+    Reference < XDispatch > xDisp;
+    const SfxSlot* pSlot = 0;
+    SfxDispatcher* pAppDisp = SFX_APP()->GetAppDispatcher_Impl();
+    if ( aURL.Protocol == "slot:" || aURL.Protocol == "commandId:" )
+    {
+        nId = (sal_uInt16) aURL.Path.toInt32();
+        SfxShell* pShell;
+        pAppDisp->GetShellAndSlot_Impl( nId, &pShell, &pSlot, sal_True, sal_True );
+    }
+    else if ( aURL.Protocol == ".uno:" )
+    {
+        // Support ".uno" commands. Map commands to slotid
+        bMasterCommand = SfxOfficeDispatch::IsMasterUnoCommand( aURL );
+        if ( bMasterCommand )
+            pSlot = pAppDisp->GetSlot( SfxOfficeDispatch::GetMasterUnoCommand( aURL ) );
+        else
+            pSlot = pAppDisp->GetSlot( aURL.Main );
+    }
+
+    if ( pSlot )
+    {
+        SfxOfficeDispatch* pDispatch = new SfxOfficeDispatch( pAppDisp, pSlot, aURL ) ;
+        pDispatch->SetFrame(m_xFrame);
+        pDispatch->SetMasterUnoCommand( bMasterCommand );
+        xDisp = pDispatch;
+    }
+
+    return xDisp;
+}
+
+Sequence< Reference < XDispatch > > SAL_CALL SfxAppDispatchProvider::queryDispatches( const Sequence < DispatchDescriptor >& seqDescriptor )
+throw( RuntimeException )
+{
+    sal_Int32 nCount = seqDescriptor.getLength();
+    uno::Sequence< uno::Reference < frame::XDispatch > > lDispatcher(nCount);
+    for( sal_Int32 i=0; i<nCount; ++i )
+        lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
+                                              seqDescriptor[i].FrameName,
+                                              seqDescriptor[i].SearchFlags );
+    return lDispatcher;
+}
+
+Sequence< sal_Int16 > SAL_CALL SfxAppDispatchProvider::getSupportedCommandGroups()
+throw (uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+
+    std::list< sal_Int16 > aGroupList;
+    SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
+
+    const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
+
+    // Gruppe anw"ahlen ( Gruppe 0 ist intern )
+    for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
+    {
+        pAppSlotPool->SeekGroup( i );
+        const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
+        while ( pSfxSlot )
+        {
+            if ( pSfxSlot->GetMode() & nMode )
+            {
+                sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
+                aGroupList.push_back( nCommandGroup );
+                break;
+            }
+            pSfxSlot = pAppSlotPool->NextSlot();
+        }
+    }
+
+    uno::Sequence< sal_Int16 > aSeq =
+        comphelper::containerToSequence< sal_Int16, std::list< sal_Int16 > >( aGroupList );
+
+    return aSeq;
+}
+
+Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
+throw (uno::RuntimeException)
+{
+    std::list< frame::DispatchInformation > aCmdList;
+
+    SolarMutexGuard aGuard;
+    SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
+
+    if ( pAppSlotPool )
+    {
+        const sal_uIntPtr   nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
+        OUString aCmdPrefix( ".uno:" );
+
+        // Gruppe anw"ahlen ( Gruppe 0 ist intern )
+        for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
+        {
+            pAppSlotPool->SeekGroup( i );
+            const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
+            if ( pSfxSlot )
+            {
+                sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
+                if ( nCommandGroup == nCmdGroup )
+                {
+                    while ( pSfxSlot )
+                    {
+                        if ( pSfxSlot->GetMode() & nMode )
+                        {
+                            frame::DispatchInformation aCmdInfo;
+                            OUStringBuffer aBuf( aCmdPrefix );
+                            aBuf.appendAscii( pSfxSlot->GetUnoName() );
+                            aCmdInfo.Command = aBuf.makeStringAndClear();
+                            aCmdInfo.GroupId = nCommandGroup;
+                            aCmdList.push_back( aCmdInfo );
+                        }
+                        pSfxSlot = pAppSlotPool->NextSlot();
+                    }
+                }
+            }
+        }
+    }
+
+    uno::Sequence< frame::DispatchInformation > aSeq =
+        comphelper::containerToSequence< frame::DispatchInformation, std::list< frame::DispatchInformation > >( aCmdList );
+
+    return aSeq;
+}
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation(
+    css::uno::XComponentContext *,
+    css::uno::Sequence<css::uno::Any> const &arguments)
+{
+    rtl::Reference<SfxAppDispatchProvider> x(new SfxAppDispatchProvider(arguments));
+    x->acquire();
+    return static_cast<cppu::OWeakObject *>(x.get());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 109cc2d..e5e4f50 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -21,8 +21,6 @@
 #pragma warning( disable : 4290 )
 #endif
 
-#include <sfx2/appuno.hxx>
-
 #include "backingcomp.hxx"
 #include "SfxDocumentMetaData.hxx"
 #include "appbaslib.hxx"
@@ -1705,186 +1703,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
     rArgs = aSequ;
 }
 
- /* XServiceInfo */
-OUString SAL_CALL SfxAppDispatchProvider::getImplementationName() throw( css::uno::RuntimeException )
-{
-    return impl_getStaticImplementationName();
-}
-
-/* XServiceInfo */
-sal_Bool SAL_CALL SfxAppDispatchProvider::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException )
-{
-    return cppu::supportsService(this, sServiceName);
-}
-
-/* XServiceInfo */
-css::uno::Sequence< OUString > SAL_CALL SfxAppDispatchProvider::getSupportedServiceNames() throw( css::uno::RuntimeException )
-{
-    return impl_getStaticSupportedServiceNames();
-}
-
-/* Helper for XServiceInfo */
-css::uno::Sequence< OUString > SfxAppDispatchProvider::impl_getStaticSupportedServiceNames()
-{
-    css::uno::Sequence< OUString > seqServiceNames( 2 );
-    seqServiceNames.getArray()[0] = "com.sun.star.frame.DispatchProvider";
-    seqServiceNames.getArray()[1] = "com.sun.star.frame.AppDispatchProvider";
-    return seqServiceNames;
-}
-
-/* Helper for XServiceInfo */
-OUString SfxAppDispatchProvider::impl_getStaticImplementationName()
-{
-    return OUString( "com.sun.star.comp.sfx2.AppDispatchProvider" );
-}
-
-/* Helper for registry */
-css::uno::Reference< css::uno::XInterface > SAL_CALL SfxAppDispatchProvider::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception )
-{
-    return css::uno::Reference< css::uno::XInterface >( *new SfxAppDispatchProvider( xServiceManager ) );
-}
-
-SFX_IMPL_SINGLEFACTORY( SfxAppDispatchProvider );
-
-void SAL_CALL SfxAppDispatchProvider::initialize( const uno::Sequence<uno::Any>& aArguments ) throw (uno::Exception, uno::RuntimeException)
-{
-    Reference < XFrame > xFrame;
-    if ( aArguments.getLength() )
-    {
-        aArguments[0] >>= xFrame;
-        m_xFrame = xFrame;
-    }
-}
-
-Reference < XDispatch > SAL_CALL SfxAppDispatchProvider::queryDispatch(
-    const util::URL& aURL,
-    const OUString& /*sTargetFrameName*/,
-    FrameSearchFlags /*eSearchFlags*/ ) throw( RuntimeException )
-{
-    sal_uInt16                  nId( 0 );
-    sal_Bool                bMasterCommand( sal_False );
-    Reference < XDispatch > xDisp;
-    const SfxSlot* pSlot = 0;
-    SfxDispatcher* pAppDisp = SFX_APP()->GetAppDispatcher_Impl();
-    if ( aURL.Protocol == "slot:" || aURL.Protocol == "commandId:" )
-    {
-        nId = (sal_uInt16) aURL.Path.toInt32();
-        SfxShell* pShell;
-        pAppDisp->GetShellAndSlot_Impl( nId, &pShell, &pSlot, sal_True, sal_True );
-    }
-    else if ( aURL.Protocol == ".uno:" )
-    {
-        // Support ".uno" commands. Map commands to slotid
-        bMasterCommand = SfxOfficeDispatch::IsMasterUnoCommand( aURL );
-        if ( bMasterCommand )
-            pSlot = pAppDisp->GetSlot( SfxOfficeDispatch::GetMasterUnoCommand( aURL ) );
-        else
-            pSlot = pAppDisp->GetSlot( aURL.Main );
-    }
-
-    if ( pSlot )
-    {
-        SfxOfficeDispatch* pDispatch = new SfxOfficeDispatch( pAppDisp, pSlot, aURL ) ;
-        pDispatch->SetFrame(m_xFrame);
-        pDispatch->SetMasterUnoCommand( bMasterCommand );
-        xDisp = pDispatch;
-    }
-
-    return xDisp;
-}
-
-Sequence< Reference < XDispatch > > SAL_CALL SfxAppDispatchProvider::queryDispatches( const Sequence < DispatchDescriptor >& seqDescriptor )
-throw( RuntimeException )
-{
-    sal_Int32 nCount = seqDescriptor.getLength();
-    uno::Sequence< uno::Reference < frame::XDispatch > > lDispatcher(nCount);
-    for( sal_Int32 i=0; i<nCount; ++i )
-        lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
-                                              seqDescriptor[i].FrameName,
-                                              seqDescriptor[i].SearchFlags );
-    return lDispatcher;
-}
-
-Sequence< sal_Int16 > SAL_CALL SfxAppDispatchProvider::getSupportedCommandGroups()
-throw (uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-
-    std::list< sal_Int16 > aGroupList;
-    SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
-
-    const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
-
-    // Gruppe anw"ahlen ( Gruppe 0 ist intern )
-    for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
-    {
-        pAppSlotPool->SeekGroup( i );
-        const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
-        while ( pSfxSlot )
-        {
-            if ( pSfxSlot->GetMode() & nMode )
-            {
-                sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
-                aGroupList.push_back( nCommandGroup );
-                break;
-            }
-            pSfxSlot = pAppSlotPool->NextSlot();
-        }
-    }
-
-    uno::Sequence< sal_Int16 > aSeq =
-        comphelper::containerToSequence< sal_Int16, std::list< sal_Int16 > >( aGroupList );
-
-    return aSeq;
-}
-
-Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
-throw (uno::RuntimeException)
-{
-    std::list< frame::DispatchInformation > aCmdList;
-
-    SolarMutexGuard aGuard;
-    SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
-
-    if ( pAppSlotPool )
-    {
-        const sal_uIntPtr   nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
-        OUString aCmdPrefix( ".uno:" );
-
-        // Gruppe anw"ahlen ( Gruppe 0 ist intern )
-        for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
-        {
-            pAppSlotPool->SeekGroup( i );
-            const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
-            if ( pSfxSlot )
-            {
-                sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
-                if ( nCommandGroup == nCmdGroup )
-                {
-                    while ( pSfxSlot )
-                    {
-                        if ( pSfxSlot->GetMode() & nMode )
-                        {
-                            frame::DispatchInformation aCmdInfo;
-                            OUStringBuffer aBuf( aCmdPrefix );
-                            aBuf.appendAscii( pSfxSlot->GetUnoName() );
-                            aCmdInfo.Command = aBuf.makeStringAndClear();
-                            aCmdInfo.GroupId = nCommandGroup;
-                            aCmdList.push_back( aCmdInfo );
-                        }
-                        pSfxSlot = pAppSlotPool->NextSlot();
-                    }
-                }
-            }
-        }
-    }
-
-    uno::Sequence< frame::DispatchInformation > aSeq =
-        comphelper::containerToSequence< frame::DispatchInformation, std::list< frame::DispatchInformation > >( aCmdList );
-
-    return aSeq;
-}
-
 #ifdef TEST_HANDLERS
 #include <cppuhelper/implbase2.hxx>
 
@@ -1985,7 +1803,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
         IF_NAME_CREATECOMPONENTFACTORY( BackingComp )
         IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
         IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
-        IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
         IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
         IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
         IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationScriptLibraryContainer )
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index 4d47644..2395b73 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -44,7 +44,8 @@
     <service name="com.sun.star.frame.SynchronousFrameLoader"/>
     <service name="com.sun.star.frame.OfficeFrameLoader"/>
   </implementation>
-  <implementation name="com.sun.star.comp.sfx2.AppDispatchProvider">
+  <implementation name="com.sun.star.comp.sfx2.AppDispatchProvider"
+      constructor="com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation">
     <service name="com.sun.star.frame.ProtocolHandler"/>
     <service name="com.sun.star.frame.AppDispatchProvider"/>
   </implementation>
commit 90a1232fb3a38bcf67ed2b1f195206041bca4174
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jan 14 15:25:10 2014 +0100

    sfx: Use constructor feature for SfxMacroLoader.
    
    Extract that class to its own source file.
    
    Change-Id: Idc192354b88d4489db22f6f6e9b7f5178f4030e4

diff --git a/include/sfx2/appuno.hxx b/include/sfx2/appuno.hxx
index a513dbc..a022328 100644
--- a/include/sfx2/appuno.hxx
+++ b/include/sfx2/appuno.hxx
@@ -46,41 +46,6 @@
 #include <tools/errcode.hxx>
 #include <sfx2/sfxuno.hxx>
 
-class SfxObjectShell;
-class SfxMacroLoader  :     public ::cppu::WeakImplHelper5<
-                                       css::frame::XDispatchProvider,
-                                       css::frame::XNotifyingDispatch,
-                                       css::frame::XSynchronousDispatch,
-                                       css::lang::XServiceInfo,
-                                       css::lang::XInitialization >
-{
-    ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame;
-
-    SfxObjectShell*             GetObjectShell_Impl();
-
-public:
-    // XInterface, XTypeProvider, XServiceInfo
-    SFX_DECL_XSERVICEINFO
-
-    SfxMacroLoader( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
-    {}
-
-    static ErrCode loadMacro( const OUString& aURL, ::com::sun::star::uno::Any& rRetval, SfxObjectShell* pDoc=NULL ) throw( ::com::sun::star::uno::RuntimeException );
-
-    virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL
-                    queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName,
-                    FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ;
-    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
-                    queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
-                        throw( ::com::sun::star::uno::RuntimeException ) ;
-    virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException);
-    virtual ::com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-};
-
 class SfxAppDispatchProvider : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XAppDispatchProvider,
                                                                ::com::sun::star::lang::XServiceInfo,
                                                                ::com::sun::star::lang::XInitialization >
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index b6e0962..f6e39b3 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -107,6 +107,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/appl/linkmgr2 \
     sfx2/source/appl/linksrc \
     sfx2/source/appl/lnkbase2 \
+	sfx2/source/appl/macroloader \
     sfx2/source/appl/module \
     sfx2/source/appl/newhelp \
     sfx2/source/appl/opengrf \
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 50f8ee6..109cc2d 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -115,8 +115,6 @@
 
 #include <boost/scoped_ptr.hpp>
 
-#define PROTOCOLHANDLER_SERVICENAME     "com.sun.star.frame.ProtocolHandler"
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::ucb;
 using namespace ::com::sun::star::uno;
@@ -1707,280 +1705,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
     rArgs = aSequ;
 }
 
-SFX_IMPL_XSERVICEINFO( SfxMacroLoader, PROTOCOLHANDLER_SERVICENAME, "com.sun.star.comp.sfx2.SfxMacroLoader" )
-SFX_IMPL_SINGLEFACTORY( SfxMacroLoader )
-
-void SAL_CALL SfxMacroLoader::initialize( const uno::Sequence<uno::Any>& aArguments ) throw (uno::Exception, uno::RuntimeException)
-{
-    Reference < XFrame > xFrame;
-    if ( aArguments.getLength() )
-    {
-        aArguments[0] >>= xFrame;
-        m_xFrame = xFrame;
-    }
-}
-
-SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
-{
-    SfxObjectShell* pDocShell = NULL;
-    Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
-    if ( xFrame.is() )
-    {
-        SfxFrame* pFrame=0;
-        for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
-        {
-            if ( pFrame->GetFrameInterface() == xFrame )
-                break;
-        }
-
-        if ( pFrame )
-            pDocShell = pFrame->GetCurrentDocument();
-    }
-
-    return pDocShell;
-}
-
-// -----------------------------------------------------------------------
-uno::Reference<frame::XDispatch> SAL_CALL SfxMacroLoader::queryDispatch(
-    const util::URL&   aURL            ,
-    const OUString&               /*sTargetFrameName*/,
-    sal_Int32                            /*nSearchFlags*/    ) throw( uno::RuntimeException )
-{
-    uno::Reference<frame::XDispatch> xDispatcher;
-    if(aURL.Complete.startsWith("macro:"))
-        xDispatcher = this;
-    return xDispatcher;
-}
-
-// -----------------------------------------------------------------------
-uno::Sequence< uno::Reference<frame::XDispatch> > SAL_CALL
-                SfxMacroLoader::queryDispatches( const uno::Sequence < frame::DispatchDescriptor >& seqDescriptor )
-                    throw( uno::RuntimeException )
-{
-    sal_Int32 nCount = seqDescriptor.getLength();
-    uno::Sequence< uno::Reference<frame::XDispatch> > lDispatcher(nCount);
-    for( sal_Int32 i=0; i<nCount; ++i )
-        lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
-                                              seqDescriptor[i].FrameName,
-                                              seqDescriptor[i].SearchFlags );
-    return lDispatcher;
-}
-
-// -----------------------------------------------------------------------
-void SAL_CALL SfxMacroLoader::dispatchWithNotification(
-    const util::URL& aURL, const uno::Sequence<beans::PropertyValue>& /*lArgs*/,
-    const uno::Reference<frame::XDispatchResultListener>& xListener )
-              throw (uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-
-    uno::Any aAny;
-    ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
-    if( xListener.is() )
-    {
-        // always call dispatchFinished(), because we didn't load a document but
-        // executed a macro instead!
-        frame::DispatchResultEvent aEvent;
-
-        aEvent.Source = static_cast< ::cppu::OWeakObject* >(this);
-        if( nErr == ERRCODE_NONE )
-            aEvent.State = frame::DispatchResultState::SUCCESS;
-        else
-            aEvent.State = frame::DispatchResultState::FAILURE;
-
-        xListener->dispatchFinished( aEvent ) ;
-    }
-}
-
-uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue(
-    const util::URL& aURL, const uno::Sequence<beans::PropertyValue>& )
-        throw (uno::RuntimeException)
-{
-    uno::Any aRet;
-    loadMacro( aURL.Complete, aRet, GetObjectShell_Impl() );
-    return aRet;
-}
-
-void SAL_CALL SfxMacroLoader::dispatch(
-    const util::URL& aURL, const uno::Sequence<beans::PropertyValue>& /*lArgs*/ )
-        throw (uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-
-    uno::Any aAny;
-    loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
-}
-
-void SAL_CALL SfxMacroLoader::addStatusListener(
-    const uno::Reference< frame::XStatusListener >& ,
-    const util::URL&                                                    )
-              throw (uno::RuntimeException)
-{
-    /* TODO
-            How we can handle different listener for further coming or currently running dispatch() jobs
-            without any inconsistency!
-     */
-}
-
-// -----------------------------------------------------------------------
-void SAL_CALL SfxMacroLoader::removeStatusListener(
-    const uno::Reference< frame::XStatusListener >&,
-    const util::URL&                                                  )
-        throw (uno::RuntimeException)
-{
-}
-
-ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh )
-    throw ( uno::RuntimeException )
-{
-#ifdef DISABLE_SCRIPTING
-    (void) rURL;
-    (void) rRetval;
-    (void) pSh;
-    return ERRCODE_BASIC_PROC_UNDEFINED;
-#else
-    SfxObjectShell* pCurrent = pSh;
-    if ( !pCurrent )
-        // all not full qualified names use the BASIC of the given or current document
-        pCurrent = SfxObjectShell::Current();
-
-    // 'macro:///lib.mod.proc(args)' => macro of App-BASIC
-    // 'macro://[docname|.]/lib.mod.proc(args)' => macro of current or qualified document
-    // 'macro://obj.method(args)' => direct API call, execute it via App-BASIC
-    OUString aMacro( rURL );
-    sal_Int32 nHashPos = aMacro.indexOf( '/', 8 );
-    sal_Int32 nArgsPos = aMacro.indexOf( '(' );
-    BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
-    BasicManager *pBasMgr = 0;
-    ErrCode nErr = ERRCODE_NONE;
-
-    // should a macro function be executed ( no direct API call)?
-    if ( -1 != nHashPos && ( -1 == nArgsPos || nHashPos < nArgsPos ) )
-    {
-        // find BasicManager
-        SfxObjectShell* pDoc = NULL;
-        OUString aBasMgrName( INetURLObject::decode(aMacro.copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
-        if ( aBasMgrName.isEmpty() )
-            pBasMgr = pAppMgr;
-        else if ( aBasMgrName == "." )
-        {
-            // current/actual document
-            pDoc = pCurrent;
-            if (pDoc)
-                pBasMgr = pDoc->GetBasicManager();
-        }
-        else
-        {
-            // full qualified name, find document by name
-            for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
-                    pObjSh && !pBasMgr;
-                    pObjSh = SfxObjectShell::GetNext(*pObjSh) )
-                if ( aBasMgrName == pObjSh->GetTitle(SFX_TITLE_APINAME) )
-                {
-                    pDoc = pObjSh;
-                    pBasMgr = pDoc->GetBasicManager();
-                }
-        }
-
-        if ( pBasMgr )
-        {
-            const bool bIsAppBasic = ( pBasMgr == pAppMgr );
-            const bool bIsDocBasic = ( pBasMgr != pAppMgr );
-
-            if ( pDoc )
-            {
-                // security check for macros from document basic if an SFX doc is given
-                if ( !pDoc->AdjustMacroMode( OUString() ) )
-                    // check forbids execution
-                    return ERRCODE_IO_ACCESSDENIED;
-            }
-            else if ( pDoc && pDoc->GetMedium() )
-            {
-                pDoc->AdjustMacroMode( OUString() );
-                SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
-                SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False);
-                if ( pUpdateDocItem && pMacroExecModeItem
-                  && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE
-                  && pMacroExecModeItem->GetValue() == document::MacroExecMode::NEVER_EXECUTE )
-                    return ERRCODE_IO_ACCESSDENIED;
-            }
-
-            // find BASIC method
-            OUString aQualifiedMethod( INetURLObject::decode(aMacro.copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
-            OUString aArgs;
-            if ( -1 != nArgsPos )
-            {
-                // remove arguments from macro name
-                aArgs = aQualifiedMethod.copy( nArgsPos - nHashPos - 1 );
-                aQualifiedMethod = aQualifiedMethod.copy( 0, nArgsPos - nHashPos - 1 );
-            }
-
-            if ( pBasMgr->HasMacro( aQualifiedMethod ) )
-            {
-                Any aOldThisComponent;
-                const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic;
-                const bool bSetGlobalThisComponent = ( pDoc != NULL ) && bIsAppBasic;
-                if ( bSetDocMacroMode )
-                {
-                    // mark document: it executes an own macro, so it's in a modal mode
-                    pDoc->SetMacroMode_Impl( sal_True );
-                }
-
-                if ( bSetGlobalThisComponent )
-                {
-                    // document is executed via AppBASIC, adjust ThisComponent variable
-                    aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pDoc->GetModel() ) );
-                }
-
-                // just to let the shell be alive
-                SfxObjectShellRef xKeepDocAlive = pDoc;
-
-                {
-                    // attempt to protect the document against the script tampering with its Undo Context
-                    ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
-                    if ( bIsDocBasic )
-                        pUndoGuard.reset( new ::framework::DocumentUndoGuard( pDoc->GetModel() ) );
-
-                    // execute the method
-                    SbxVariableRef retValRef = new SbxVariable;
-                    nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef );
-                    if ( nErr == ERRCODE_NONE )
-                        rRetval = sbxToUnoValue( retValRef );
-                }
-
-                if ( bSetGlobalThisComponent )
-                {
-                    pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
-                }
-
-                if ( bSetDocMacroMode )
-                {
-                    // remove flag for modal mode
-                    pDoc->SetMacroMode_Impl( sal_False );
-                }
-            }
-            else
-                nErr = ERRCODE_BASIC_PROC_UNDEFINED;
-        }
-        else
-            nErr = ERRCODE_IO_NOTEXISTS;
-    }
-    else
-    {
-        // direct API call on a specified object
-        OUStringBuffer aCall;
-        aCall.append('[').append(INetURLObject::decode(aMacro.copy(6), INET_HEX_ESCAPE,
-            INetURLObject::DECODE_WITH_CHARSET));
-        aCall.append(']');
-        pAppMgr->GetLib(0)->Execute(aCall.makeStringAndClear());
-        nErr = SbxBase::GetError();
-    }
-
-    SbxBase::ResetError();
-    return nErr;
-#endif
-}
-
  /* XServiceInfo */
 OUString SAL_CALL SfxAppDispatchProvider::getImplementationName() throw( css::uno::RuntimeException )
 {
@@ -2261,7 +1985,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
         IF_NAME_CREATECOMPONENTFACTORY( BackingComp )
         IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
         IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
-        IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
         IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
         IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
         IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx
new file mode 100644
index 0000000..8d59b84
--- /dev/null
+++ b/sfx2/source/appl/macroloader.cxx
@@ -0,0 +1,349 @@
+/* -*- 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 .
+ */
+
+#include <macroloader.hxx>
+
+#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <com/sun/star/document/MacroExecMode.hpp>
+#include <com/sun/star/frame/DispatchResultState.hpp>
+#include <basic/basmgr.hxx>
+#include <basic/sbuno.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <framework/documentundoguard.hxx>
+#include <rtl/ref.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/intitem.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+SfxMacroLoader::SfxMacroLoader( const css::uno::Sequence<css::uno::Any>& aArguments )
+    throw (css::uno::Exception, css::uno::RuntimeException)
+{
+    Reference < XFrame > xFrame;
+    if ( aArguments.getLength() )
+    {
+        aArguments[0] >>= xFrame;
+        m_xFrame = xFrame;
+    }
+}
+
+OUString SAL_CALL SfxMacroLoader::getImplementationName()
+    throw (css::uno::RuntimeException)
+{
+    return OUString("com.sun.star.comp.sfx2.SfxMacroLoader");
+}
+
+sal_Bool SAL_CALL SfxMacroLoader::supportsService(OUString const & ServiceName)
+    throw (css::uno::RuntimeException)
+{
+    return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence<OUString> SAL_CALL SfxMacroLoader::getSupportedServiceNames()
+    throw (css::uno::RuntimeException)
+{
+    css::uno::Sequence< OUString > aSeq(1);
+    aSeq[0] = OUString("com.sun.star.frame.ProtocolHandler");
+    return aSeq;
+}
+
+SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
+{
+    SfxObjectShell* pDocShell = NULL;
+    Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
+    if ( xFrame.is() )
+    {
+        SfxFrame* pFrame=0;
+        for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
+        {
+            if ( pFrame->GetFrameInterface() == xFrame )
+                break;
+        }
+
+        if ( pFrame )
+            pDocShell = pFrame->GetCurrentDocument();
+    }
+
+    return pDocShell;
+}
+
+// -----------------------------------------------------------------------
+uno::Reference<frame::XDispatch> SAL_CALL SfxMacroLoader::queryDispatch(
+    const util::URL&   aURL            ,
+    const OUString&               /*sTargetFrameName*/,
+    sal_Int32                            /*nSearchFlags*/    ) throw( uno::RuntimeException )
+{
+    uno::Reference<frame::XDispatch> xDispatcher;
+    if(aURL.Complete.startsWith("macro:"))
+        xDispatcher = this;
+    return xDispatcher;
+}
+
+// -----------------------------------------------------------------------
+uno::Sequence< uno::Reference<frame::XDispatch> > SAL_CALL
+                SfxMacroLoader::queryDispatches( const uno::Sequence < frame::DispatchDescriptor >& seqDescriptor )
+                    throw( uno::RuntimeException )
+{
+    sal_Int32 nCount = seqDescriptor.getLength();
+    uno::Sequence< uno::Reference<frame::XDispatch> > lDispatcher(nCount);
+    for( sal_Int32 i=0; i<nCount; ++i )
+        lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
+                                              seqDescriptor[i].FrameName,
+                                              seqDescriptor[i].SearchFlags );
+    return lDispatcher;
+}
+
+// -----------------------------------------------------------------------
+void SAL_CALL SfxMacroLoader::dispatchWithNotification(
+    const util::URL& aURL, const uno::Sequence<beans::PropertyValue>& /*lArgs*/,
+    const uno::Reference<frame::XDispatchResultListener>& xListener )
+              throw (uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+
+    uno::Any aAny;
+    ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
+    if( xListener.is() )
+    {
+        // always call dispatchFinished(), because we didn't load a document but
+        // executed a macro instead!
+        frame::DispatchResultEvent aEvent;
+
+        aEvent.Source = static_cast< ::cppu::OWeakObject* >(this);
+        if( nErr == ERRCODE_NONE )
+            aEvent.State = frame::DispatchResultState::SUCCESS;
+        else
+            aEvent.State = frame::DispatchResultState::FAILURE;
+
+        xListener->dispatchFinished( aEvent ) ;
+    }
+}
+
+uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue(
+    const util::URL& aURL, const uno::Sequence<beans::PropertyValue>& )
+        throw (uno::RuntimeException)
+{
+    uno::Any aRet;
+    loadMacro( aURL.Complete, aRet, GetObjectShell_Impl() );
+    return aRet;
+}
+
+void SAL_CALL SfxMacroLoader::dispatch(
+    const util::URL& aURL, const uno::Sequence<beans::PropertyValue>& /*lArgs*/ )
+        throw (uno::RuntimeException)
+{
+    SolarMutexGuard aGuard;
+
+    uno::Any aAny;
+    loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
+}
+
+void SAL_CALL SfxMacroLoader::addStatusListener(
+    const uno::Reference< frame::XStatusListener >& ,
+    const util::URL&                                                    )
+              throw (uno::RuntimeException)
+{
+    /* TODO
+            How we can handle different listener for further coming or currently running dispatch() jobs
+            without any inconsistency!
+     */
+}
+
+// -----------------------------------------------------------------------
+void SAL_CALL SfxMacroLoader::removeStatusListener(
+    const uno::Reference< frame::XStatusListener >&,
+    const util::URL&                                                  )
+        throw (uno::RuntimeException)
+{
+}
+
+ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh )
+    throw ( uno::RuntimeException )
+{
+#ifdef DISABLE_SCRIPTING
+    (void) rURL;
+    (void) rRetval;
+    (void) pSh;
+    return ERRCODE_BASIC_PROC_UNDEFINED;
+#else
+    SfxObjectShell* pCurrent = pSh;
+    if ( !pCurrent )
+        // all not full qualified names use the BASIC of the given or current document
+        pCurrent = SfxObjectShell::Current();
+
+    // 'macro:///lib.mod.proc(args)' => macro of App-BASIC
+    // 'macro://[docname|.]/lib.mod.proc(args)' => macro of current or qualified document
+    // 'macro://obj.method(args)' => direct API call, execute it via App-BASIC
+    OUString aMacro( rURL );
+    sal_Int32 nHashPos = aMacro.indexOf( '/', 8 );
+    sal_Int32 nArgsPos = aMacro.indexOf( '(' );
+    BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
+    BasicManager *pBasMgr = 0;
+    ErrCode nErr = ERRCODE_NONE;
+
+    // should a macro function be executed ( no direct API call)?
+    if ( -1 != nHashPos && ( -1 == nArgsPos || nHashPos < nArgsPos ) )
+    {
+        // find BasicManager
+        SfxObjectShell* pDoc = NULL;
+        OUString aBasMgrName( INetURLObject::decode(aMacro.copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
+        if ( aBasMgrName.isEmpty() )
+            pBasMgr = pAppMgr;
+        else if ( aBasMgrName == "." )
+        {
+            // current/actual document
+            pDoc = pCurrent;
+            if (pDoc)
+                pBasMgr = pDoc->GetBasicManager();
+        }
+        else
+        {
+            // full qualified name, find document by name
+            for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
+                    pObjSh && !pBasMgr;
+                    pObjSh = SfxObjectShell::GetNext(*pObjSh) )
+                if ( aBasMgrName == pObjSh->GetTitle(SFX_TITLE_APINAME) )
+                {
+                    pDoc = pObjSh;
+                    pBasMgr = pDoc->GetBasicManager();
+                }
+        }
+
+        if ( pBasMgr )
+        {
+            const bool bIsAppBasic = ( pBasMgr == pAppMgr );
+            const bool bIsDocBasic = ( pBasMgr != pAppMgr );
+
+            if ( pDoc )
+            {
+                // security check for macros from document basic if an SFX doc is given
+                if ( !pDoc->AdjustMacroMode( OUString() ) )
+                    // check forbids execution
+                    return ERRCODE_IO_ACCESSDENIED;
+            }
+            else if ( pDoc && pDoc->GetMedium() )
+            {
+                pDoc->AdjustMacroMode( OUString() );
+                SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+                SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False);
+                if ( pUpdateDocItem && pMacroExecModeItem
+                  && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE
+                  && pMacroExecModeItem->GetValue() == document::MacroExecMode::NEVER_EXECUTE )
+                    return ERRCODE_IO_ACCESSDENIED;
+            }
+
+            // find BASIC method
+            OUString aQualifiedMethod( INetURLObject::decode(aMacro.copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
+            OUString aArgs;
+            if ( -1 != nArgsPos )
+            {
+                // remove arguments from macro name
+                aArgs = aQualifiedMethod.copy( nArgsPos - nHashPos - 1 );
+                aQualifiedMethod = aQualifiedMethod.copy( 0, nArgsPos - nHashPos - 1 );
+            }
+
+            if ( pBasMgr->HasMacro( aQualifiedMethod ) )
+            {
+                Any aOldThisComponent;
+                const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic;
+                const bool bSetGlobalThisComponent = ( pDoc != NULL ) && bIsAppBasic;
+                if ( bSetDocMacroMode )
+                {
+                    // mark document: it executes an own macro, so it's in a modal mode
+                    pDoc->SetMacroMode_Impl( sal_True );
+                }
+
+                if ( bSetGlobalThisComponent )
+                {
+                    // document is executed via AppBASIC, adjust ThisComponent variable
+                    aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pDoc->GetModel() ) );
+                }
+
+                // just to let the shell be alive
+                SfxObjectShellRef xKeepDocAlive = pDoc;
+
+                {
+                    // attempt to protect the document against the script tampering with its Undo Context
+                    ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
+                    if ( bIsDocBasic )
+                        pUndoGuard.reset( new ::framework::DocumentUndoGuard( pDoc->GetModel() ) );
+
+                    // execute the method
+                    SbxVariableRef retValRef = new SbxVariable;
+                    nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef );
+                    if ( nErr == ERRCODE_NONE )
+                        rRetval = sbxToUnoValue( retValRef );
+                }
+
+                if ( bSetGlobalThisComponent )
+                {
+                    pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
+                }
+
+                if ( bSetDocMacroMode )
+                {
+                    // remove flag for modal mode
+                    pDoc->SetMacroMode_Impl( sal_False );
+                }
+            }
+            else
+                nErr = ERRCODE_BASIC_PROC_UNDEFINED;
+        }
+        else
+            nErr = ERRCODE_IO_NOTEXISTS;
+    }
+    else
+    {
+        // direct API call on a specified object
+        OUStringBuffer aCall;
+        aCall.append('[').append(INetURLObject::decode(aMacro.copy(6), INET_HEX_ESCAPE,
+            INetURLObject::DECODE_WITH_CHARSET));
+        aCall.append(']');
+        pAppMgr->GetLib(0)->Execute(aCall.makeStringAndClear());
+        nErr = SbxBase::GetError();
+    }
+
+    SbxBase::ResetError();
+    return nErr;
+#endif
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_sfx2_SfxMacroLoader_get_implementation(
+    css::uno::XComponentContext *,
+    css::uno::Sequence<css::uno::Any> const &arguments)
+{
+    rtl::Reference<SfxMacroLoader> x(new SfxMacroLoader(arguments));
+    x->acquire();
+    return static_cast<cppu::OWeakObject *>(x.get());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/inc/macroloader.hxx b/sfx2/source/inc/macroloader.hxx
new file mode 100644
index 0000000..8e632e5
--- /dev/null
+++ b/sfx2/source/inc/macroloader.hxx
@@ -0,0 +1,94 @@
+/* -*- 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_SFXMACROLOADER_HXX
+#define INCLUDED_SFXMACROLOADER_HXX
+
+#include <sal/config.h>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/frame/XSynchronousDispatch.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+#include <cppuhelper/implbase4.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <tools/errcode.hxx>
+
+class SfxObjectShell;
+
+class SfxMacroLoader : public cppu::WeakImplHelper4<
+                                       css::frame::XDispatchProvider,
+                                       css::frame::XNotifyingDispatch,
+                                       css::frame::XSynchronousDispatch,
+                                       css::lang::XServiceInfo>
+{
+    css::uno::WeakReference < css::frame::XFrame > m_xFrame;
+    SfxObjectShell* GetObjectShell_Impl();
+
+public:
+    SfxMacroLoader(const css::uno::Sequence< css::uno::Any >& aArguments )
+        throw (css::uno::Exception, css::uno::RuntimeException);
+
+    virtual OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException);
+
+    virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException);
+
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException);
+
+    static ErrCode loadMacro( const OUString& aURL, css::uno::Any& rRetval, SfxObjectShell* pDoc=NULL ) throw( css::uno::RuntimeException );
+
+    virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL queryDispatch(
+            const css::util::URL& aURL, const OUString& sTargetFrameName,
+            FrameSearchFlags eSearchFlags )
+        throw( css::uno::RuntimeException );
+
+    virtual css::uno::Sequence< css::uno::Reference < css::frame::XDispatch > > SAL_CALL queryDispatches(
+            const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescriptor )
+        throw( css::uno::RuntimeException );
+
+    virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArgs, const css::uno::Reference< css::frame::XDispatchResultListener >& Listener )
+        throw (css::uno::RuntimeException);
+
+    virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArgs )
+        throw (css::uno::RuntimeException);
+
+    virtual css::uno::Any SAL_CALL dispatchWithReturnValue( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArgs )
+        throw (css::uno::RuntimeException);
+
+    virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL )
+        throw (css::uno::RuntimeException);
+
+    virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL )
+        throw (css::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 3a12c9e..418f35d 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -28,7 +28,6 @@
 #include <tools/urlobj.hxx>
 #include <tools/diagnose_ex.h>
 #include <svl/macitem.hxx>
-#include <sfx2/appuno.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/sfxbasemodel.hxx>
 #include <sfx2/evntconf.hxx>
@@ -47,6 +46,7 @@
 #include <sfx2/docfile.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/frame.hxx>
+#include <macroloader.hxx>
 
 //--------------------------------------------------------------------------------------------------------
 
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index c5f2515..4d47644 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -66,7 +66,8 @@
   <implementation name="com.sun.star.comp.sfx2.PluginObject">
     <service name="com.sun.star.frame.SpecialEmbeddedObject"/>
   </implementation>
-  <implementation name="com.sun.star.comp.sfx2.SfxMacroLoader">
+  <implementation name="com.sun.star.comp.sfx2.SfxMacroLoader"
+      constructor="com_sun_star_comp_sfx2_SfxMacroLoader_get_implementation">
     <service name="com.sun.star.frame.ProtocolHandler"/>
   </implementation>
 </component>
commit 4337a0664f4fb73f9e1be74f2a632847871da402
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jan 14 15:41:32 2014 +0100

    Use const& arguments parameter for ctor functions.
    
    Change-Id: I19ce8bd1a23123ac9a62a7fc95cd54fea5315221

diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index bebeaa8..d7ab48a 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -588,7 +588,7 @@ ImplementationWrapper::createInstanceWithContext(
     return constructor_ != 0
         ? css::uno::Reference<css::uno::XInterface>(
             (*constructor_)(
-                Context.get(), css::uno::Sequence<css::uno::Any>().get()),
+                Context.get(), css::uno::Sequence<css::uno::Any>()),
             SAL_NO_ACQUIRE)
         : factory1_.is()
         ? factory1_->createInstanceWithContext(Context)
@@ -604,7 +604,7 @@ ImplementationWrapper::createInstanceWithArgumentsAndContext(
     loadImplementation(Context);
     if (constructor_ != 0) {
         css::uno::Reference<css::uno::XInterface> xRet(
-            (*constructor_)(Context.get(), Arguments.get()), SAL_NO_ACQUIRE);
+            (*constructor_)(Context.get(), Arguments), SAL_NO_ACQUIRE);
         css::uno::Reference<css::lang::XInitialization> xInit(
                 xRet, css::uno::UNO_QUERY);
         if (xInit.is())
@@ -909,7 +909,7 @@ cppuhelper::ServiceManager::createInstanceWithContext(
     if (impl->constructor != 0) {
         return css::uno::Reference<css::uno::XInterface>(
             (*impl->constructor)(
-                Context.get(), css::uno::Sequence<css::uno::Any>().get()),
+                Context.get(), css::uno::Sequence<css::uno::Any>()),
             SAL_NO_ACQUIRE);
     } else if (impl->factory1.is()) {
         return impl->factory1->createInstanceWithContext(Context);
@@ -936,7 +936,7 @@ cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(
     }
     if (impl->constructor != 0) {
         css::uno::Reference<css::uno::XInterface> xRet(
-            (*impl->constructor)(Context.get(), Arguments.get()),
+            (*impl->constructor)(Context.get(), Arguments),
             SAL_NO_ACQUIRE);
         css::uno::Reference<css::lang::XInitialization> xInit(
                 xRet, css::uno::UNO_QUERY);
diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx
index d76b93f..74f2f4a 100644
--- a/cppuhelper/source/servicemanager.hxx
+++ b/cppuhelper/source/servicemanager.hxx
@@ -44,7 +44,7 @@ namespace cppuhelper {
 extern "C" {
 
 typedef css::uno::XInterface * SAL_CALL ImplementationConstructorFn(
-    css::uno::XComponentContext *, uno_Sequence *);
+    css::uno::XComponentContext *, css::uno::Sequence<css::uno::Any> const &);
 
 }
 
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 981d68e..19f2f3a 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -1022,9 +1022,8 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis )
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_extensions_xml_sax_ParserExpat(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new SaxExpatParser));
     x->acquire();
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 6279640..38975bf 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -1375,9 +1375,8 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_extensions_xml_sax_Writer(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new SAXWriter));
     x->acquire();
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 8c8ab1b..99a8e93 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1429,9 +1429,8 @@ bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_extensions_xml_sax_FastParser(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FastSaxParser));
     x->acquire();
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index 285e379..977a797 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -1352,9 +1352,8 @@ void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUSt
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_stoc_NestedRegistry(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new NestedRegistryImpl));
     x->acquire();
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index bceef4b..afc6236 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -1818,9 +1818,9 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_stoc_ImplementationRegistration(
-    css::uno::XComponentContext * context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(
             new ImplementationRegistration(context)));
diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx
index d4ab87f..bdd90c4 100644
--- a/stoc/source/loader/dllcomponentloader.cxx
+++ b/stoc/source/loader/dllcomponentloader.cxx
@@ -166,9 +166,9 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_stoc_DLLComponentLoader(
-    css::uno::XComponentContext * context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new DllComponentLoader(context)));
     x->acquire();
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index 07e3b58..0be6b2c 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -981,9 +981,9 @@ Sequence< OUString > AccessController::getSupportedServiceNames()
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_security_comp_stoc_AccessController(
-    css::uno::XComponentContext * context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new AccessController(context)));
     x->acquire();
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 7d0ad08..8dc3a47 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -543,9 +543,9 @@ Sequence< OUString > FilePolicy::getSupportedServiceNames()
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_security_comp_stoc_FilePolicy(
-    css::uno::XComponentContext * context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FilePolicy(context)));
     x->acquire();
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 9c96a78..5dfaba6 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -1672,9 +1672,9 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName)
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_stoc_OServiceManager(
-    css::uno::XComponentContext * context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new OServiceManager(context)));
     x->acquire();
@@ -1683,9 +1683,9 @@ com_sun_star_comp_stoc_OServiceManager(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_stoc_ORegistryServiceManager(
-    css::uno::XComponentContext * context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new ORegistryServiceManager(context)));
     x->acquire();
@@ -1694,9 +1694,9 @@ com_sun_star_comp_stoc_ORegistryServiceManager(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_stoc_OServiceManagerWrapper(
-    css::uno::XComponentContext * context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new OServiceManagerWrapper(context)));
     x->acquire();
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index d1a761b..fac51ce 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -1126,9 +1126,8 @@ void SimpleRegistry::mergeKey(
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_stoc_SimpleRegistry(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new SimpleRegistry));
     x->acquire();
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 2bc31a6..95dda1a 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -874,9 +874,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_graphic_GraphicProvider_get_implementation(
         SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-        uno_Sequence * arguments)
+        css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
             static_cast<cppu::OWeakObject *>(new GraphicProvider));
     x->acquire();
diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx
index 38b87bb..2b3fc31 100644
--- a/svtools/source/graphic/renderer.cxx
+++ b/svtools/source/graphic/renderer.cxx
@@ -294,9 +294,8 @@ void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphi
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_graphic_GraphicRendererVCL_get_implementation(
         SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-        uno_Sequence * arguments)
+        css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
             static_cast<cppu::OWeakObject *>(new GraphicRendererVCL));
     x->acquire();
diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx
index 66c0ed5..d7f9e8c 100644
--- a/svtools/source/hatchwindow/documentcloser.cxx
+++ b/svtools/source/hatchwindow/documentcloser.cxx
@@ -279,9 +279,8 @@ uno::Sequence< OUString > SAL_CALL ODocumentCloser::getSupportedServiceNames()
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_embed_DocumentCloser_get_implementation(
         SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-        uno_Sequence * arguments)
+        css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     rtl::Reference<ODocumentCloser> x(new ODocumentCloser);
     x->acquire();
     return static_cast<cppu::OWeakObject *>(x.get());
diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx
index ea87180..17c0584 100644
--- a/svtools/source/hatchwindow/hatchwindowfactory.cxx
+++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx
@@ -86,9 +86,8 @@ uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_embed_HatchWindowFactory_get_implementation(
         SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-        uno_Sequence * arguments)
+        css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
             static_cast<cppu::OWeakObject *>(new OHatchWindowFactory));
     x->acquire();
diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx
index 89089d3..1eccb57 100644
--- a/svtools/source/uno/fpicker.cxx
+++ b/svtools/source/uno/fpicker.cxx
@@ -55,9 +55,9 @@ static OUString FilePicker_getSystemPickerServiceName()
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_svt_FilePicker_get_implementation(
-        css::uno::XComponentContext *context, uno_Sequence * arguments)
+        css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     Reference< css::uno::XInterface > xResult;
     Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
     if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
@@ -115,9 +115,9 @@ static OUString FolderPicker_getSystemPickerServiceName()
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_svt_FolderPicker_get_implementation(
-        css::uno::XComponentContext *context, uno_Sequence * arguments)
+        css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     Reference< css::uno::XInterface > xResult;
     Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
     if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 8cbd2f2..c6a5feb 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -491,9 +491,8 @@ Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShap
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new EnhancedCustomShapeEngine));
     x->acquire();
diff --git a/svx/source/sdr/primitive2d/primitivefactory2d.cxx b/svx/source/sdr/primitive2d/primitivefactory2d.cxx
index fad0b75..7f35df7 100644
--- a/svx/source/sdr/primitive2d/primitivefactory2d.cxx
+++ b/svx/source/sdr/primitive2d/primitivefactory2d.cxx
@@ -90,9 +90,8 @@ Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXDrawPage(
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_graphic_PrimitiveFactory2D_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new PrimitiveFactory2D));
     x->acquire();
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index 9942faf..34638f8 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -207,9 +207,8 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 org_apache_openoffice_comp_svx_sidebar_PanelFactory_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new PanelFactory));
     x->acquire();
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index 0d560e9..b29e954 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -441,9 +441,8 @@ void FontHeightToolBoxControl::dispatchCommand(
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_FontHeightToolBoxController_implementation_getFactory(
     css::uno::XComponentContext *rxContext,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FontHeightToolBoxControl(rxContext)));
     x->acquire();
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 8534bb3..63ba432 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -1051,9 +1051,9 @@ void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_FindTextToolboxController_implementation_getFactory(
-    css::uno::XComponentContext *context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FindTextToolbarController(context)));
     x->acquire();
@@ -1062,9 +1062,9 @@ com_sun_star_svx_FindTextToolboxController_implementation_getFactory(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_ExitFindbarToolboxController_implementation_getFactory(
-    css::uno::XComponentContext *context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new ExitSearchToolboxController(context)));
     x->acquire();
@@ -1073,9 +1073,9 @@ com_sun_star_svx_ExitFindbarToolboxController_implementation_getFactory(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_UpSearchToolboxController_implementation_getFactory(
-    css::uno::XComponentContext *context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(
                 context, UpDownSearchToolboxController::UP )));
@@ -1085,9 +1085,9 @@ com_sun_star_svx_UpSearchToolboxController_implementation_getFactory(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_DownSearchToolboxController_implementation_getFactory(
-    css::uno::XComponentContext *context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(
                 context, UpDownSearchToolboxController::DOWN )));
@@ -1097,9 +1097,9 @@ com_sun_star_svx_DownSearchToolboxController_implementation_getFactory(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_MatchCaseToolboxController_implementation_getFactory(
-    css::uno::XComponentContext *context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new MatchCaseToolboxController(context)));
     x->acquire();
@@ -1108,9 +1108,9 @@ com_sun_star_svx_MatchCaseToolboxController_implementation_getFactory(
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_FindAllToolboxController_implementation_getFactory(
-    css::uno::XComponentContext *context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FindAllToolboxController(context)));
     x->acquire();
@@ -1120,9 +1120,8 @@ com_sun_star_svx_FindAllToolboxController_implementation_getFactory(
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_svx_Impl_FindbarDispatcher_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FindbarDispatcher));
     x->acquire();
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 8220620..93b2802 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -1283,9 +1283,8 @@ Graphic SvxGetGraphicForShape( SdrObject& rShape, bool bVector )
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_Draw_GraphicExporter_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new GraphicExporter));
     x->acquire();
diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx
index a6e344a..3867626 100644
--- a/svx/source/unodraw/recoveryui.cxx
+++ b/svx/source/unodraw/recoveryui.cxx
@@ -421,9 +421,9 @@ void RecoveryUI::impl_showAllRecoveredDocs()
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_svx_RecoveryUI_implementation_getFactory(
-    css::uno::XComponentContext *context, uno_Sequence * arguments)
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new RecoveryUI(context)));
     x->acquire();
diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
index 925265b..f30e6ae 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -193,9 +193,8 @@ sal_Bool SAL_CALL SvxUnoColorTable::hasElements()
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_drawing_SvxUnoColorTable_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new SvxUnoColorTable));
     x->acquire();
diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx
index 553723f..0337734 100644
--- a/svx/source/unodraw/unoshcol.cxx
+++ b/svx/source/unodraw/unoshcol.cxx
@@ -271,9 +271,8 @@ uno::Sequence< OUString > SAL_CALL SvxShapeCollection::getSupportedServiceNames(
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_drawing_SvxShapeCollection_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new SvxShapeCollection));
     x->acquire();
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
index 78c4628..39e50256 100644
--- a/svx/source/unogallery/unogalthemeprovider.cxx
+++ b/svx/source/unogallery/unogalthemeprovider.cxx
@@ -251,9 +251,8 @@ void SAL_CALL GalleryThemeProvider::removeByName( const OUString& rName )
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_gallery_GalleryThemeProvider_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new GalleryThemeProvider));
     x->acquire();
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 4c70597..75bd29e 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -1053,9 +1053,8 @@ Sequence< OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServic
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_Svx_GraphicImportHelper_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(
                 GRAPHICHELPER_MODE_READ)));
@@ -1078,9 +1077,8 @@ com_sun_star_comp_Svx_GraphicImportHelper_implementation_getFactory(
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_Svx_GraphicExportHelper_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
-    uno_Sequence * arguments)
+    css::uno::Sequence<css::uno::Any> const &)
 {
-    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(
                 GRAPHICHELPER_MODE_WRITE )));
commit bdeb57c23973f3ef79020847b2fe39f312cf3c0b
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jan 14 09:09:57 2014 +0100

    Initialize constructor based implementations in one place.
    
    Change-Id: I324f25bb5ec7d792c3e015815f2a11b08f519764

diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 4044c1c..bebeaa8 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -20,6 +20,7 @@
 #include "com/sun/star/container/ElementExistException.hpp"
 #include "com/sun/star/container/XEnumeration.hpp"
 #include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
 #include "com/sun/star/lang/XServiceInfo.hpp"
 #include "com/sun/star/lang/XSingleComponentFactory.hpp"
 #include "com/sun/star/lang/XSingleServiceFactory.hpp"
@@ -601,12 +602,18 @@ ImplementationWrapper::createInstanceWithArgumentsAndContext(
     throw (css::uno::Exception, css::uno::RuntimeException)
 {
     loadImplementation(Context);
-    return constructor_ != 0
-        ? css::uno::Reference<css::uno::XInterface>(
-            (*constructor_)(Context.get(), Arguments.get()), SAL_NO_ACQUIRE)
-        : factory1_.is()
-        ? factory1_->createInstanceWithArgumentsAndContext(Arguments, Context)
-        : factory2_->createInstanceWithArguments(Arguments);
+    if (constructor_ != 0) {
+        css::uno::Reference<css::uno::XInterface> xRet(
+            (*constructor_)(Context.get(), Arguments.get()), SAL_NO_ACQUIRE);
+        css::uno::Reference<css::lang::XInitialization> xInit(
+                xRet, css::uno::UNO_QUERY);
+        if (xInit.is())
+            xInit->initialize(Arguments);
+        return xRet;
+    } else
+        return factory1_.is()
+            ? factory1_->createInstanceWithArgumentsAndContext(Arguments, Context)
+            : factory2_->createInstanceWithArguments(Arguments);
 }
 
 css::uno::Reference< css::uno::XInterface >
@@ -928,9 +935,14 @@ cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(
         return css::uno::Reference< css::uno::XInterface >();
     }
     if (impl->constructor != 0) {
-        return css::uno::Reference<css::uno::XInterface>(
+        css::uno::Reference<css::uno::XInterface> xRet(
             (*impl->constructor)(Context.get(), Arguments.get()),
             SAL_NO_ACQUIRE);
+        css::uno::Reference<css::lang::XInitialization> xInit(
+                xRet, css::uno::UNO_QUERY);
+        if (xInit.is())
+            xInit->initialize(Arguments);
+        return xRet;
     } else if (impl->factory1.is()) {
         return impl->factory1->createInstanceWithArgumentsAndContext(
             Arguments, Context);
diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx
index 1e198da..66c0ed5 100644
--- a/svtools/source/hatchwindow/documentcloser.cxx
+++ b/svtools/source/hatchwindow/documentcloser.cxx
@@ -281,12 +281,8 @@ com_sun_star_comp_embed_DocumentCloser_get_implementation(
         SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
         uno_Sequence * arguments)
 {
-    assert(arguments != 0 );
+    assert(arguments != 0); (void) arguments;
     rtl::Reference<ODocumentCloser> x(new ODocumentCloser);
-    css::uno::Sequence<css::uno::Any> aArgs(
-            reinterpret_cast<css::uno::Any *>(arguments->elements),
-            arguments->nElements);
-    x->initialize(aArgs);
     x->acquire();
     return static_cast<cppu::OWeakObject *>(x.get());
 }
diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx
index 9ff1f6d..89089d3 100644
--- a/svtools/source/uno/fpicker.cxx
+++ b/svtools/source/uno/fpicker.cxx
@@ -20,7 +20,6 @@
 #include "sal/types.h"
 #include "rtl/ustring.hxx"
 
-#include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 
 #include "svtools/miscopt.hxx"
@@ -58,7 +57,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_svt_FilePicker_get_implementation(
         css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     Reference< css::uno::XInterface > xResult;
     Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
     if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
@@ -93,14 +92,6 @@ com_sun_star_comp_svt_FilePicker_get_implementation(
         // Add to FilePicker history.
         svt::addFilePicker (xResult);
     }
-    css::uno::Reference< css::lang::XInitialization > xx(xResult, css::uno::UNO_QUERY);
-    if (xx.is() && arguments->nElements)
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     xResult->acquire();
     return xResult.get();
 }
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index b9bc674..8cbd2f2 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -493,18 +493,10 @@ com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
     uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new EnhancedCustomShapeEngine));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index 56dc41e..0d560e9 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -443,18 +443,10 @@ com_sun_star_svx_FontHeightToolBoxController_implementation_getFactory(
     css::uno::XComponentContext *rxContext,
     uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FontHeightToolBoxControl(rxContext)));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index aecea5c..8534bb3 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -1053,18 +1053,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_FindTextToolboxController_implementation_getFactory(
     css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FindTextToolbarController(context)));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
@@ -1072,18 +1064,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_ExitFindbarToolboxController_implementation_getFactory(
     css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new ExitSearchToolboxController(context)));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
@@ -1091,19 +1075,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_UpSearchToolboxController_implementation_getFactory(
     css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(
                 context, UpDownSearchToolboxController::UP )));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
@@ -1111,19 +1087,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_DownSearchToolboxController_implementation_getFactory(
     css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(
                 context, UpDownSearchToolboxController::DOWN )));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
@@ -1131,18 +1099,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_MatchCaseToolboxController_implementation_getFactory(
     css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new MatchCaseToolboxController(context)));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
@@ -1150,18 +1110,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_svx_FindAllToolboxController_implementation_getFactory(
     css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FindAllToolboxController(context)));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
@@ -1170,18 +1122,10 @@ com_sun_star_comp_svx_Impl_FindbarDispatcher_implementation_getFactory(
     SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
     uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0); (void) arguments;
     css::uno::Reference<css::uno::XInterface> x(
         static_cast<cppu::OWeakObject *>(new FindbarDispatcher));
     x->acquire();
-    css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     return x.get();
 }
 
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
index 71b0736..78c4628 100644
--- a/svx/source/unogallery/unogalthemeprovider.cxx
+++ b/svx/source/unogallery/unogalthemeprovider.cxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list