summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-01-21 15:45:43 +0100
committerJan Holesovsky <kendy@collabora.com>2014-01-21 21:25:22 +0100
commitf278397787f7b79cee8536e806e8b7113800f2ef (patch)
tree1760bce432d466cf9f3ca444c89ec8f44306ab04 /svtools
parent3780738154b8c3b3f9d85c64cccf621d97574886 (diff)
Change _get_implementation()'s not to do initialization directly.
Many of the initalizations (in eg. framework) have to be done on an acquire()'d object, so instead of doing the initialization directly, return the initialization member function back to the createInstance() / createInstanceWithContext() / ... and perform the initialization there. As a sideeffect, I belive the calling initialize() from servicemanager is not that much a hack any more - whoever converts the implementation to be constructor-base has the choice to provide the callback, or still initialize through XInitialization, where the callback is preferred by servicemanager when it exists. Change-Id: I8a87b75c54c1441ca0f184967d31ff4902fc4081
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/filter/SvFilterOptionsDialog.cxx4
-rw-r--r--svtools/source/graphic/graphicunofactory.cxx19
-rw-r--r--svtools/source/graphic/provider.cxx2
-rw-r--r--svtools/source/graphic/renderer.cxx2
-rw-r--r--svtools/source/hatchwindow/documentcloser.cxx18
-rw-r--r--svtools/source/hatchwindow/hatchwindowfactory.cxx2
-rw-r--r--svtools/source/uno/addrtempuno.cxx4
-rw-r--r--svtools/source/uno/wizard/unowizard.cxx2
8 files changed, 36 insertions, 17 deletions
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));
}