This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new 40e0812660 Port main/svguno to the component context API.
40e0812660 is described below
commit 40e0812660bfe2e7b76a78d3f65adefe135cf9ca
Author: Damjan Jovanovic <[email protected]>
AuthorDate: Fri Jun 6 07:02:42 2025 +0200
Port main/svguno to the component context API.
Patch by: me
(cherry picked from commit c058b6cb56da217017ee772fd47692977a71f895)
---
main/svgio/source/svguno/svguno.cxx | 38 +++++++++++++++------------------
main/svgio/source/svguno/xsvgparser.cxx | 3 ++-
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/main/svgio/source/svguno/svguno.cxx
b/main/svgio/source/svguno/svguno.cxx
index 2162bc63fc..256adeac34 100644
--- a/main/svgio/source/svguno/svguno.cxx
+++ b/main/svgio/source/svguno/svguno.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <uno/environment.h>
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -47,7 +48,7 @@ namespace svgio
{
extern uno::Sequence< rtl::OUString > SAL_CALL
XSvgParser_getSupportedServiceNames();
extern rtl::OUString SAL_CALL XSvgParser_getImplementationName();
- extern uno::Reference< uno::XInterface > SAL_CALL
XSvgParser_createInstance( const uno::Reference< lang::XMultiServiceFactory > &
);
+ extern uno::Reference< uno::XInterface > SAL_CALL
XSvgParser_createInstance( const uno::Reference< uno::XComponentContext > & );
} // end of namespace svgreader
} // end of namespace svgio
@@ -65,29 +66,24 @@ extern "C"
//////////////////////////////////////////////////////////////////////////////
// component_getFactory
-extern "C"
+static struct ::cppu::ImplementationEntry g_component_entries[] =
{
- SVGIO_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char*
pImplName, void* pServiceManager, void* /* pRegistryKey */ )
{
- uno::Reference< lang::XSingleServiceFactory > xFactory;
- void* pRet = 0;
-
-
if(svgio::svgreader::XSvgParser_getImplementationName().equalsAscii(pImplName))
- {
- xFactory = ::cppu::createSingleFactory(
- reinterpret_cast< lang::XMultiServiceFactory *
>(pServiceManager),
- svgio::svgreader::XSvgParser_getImplementationName(),
- svgio::svgreader::XSvgParser_createInstance,
- svgio::svgreader::XSvgParser_getSupportedServiceNames());
- }
-
- if(xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
+ svgio::svgreader::XSvgParser_createInstance,
+ svgio::svgreader::XSvgParser_getImplementationName,
+ svgio::svgreader::XSvgParser_getSupportedServiceNames,
+ ::cppu::createSingleComponentFactory,
+ 0,
+ 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
- return pRet;
+extern "C"
+{
+ SVGIO_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char*
pImplName, void* pServiceManager, void* pRegistryKey )
+ {
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager,
pRegistryKey, g_component_entries );
}
}
diff --git a/main/svgio/source/svguno/xsvgparser.cxx
b/main/svgio/source/svguno/xsvgparser.cxx
index 6f2d128302..16f207a99d 100644
--- a/main/svgio/source/svguno/xsvgparser.cxx
+++ b/main/svgio/source/svguno/xsvgparser.cxx
@@ -28,6 +28,7 @@
#include <svgio/svgreader/svgdocumenthandler.hxx>
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/processfactory.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
@@ -85,7 +86,7 @@ namespace svgio
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"svgio::svgreader::XSvgParser" ) );
}
- uno::Reference< uno::XInterface > SAL_CALL
XSvgParser_createInstance(const uno::Reference< lang::XMultiServiceFactory >&)
+ uno::Reference< uno::XInterface > SAL_CALL
XSvgParser_createInstance(const uno::Reference< uno::XComponentContext >&)
{
return static_cast< ::cppu::OWeakObject* >(new XSvgParser);
}