This is an automated email from the ASF dual-hosted git repository. damjan pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 7e7d909f7b346ca319119ba7253c8eae03fb7764 Author: Damjan Jovanovic <[email protected]> AuthorDate: Thu Jun 5 19:06:47 2025 +0200 Port main/unotools component_getFactory() to the component context API. Patch by: me --- main/unotools/source/ucbhelper/XTempFile.hxx | 3 --- main/unotools/source/ucbhelper/xtempfile.cxx | 32 ++++++++++++---------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/main/unotools/source/ucbhelper/XTempFile.hxx b/main/unotools/source/ucbhelper/XTempFile.hxx index a7eca2713a..8489548043 100644 --- a/main/unotools/source/ucbhelper/XTempFile.hxx +++ b/main/unotools/source/ucbhelper/XTempFile.hxx @@ -30,7 +30,6 @@ #include <com/sun/star/io/XTempFile.hpp> #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase5.hxx> #ifndef _CPPUHELPER_PROPERTYSETMIXIN_HXX_ @@ -139,8 +138,6 @@ public: static ::rtl::OUString getImplementationName_Static (); static ::com::sun::star::uno::Sequence < ::rtl::OUString > getSupportedServiceNames_Static(); - static ::com::sun::star::uno::Reference < com::sun::star::lang::XSingleComponentFactory > createServiceFactory_Static( com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory ); - private: OTempFileService( OTempFileService & ); virtual ~OTempFileService (); diff --git a/main/unotools/source/ucbhelper/xtempfile.cxx b/main/unotools/source/ucbhelper/xtempfile.cxx index 0f9bd6adb0..bd81e5bdaf 100644 --- a/main/unotools/source/ucbhelper/xtempfile.cxx +++ b/main/unotools/source/ucbhelper/xtempfile.cxx @@ -24,6 +24,7 @@ #include <XTempFile.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/implementationentry.hxx> #include <unotools/tempfile.hxx> #include <osl/file.hxx> #include <unotools/configmgr.hxx> @@ -474,10 +475,18 @@ throw ( ::css::uno::RuntimeException ) return static_cast< ::cppu::OWeakObject * >( new OTempFileService(context) ); } -::css::uno::Reference < ::css::lang::XSingleComponentFactory > OTempFileService::createServiceFactory_Static( ::css::uno::Reference < ::css::lang::XMultiServiceFactory > const & ) +static struct ::cppu::ImplementationEntry g_component_entries[] = { - return ::cppu::createSingleComponentFactory( XTempFile_createInstance, getImplementationName_Static(), getSupportedServiceNames_Static() ); -} + { + XTempFile_createInstance, + OTempFileService::getImplementationName_Static, + OTempFileService::getSupportedServiceNames_Static, + ::cppu::createSingleComponentFactory, + 0, + 0 + }, + { 0, 0, 0, 0, 0, 0 } +}; // C functions to implement this as a component @@ -495,20 +504,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron * @return a component factory (generic uno interface) */ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) + const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { - void * pRet = 0; - ::css::uno::Reference< ::css::lang::XMultiServiceFactory > xSMgr( - reinterpret_cast< ::css::lang::XMultiServiceFactory * >( pServiceManager ) ); - ::css::uno::Reference< ::css::lang::XSingleComponentFactory > xFactory; - - if (OTempFileService::getImplementationName_Static().compareToAscii( pImplName ) == 0) - xFactory = OTempFileService::createServiceFactory_Static ( xSMgr ); - - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; + return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, g_component_entries ); }
