summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Sherlock <chris.sherlock79@gmail.com>2024-12-10 02:23:55 +1100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-10 11:44:47 +0100
commit3faa61452a67bca97d223ee59748ac7b469cdd48 (patch)
tree781385acacbc0454e7982f9a1dc8bb0f88240dcf
parent28c526bc88dad00c74fba969fd76032ac94801fe (diff)
vcl: flatten vcl_component_getFactory()
Change-Id: I411c75ad491e5d755710bc6a4d38446e170abc47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178159 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/source/components/factory.cxx52
1 files changed, 26 insertions, 26 deletions
diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx
index 0a5b7e8f6f8c..2a2014125bee 100644
--- a/vcl/source/components/factory.cxx
+++ b/vcl/source/components/factory.cxx
@@ -32,36 +32,36 @@ extern "C" {
VCL_DLLPUBLIC void* vcl_component_getFactory(
const char* pImplementationName,
void* pXUnoSMgr,
- void* /*pXUnoKey*/
- )
+ void* /*pXUnoKey*/)
{
- void* pRet = nullptr;
+ if (!pXUnoSMgr)
+ return nullptr;
- if( pXUnoSMgr )
+ Reference< css::lang::XMultiServiceFactory > xMgr(
+ static_cast<css::lang::XMultiServiceFactory*>(pXUnoSMgr));
+
+ Reference< css::lang::XSingleServiceFactory > xFactory;
+
+ if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
+ vcl::DragSource_getSupportedServiceNames() );
+ }
+ else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
{
- Reference< css::lang::XMultiServiceFactory > xMgr(
- static_cast< css::lang::XMultiServiceFactory* >( pXUnoSMgr )
- );
- Reference< css::lang::XSingleServiceFactory > xFactory;
- if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
- {
- xFactory = ::cppu::createSingleFactory(
- xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
- vcl::DragSource_getSupportedServiceNames() );
- }
- else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
- {
- xFactory = ::cppu::createSingleFactory(
- xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance,
- vcl::DropTarget_getSupportedServiceNames() );
- }
- if( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance,
+ vcl::DropTarget_getSupportedServiceNames() );
}
- return pRet;
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ return xFactory.get();
+ }
+
+ return nullptr;
}
} /* extern "C" */