[Libreoffice-commits] core.git: winaccessibility/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 16:32:24 UTC 2020


 winaccessibility/source/service/msaaservice_impl.cxx       |   65 ++-----------
 winaccessibility/source/service/winaccessibility.component |    5 -
 2 files changed, 16 insertions(+), 54 deletions(-)

New commits:
commit dede9ec2890f8fe014a2d0fdd84fffd414ce23b6
Author:     Noel Grandin <noel at peralex.com>
AuthorDate: Tue Jul 14 13:00:19 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 14 18:31:39 2020 +0200

    winaccessibility: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: I8b3465ddec68b99c78cb6cc8193f4944ed5ba190
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98727
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx
index 02ac891f5d4b..be9fd22ba58e 100644
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -46,17 +46,6 @@ using namespace ::com::sun::star::awt;
 namespace my_sc_impl
 {
 
-static Sequence< OUString > getSupportedServiceNames_MSAAServiceImpl()
-{
-    Sequence< OUString > seqNames { "com.sun.star.accessibility.MSAAService" };
-    return seqNames;
-}
-
-static OUString getImplementationName_MSAAServiceImpl()
-{
-    return "com.sun.star.accessibility.my_sc_implementation.MSAAService";
-}
-
 namespace {
 
 class MSAAServiceImpl : public ::cppu::WeakImplHelper<
@@ -127,7 +116,7 @@ void MSAAServiceImpl::handleWindowOpened(sal_Int64 nAcc)
 
 OUString MSAAServiceImpl::getImplementationName()
 {
-    return getImplementationName_MSAAServiceImpl();
+    return "com.sun.star.accessibility.my_sc_implementation.MSAAService";
 }
 
 /**
@@ -147,7 +136,7 @@ sal_Bool MSAAServiceImpl::supportsService( OUString const & serviceName )
    */
 Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames()
 {
-    return getSupportedServiceNames_MSAAServiceImpl();
+   return { "com.sun.star.accessibility.MSAAService" };
 }
 
 static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > &xAccMgr,
@@ -239,22 +228,6 @@ static void AccessBridgeUpdateOldTopWindows( const Reference< XMSAAService > &xA
     }
 }
 
-/**
- * Static method that can create an entity of our MSAA Service
- * @param xContext No use here.
- * @return The object interface.
- */
-static Reference< XInterface > create_MSAAServiceImpl( Reference< XComponentContext > const & /*xContext*/ )
-{
-    Reference< XMSAAService > xAccMgr( new MSAAServiceImpl() );
-
-    AccessBridgeUpdateOldTopWindows( xAccMgr );
-
-    SAL_INFO("iacc2", "Created new IAccessible2 service impl.");
-
-    return xAccMgr;
-}
-
 MSAAServiceImpl::MSAAServiceImpl()
 {
     Reference< XExtendedToolkit > xToolkit(Application::GetVCLToolkit(), UNO_QUERY);
@@ -283,32 +256,20 @@ void MSAAServiceImpl::dispose()
     m_pTopWindowListener.clear();
 }
 
-}
-
-/* shared lib exports implemented without helpers in service_impl1.cxx */
-namespace my_sc_impl
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+winaccessibility_MSAAServiceImpl_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-static struct ::cppu::ImplementationEntry s_component_entries [] =
-    {
-        {
-            create_MSAAServiceImpl, getImplementationName_MSAAServiceImpl,
-            getSupportedServiceNames_MSAAServiceImpl,
-            ::cppu::createSingleComponentFactory,
-            nullptr, 0
-        },
-        { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-    };
+    Reference< XMSAAService > xAccMgr( new MSAAServiceImpl() );
+
+    AccessBridgeUpdateOldTopWindows( xAccMgr );
+
+    SAL_INFO("iacc2", "Created new IAccessible2 service impl.");
+
+    xAccMgr->acquire();
+    return xAccMgr.get();
 }
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT void * iacc2_component_getFactory(
-        sal_Char const * implName, lang::XMultiServiceFactory * xMgr,
-        registry::XRegistryKey * xRegistry )
-    {
-        return ::cppu::component_getFactoryHelper(
-                   implName, xMgr, xRegistry, ::my_sc_impl::s_component_entries );
-    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/winaccessibility/source/service/winaccessibility.component b/winaccessibility/source/service/winaccessibility.component
index 8c61403e0066..fe26e40e20d8 100644
--- a/winaccessibility/source/service/winaccessibility.component
+++ b/winaccessibility/source/service/winaccessibility.component
@@ -17,8 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  -->
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="iacc2" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.accessibility.my_sc_implementation.MSAAService">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.accessibility.my_sc_implementation.MSAAService"
+    constructor="winaccessibility_MSAAServiceImpl_get_implementation">
     <service name="com.sun.star.accessibility.MSAAService"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list