diff options
67 files changed, 274 insertions, 354 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 3d81b8b68dc6..e6c31fc53302 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -704,14 +704,11 @@ cppuhelper::ServiceManager::Data::Implementation::createInstance( if (info->singletons.empty()) { assert(!singletonRequest); if (constructor != 0) { - 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; + // the interface is already acquired, don't acquire here + return css::uno::Reference<css::uno::XInterface>( + (*constructor)(context.get(), + css::uno::Sequence<css::uno::Any>()), + SAL_NO_ACQUIRE); } if (factory1.is()) { return factory1->createInstanceWithContext(context); @@ -727,13 +724,11 @@ cppuhelper::ServiceManager::Data::Implementation::createInstance( return singleton; } if (constructor != 0) { - cppu::constructor_InitializationFunc init = NULL; + // the interface is already acquired, don't acquire here singleton.set( - (*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>()); + (*constructor)(context.get(), + css::uno::Sequence<css::uno::Any>()), + SAL_NO_ACQUIRE); } else if (factory1.is()) { singleton = factory1->createInstanceWithContext(context); } else { @@ -753,24 +748,18 @@ cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments( if (info->singletons.empty()) { assert(!singletonRequest); if (constructor != 0) { - cppu::constructor_InitializationFunc init = NULL; + // the interface is already acquired, don't acquire here 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)( - 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); - } + (*constructor)(context.get(), arguments), SAL_NO_ACQUIRE); + + // HACK: The service can implement XInitialization too. + // It should be removed when converting to constructor-based + // initialization, but in case somebody forgets, be safe, and + // call it anyway for the moment. + css::uno::Reference<css::lang::XInitialization> xinit( + inst, css::uno::UNO_QUERY); + if (xinit.is()) { + xinit->initialize(arguments); } return inst; } @@ -793,23 +782,18 @@ cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments( return singleton; } if (constructor != 0) { - 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); - } + // the interface is already acquired, don't acquire here + singleton.set( + (*constructor)(context.get(), arguments), SAL_NO_ACQUIRE); + + // HACK: The service can implement XInitialization too. + // It should be removed when converting to constructor-based + // initialization, but in case somebody forgets, be safe, and + // call it anyway for the moment. + 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 2d29f58b48ca..b6e506bfbd47 100644 --- a/cppuhelper/source/servicemanager.hxx +++ b/cppuhelper/source/servicemanager.hxx @@ -45,7 +45,7 @@ namespace cppuhelper { extern "C" { typedef css::uno::XInterface * SAL_CALL ImplementationConstructorFn( - css::uno::XComponentContext *, cppu::constructor_InitializationFunc &); + css::uno::XComponentContext *, css::uno::Sequence<css::uno::Any> const &); } diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index 39c32b3584ec..8019e81e5694 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -68,10 +68,8 @@ public: reference to an uno service manager, which is used internaly. */ DocumentAcceleratorConfiguration( - 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); + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Sequence< css::uno::Any >& lArguments); virtual ~DocumentAcceleratorConfiguration(); @@ -114,13 +112,10 @@ private: //----------------------------------------------- DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration( - const css::uno::Reference< css::uno::XComponentContext >& xContext) + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lArguments) : 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; @@ -229,12 +224,9 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&DocumentAcceleratorConfiguration::constructorInit); - - return static_cast<cppu::OWeakObject *>(new DocumentAcceleratorConfiguration(context)); + return cppu::acquire(new DocumentAcceleratorConfiguration(context, arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx index 697faaff35c7..3b809ee9e274 100644 --- a/framework/source/accelerators/globalacceleratorconfiguration.cxx +++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx @@ -81,9 +81,8 @@ public: // XComponent virtual void SAL_CALL dispose() throw (::com::sun::star::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); + /// This has to be called after when the instance is acquire()'d. + void fillCache(); private: @@ -98,7 +97,7 @@ GlobalAcceleratorConfiguration::GlobalAcceleratorConfiguration(const css::uno::R { } -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) +void GlobalAcceleratorConfiguration::fillCache() { /** read all data into the cache. */ @@ -150,12 +149,14 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&GlobalAcceleratorConfiguration::constructorInit); + GlobalAcceleratorConfiguration *inst = new GlobalAcceleratorConfiguration(context); + css::uno::XInterface *acquired_inst = cppu::acquire(inst); - return static_cast<cppu::OWeakObject *>(new GlobalAcceleratorConfiguration(context)); + inst->fillCache(); + + return acquired_inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx index 731161615564..7648c2792b1a 100644 --- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx +++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx @@ -68,7 +68,8 @@ public: reference to an uno service manager, which is used internaly. */ ModuleAcceleratorConfiguration( - const css::uno::Reference< css::uno::XComponentContext >& xContext); + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lArguments); /** TODO */ virtual ~ModuleAcceleratorConfiguration(); @@ -96,9 +97,8 @@ public: // XComponent virtual void SAL_CALL dispose() throw (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); + /// This has to be called after when the instance is acquire()'d. + void SAL_CALL fillCache(); private: /** helper to listen for configuration changes without ownership cycle problems */ @@ -106,17 +106,10 @@ private: }; ModuleAcceleratorConfiguration::ModuleAcceleratorConfiguration( - const css::uno::Reference< css::uno::XComponentContext >& xContext) + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lArguments) : 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; @@ -136,7 +129,14 @@ void ModuleAcceleratorConfiguration::constructorInit(const ::com::sun::star::uno static_cast< ::cppu::OWeakObject* >(this)); aWriteLock.unlock(); +} +ModuleAcceleratorConfiguration::~ModuleAcceleratorConfiguration() +{ +} + +void ModuleAcceleratorConfiguration::fillCache() +{ // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); m_sModuleCFG = m_sModule; @@ -192,12 +192,14 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&ModuleAcceleratorConfiguration::constructorInit); + ModuleAcceleratorConfiguration *inst = new ModuleAcceleratorConfiguration(context, arguments); + css::uno::XInterface *acquired_inst = cppu::acquire(inst); + + inst->fillCache(); - return static_cast<cppu::OWeakObject *>(new ModuleAcceleratorConfiguration(context)); + return acquired_inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 17d2f7c785bc..61dc16df16df 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -606,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new framework::StatusIndicatorFactory(context)); + return cppu::acquire(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 9da2198a5662..4cda0c03b20d 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -534,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new JobDispatch(context)); + return cppu::acquire(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 8844ef4dd954..7c8b7961ab26 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -111,7 +111,7 @@ public: virtual void SAL_CALL trigger( const OUString& sEvent ) 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); + void initListeners(); // document.XEventListener virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException); @@ -123,8 +123,6 @@ public: // lang.XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException); - - void onCreate(); }; /** @@ -142,7 +140,7 @@ JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< css::uno::XComponent { } -void JobExecutor::constructorInit(const css::uno::Sequence< css::uno::Any >& ) throw (css::uno::Exception, css::uno::RuntimeException) +void JobExecutor::initListeners() { // read the list of all currently registered events inside configuration. // e.g. "/org.openoffice.Office.Jobs/Events/<event name>" @@ -404,12 +402,14 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&JobExecutor::constructorInit); + JobExecutor *inst = new JobExecutor(context); + css::uno::XInterface *acquired_inst = cppu::acquire(inst); + + inst->initListeners(); - return static_cast<cppu::OWeakObject *>(new JobExecutor(context)); + return acquired_inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 9f052a30d58e..bca54870731f 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -3225,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new framework::LayoutManager(context)); + return cppu::acquire(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 0cd13705122b..c83cdfbd7b2d 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -541,7 +541,7 @@ public: 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); + void initListeners(); // XTypeProvider virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException); @@ -1418,7 +1418,7 @@ AutoRecovery::AutoRecovery(const css::uno::Reference< css::uno::XComponentContex { } -void AutoRecovery::constructorInit(const css::uno::Sequence< css::uno::Any >& ) throw (css::uno::Exception, css::uno::RuntimeException) +void AutoRecovery::initListeners() { // read configuration to know if autosave/recovery is on/off etcpp... implts_readConfig(); @@ -4634,12 +4634,14 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&AutoRecovery::constructorInit); + AutoRecovery *inst = new AutoRecovery(context); + css::uno::XInterface *acquired_inst = cppu::acquire(inst); - return static_cast<cppu::OWeakObject *>(new AutoRecovery(context)); + inst->initListeners(); + + return acquired_inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 4a47cdafcdaf..08642a5c7799 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -129,9 +129,7 @@ enum EActiveState @devstatus ready to use @threadsafe yes *//*-*************************************************************************************************************/ -class Frame : - public ::cppu::OWeakObject , // helper implements XInterface, XWeak - // interfaces +class Frame : // interfaces public css::lang::XTypeProvider , public css::lang::XServiceInfo , public css::frame::XFrame2 , @@ -147,7 +145,8 @@ class Frame : // Order is necessary for right initialization of this class! public ThreadHelpBase , public TransactionBase , - public PropertySetHelper // helper implements ThreadHelpbase, TransactionBase, XPropertySet, XPropertySetInfo + public PropertySetHelper , // helper implements ThreadHelpbase, TransactionBase, XPropertySet, XPropertySetInfo + public ::cppu::OWeakObject // helper implements XInterface, XWeak { public: @@ -155,7 +154,7 @@ public: virtual ~Frame(); /// 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); + void initListeners(); FWK_DECLARE_XINTERFACE FWK_DECLARE_XTYPEPROVIDER @@ -586,7 +585,7 @@ Frame::Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext { } -void Frame::constructorInit(const css::uno::Sequence< css::uno::Any >&) throw (css::uno::Exception, css::uno::RuntimeException) +void Frame::initListeners() { css::uno::Reference< css::uno::XInterface > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY_THROW); @@ -3585,12 +3584,14 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&Frame::constructorInit); + Frame *inst = new Frame(context); + css::uno::XInterface *acquired_inst = cppu::acquire(inst); - return static_cast<cppu::OWeakObject *>(new Frame(context)); + inst->initListeners(); + + return acquired_inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index c2c5d9e71a0d..84e1c9b25ac0 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -492,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new ModuleManager(context)); + return cppu::acquire(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 f108e8d54cc4..2630ff951a4b 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -97,7 +97,7 @@ public: virtual ~TabWindowService(); /// 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); + void initProperties(); FWK_DECLARE_XINTERFACE FWK_DECLARE_XTYPEPROVIDER @@ -229,7 +229,7 @@ TabWindowService::TabWindowService() { } -void TabWindowService::constructorInit(const css::uno::Sequence< css::uno::Any >&) throw (css::uno::Exception, css::uno::RuntimeException) +void TabWindowService::initProperties() { impl_initializePropInfo(); m_aTransactionManager.setWorkingMode( E_WORK ); @@ -584,12 +584,14 @@ 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 *, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&TabWindowService::constructorInit); + TabWindowService *inst = new TabWindowService; + css::uno::XInterface *acquired_inst = cppu::acquire(inst); - return static_cast<cppu::OWeakObject *>(new TabWindowService); + inst->initProperties(); + + return acquired_inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx index cf5e24720a9a..2716740aa69d 100644 --- a/framework/source/services/urltransformer.cxx +++ b/framework/source/services/urltransformer.cxx @@ -337,9 +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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new URLTransformer()); + return cppu::acquire(new URLTransformer()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx index 3ceecda48c37..8540e2400945 100644 --- a/framework/source/uiconfiguration/imagemanager.cxx +++ b/framework/source/uiconfiguration/imagemanager.cxx @@ -210,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new framework::ImageManager(context)); + return cppu::acquire(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 69c3963c4731..4279482c6e56 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -72,10 +72,8 @@ class ModuleUIConfigurationManager : private ThreadHelpBase, // Struct for rig { public: ModuleUIConfigurationManager( - 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); + const css::uno::Reference< css::uno::XComponentContext >& xServiceManager, + const css::uno::Sequence< css::uno::Any >& aArguments); virtual ~ModuleUIConfigurationManager(); @@ -847,7 +845,8 @@ void ModuleUIConfigurationManager::impl_Initialize() } ModuleUIConfigurationManager::ModuleUIConfigurationManager( - const Reference< XComponentContext >& xContext) + const Reference< XComponentContext >& xContext, + const css::uno::Sequence< css::uno::Any >& aArguments) : ThreadHelpBase( &Application::GetSolarMutex() ) , m_xDefaultConfigStorage( 0 ) , m_xUserConfigStorage( 0 ) @@ -868,10 +867,7 @@ 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)) @@ -1715,12 +1711,9 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&ModuleUIConfigurationManager::constructorInit); - - return static_cast<cppu::OWeakObject *>(new ModuleUIConfigurationManager(context)); + return cppu::acquire(new ModuleUIConfigurationManager(context, arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 7f79fb04ec29..29ccd8796137 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -1430,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new UIConfigurationManager(context)); + return cppu::acquire(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 2a187e28205c..3a542b334fdf 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -461,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new ControlMenuController(context)); + return cppu::acquire(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 a463ce2a063e..f06197afc9ab 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -366,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new LangSelectionStatusbarController(context)); + return cppu::acquire(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 ea19f0bf5ae4..618171c1e785 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -176,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new ObjectMenuController(context)); + return cppu::acquire(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 0301a9504d60..c94edc5fed6b 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -580,23 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new WizardsToolbarController(context)); + return cppu::acquire(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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new OpenToolbarController(context)); + return cppu::acquire(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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new NewToolbarController(context)); + return cppu::acquire(new NewToolbarController(context)); } diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 84753c18dbe5..99cd85781e64 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -424,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new RecentFilesMenuController(context)); + return cppu::acquire(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 8d965e5ffe24..ffdea9c8c570 100644 --- a/framework/source/uifactory/addonstoolboxfactory.cxx +++ b/framework/source/uifactory/addonstoolboxfactory.cxx @@ -232,9 +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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new AddonsToolBoxFactory(context)); + return cppu::acquire(new AddonsToolBoxFactory(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/weak.hxx b/include/cppuhelper/weak.hxx index 0fefafc81ba9..cfae9fe2c168 100644 --- a/include/cppuhelper/weak.hxx +++ b/include/cppuhelper/weak.hxx @@ -156,21 +156,25 @@ public: { return this; } }; -/** Function pointer declaration. +/// @cond INTERNAL +/** Convenience function for constructor-based service implementations. - 2nd stage initialization using the service implementation pointer. + To be used like: - 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. + css::uno::XInterface * FOO_constructor_function(...) { + return cppu::acquire(new FOO(...)); + } - Typically, this happens in framework/. - - @param aArguments - Arguments the instance will use for its own initialization. + @param instance + Newly created instance that should be acquired. */ - -typedef void (SAL_CALL OWeakObject::* constructor_InitializationFunc)( - const css::uno::Sequence< css::uno::Any >& aArguments); +static inline ::com::sun::star::uno::XInterface * acquire(OWeakObject * instance) +{ + assert(instance != 0); + instance->acquire(); + return instance; +} +/// @endcond } diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 3f2adc5b7975..a5edfc53b383 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -1023,9 +1023,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SaxExpatParser); + return cppu::acquire(new SaxExpatParser); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 24819526eeaf..b1601413b9e9 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -1373,9 +1373,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SAXWriter); + return cppu::acquire(new SAXWriter); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index a97c786c1299..a3e201cb620c 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -1429,9 +1429,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new FastSaxParser); + return cppu::acquire(new FastSaxParser); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index 39e768a8a065..7d295cdef8cc 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -159,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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { SFX_APP()->GetBasicManager(); return SFX_APP()->GetDialogContainer(); @@ -171,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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { SFX_APP()->GetBasicManager(); return SFX_APP()->GetBasicContainer(); diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx index 6aa197c60df0..da2a6fd8d9c4 100644 --- a/sfx2/source/appl/appdispatchprovider.cxx +++ b/sfx2/source/appl/appdispatchprovider.cxx @@ -62,11 +62,7 @@ class SfxAppDispatchProvider : public ::cppu::WeakImplHelper2< css::frame::XAppD { css::uno::WeakReference < css::frame::XFrame > m_xFrame; public: - 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 >&) + SfxAppDispatchProvider(const css::uno::Sequence< css::uno::Any >&aArguments) throw (css::uno::Exception, css::uno::RuntimeException); virtual OUString SAL_CALL getImplementationName() @@ -94,13 +90,9 @@ public: throw (css::uno::RuntimeException); }; -SfxAppDispatchProvider::SfxAppDispatchProvider() +SfxAppDispatchProvider::SfxAppDispatchProvider(const css::uno::Sequence< css::uno::Any >& aArguments) 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() ) { @@ -261,12 +253,9 @@ throw (uno::RuntimeException) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation( css::uno::XComponentContext *, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&SfxAppDispatchProvider::constructorInit); - - return static_cast<cppu::OWeakObject *>(new SfxAppDispatchProvider()); + return cppu::acquire(new SfxAppDispatchProvider(arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx index d485d68ad610..9291e7016700 100644 --- a/sfx2/source/appl/macroloader.cxx +++ b/sfx2/source/appl/macroloader.cxx @@ -44,13 +44,9 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; -SfxMacroLoader::SfxMacroLoader() +SfxMacroLoader::SfxMacroLoader(const css::uno::Sequence< css::uno::Any >& aArguments) 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() ) { @@ -343,12 +339,9 @@ 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 *, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&SfxMacroLoader::constructorInit); - - return static_cast<cppu::OWeakObject *>(new SfxMacroLoader()); + return cppu::acquire(new SfxMacroLoader(arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 20b64490b2c5..5614f494df34 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -974,9 +974,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new ShutdownIcon(context)); + return cppu::acquire(new ShutdownIcon(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index 4ff41b70f431..6229c61f7130 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -176,9 +176,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new OPackageStructureCreator()); + return cppu::acquire(new OPackageStructureCreator()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx index eee5d333f863..d79c545266bf 100644 --- a/sfx2/source/dialog/backingcomp.cxx +++ b/sfx2/source/dialog/backingcomp.cxx @@ -825,9 +825,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new BackingComp(context)); + return cppu::acquire(new BackingComp(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index d3fd3b079131..4618ac93d517 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -2317,17 +2317,17 @@ void SfxDocumentMetaData::createUserDefined() extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL CompatWriterDocPropsImpl_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new CompatWriterDocPropsImpl(context)); + return cppu::acquire(new CompatWriterDocPropsImpl(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL SfxDocumentMetaData_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SfxDocumentMetaData(context)); + return cppu::acquire(new SfxDocumentMetaData(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 364564a30a24..e61eeac6d896 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2898,9 +2898,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SfxDocTplService(context)); + return cppu::acquire(new SfxDocTplService(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 23436518bab6..9e41641e68ec 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -63,14 +63,10 @@ class IFrameObject : public ::cppu::WeakImplHelper6 < SfxFrameDescriptor maFrmDescr; public: - IFrameObject( const css::uno::Reference < css::uno::XComponentContext>& rxContext) + IFrameObject(const css::uno::Reference < css::uno::XComponentContext>& rxContext, const css::uno::Sequence< css::uno::Any >& aArguments) 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) { @@ -161,15 +157,11 @@ const SfxItemPropertyMapEntry* lcl_GetIFramePropertyMap_Impl() return aIFramePropertyMap_Impl; } -IFrameObject::IFrameObject( const uno::Reference < uno::XComponentContext >& rxContext ) +IFrameObject::IFrameObject(const uno::Reference < uno::XComponentContext >& rxContext, const css::uno::Sequence< css::uno::Any >& aArguments) 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; } @@ -436,12 +428,9 @@ 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, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&IFrameObject::constructorInit); - - return static_cast<cppu::OWeakObject *>(new IFrameObject(context)); + return cppu::acquire(new IFrameObject(context, arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/ownsubfilterservice.cxx b/sfx2/source/doc/ownsubfilterservice.cxx index 61d000cb48ee..4529730f7d05 100644 --- a/sfx2/source/doc/ownsubfilterservice.cxx +++ b/sfx2/source/doc/ownsubfilterservice.cxx @@ -41,13 +41,9 @@ class OwnSubFilterService : public cppu::WeakImplHelper2 < document::XFilter SfxObjectShell* m_pObjectShell; public: - OwnSubFilterService() + OwnSubFilterService(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments) 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 @@ -60,14 +56,10 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (uno::RuntimeException); }; -OwnSubFilterService::OwnSubFilterService() +OwnSubFilterService::OwnSubFilterService(const css::uno::Sequence< css::uno::Any >& aArguments) 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(); @@ -133,12 +125,9 @@ 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 *, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&OwnSubFilterService::constructorInit); - - return static_cast<cppu::OWeakObject *>(new OwnSubFilterService); + return cppu::acquire(new OwnSubFilterService(arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx index 60eddc1cf2a4..43f73973382d 100644 --- a/sfx2/source/doc/plugin.cxx +++ b/sfx2/source/doc/plugin.cxx @@ -309,9 +309,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new PluginObject()); + return cppu::acquire(new PluginObject()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/macroloader.hxx b/sfx2/source/inc/macroloader.hxx index 7dac814da03d..f0a775787d7e 100644 --- a/sfx2/source/inc/macroloader.hxx +++ b/sfx2/source/inc/macroloader.hxx @@ -50,13 +50,9 @@ class SfxMacroLoader : public cppu::WeakImplHelper4< SfxObjectShell* GetObjectShell_Impl(); public: - SfxMacroLoader() + SfxMacroLoader(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments) 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 16b7118645bd..de482dcd0746 100644 --- a/sfx2/source/notify/globalevents.cxx +++ b/sfx2/source/notify/globalevents.cxx @@ -547,9 +547,11 @@ struct Singleton: extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return Singleton::get(context).instance.get(); + css::uno::XInterface *inst = Singleton::get(context).instance.get(); + inst->acquire(); + return inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index c7c0ff6fb824..9e4f71696659 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -776,9 +776,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SfxFrameLoader_Impl(context)); + return cppu::acquire(new SfxFrameLoader_Impl(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx index 2f09bf5309a2..6c8dbb57b8ba 100644 --- a/stoc/source/defaultregistry/defaultregistry.cxx +++ b/stoc/source/defaultregistry/defaultregistry.cxx @@ -1353,9 +1353,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new NestedRegistryImpl); + return cppu::acquire(new NestedRegistryImpl); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 8218c2ebdbcb..738f25ad68d9 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -1819,9 +1819,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new ImplementationRegistration(context)); + return cppu::acquire(new ImplementationRegistration(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx index e52519cb67ad..9c1283bba5ad 100644 --- a/stoc/source/loader/dllcomponentloader.cxx +++ b/stoc/source/loader/dllcomponentloader.cxx @@ -168,9 +168,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new DllComponentLoader(context)); + return cppu::acquire(new DllComponentLoader(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index 3fbf8f5c7db6..abc959c056b0 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -982,9 +982,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new AccessController(context)); + return cppu::acquire(new AccessController(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 2864b6da6f14..9d646a78f2e2 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_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new FilePolicy(context)); + return cppu::acquire(new FilePolicy(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 00763d5649d3..0abf06d80198 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -1674,25 +1674,25 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new OServiceManager(context)); + return cppu::acquire(new OServiceManager(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_ORegistryServiceManager_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new ORegistryServiceManager(context)); + return cppu::acquire(new ORegistryServiceManager(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new OServiceManagerWrapper(context)); + return cppu::acquire(new OServiceManagerWrapper(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index 4927efe24ffa..3f5c8d8c871d 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -1126,9 +1126,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SimpleRegistry); + return cppu::acquire(new SimpleRegistry); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter/SvFilterOptionsDialog.cxx index 431d84c4b880..706ad184e55b 100644 --- a/svtools/source/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter/SvFilterOptionsDialog.cxx @@ -302,9 +302,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SvFilterOptionsDialog(context)); + return cppu::acquire(new SvFilterOptionsDialog(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx index 6b526f918146..139ccb32a6de 100644 --- a/svtools/source/graphic/graphicunofactory.cxx +++ b/svtools/source/graphic/graphicunofactory.cxx @@ -39,9 +39,7 @@ class GObjectImpl : public GObjectAccess_BASE ::osl::Mutex m_aMutex; std::auto_ptr< GraphicObject > mpGObject; public: - GObjectImpl() throw (uno::RuntimeException); - - void SAL_CALL constructorInit( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException); + GObjectImpl(uno::Sequence< uno::Any > const & args) throw (uno::RuntimeException); // XGraphicObject virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException); @@ -70,11 +68,7 @@ public: } }; -GObjectImpl::GObjectImpl() throw (uno::RuntimeException) -{ -} - -void GObjectImpl::constructorInit( const uno::Sequence< uno::Any >& args ) throw (uno::Exception, uno::RuntimeException) +GObjectImpl::GObjectImpl(const uno::Sequence< uno::Any >& args) throw (uno::RuntimeException) { if ( args.getLength() == 1 ) { @@ -119,12 +113,9 @@ 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 *, - cppu::constructor_InitializationFunc &init_func) + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&GObjectImpl::constructorInit); - - return static_cast<cppu::OWeakObject *>(new GObjectImpl); + return cppu::acquire(new GObjectImpl(arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index ac29035aaa16..554a5558739f 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -859,9 +859,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new GraphicProvider); + return cppu::acquire(new GraphicProvider); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index 8e8c38b89aed..1577ba747c64 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -295,9 +295,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new GraphicRendererVCL); + return cppu::acquire(new GraphicRendererVCL); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx index b92ab499c759..b4ffcc917473 100644 --- a/svtools/source/hatchwindow/documentcloser.cxx +++ b/svtools/source/hatchwindow/documentcloser.cxx @@ -54,12 +54,9 @@ class ODocumentCloser : public ::cppu::WeakImplHelper2< ::com::sun::star::lang:: sal_Bool m_bDisposed; public: - ODocumentCloser(); + ODocumentCloser(const css::uno::Sequence< css::uno::Any >& aArguments); ~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); @@ -148,14 +145,10 @@ IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, MainThreadFrameCloserReq return 0; } -ODocumentCloser::ODocumentCloser() +ODocumentCloser::ODocumentCloser(const css::uno::Sequence< css::uno::Any >& aArguments) : 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! @@ -256,13 +249,10 @@ 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 *, - cppu::constructor_InitializationFunc &init_func) + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + css::uno::Sequence<css::uno::Any> const &arguments) { - // 2nd phase initialization needed - init_func = static_cast<cppu::constructor_InitializationFunc>(&ODocumentCloser::constructorInit); - - return static_cast<cppu::OWeakObject *>(new ODocumentCloser()); + return cppu::acquire(new ODocumentCloser(arguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index 7f1991919f5d..27b27e283e17 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -87,9 +87,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new OHatchWindowFactory); + return cppu::acquire(new OHatchWindowFactory); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index 32219a15bf5f..85706cf350cc 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -225,10 +225,10 @@ namespace { extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_svtools_OAddressBookSourceDialogUno_get_implementation( - css::uno::XComponentContext * context, - cppu::constructor_InitializationFunc &) + css::uno::XComponentContext * context, + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new OAddressBookSourceDialogUno(context)); + return cppu::acquire(new OAddressBookSourceDialogUno(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index f8f440ae8d54..ae2d96b9b526 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -499,10 +499,10 @@ namespace { extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_svtools_uno_Wizard_get_implementation( - css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new Wizard(context)); + return cppu::acquire(new Wizard(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index 6d8e62ab226a..e1ceb9591b20 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -492,9 +492,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new EnhancedCustomShapeEngine); + return cppu::acquire(new EnhancedCustomShapeEngine); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/primitive2d/primitivefactory2d.cxx b/svx/source/sdr/primitive2d/primitivefactory2d.cxx index a5dede56473d..06bafe870eb2 100644 --- a/svx/source/sdr/primitive2d/primitivefactory2d.cxx +++ b/svx/source/sdr/primitive2d/primitivefactory2d.cxx @@ -91,9 +91,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new PrimitiveFactory2D); + return cppu::acquire(new PrimitiveFactory2D); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index d8839db828fc..982f470782ec 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new PanelFactory); + return cppu::acquire(new PanelFactory); } diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 418fab4ee3de..47330431a5b6 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -442,9 +442,9 @@ void FontHeightToolBoxControl::dispatchCommand( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_FontHeightToolBoxController_get_implementation( css::uno::XComponentContext *rxContext, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new FontHeightToolBoxControl(rxContext)); + return cppu::acquire(new FontHeightToolBoxControl(rxContext)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 19c0adb9ab40..8cedb04d2e11 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -1053,57 +1053,57 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new FindTextToolbarController(context)); + return cppu::acquire(new FindTextToolbarController(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_ExitFindbarToolboxController_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new ExitSearchToolboxController(context)); + return cppu::acquire(new ExitSearchToolboxController(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_UpSearchToolboxController_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(context, UpDownSearchToolboxController::UP)); + return cppu::acquire(new UpDownSearchToolboxController(context, UpDownSearchToolboxController::UP)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_DownSearchToolboxController_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new UpDownSearchToolboxController(context, UpDownSearchToolboxController::DOWN)); + return cppu::acquire(new UpDownSearchToolboxController(context, UpDownSearchToolboxController::DOWN)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_MatchCaseToolboxController_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new MatchCaseToolboxController(context)); + return cppu::acquire(new MatchCaseToolboxController(context)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_svx_FindAllToolboxController_get_implementation( css::uno::XComponentContext *context, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new FindAllToolboxController(context)); + return cppu::acquire(new FindAllToolboxController(context)); } 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new FindbarDispatcher); + return cppu::acquire(new FindbarDispatcher); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 6d4c7d318b7b..57344500d64c 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -1283,9 +1283,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new GraphicExporter); + return cppu::acquire(new GraphicExporter); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx index 19142a4601e5..65033f63fe37 100644 --- a/svx/source/unodraw/recoveryui.cxx +++ b/svx/source/unodraw/recoveryui.cxx @@ -423,9 +423,9 @@ 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, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new RecoveryUI(context)); + return cppu::acquire(new RecoveryUI(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 6205d0cd4791..3a3b91707a37 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -188,9 +188,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SvxUnoColorTable); + return cppu::acquire(new SvxUnoColorTable); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx index 76f48ad7b2fd..925a88146d9b 100644 --- a/svx/source/unodraw/unoshcol.cxx +++ b/svx/source/unodraw/unoshcol.cxx @@ -272,9 +272,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SvxShapeCollection); + return cppu::acquire(new SvxShapeCollection); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx index 0961198bfe7d..a94224673d22 100644 --- a/svx/source/unogallery/unogalthemeprovider.cxx +++ b/svx/source/unogallery/unogalthemeprovider.cxx @@ -234,9 +234,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new GalleryThemeProvider); + return cppu::acquire(new GalleryThemeProvider); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index d6c8d26c7a28..41e94a93359e 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -1053,9 +1053,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(GRAPHICHELPER_MODE_READ)); + return cppu::acquire(new SvXMLGraphicImportExportHelper(GRAPHICHELPER_MODE_READ)); } /** Create this with createInstanceWithArguments. service name @@ -1073,9 +1073,9 @@ 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 *, - cppu::constructor_InitializationFunc &) + css::uno::Sequence<css::uno::Any> const &) { - return static_cast<cppu::OWeakObject *>(new SvXMLGraphicImportExportHelper(GRAPHICHELPER_MODE_WRITE)); + return cppu::acquire(new SvXMLGraphicImportExportHelper(GRAPHICHELPER_MODE_WRITE)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |