diff options
67 files changed, 325 insertions, 234 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 0eb30aa0e9c1..3d81b8b68dc6 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -704,9 +704,14 @@ cppuhelper::ServiceManager::Data::Implementation::createInstance( if (info->singletons.empty()) { assert(!singletonRequest); if (constructor != 0) { - return css::uno::Reference<css::uno::XInterface>( - (*constructor)( - context.get(), css::uno::Sequence<css::uno::Any>())); + cppu::constructor_InitializationFunc init = NULL; + css::uno::Reference<css::uno::XInterface> inst( + (*constructor)(context.get(), init)); + // call the initialization on the acquired instance + if (init) + (static_cast<OWeakObject*>(inst.get())->*init)( + css::uno::Sequence<css::uno::Any>()); + return inst; } if (factory1.is()) { return factory1->createInstanceWithContext(context); @@ -722,9 +727,13 @@ cppuhelper::ServiceManager::Data::Implementation::createInstance( return singleton; } if (constructor != 0) { + cppu::constructor_InitializationFunc init = NULL; singleton.set( - (*constructor)( - context.get(), css::uno::Sequence<css::uno::Any>())); + (*constructor)(context.get(), init)); + // call the initialization on the acquired instance + if (init) + (static_cast<OWeakObject*>(singleton.get())->*init)( + css::uno::Sequence<css::uno::Any>()); } else if (factory1.is()) { singleton = factory1->createInstanceWithContext(context); } else { @@ -744,17 +753,24 @@ cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments( if (info->singletons.empty()) { assert(!singletonRequest); if (constructor != 0) { - //HACK: The constructor will either observe arguments and return - // inst that does not implement XInitialization (or null), or ignore - // arguments and return inst that implements XInitialization; this - // should be removed again once XInitialization-based - // implementations have become rare: + cppu::constructor_InitializationFunc init = NULL; css::uno::Reference<css::uno::XInterface> inst( - (*constructor)(context.get(), arguments)); - css::uno::Reference<css::lang::XInitialization> init( - inst, css::uno::UNO_QUERY); - if (init.is()) { - init->initialize(arguments); + (*constructor)(context.get(), init)); + // call the initialization on the acquired instance + if (init) + (static_cast<OWeakObject*>(inst.get())->*init)( + arguments); + else { + // The service can implement XInitialization, and it is just + // too easy to do a mistake during conversion to the + // constructor-based initialization, and forget to add the + // above callback that would call it; so allow initialization + // through XInitialization still too. + css::uno::Reference<css::lang::XInitialization> xinit( + inst, css::uno::UNO_QUERY); + if (xinit.is()) { + xinit->initialize(arguments); + } } return inst; } @@ -777,12 +793,23 @@ cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments( return singleton; } if (constructor != 0) { - //HACK: see above - singleton.set((*constructor)(context.get(), arguments)); - css::uno::Reference<css::lang::XInitialization> init( - singleton, css::uno::UNO_QUERY); - if (init.is()) { - init->initialize(arguments); + cppu::constructor_InitializationFunc init = NULL; + singleton.set((*constructor)(context.get(), init)); + // call the initialization on the acquired instance + if (init) + (static_cast<OWeakObject*>(singleton.get())->*init)( + arguments); + else { + // The service can implement XInitialization, and it is just + // too easy to do a mistake during conversion to the + // constructor-based initialization, and forget to add the + // above callback that would call it; so allow initialization + // through XInitialization still too. + css::uno::Reference<css::lang::XInitialization> xinit( + singleton, css::uno::UNO_QUERY); + if (xinit.is()) { + xinit->initialize(arguments); + } } } else if (factory1.is()) { singleton = factory1->createInstanceWithArgumentsAndContext( diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx index a9522a564e5e..2d29f58b48ca 100644 --- a/cppuhelper/source/servicemanager.hxx +++ b/cppuhelper/source/servicemanager.hxx @@ -33,6 +33,7 @@ #include "osl/mutex.hxx" #include "registry/registry.hxx" #include "rtl/ustring.hxx" +#include "cppuhelper/weak.hxx" namespace com { namespace sun { namespace star { namespace lang { class XSingleComponentFactory; @@ -44,7 +45,7 @@ namespace cppuhelper { extern "C" { typedef css::uno::XInterface * SAL_CALL ImplementationConstructorFn( - css::uno::XComponentContext *, css::uno::Sequence<css::uno::Any> const &); + css::uno::XComponentContext *, cppu::constructor_InitializationFunc &); } diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index be029dd46667..39c32b3584ec 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -68,8 +68,10 @@ public: reference to an uno service manager, which is used internaly. */ DocumentAcceleratorConfiguration( - const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Sequence< css::uno::Any >& lArguments); + const css::uno::Reference< css::uno::XComponentContext >& xContext); + + void SAL_CALL constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); virtual ~DocumentAcceleratorConfiguration(); @@ -112,10 +114,13 @@ private: //----------------------------------------------- DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration( - const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Sequence< css::uno::Any >& lArguments) + const css::uno::Reference< css::uno::XComponentContext >& xContext) : DocumentAcceleratorConfiguration_BASE(xContext) { +} + +void DocumentAcceleratorConfiguration::constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lArguments) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) +{ WriteGuard aWriteLock(m_aLock); css::uno::Reference<css::embed::XStorage> xRoot; @@ -224,11 +229,12 @@ void DocumentAcceleratorConfiguration::impl_ts_clearCache() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &arguments) + cppu::constructor_InitializationFunc &init_func) { - rtl::Reference<DocumentAcceleratorConfiguration> x(new DocumentAcceleratorConfiguration(context, arguments)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&DocumentAcceleratorConfiguration::constructorInit); + + return static_cast<cppu::OWeakObject *>(new DocumentAcceleratorConfiguration(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx index 261aa178ba55..697faaff35c7 100644 --- a/framework/source/accelerators/globalacceleratorconfiguration.cxx +++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx @@ -81,7 +81,9 @@ public: // XComponent virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - void impl_ts_fillCache(); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); private: @@ -96,7 +98,7 @@ GlobalAcceleratorConfiguration::GlobalAcceleratorConfiguration(const css::uno::R { } -void GlobalAcceleratorConfiguration::impl_ts_fillCache() +void GlobalAcceleratorConfiguration::constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { /** read all data into the cache. */ @@ -148,12 +150,12 @@ void SAL_CALL GlobalAcceleratorConfiguration::dispose() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &init_func) { - rtl::Reference<GlobalAcceleratorConfiguration> x(new GlobalAcceleratorConfiguration(context)); - x->impl_ts_fillCache(); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&GlobalAcceleratorConfiguration::constructorInit); + + return static_cast<cppu::OWeakObject *>(new GlobalAcceleratorConfiguration(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx index f19b91c291f2..731161615564 100644 --- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx +++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx @@ -68,8 +68,7 @@ public: reference to an uno service manager, which is used internaly. */ ModuleAcceleratorConfiguration( - const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Sequence< css::uno::Any >& lArguments); + const css::uno::Reference< css::uno::XComponentContext >& xContext); /** TODO */ virtual ~ModuleAcceleratorConfiguration(); @@ -97,8 +96,9 @@ public: // XComponent virtual void SAL_CALL dispose() throw (css::uno::RuntimeException); - /** read all data into the cache. */ - void impl_ts_fillCache(); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); private: /** helper to listen for configuration changes without ownership cycle problems */ @@ -106,10 +106,17 @@ private: }; ModuleAcceleratorConfiguration::ModuleAcceleratorConfiguration( - const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Sequence< css::uno::Any >& lArguments) + const css::uno::Reference< css::uno::XComponentContext >& xContext) : ModuleAcceleratorConfiguration_BASE(xContext) { +} + +ModuleAcceleratorConfiguration::~ModuleAcceleratorConfiguration() +{ +} + +void ModuleAcceleratorConfiguration::constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lArguments) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) +{ WriteGuard aWriteLock(m_aLock); OUString sModule; @@ -129,14 +136,7 @@ ModuleAcceleratorConfiguration::ModuleAcceleratorConfiguration( static_cast< ::cppu::OWeakObject* >(this)); aWriteLock.unlock(); -} -ModuleAcceleratorConfiguration::~ModuleAcceleratorConfiguration() -{ -} - -void ModuleAcceleratorConfiguration::impl_ts_fillCache() -{ // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); m_sModuleCFG = m_sModule; @@ -192,12 +192,12 @@ void SAL_CALL ModuleAcceleratorConfiguration::dispose() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &arguments) + cppu::constructor_InitializationFunc &init_func) { - rtl::Reference<ModuleAcceleratorConfiguration> x(new ModuleAcceleratorConfiguration(context, arguments)); - x->impl_ts_fillCache(); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&ModuleAcceleratorConfiguration::constructorInit); + + return static_cast<cppu::OWeakObject *>(new ModuleAcceleratorConfiguration(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index a81aacfe9440..17d2f7c785bc 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -606,11 +606,9 @@ void StatusIndicatorFactory::impl_stopWakeUpThread() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<framework::StatusIndicatorFactory> x(new framework::StatusIndicatorFactory(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new framework::StatusIndicatorFactory(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index 226bc95985dc..9da2198a5662 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -534,11 +534,9 @@ void SAL_CALL JobDispatch::removeStatusListener( /*IN*/ const css::uno::Referenc extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_jobs_JobDispatch_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<JobDispatch> x(new JobDispatch(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new JobDispatch(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index 05a0cfd3a9ac..8844ef4dd954 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -37,12 +37,11 @@ #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/document/XEventListener.hpp> #include <com/sun/star/frame/XModuleManager2.hpp> -#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase4.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/configpaths.hxx> #include <rtl/ref.hxx> @@ -60,10 +59,9 @@ namespace { liftime of such jobs too. */ class JobExecutor : private ThreadHelpBase - , public ::cppu::WeakImplHelper5< + , public ::cppu::WeakImplHelper4< css::lang::XServiceInfo , css::task::XJobExecutor - , css::lang::XInitialization , css::container::XContainerListener // => lang.XEventListener , css::document::XEventListener > { @@ -112,8 +110,8 @@ public: // task.XJobExecutor virtual void SAL_CALL trigger( const OUString& sEvent ) throw(css::uno::RuntimeException); - // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); // document.XEventListener virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException); @@ -144,7 +142,7 @@ JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< css::uno::XComponent { } -void JobExecutor::initialize(const css::uno::Sequence< css::uno::Any >& ) throw (css::uno::Exception, css::uno::RuntimeException) +void JobExecutor::constructorInit(const css::uno::Sequence< css::uno::Any >& ) throw (css::uno::Exception, css::uno::RuntimeException) { // read the list of all currently registered events inside configuration. // e.g. "/org.openoffice.Office.Jobs/Events/<event name>" @@ -406,8 +404,11 @@ void SAL_CALL JobExecutor::disposing( const css::lang::EventObject& aEvent ) thr extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_JobExecutor_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &init_func) { + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&JobExecutor::constructorInit); + return static_cast<cppu::OWeakObject *>(new JobExecutor(context)); } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index c3710c0c7b32..9f052a30d58e 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -3225,11 +3225,9 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySet extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_LayoutManager_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<framework::LayoutManager> x(new framework::LayoutManager(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new framework::LayoutManager(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index badab99a40f3..0cd13705122b 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -65,7 +65,6 @@ #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> -#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -77,7 +76,7 @@ #include <comphelper/configurationhelper.hxx> #include <cppuhelper/exc_hlp.hxx> -#include <cppuhelper/implbase6.hxx> +#include <cppuhelper/implbase5.hxx> #include <cppuhelper/propshlp.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/mediadescriptor.hxx> @@ -189,9 +188,8 @@ public: of documents - including features of an EmergencySave in case a GPF occurs. */ -typedef ::cppu::WeakImplHelper6< +typedef ::cppu::WeakImplHelper5< css::lang::XServiceInfo, - css::lang::XInitialization, css::frame::XDispatch, css::document::XEventListener, // => css.lang.XEventListener css::util::XChangesListener, // => css.lang.XEventListener @@ -542,12 +540,12 @@ public: { OWeakObject::release(); } virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) throw ( css::uno::RuntimeException ); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); + // XTypeProvider virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException); - // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); - //--------------------------------------- // css.frame.XDispatch virtual void SAL_CALL dispatch(const css::util::URL& aURL , @@ -1420,7 +1418,7 @@ AutoRecovery::AutoRecovery(const css::uno::Reference< css::uno::XComponentContex { } -void AutoRecovery::initialize(const css::uno::Sequence< css::uno::Any >& ) throw (css::uno::Exception, css::uno::RuntimeException) +void AutoRecovery::constructorInit(const css::uno::Sequence< css::uno::Any >& ) throw (css::uno::Exception, css::uno::RuntimeException) { // read configuration to know if autosave/recovery is on/off etcpp... implts_readConfig(); @@ -4636,8 +4634,11 @@ void AutoRecovery::st_impl_removeLockFile() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_AutoRecovery_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &init_func) { + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&AutoRecovery::constructorInit); + return static_cast<cppu::OWeakObject *>(new AutoRecovery(context)); } diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 590d4116df25..230707cea74b 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -153,7 +153,8 @@ public: Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext ); virtual ~Frame(); - void onCreate(); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); FWK_DECLARE_XINTERFACE FWK_DECLARE_XTYPEPROVIDER @@ -584,7 +585,7 @@ Frame::Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext { } -void Frame::onCreate() +void Frame::constructorInit(const css::uno::Sequence< css::uno::Any >&) throw (css::uno::Exception, css::uno::RuntimeException) { css::uno::Reference< css::uno::XInterface > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY_THROW); @@ -3583,12 +3584,12 @@ sal_Bool Frame::implcp_disposing( const css::lang::EventObject& aEvent ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_Frame_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &init_func) { - rtl::Reference<Frame> x(new Frame(context)); - x->onCreate(); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&Frame::constructorInit); + + return static_cast<cppu::OWeakObject *>(new Frame(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index 1815c269879f..c2c5d9e71a0d 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -492,11 +492,9 @@ OUString ModuleManager::implts_identify(const css::uno::Reference< css::uno::XIn extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_ModuleManager_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<ModuleManager> x(new ModuleManager(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new ModuleManager(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index 3aae564236df..f108e8d54cc4 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -96,7 +96,8 @@ public: TabWindowService(); virtual ~TabWindowService(); - void onCreate(); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); FWK_DECLARE_XINTERFACE FWK_DECLARE_XTYPEPROVIDER @@ -228,7 +229,7 @@ TabWindowService::TabWindowService() { } -void TabWindowService::onCreate() +void TabWindowService::constructorInit(const css::uno::Sequence< css::uno::Any >&) throw (css::uno::Exception, css::uno::RuntimeException) { impl_initializePropInfo(); m_aTransactionManager.setWorkingMode( E_WORK ); @@ -583,12 +584,12 @@ FwkTabWindow* TabWindowService::mem_TabWin () extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_TabWindowService_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &init_func) { - rtl::Reference<TabWindowService> x(new TabWindowService); - x->onCreate(); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&TabWindowService::constructorInit); + + return static_cast<cppu::OWeakObject *>(new TabWindowService); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx index d8aaacf321e1..cf5e24720a9a 100644 --- a/framework/source/services/urltransformer.cxx +++ b/framework/source/services/urltransformer.cxx @@ -337,11 +337,9 @@ OUString SAL_CALL URLTransformer::getPresentation( const css::util::URL& aURL, extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_URLTransformer_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<URLTransformer> x(new URLTransformer()); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new URLTransformer()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx index 4d08b66a59cc..3ceecda48c37 100644 --- a/framework/source/uiconfiguration/imagemanager.cxx +++ b/framework/source/uiconfiguration/imagemanager.cxx @@ -210,11 +210,9 @@ sal_Bool SAL_CALL ImageManager::isReadOnly() throw (::com::sun::star::uno::Runti extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_ImageManager_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<framework::ImageManager> x(new framework::ImageManager(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new framework::ImageManager(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 6d8104cbffef..69c3963c4731 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -72,8 +72,10 @@ class ModuleUIConfigurationManager : private ThreadHelpBase, // Struct for rig { public: ModuleUIConfigurationManager( - const css::uno::Reference< css::uno::XComponentContext >& xServiceManager, - const css::uno::Sequence< css::uno::Any >& aArguments ); + const css::uno::Reference< css::uno::XComponentContext >& xServiceManager); + + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); virtual ~ModuleUIConfigurationManager(); @@ -845,8 +847,7 @@ void ModuleUIConfigurationManager::impl_Initialize() } ModuleUIConfigurationManager::ModuleUIConfigurationManager( - const Reference< XComponentContext >& xContext, - const Sequence< Any >& aArguments ) + const Reference< XComponentContext >& xContext) : ThreadHelpBase( &Application::GetSolarMutex() ) , m_xDefaultConfigStorage( 0 ) , m_xUserConfigStorage( 0 ) @@ -867,7 +868,10 @@ ModuleUIConfigurationManager::ModuleUIConfigurationManager( // The following code depends on this! m_aUIElements[LAYER_DEFAULT].resize( ::com::sun::star::ui::UIElementType::COUNT ); m_aUIElements[LAYER_USERDEFINED].resize( ::com::sun::star::ui::UIElementType::COUNT ); +} +void ModuleUIConfigurationManager::constructorInit(const css::uno::Sequence< css::uno::Any >& aArguments) throw (css::uno::Exception, css::uno::RuntimeException) +{ ResetableGuard aLock( m_aLock ); if( aArguments.getLength() == 2 && (aArguments[0] >>= m_aModuleShortName) && (aArguments[1] >>= m_aModuleIdentifier)) @@ -1711,11 +1715,12 @@ void ModuleUIConfigurationManager::implts_notifyContainerListener( const ui::Con extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &arguments) + cppu::constructor_InitializationFunc &init_func) { - rtl::Reference<ModuleUIConfigurationManager> x(new ModuleUIConfigurationManager(context, arguments)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&ModuleUIConfigurationManager::constructorInit); + + return static_cast<cppu::OWeakObject *>(new ModuleUIConfigurationManager(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index faa529ee9493..7f79fb04ec29 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -1430,11 +1430,9 @@ void UIConfigurationManager::implts_notifyContainerListener( const Configuration extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_UIConfigurationManager_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<UIConfigurationManager> x(new UIConfigurationManager(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new UIConfigurationManager(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index a3846d46bcf9..2a187e28205c 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -461,11 +461,9 @@ void SAL_CALL ControlMenuController::initialize( const Sequence< Any >& aArgumen extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_ControlMenuController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<ControlMenuController> x(new ControlMenuController(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new ControlMenuController(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index f51ce75f0aa3..a463ce2a063e 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -366,11 +366,9 @@ throw ( RuntimeException ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_LangSelectionStatusbarController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<LangSelectionStatusbarController> x(new LangSelectionStatusbarController(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new LangSelectionStatusbarController(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index de84009e1f67..ea19f0bf5ae4 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -176,11 +176,9 @@ void ObjectMenuController::impl_select(const Reference< XDispatch >& _xDispatch, extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_ObjectMenuController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<ObjectMenuController> x(new ObjectMenuController(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new ObjectMenuController(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index a4b3ab2573c4..0301a9504d60 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -580,29 +580,23 @@ void NewToolbarController::setItemImage( const OUString &rCommand ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL org_apache_openoffice_comp_framework_WizardsToolbarController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<WizardsToolbarController> x(new WizardsToolbarController(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new WizardsToolbarController(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL org_apache_openoffice_comp_framework_OpenToolbarController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<OpenToolbarController> x(new OpenToolbarController(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new OpenToolbarController(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL org_apache_openoffice_comp_framework_NewToolbarController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<NewToolbarController> x(new NewToolbarController(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new NewToolbarController(context)); } diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 91340111778d..84753c18dbe5 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -424,11 +424,9 @@ IMPL_STATIC_LINK_NOINSTANCE( RecentFilesMenuController, ExecuteHdl_Impl, LoadRec extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_RecentFilesMenuController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<RecentFilesMenuController> x(new RecentFilesMenuController(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new RecentFilesMenuController(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uifactory/addonstoolboxfactory.cxx b/framework/source/uifactory/addonstoolboxfactory.cxx index 992dfb630bc9..8d965e5ffe24 100644 --- a/framework/source/uifactory/addonstoolboxfactory.cxx +++ b/framework/source/uifactory/addonstoolboxfactory.cxx @@ -232,11 +232,9 @@ throw ( ::com::sun::star::container::NoSuchElementException, extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_framework_AddonsToolBarFactory_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<AddonsToolBoxFactory> x(new AddonsToolBoxFactory(context)); - x->acquire(); - return static_cast<cppu::OWeakObject *>(x.get()); + return static_cast<cppu::OWeakObject *>(new AddonsToolBoxFactory(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/weak.hxx b/include/cppuhelper/weak.hxx index e74fac929fc8..0fefafc81ba9 100644 --- a/include/cppuhelper/weak.hxx +++ b/include/cppuhelper/weak.hxx @@ -156,9 +156,24 @@ public: { return this; } }; +/** Function pointer declaration. + + 2nd stage initialization using the service implementation pointer. + + Some services have to be initialized after the object has been acquire()'d - so the + implementation has to provide function that does this 2nd stage initialization. + + Typically, this happens in framework/. + + @param aArguments + Arguments the instance will use for its own initialization. +*/ + +typedef void (SAL_CALL OWeakObject::* constructor_InitializationFunc)( + const css::uno::Sequence< css::uno::Any >& aArguments); + } #endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 7d5e36cabf80..3f2adc5b7975 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -1023,7 +1023,7 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SaxExpatParser); } diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 73cb50ff74fe..24819526eeaf 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -1373,7 +1373,7 @@ 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_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SAXWriter); } diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 152c22da376a..a97c786c1299 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -1429,7 +1429,7 @@ 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_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new FastSaxParser); } diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index df0c237c906d..39e768a8a065 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -27,6 +27,7 @@ #include <basic/basmgr.hxx> #include <tools/diagnose_ex.h> #include <comphelper/processfactory.hxx> +#include <cppuhelper/weak.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -158,7 +159,7 @@ SfxBasicManagerHolder::LegacyPsswdBinaryLimitExceeded( Sequence< OUString >& sMo extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_ApplicationDialogLibraryContainer_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { SFX_APP()->GetBasicManager(); return SFX_APP()->GetDialogContainer(); @@ -170,7 +171,7 @@ com_sun_star_comp_sfx2_ApplicationDialogLibraryContainer_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_ApplicationScriptLibraryContainer_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { SFX_APP()->GetBasicManager(); return SFX_APP()->GetBasicContainer(); diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx index c2b88af54dd4..6aa197c60df0 100644 --- a/sfx2/source/appl/appdispatchprovider.cxx +++ b/sfx2/source/appl/appdispatchprovider.cxx @@ -62,7 +62,11 @@ class SfxAppDispatchProvider : public ::cppu::WeakImplHelper2< css::frame::XAppD { css::uno::WeakReference < css::frame::XFrame > m_xFrame; public: - SfxAppDispatchProvider( const css::uno::Sequence< css::uno::Any >& aArguments ) + SfxAppDispatchProvider() + throw (css::uno::Exception, css::uno::RuntimeException); + + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit(const css::uno::Sequence< css::uno::Any >&) throw (css::uno::Exception, css::uno::RuntimeException); virtual OUString SAL_CALL getImplementationName() @@ -90,9 +94,13 @@ public: throw (css::uno::RuntimeException); }; -SfxAppDispatchProvider::SfxAppDispatchProvider( const uno::Sequence<uno::Any>& aArguments ) +SfxAppDispatchProvider::SfxAppDispatchProvider() throw (uno::Exception, uno::RuntimeException) { +} + +void SfxAppDispatchProvider::constructorInit(const css::uno::Sequence< css::uno::Any >& aArguments) throw (css::uno::Exception, css::uno::RuntimeException) +{ Reference < XFrame > xFrame; if ( aArguments.getLength() ) { @@ -253,9 +261,12 @@ throw (uno::RuntimeException) 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) + cppu::constructor_InitializationFunc &init_func) { - return static_cast<cppu::OWeakObject *>(new SfxAppDispatchProvider(arguments)); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&SfxAppDispatchProvider::constructorInit); + + return static_cast<cppu::OWeakObject *>(new SfxAppDispatchProvider()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx index ff5886148a27..d485d68ad610 100644 --- a/sfx2/source/appl/macroloader.cxx +++ b/sfx2/source/appl/macroloader.cxx @@ -44,9 +44,13 @@ 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 ) +SfxMacroLoader::SfxMacroLoader() throw (css::uno::Exception, css::uno::RuntimeException) { +} + +void SAL_CALL SfxMacroLoader::constructorInit(const css::uno::Sequence< css::uno::Any >& aArguments) throw (css::uno::Exception, css::uno::RuntimeException) +{ Reference < XFrame > xFrame; if ( aArguments.getLength() ) { @@ -339,9 +343,12 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::An 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) + cppu::constructor_InitializationFunc &init_func) { - return static_cast<cppu::OWeakObject *>(new SfxMacroLoader(arguments)); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&SfxMacroLoader::constructorInit); + + return static_cast<cppu::OWeakObject *>(new SfxMacroLoader()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index a7e2e1b67cd8..20b64490b2c5 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -974,7 +974,7 @@ void SAL_CALL ShutdownIcon::setFastPropertyValue( ::sal_Int32 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_desktop_QuickstartWrapper_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new ShutdownIcon(context)); } diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index 6c654e77a7fe..4ff41b70f431 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -176,7 +176,7 @@ uno::Sequence< OUString > SAL_CALL OPackageStructureCreator::getSupportedService extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_embed_PackageStructureCreator_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new OPackageStructureCreator()); } diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx index cadf4c3e41ae..eee5d333f863 100644 --- a/sfx2/source/dialog/backingcomp.cxx +++ b/sfx2/source/dialog/backingcomp.cxx @@ -825,7 +825,7 @@ void SAL_CALL BackingComp::removeStatusListener( const css::uno::Reference< css: extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_BackingComp_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new BackingComp(context)); } diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 90bb305a80d3..d3fd3b079131 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -2317,7 +2317,7 @@ void SfxDocumentMetaData::createUserDefined() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL CompatWriterDocPropsImpl_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new CompatWriterDocPropsImpl(context)); } @@ -2325,7 +2325,7 @@ CompatWriterDocPropsImpl_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL SfxDocumentMetaData_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SfxDocumentMetaData(context)); } diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 54d2bf95409f..364564a30a24 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2898,7 +2898,7 @@ void SfxURLRelocator_Impl::makeAbsoluteURL( OUString & rURL ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_DocumentTemplates_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SfxDocTplService(context)); } diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 504b2891c795..23436518bab6 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -63,11 +63,14 @@ class IFrameObject : public ::cppu::WeakImplHelper6 < SfxFrameDescriptor maFrmDescr; public: - IFrameObject( const css::uno::Reference < css::uno::XComponentContext>& rxContext, - const css::uno::Sequence< css::uno::Any >& aArguments ) + IFrameObject( const css::uno::Reference < css::uno::XComponentContext>& rxContext) throw (css::uno::Exception, css::uno::RuntimeException); ~IFrameObject(); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit(const css::uno::Sequence< css::uno::Any >& aArguments) + throw (css::uno::Exception, css::uno::RuntimeException); + virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException) { @@ -158,12 +161,15 @@ const SfxItemPropertyMapEntry* lcl_GetIFramePropertyMap_Impl() return aIFramePropertyMap_Impl; } -IFrameObject::IFrameObject( const uno::Reference < uno::XComponentContext >& rxContext, - const uno::Sequence< uno::Any >& aArguments ) +IFrameObject::IFrameObject( const uno::Reference < uno::XComponentContext >& rxContext ) throw ( uno::Exception, uno::RuntimeException ) : mxContext( rxContext ) , maPropMap( lcl_GetIFramePropertyMap_Impl() ) { +} + +void SAL_CALL IFrameObject::constructorInit(const css::uno::Sequence< css::uno::Any >& aArguments) throw (css::uno::Exception, css::uno::RuntimeException) +{ if ( aArguments.getLength() ) aArguments[0] >>= mxObj; } @@ -430,9 +436,12 @@ void SAL_CALL IFrameObject::setTitle( const OUString& ) throw (::com::sun::star: extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_IFrameObject_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &arguments) + cppu::constructor_InitializationFunc &init_func) { - return static_cast<cppu::OWeakObject *>(new IFrameObject(context, arguments)); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&IFrameObject::constructorInit); + + return static_cast<cppu::OWeakObject *>(new IFrameObject(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/ownsubfilterservice.cxx b/sfx2/source/doc/ownsubfilterservice.cxx index 139f7dac587d..61d000cb48ee 100644 --- a/sfx2/source/doc/ownsubfilterservice.cxx +++ b/sfx2/source/doc/ownsubfilterservice.cxx @@ -41,8 +41,13 @@ class OwnSubFilterService : public cppu::WeakImplHelper2 < document::XFilter SfxObjectShell* m_pObjectShell; public: - OwnSubFilterService( const uno::Sequence< uno::Any >& aArguments ) + OwnSubFilterService() throw (uno::Exception, uno::RuntimeException); + + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ~OwnSubFilterService(); // XFilter @@ -55,10 +60,14 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (uno::RuntimeException); }; -OwnSubFilterService::OwnSubFilterService( const uno::Sequence< uno::Any >& aArguments ) +OwnSubFilterService::OwnSubFilterService() throw (uno::Exception, uno::RuntimeException) : m_pObjectShell( NULL ) { +} + +void OwnSubFilterService::constructorInit( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException) +{ if ( aArguments.getLength() != 2 ) throw lang::IllegalArgumentException(); @@ -124,9 +133,12 @@ uno::Sequence< OUString > SAL_CALL OwnSubFilterService::getSupportedServiceNames extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_document_OwnSubFilter_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &arguments) + cppu::constructor_InitializationFunc &init_func) { - return static_cast<cppu::OWeakObject *>(new OwnSubFilterService(arguments)); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&OwnSubFilterService::constructorInit); + + return static_cast<cppu::OWeakObject *>(new OwnSubFilterService); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx index b79219624646..60eddc1cf2a4 100644 --- a/sfx2/source/doc/plugin.cxx +++ b/sfx2/source/doc/plugin.cxx @@ -309,7 +309,7 @@ void SAL_CALL PluginObject::removeVetoableChangeListener(const OUString&, const extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_PluginObject_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new PluginObject()); } diff --git a/sfx2/source/inc/macroloader.hxx b/sfx2/source/inc/macroloader.hxx index 8e632e5024e8..7dac814da03d 100644 --- a/sfx2/source/inc/macroloader.hxx +++ b/sfx2/source/inc/macroloader.hxx @@ -50,9 +50,13 @@ class SfxMacroLoader : public cppu::WeakImplHelper4< SfxObjectShell* GetObjectShell_Impl(); public: - SfxMacroLoader(const css::uno::Sequence< css::uno::Any >& aArguments ) + SfxMacroLoader() throw (css::uno::Exception, css::uno::RuntimeException); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException); diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx index 5c8605282b52..16b7118645bd 100644 --- a/sfx2/source/notify/globalevents.cxx +++ b/sfx2/source/notify/globalevents.cxx @@ -547,11 +547,9 @@ struct Singleton: extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { - rtl::Reference<css::uno::XInterface> x(Singleton::get(context).instance); - x->acquire(); - return x.get(); + return Singleton::get(context).instance.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index daab66b976e2..c7c0ff6fb824 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -776,7 +776,7 @@ Sequence< OUString > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() th extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_office_FrameLoader_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SfxFrameLoader_Impl(context)); } diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx index a5446f2d30f0..2f09bf5309a2 100644 --- a/stoc/source/defaultregistry/defaultregistry.cxx +++ b/stoc/source/defaultregistry/defaultregistry.cxx @@ -1353,7 +1353,7 @@ 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_get_implementation( SAL_UNUSED_PARAMETER css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new NestedRegistryImpl); } diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index e594dbda1a06..8218c2ebdbcb 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -1819,7 +1819,7 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_ImplementationRegistration_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new ImplementationRegistration(context)); } diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx index 4b90cdc133f0..e52519cb67ad 100644 --- a/stoc/source/loader/dllcomponentloader.cxx +++ b/stoc/source/loader/dllcomponentloader.cxx @@ -168,7 +168,7 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_DLLComponentLoader_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new DllComponentLoader(context)); } diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index e8c8cb8f5fc7..3fbf8f5c7db6 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -982,7 +982,7 @@ Sequence< OUString > AccessController::getSupportedServiceNames() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_security_comp_stoc_AccessController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new AccessController(context)); } diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 6766aff2f8f2..2864b6da6f14 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -543,7 +543,7 @@ Sequence< OUString > FilePolicy::getSupportedServiceNames() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_security_comp_stoc_FilePolicy_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new FilePolicy(context)); } diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 3e7cb3d1e051..00763d5649d3 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -1674,7 +1674,7 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_OServiceManager_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new OServiceManager(context)); } @@ -1682,7 +1682,7 @@ com_sun_star_comp_stoc_OServiceManager_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_ORegistryServiceManager_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new ORegistryServiceManager(context)); } @@ -1690,7 +1690,7 @@ com_sun_star_comp_stoc_ORegistryServiceManager_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new OServiceManagerWrapper(context)); } diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index bddc67be127d..4927efe24ffa 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -1126,7 +1126,7 @@ void SimpleRegistry::mergeKey( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_SimpleRegistry_get_implementation( SAL_UNUSED_PARAMETER css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SimpleRegistry); } diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter/SvFilterOptionsDialog.cxx index 8311d83d53cb..431d84c4b880 100644 --- a/svtools/source/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter/SvFilterOptionsDialog.cxx @@ -301,8 +301,8 @@ void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComp extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svtools_SvFilterOptionsDialog_get_implementation( - css::uno::XComponentContext * context, - css::uno::Sequence<css::uno::Any> const &) + css::uno::XComponentContext * context, + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SvFilterOptionsDialog(context)); } diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx index 5ba8db405b0a..6b526f918146 100644 --- a/svtools/source/graphic/graphicunofactory.cxx +++ b/svtools/source/graphic/graphicunofactory.cxx @@ -39,7 +39,9 @@ class GObjectImpl : public GObjectAccess_BASE ::osl::Mutex m_aMutex; std::auto_ptr< GraphicObject > mpGObject; public: - GObjectImpl( uno::Sequence< uno::Any > const & args ) throw (uno::RuntimeException); + GObjectImpl() throw (uno::RuntimeException); + + void SAL_CALL constructorInit( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException); // XGraphicObject virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException); @@ -68,7 +70,11 @@ public: } }; -GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args) throw (uno::RuntimeException) +GObjectImpl::GObjectImpl() throw (uno::RuntimeException) +{ +} + +void GObjectImpl::constructorInit( const uno::Sequence< uno::Any >& args ) throw (uno::Exception, uno::RuntimeException) { if ( args.getLength() == 1 ) { @@ -112,10 +118,13 @@ OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_graphic_GraphicObject_get_implementation( - SAL_UNUSED_PARAMETER css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &arguments) + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + cppu::constructor_InitializationFunc &init_func) { - return static_cast<cppu::OWeakObject *>(new GObjectImpl(arguments)); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&GObjectImpl::constructorInit); + + return static_cast<cppu::OWeakObject *>(new GObjectImpl); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 9f99ce47f584..ac29035aaa16 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -859,7 +859,7 @@ 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( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new GraphicProvider); } diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index 40280d8b6ba7..8e8c38b89aed 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -295,7 +295,7 @@ 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( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new GraphicRendererVCL); } diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx index 86a64ff7b24c..b92ab499c759 100644 --- a/svtools/source/hatchwindow/documentcloser.cxx +++ b/svtools/source/hatchwindow/documentcloser.cxx @@ -54,9 +54,12 @@ class ODocumentCloser : public ::cppu::WeakImplHelper2< ::com::sun::star::lang:: sal_Bool m_bDisposed; public: - ODocumentCloser(const uno::Sequence< uno::Any >& aArguments); + ODocumentCloser(); ~ODocumentCloser(); + /// Initialization function after having acquire()'d. + void SAL_CALL constructorInit( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); + // XComponent virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); @@ -145,10 +148,14 @@ IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, MainThreadFrameCloserReq return 0; } -ODocumentCloser::ODocumentCloser(const uno::Sequence< uno::Any >& aArguments) +ODocumentCloser::ODocumentCloser() : m_pListenersContainer( NULL ) , m_bDisposed( sal_False ) { +} + +void ODocumentCloser::constructorInit(const css::uno::Sequence< css::uno::Any >& aArguments) throw (css::uno::Exception, css::uno::RuntimeException) +{ ::osl::MutexGuard aGuard( m_aMutex ); if ( !m_refCount ) throw uno::RuntimeException(); // the object must be refcounted already! @@ -250,9 +257,12 @@ 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 *, - css::uno::Sequence<css::uno::Any> const &arguments) + cppu::constructor_InitializationFunc &init_func) { - return static_cast<cppu::OWeakObject *>(new ODocumentCloser(arguments)); + // 2nd phase initialization needed + init_func = static_cast<cppu::constructor_InitializationFunc>(&ODocumentCloser::constructorInit); + + return static_cast<cppu::OWeakObject *>(new ODocumentCloser()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index 2a581d07ced3..7f1991919f5d 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -87,7 +87,7 @@ 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( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new OHatchWindowFactory); } diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index c90b4c07d8c2..32219a15bf5f 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -19,8 +19,8 @@ #include <svtools/addresstemplate.hxx> #include <svtools/genericunodialog.hxx> -#include <comphelper/extract.hxx> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/extract.hxx> #include <comphelper/property.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/sdbc/XDataSource.hpp> @@ -226,7 +226,7 @@ namespace { extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_svtools_OAddressBookSourceDialogUno_get_implementation( css::uno::XComponentContext * context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new OAddressBookSourceDialogUno(context)); } diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 870315357eb1..f8f440ae8d54 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -500,7 +500,7 @@ namespace { extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_svtools_uno_Wizard_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new Wizard(context)); } diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index dfe1711c4883..6d8e62ab226a 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -492,7 +492,7 @@ Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShap extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new EnhancedCustomShapeEngine); } diff --git a/svx/source/sdr/primitive2d/primitivefactory2d.cxx b/svx/source/sdr/primitive2d/primitivefactory2d.cxx index eb5ad2dd6b39..a5dede56473d 100644 --- a/svx/source/sdr/primitive2d/primitivefactory2d.cxx +++ b/svx/source/sdr/primitive2d/primitivefactory2d.cxx @@ -91,7 +91,7 @@ Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXDrawPage( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_graphic_PrimitiveFactory2D_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new PrimitiveFactory2D); } diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index fb5be3012f37..d8839db828fc 100644 --- a/svx/source/sidebar/PanelFactory.cxx +++ b/svx/source/sidebar/PanelFactory.cxx @@ -207,7 +207,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL org_apache_openoffice_comp_svx_sidebar_PanelFactory_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new PanelFactory); } diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 9ab903cf851f..418fab4ee3de 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -442,7 +442,7 @@ void FontHeightToolBoxControl::dispatchCommand( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_FontHeightToolBoxController_get_implementation( css::uno::XComponentContext *rxContext, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new FontHeightToolBoxControl(rxContext)); } diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 120769188b80..19c0adb9ab40 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -1053,7 +1053,7 @@ void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_FindTextToolboxController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new FindTextToolbarController(context)); } @@ -1061,7 +1061,7 @@ com_sun_star_svx_FindTextToolboxController_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_ExitFindbarToolboxController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new ExitSearchToolboxController(context)); } @@ -1069,7 +1069,7 @@ com_sun_star_svx_ExitFindbarToolboxController_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_UpSearchToolboxController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(context, UpDownSearchToolboxController::UP)); } @@ -1077,7 +1077,7 @@ com_sun_star_svx_UpSearchToolboxController_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_DownSearchToolboxController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(context, UpDownSearchToolboxController::DOWN)); } @@ -1085,7 +1085,7 @@ com_sun_star_svx_DownSearchToolboxController_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_MatchCaseToolboxController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new MatchCaseToolboxController(context)); } @@ -1093,7 +1093,7 @@ com_sun_star_svx_MatchCaseToolboxController_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_FindAllToolboxController_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new FindAllToolboxController(context)); } @@ -1101,7 +1101,7 @@ com_sun_star_svx_FindAllToolboxController_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_svx_Impl_FindbarDispatcher_get_implementation( SAL_UNUSED_PARAMETER css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new FindbarDispatcher); } diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index dc7c7f1fe698..6d4c7d318b7b 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -1283,7 +1283,7 @@ Graphic SvxGetGraphicForShape( SdrObject& rShape, bool bVector ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_Draw_GraphicExporter_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new GraphicExporter); } diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx index ea34f6c1cb10..19142a4601e5 100644 --- a/svx/source/unodraw/recoveryui.cxx +++ b/svx/source/unodraw/recoveryui.cxx @@ -423,7 +423,7 @@ void RecoveryUI::impl_showAllRecoveredDocs() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_svx_RecoveryUI_get_implementation( css::uno::XComponentContext *context, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new RecoveryUI(context)); } diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index ec8fcc848d18..6205d0cd4791 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -188,7 +188,7 @@ sal_Bool SAL_CALL SvxUnoColorTable::hasElements() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_drawing_SvxUnoColorTable_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SvxUnoColorTable); } diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx index a3d187a2b15d..76f48ad7b2fd 100644 --- a/svx/source/unodraw/unoshcol.cxx +++ b/svx/source/unodraw/unoshcol.cxx @@ -272,7 +272,7 @@ uno::Sequence< OUString > SAL_CALL SvxShapeCollection::getSupportedServiceNames( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_drawing_SvxShapeCollection_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SvxShapeCollection); } diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx index ece74206b9de..0961198bfe7d 100644 --- a/svx/source/unogallery/unogalthemeprovider.cxx +++ b/svx/source/unogallery/unogalthemeprovider.cxx @@ -234,7 +234,7 @@ void SAL_CALL GalleryThemeProvider::removeByName( const OUString& rName ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_gallery_GalleryThemeProvider_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new GalleryThemeProvider); } diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index c285806682b8..d6c8d26c7a28 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -1053,7 +1053,7 @@ Sequence< OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServic extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_Svx_GraphicImportHelper_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(GRAPHICHELPER_MODE_READ)); } @@ -1073,7 +1073,7 @@ com_sun_star_comp_Svx_GraphicImportHelper_get_implementation( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_Svx_GraphicExportHelper_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &) + cppu::constructor_InitializationFunc &) { return static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(GRAPHICHELPER_MODE_WRITE)); } |