diff options
author | Chris Sherlock <chris.sherlock@collabora.com> | 2015-02-23 11:51:18 +1100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-12 10:05:05 +0100 |
commit | b47901e5831e480caacab837b1c8a999ae515c02 (patch) | |
tree | 6e8f2b10db0d4f14caaf0ceab0435e8cefb35e31 | |
parent | f71acd40e351517c64ff19a47e8422dedfd49cf9 (diff) |
sw: further components converted to constructor method
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, with fixes for:
* copy missing parts from SwXAutoTextContainer_createInstance to
SwXAutoTextContainer_get_implementation
* include (dummy) SwXMailMerge_get_implementation if
!HAVE_FEATURE_DBCONNECTIVITY
Change-Id: I36f5b5cad42bda55139bdf96d9a0621dc5ec2419
-rw-r--r-- | sw/inc/finalthreadmanager.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/docnode/finalthreadmanager.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/inc/unofreg.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/dumpfilter.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/inc/SwXFilterOptions.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXFilterOptions.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/unoatxt.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/unofreg.cxx | 78 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomailmerge.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomod.cxx | 7 | ||||
-rw-r--r-- | sw/util/sw.component | 15 |
11 files changed, 68 insertions, 102 deletions
diff --git a/sw/inc/finalthreadmanager.hxx b/sw/inc/finalthreadmanager.hxx index c2d489c7618a..ce510648769a 100644 --- a/sw/inc/finalthreadmanager.hxx +++ b/sw/inc/finalthreadmanager.hxx @@ -40,8 +40,6 @@ namespace comp_FinalThreadManager { // component and service helper functions: OUString SAL_CALL _getImplementationName(); com::sun::star::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames(); -com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _create( - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context ); } // closing service helper namespace diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx index b055c15d4939..3683f0a5896f 100644 --- a/sw/source/core/docnode/finalthreadmanager.cxx +++ b/sw/source/core/docnode/finalthreadmanager.cxx @@ -457,12 +457,14 @@ namespace comp_FinalThreadManager { return s; } - css::uno::Reference< css::uno::XInterface > SAL_CALL _create( - const css::uno::Reference< css::uno::XComponentContext > & context) - { - return static_cast< ::cppu::OWeakObject * >(new FinalThreadManager(context)); - } - } // closing component helper namespace + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_util_comp_FinalThreadManager_get_implementation(::com::sun::star::uno::XComponentContext* context, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new FinalThreadManager(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/inc/unofreg.hxx b/sw/source/core/inc/unofreg.hxx index 0b49ffd9bc90..0e7d0879ad09 100644 --- a/sw/source/core/inc/unofreg.hxx +++ b/sw/source/core/inc/unofreg.hxx @@ -46,7 +46,6 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL SwXAutoTextContainer_create css::uno::Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw(); OUString SAL_CALL SwXModule_getImplementationName() throw(); -css::uno::Reference< css::uno::XInterface > SAL_CALL SwXModule_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw( css::uno::Exception ); css::uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw(); OUString SAL_CALL SwXMailMerge_getImplementationName() throw(); @@ -55,8 +54,6 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL SwXMailMerge_createInstance // Layout dump filter css::uno::Sequence< OUString > SAL_CALL LayoutDumpFilter_getSupportedServiceNames() throw(); OUString SAL_CALL LayoutDumpFilter_getImplementationName() throw(); -css::uno::Reference< css::uno::XInterface > SAL_CALL LayoutDumpFilter_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > &rSMgr ) throw( css::uno::Exception ); - #endif diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx index 672bab301a69..9b7d3feef7b1 100644 --- a/sw/source/core/layout/dumpfilter.cxx +++ b/sw/source/core/layout/dumpfilter.cxx @@ -34,13 +34,6 @@ uno::Sequence< OUString > SAL_CALL LayoutDumpFilter_getSupportedServiceNames() t return aSeq; } -uno::Reference< uno::XInterface > SAL_CALL LayoutDumpFilter_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & ) - throw (css::uno::Exception) -{ - return static_cast< cppu::OWeakObject* >( new sw::LayoutDumpFilter( ) ); -} - namespace { int writeCallback( void* pContext, const char* sBuffer, int nLen ) @@ -180,4 +173,11 @@ namespace sw } // Namespace sw + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_Writer_LayoutDump_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new sw::LayoutDumpFilter()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/SwXFilterOptions.hxx b/sw/source/uibase/inc/SwXFilterOptions.hxx index 4c583d68dac9..32a1bc59c53f 100644 --- a/sw/source/uibase/inc/SwXFilterOptions.hxx +++ b/sw/source/uibase/inc/SwXFilterOptions.hxx @@ -92,11 +92,6 @@ public: }; -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - SwXFilterOptions_createInstance( - const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& ); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uno/SwXFilterOptions.cxx b/sw/source/uibase/uno/SwXFilterOptions.cxx index fef02b76f6bc..96d46a4bf464 100644 --- a/sw/source/uibase/uno/SwXFilterOptions.cxx +++ b/sw/source/uibase/uno/SwXFilterOptions.cxx @@ -166,12 +166,16 @@ uno::Sequence< OUString > SwXFilterOptions::getSupportedServiceNames() return SwXFilterOptions::getSupportedServiceNames_Static(); } -uno::Reference<uno::XInterface> SAL_CALL SwXFilterOptions_createInstance( - const uno::Reference<lang::XMultiServiceFactory>& ) +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_Writer_FilterOptionsDialog_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) { SolarMutexGuard aGuard; + + //the module may not be loaded SwGlobals::ensure(); - return (::cppu::OWeakObject*) new SwXFilterOptions; + return cppu::acquire(new SwXFilterOptions()); + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 003e89dc35af..d3641ffe8a2a 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -1111,4 +1111,14 @@ void SwAutoTextEventDescriptor::getByName( } } +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +SwXAutoTextContainer_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + //the module may not be loaded + SolarMutexGuard aGuard; + SwGlobals::ensure(); + return cppu::acquire(new SwXAutoTextContainer()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uno/unofreg.cxx b/sw/source/uibase/uno/unofreg.cxx index c5b2138c0623..4ad389bc3e09 100644 --- a/sw/source/uibase/uno/unofreg.cxx +++ b/sw/source/uibase/uno/unofreg.cxx @@ -20,11 +20,14 @@ #include <config_features.h> #include "SwXFilterOptions.hxx" +#include "swdll.hxx" #include "unofreg.hxx" +#include "unomailmerge.hxx" #include <sal/types.h> #include <osl/diagnose.h> #include <cppuhelper/factory.hxx> #include <sfx2/sfxmodelfactory.hxx> +#include <vcl/svapp.hxx> #include <string.h> @@ -38,18 +41,10 @@ using namespace ::com::sun::star::lang; extern "C" { -static ::cppu::ImplementationEntry const entries[] = { - { &comp_FinalThreadManager::_create, - &comp_FinalThreadManager::_getImplementationName, - &comp_FinalThreadManager::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; - SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( const sal_Char * pImplName, void * pServiceManager, - void * pRegistryKey ) + void * ) { void * pRet = 0; if( pServiceManager ) @@ -60,41 +55,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( uno::Reference< XSingleServiceFactory > xFactory; const sal_Int32 nImplNameLen = strlen( pImplName ); - if( SwXAutoTextContainer_getImplementationName().equalsAsciiL( - pImplName, nImplNameLen ) ) - { - xFactory = ::cppu::createSingleFactory( xMSF, - SwXAutoTextContainer_getImplementationName(), - SwXAutoTextContainer_createInstance, - SwXAutoTextContainer_getSupportedServiceNames() ); - } - else if( SwXModule_getImplementationName().equalsAsciiL( - pImplName, nImplNameLen ) ) - { - xFactory = ::cppu::createSingleFactory( xMSF, - SwXModule_getImplementationName(), - SwXModule_createInstance, - SwXModule_getSupportedServiceNames() ); - } -#if HAVE_FEATURE_DBCONNECTIVITY - else if( SwXMailMerge_getImplementationName().equalsAsciiL( - pImplName, nImplNameLen ) ) - { - xFactory = ::cppu::createSingleFactory( xMSF, - SwXMailMerge_getImplementationName(), - SwXMailMerge_createInstance, - SwXMailMerge_getSupportedServiceNames() ); - } -#endif - else if( SwXFilterOptions::getImplementationName_Static().equalsAsciiL( - pImplName, nImplNameLen ) ) - { - xFactory = ::cppu::createSingleFactory( xMSF, - SwXFilterOptions::getImplementationName_Static(), - SwXFilterOptions_createInstance, - SwXFilterOptions::getSupportedServiceNames_Static() ); - } - else if( SwTextDocument_getImplementationName().equalsAsciiL( + if( SwTextDocument_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) { xFactory = ::sfx2::createSfxModelFactory( xMSF, @@ -110,20 +71,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( SwUnoModule_createInstance, SwUnoModule_getSupportedServiceNames() ); } - else if( LayoutDumpFilter_getImplementationName().equalsAsciiL( - pImplName, nImplNameLen ) ) - { - xFactory = ::cppu::createSingleFactory( xMSF, - LayoutDumpFilter_getImplementationName(), - LayoutDumpFilter_createInstance, - LayoutDumpFilter_getSupportedServiceNames() ); - } - else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL( - pImplName, nImplNameLen ) ) - { - pRet = ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, entries); - } if( xFactory.is()) { @@ -136,4 +83,19 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( } // extern "C" +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +SwXMailMerge_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ +#if HAVE_FEATURE_DBCONNECTIVITY + SolarMutexGuard aGuard; + + //the module may not be loaded + SwGlobals::ensure(); + return cppu::acquire(new SwXMailMerge()); +#else + return nullptr; +#endif +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 216a6c6f7c12..8564df6d9735 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -1223,16 +1223,4 @@ OUString SAL_CALL SwXMailMerge_getImplementationName() return OUString( "SwXMailMerge" ); } -uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance( - const uno::Reference< XMultiServiceFactory > & /*rSMgr*/) - throw( uno::Exception ) -{ - SolarMutexGuard aGuard; - - //the module may not be loaded - SwGlobals::ensure(); - uno::Reference< uno::XInterface > xRef = (cppu::OWeakObject *) new SwXMailMerge(); - return xRef; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 653cc8cba628..4e9009d31f00 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -1002,4 +1002,11 @@ Sequence< OUString > SwXViewSettings::getSupportedServiceNames(void) throw( Runt return aRet; } +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +SwXModule_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new SwXModule()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/util/sw.component b/sw/util/sw.component index 0b75e6776618..e89271febeee 100644 --- a/sw/util/sw.component +++ b/sw/util/sw.component @@ -18,17 +18,18 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" prefix="sw" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="SwXAutoTextContainer"> + <implementation name="SwXAutoTextContainer" constructor="SwXAutoTextContainer_get_implementation"> <service name="com.sun.star.text.AutoTextContainer"/> </implementation> - <implementation name="SwXMailMerge"> + <implementation name="SwXMailMerge" constructor="SwXMailMerge_get_implementation"> <service name="com.sun.star.sdb.DataAccessDescriptor"/> <service name="com.sun.star.text.MailMerge"/> </implementation> - <implementation name="SwXModule"> + <implementation name="SwXModule" constructor="SwXModule_get_implementation"> <service name="com.sun.star.text.GlobalSettings"/> </implementation> - <implementation name="com.sun.star.comp.Writer.FilterOptionsDialog"> + <implementation name="com.sun.star.comp.Writer.FilterOptionsDialog" + constructor="com_sun_star_comp_Writer_FilterOptionsDialog_get_implementation"> <service name="com.sun.star.ui.dialogs.FilterOptionsDialog"/> </implementation> <implementation name="com.sun.star.comp.Writer.GlobalDocument" @@ -105,10 +106,12 @@ constructor="com_sun_star_comp_Writer_XMLStylesExporter_get_implementation"> <service name="com.sun.star.comp.Writer.XMLStylesExporter"/> </implementation> - <implementation name="com.sun.star.util.comp.FinalThreadManager"> + <implementation name="com.sun.star.util.comp.FinalThreadManager" + constructor="com_sun_star_util_comp_FinalThreadManager_get_implementation"> <service name="com.sun.star.util.JobManager"/> </implementation> - <implementation name="com.sun.star.comp.Writer.LayoutDump"> + <implementation name="com.sun.star.comp.Writer.LayoutDump" + constructor="com_sun_star_comp_Writer_LayoutDump_get_implementation"> <service name="com.sun.star.comp.Writer.LayoutDump"/> </implementation> <implementation name="org.apache.openoffice.comp.sw.sidebar.SwPanelFactory" |