[Libreoffice-commits] core.git: solenv/bin vcl/inc vcl/source vcl/vcl.android.component vcl/vcl.ios.component vcl/vcl.macosx.component vcl/vcl.unx.component

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 7 17:59:24 UTC 2020


 solenv/bin/native-code.py            |    2 +
 vcl/inc/factory.hxx                  |    5 --
 vcl/source/components/dtranscomp.cxx |   60 +++--------------------------------
 vcl/source/components/factory.cxx    |    6 ---
 vcl/vcl.android.component            |    5 +-
 vcl/vcl.ios.component                |    5 +-
 vcl/vcl.macosx.component             |    3 +
 vcl/vcl.unx.component                |    3 +
 8 files changed, 19 insertions(+), 70 deletions(-)

New commits:
commit 05d286e0065ff1c10e75827ac4726b5a74747128
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 7 15:55:05 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 7 19:58:39 2020 +0200

    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 at collabora.co.uk>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index d9d50e81103d..4f387be3186a 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -304,6 +304,8 @@ core_constructor_list = [
 # uui/util/uui.component
     "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation",
     "com_sun_star_comp_uui_UUIInteractionRequestStringResolver_get_implementation",
+# vcl/*.component
+    "vcl_SystemClipboard_get_implementation",
 # xmloff/source/transform/xof.component
     "xmloff_XMLCalcContentImportOOO_get_implementation",
     "xmloff_XMLCalcImportOOO_get_implementation",
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">


More information about the Libreoffice-commits mailing list