summaryrefslogtreecommitdiff
path: root/vcl/source/components
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/source/components
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/source/components')
-rw-r--r--vcl/source/components/dtranscomp.cxx60
-rw-r--r--vcl/source/components/factory.cxx6
2 files changed, 7 insertions, 59 deletions
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,