summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-23 16:36:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-23 21:38:44 +0200
commit09a3b52f883783a2047d77b058d085a3b14e4c9b (patch)
tree75e924a3885e63f6929874370575c60a9f97c06a /extensions
parent252c29e63ab63c2acc9ce0e02289d1688cc9b096 (diff)
extensions/scanner: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Ibf8247cb0321e6c1125a6ee49cdabdc8d4218b22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99325 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Library_scn.mk1
-rw-r--r--extensions/source/scanner/scanner.cxx26
-rw-r--r--extensions/source/scanner/scanner.hxx4
-rw-r--r--extensions/source/scanner/scn.component5
-rw-r--r--extensions/source/scanner/scnserv.cxx51
5 files changed, 14 insertions, 73 deletions
diff --git a/extensions/Library_scn.mk b/extensions/Library_scn.mk
index a95675823495..4fc8788e851d 100644
--- a/extensions/Library_scn.mk
+++ b/extensions/Library_scn.mk
@@ -40,7 +40,6 @@ $(eval $(call gb_Library_use_libraries,scn,\
))
$(eval $(call gb_Library_add_exception_objects,scn,\
- extensions/source/scanner/scnserv \
extensions/source/scanner/scanner \
))
diff --git a/extensions/source/scanner/scanner.cxx b/extensions/source/scanner/scanner.cxx
index ae0bd96893c8..b661a4f7e254 100644
--- a/extensions/source/scanner/scanner.cxx
+++ b/extensions/source/scanner/scanner.cxx
@@ -21,6 +21,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/namedvaluecollection.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
Reference< XInterface > ScannerManager_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& /*rxFactory*/ )
{
@@ -49,7 +50,7 @@ Sequence< sal_Int8 > SAL_CALL ScannerManager::getMaskDIB()
OUString ScannerManager::getImplementationName()
{
- return getImplementationName_Static();
+ return "com.sun.star.scanner.ScannerManager";
}
@@ -61,20 +62,7 @@ sal_Bool ScannerManager::supportsService(OUString const & ServiceName)
css::uno::Sequence<OUString> ScannerManager::getSupportedServiceNames()
{
- return getSupportedServiceNames_Static();
-}
-
-
-OUString ScannerManager::getImplementationName_Static() throw()
-{
- return "com.sun.star.scanner.ScannerManager";
-}
-
-
-Sequence< OUString > ScannerManager::getSupportedServiceNames_Static() throw ()
-{
- Sequence< OUString > aSNS { "com.sun.star.scanner.ScannerManager" };
- return aSNS;
+ return { "com.sun.star.scanner.ScannerManager" };
}
@@ -90,4 +78,12 @@ void SAL_CALL ScannerManager::initialize(const css::uno::Sequence<css::uno::Any>
aProperties.get("ParentWindow") >>= mxDialogParent;
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_ScannerManager_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new ScannerManager());
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/scanner/scanner.hxx b/extensions/source/scanner/scanner.hxx
index 9f59fccc6957..42e03a4533eb 100644
--- a/extensions/source/scanner/scanner.hxx
+++ b/extensions/source/scanner/scanner.hxx
@@ -73,10 +73,6 @@ public:
virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
- // Misc
- static OUString getImplementationName_Static() throw();
- static Sequence< OUString > getSupportedServiceNames_Static() throw();
-
#ifdef _WIN32
void* GetData() const { return mpData; }
#endif
diff --git a/extensions/source/scanner/scn.component b/extensions/source/scanner/scn.component
index 6fe7af4ebfda..19215a7c3a91 100644
--- a/extensions/source/scanner/scn.component
+++ b/extensions/source/scanner/scn.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="scn" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.scanner.ScannerManager">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.scanner.ScannerManager"
+ constructor="extensions_ScannerManager_get_implementation">
<service name="com.sun.star.scanner.ScannerManager"/>
</implementation>
</component>
diff --git a/extensions/source/scanner/scnserv.cxx b/extensions/source/scanner/scnserv.cxx
deleted file mode 100644
index 5c5cca36b0d2..000000000000
--- a/extensions/source/scanner/scnserv.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cppuhelper/factory.hxx>
-#include "scanner.hxx"
-
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace com::sun::star::registry;
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* scn_component_getFactory( const char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
-{
- Reference< css::lang::XSingleServiceFactory > xFactory;
- void* pRet = nullptr;
-
- if( OUString::createFromAscii( pImplName ) == ScannerManager::getImplementationName_Static() )
- {
- xFactory.set( ::cppu::createSingleFactory(
- static_cast< css::lang::XMultiServiceFactory* >( pServiceManager ),
- ScannerManager::getImplementationName_Static(),
- ScannerManager_CreateInstance,
- ScannerManager::getSupportedServiceNames_Static() ) );
- }
-
- if( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */