summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-07 15:55:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-07 19:58:39 +0200
commit05d286e0065ff1c10e75827ac4726b5a74747128 (patch)
tree4c04007256ca9a07e99171dfe0a9709f94f9afca /vcl
parent616dc30585943b2d9bdae0d2b9e95567f8c7641f (diff)
vcl/clipboard: create instances with uno constructors
See tdf#74608 for motivation Change-Id: I8b50ccb014adeba8fa5084bcb804dfa61fa61159 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98265 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/factory.hxx5
-rw-r--r--vcl/source/components/dtranscomp.cxx60
-rw-r--r--vcl/source/components/factory.cxx6
-rw-r--r--vcl/vcl.android.component5
-rw-r--r--vcl/vcl.ios.component5
-rw-r--r--vcl/vcl.macosx.component3
-rw-r--r--vcl/vcl.unx.component3
7 files changed, 17 insertions, 70 deletions
diff --git a/vcl/inc/factory.hxx b/vcl/inc/factory.hxx
index f32fdaee6012..4a808d29c70b 100644
--- a/vcl/inc/factory.hxx
+++ b/vcl/inc/factory.hxx
@@ -36,11 +36,6 @@ namespace com::sun::star {
namespace vcl {
-OUString Clipboard_getImplementationName();
-
-css::uno::Reference<css::lang::XSingleServiceFactory>
-Clipboard_createFactory();
-
css::uno::Sequence<OUString> DragSource_getSupportedServiceNames();
OUString DragSource_getImplementationName();
diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx
index c7bda5361fdb..7e5f36f67f7d 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -185,64 +185,16 @@ void GenericClipboard::removeClipboardListener( const Reference< datatransfer::c
m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), listener), m_aListeners.end());
}
-namespace {
-
-class ClipboardFactory : public ::cppu::WeakComponentImplHelper<
- css::lang::XSingleServiceFactory
->
-{
- osl::Mutex m_aMutex;
-public:
- ClipboardFactory();
-
- /*
- * XSingleServiceFactory
- */
- virtual Reference< XInterface > SAL_CALL createInstance() override;
- virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& rArgs ) override;
-};
-
-}
-
-ClipboardFactory::ClipboardFactory() :
- cppu::WeakComponentImplHelper<
- css::lang::XSingleServiceFactory
->( m_aMutex )
-{
-}
-Reference< XInterface > ClipboardFactory::createInstance()
-{
- return createInstanceWithArguments( Sequence< Any >() );
-}
-Reference< XInterface > ClipboardFactory::createInstanceWithArguments( const Sequence< Any >& arguments )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+vcl_SystemClipboard_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& args)
{
SolarMutexGuard aGuard;
- Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateClipboard( arguments );
- return xResult;
-}
-
-OUString Clipboard_getImplementationName()
-{
- return
- #if defined MACOSX
- "com.sun.star.datatransfer.clipboard.AquaClipboard"
- #elif defined IOS
- "com.sun.star.datatransfer.clipboard.iOSClipboard"
- #elif defined ANDROID
- "com.sun.star.datatransfer.VCLGenericClipboard"
- #elif defined UNX
- "com.sun.star.datatransfer.X11ClipboardSupport"
- #else
- "com.sun.star.datatransfer.VCLGenericClipboard"
- #endif
- ;
-}
-
-Reference< XSingleServiceFactory > Clipboard_createFactory()
-{
- return Reference< XSingleServiceFactory >( new ClipboardFactory() );
+ auto xClipboard = ImplGetSVData()->mpDefInst->CreateClipboard( args );
+ xClipboard->acquire();
+ return xClipboard.get();
}
namespace {
diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx
index 6c1cfe2ec872..0a5b7e8f6f8c 100644
--- a/vcl/source/components/factory.cxx
+++ b/vcl/source/components/factory.cxx
@@ -43,11 +43,7 @@ extern "C" {
static_cast< css::lang::XMultiServiceFactory* >( pXUnoSMgr )
);
Reference< css::lang::XSingleServiceFactory > xFactory;
- if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
- {
- xFactory = vcl::Clipboard_createFactory();
- }
- else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
+ if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
{
xFactory = ::cppu::createSingleFactory(
xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
diff --git a/vcl/vcl.android.component b/vcl/vcl.android.component
index b81e61591471..d59855a7342e 100644
--- a/vcl/vcl.android.component
+++ b/vcl/vcl.android.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="vcl" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.datatransfer.VCLGenericClipboard">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.datatransfer.VCLGenericClipboard"
+ constructor="vcl_SystemClipboard_get_implementation">
<service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/>
</implementation>
<implementation name="com.sun.star.frame.VCLSessionManagerClient"
diff --git a/vcl/vcl.ios.component b/vcl/vcl.ios.component
index 17e91391b855..21f73b70e705 100644
--- a/vcl/vcl.ios.component
+++ b/vcl/vcl.ios.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="vcl" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.datatransfer.clipboard.iOSClipboard">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.datatransfer.clipboard.iOSClipboard"
+ constructor="vcl_SystemClipboard_get_implementation">
<service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/>
</implementation>
<implementation name="com.sun.star.frame.VCLSessionManagerClient"
diff --git a/vcl/vcl.macosx.component b/vcl/vcl.macosx.component
index 98339e3ce573..3ae39a371909 100644
--- a/vcl/vcl.macosx.component
+++ b/vcl/vcl.macosx.component
@@ -25,7 +25,8 @@
<implementation name="com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1">
<service name="com.sun.star.datatransfer.dnd.OleDropTarget"/>
</implementation>
- <implementation name="com.sun.star.datatransfer.clipboard.AquaClipboard">
+ <implementation name="com.sun.star.datatransfer.clipboard.AquaClipboard"
+ constructor="vcl_SystemClipboard_get_implementation">
<service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/>
</implementation>
<implementation name="com.sun.star.frame.VCLSessionManagerClient"
diff --git a/vcl/vcl.unx.component b/vcl/vcl.unx.component
index 70b3370c6ae3..30506b721155 100644
--- a/vcl/vcl.unx.component
+++ b/vcl/vcl.unx.component
@@ -19,7 +19,8 @@
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="vcl" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.datatransfer.X11ClipboardSupport">
+ <implementation name="com.sun.star.datatransfer.X11ClipboardSupport"
+ constructor="vcl_SystemClipboard_get_implementation">
<service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/>
</implementation>
<implementation name="com.sun.star.datatransfer.dnd.XdndDropTarget">