[Libreoffice-commits] core.git: offapi/com toolkit/source vcl/source vcl/unx

Stephan Bergmann sbergman at redhat.com
Thu Jul 11 01:24:34 PDT 2013


 offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl  |   23 -----
 offapi/com/sun/star/datatransfer/clipboard/XSystemClipboard.idl |    2 
 toolkit/source/awt/vclxtoolkit.cxx                              |    5 -
 vcl/source/window/window.cxx                                    |   42 +++++-----
 vcl/unx/generic/dtrans/X11_clipboard.cxx                        |    6 -
 vcl/unx/generic/dtrans/X11_clipboard.hxx                        |    5 -
 6 files changed, 27 insertions(+), 56 deletions(-)

New commits:
commit 73cdc655fb16fa229324d66eba01f0a3262314a4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jul 11 10:21:15 2013 +0200

    fdo#66718: Demote SystemClipboard.createUnix to an internal hack
    
    ...see <https://bugs.freedesktop.org/show_bug.cgi?id=66718#c8> for details.
    
    Change-Id: I6e786ce21f41e51b480d0113ac0bd6a0013f4fb1

diff --git a/offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl b/offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl
index 0041471..9c5c780 100644
--- a/offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl
+++ b/offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl
@@ -20,35 +20,14 @@
 #ifndef __com_sun_star_datatransfer_clipboard_SystemClipboard_idl__
 #define __com_sun_star_datatransfer_clipboard_SystemClipboard_idl__
 
-#include <com/sun/star/awt/XDisplayConnection.idl>
 #include <com/sun/star/datatransfer/clipboard/XSystemClipboard.idl>
-#include <com/sun/star/script/XInvocation.idl>
-
 
 module com { module sun { module star { module datatransfer { module clipboard {
 
-
 /** The system clipboard service builds a bridge to the OS specific clipboard
     interfaces.
-
-    <br/><br/><p><strong>Notes:</strong> The Unix implementation needs to be instantiated with 2 Arguments:
-    <ul>
-        <li>A com::sun::star::awt::XDisplayConnection that provides the
-        display to be used.</li>
-        <li>A string that names the selection to be used</li>
-    </ul>
-    It is possible to use clipboards for different selections simultaneously.</p>
 */
-published service SystemClipboard : XSystemClipboard
-{
-    createDefault();
-
-    /** This method is only valid for unix systems (excluding MacOS) */
-    createUnix([in] com::sun::star::awt::XDisplayConnection DisplayConnection,
-               [in] string ClipboardName,
-               [in] com::sun::star::script::XInvocation BmpConverter);
-};
-
+published service SystemClipboard : XSystemClipboard;
 
 }; }; }; }; };
 
diff --git a/offapi/com/sun/star/datatransfer/clipboard/XSystemClipboard.idl b/offapi/com/sun/star/datatransfer/clipboard/XSystemClipboard.idl
index 146db5b..1cb96db 100644
--- a/offapi/com/sun/star/datatransfer/clipboard/XSystemClipboard.idl
+++ b/offapi/com/sun/star/datatransfer/clipboard/XSystemClipboard.idl
@@ -31,7 +31,7 @@ module com { module sun { module star { module datatransfer { module clipboard {
 /**
     Provides a unified interface for new-style service SystemClipboard.
 
-    @since LibreOffice 4.1
+    @since LibreOffice 4.2
 */
 published interface XSystemClipboard
 {
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 5be6f14..afe3eb1 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1315,10 +1315,9 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
     {
         if( !mxClipboard.is() )
         {
-            ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
             // remember clipboard here
-            mxClipboard = ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > (
-                ::com::sun::star::datatransfer::clipboard::SystemClipboard::createDefault(xContext), ::com::sun::star::uno::UNO_QUERY );
+            mxClipboard = css::datatransfer::clipboard::SystemClipboard::create(
+                comphelper::getProcessComponentContext());
         }
 
         return mxClipboard;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 9ad12cf..a0de356 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8480,20 +8480,15 @@ uno::Reference< XClipboard > Window::GetClipboard()
         {
             try
             {
-                uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
-                Reference<XSystemClipboard> xSystemClipboard;
-#if defined(UNX) && !defined(MACOSX)          // unix clipboard needs to be initialized
-                xSystemClipboard = SystemClipboard::createUnix( xContext, Application::GetDisplayConnection(), "CLIPBOARD", vcl::createBmpConverter() );
-#else
-                xSystemClipboard = SystemClipboard::createDefault(xContext);
-#endif
-                mpWindowImpl->mpFrameData->mxClipboard.set( xSystemClipboard, UNO_QUERY );
+                mpWindowImpl->mpFrameData->mxClipboard
+                    = css::datatransfer::clipboard::SystemClipboard::create(
+                        comphelper::getProcessComponentContext());
             }
-            // createInstance can throw any exception
-            catch (const Exception&)
+            catch (css::uno::DeploymentException & e)
             {
-                // release all instances
-                mpWindowImpl->mpFrameData->mxClipboard.clear();
+                SAL_WARN(
+                    "vcl.window",
+                    "ignoring DeploymentException \"" << e.Message << "\"");
             }
         }
 
@@ -8518,8 +8513,18 @@ uno::Reference< XClipboard > Window::GetPrimarySelection()
                 uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
 
 #if defined(UNX) && !defined(MACOSX)
-                Reference<XSystemClipboard> xSystemClipboard = SystemClipboard::createUnix( xContext, Application::GetDisplayConnection(), "PRIMARY", vcl::createBmpConverter() );
-                mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xSystemClipboard, UNO_QUERY );
+                // A hack, making the primary selection available as an instance of
+                // the SystemClipboard service on X11:
+                css::uno::Sequence<css::uno::Any> args(3);
+                args[0] <<= Application::GetDisplayConnection();
+                args[1] <<= OUString("PRIMARY");
+                args[2] <<= vcl::createBmpConverter();
+                mpWindowImpl->mpFrameData->mxSelection.set(
+                    (xContext->getServiceManager()->
+                     createInstanceWithArgumentsAndContext(
+                         "com.sun.star.datatransfer.clipboard.SystemClipboard",
+                         args, xContext)),
+                    css::uno::UNO_QUERY_THROW);
 #       else
                 static uno::Reference< XClipboard > s_xSelection(
                     xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.datatransfer.clipboard.GenericClipboard", xContext ), UNO_QUERY );
@@ -8527,12 +8532,11 @@ uno::Reference< XClipboard > Window::GetPrimarySelection()
                 mpWindowImpl->mpFrameData->mxSelection = s_xSelection;
 #       endif
             }
-
-            // createInstance can throw any exception
-            catch (const Exception&)
+            catch (css::uno::RuntimeException & e)
             {
-                // release all instances
-                mpWindowImpl->mpFrameData->mxSelection.clear();
+                SAL_WARN(
+                    "vcl.window",
+                    "ignoring RuntimeException \"" << e.Message << "\"");
             }
         }
 
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.cxx b/vcl/unx/generic/dtrans/X11_clipboard.cxx
index 6325e19..0af14a4 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.cxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.cxx
@@ -267,12 +267,6 @@ sal_Bool SAL_CALL X11Clipboard::supportsService( const OUString& ServiceName )
 
 // ------------------------------------------------------------------------
 
-void SAL_CALL X11Clipboard::initialize( const Sequence< Any >& ) throw( ::com::sun::star::uno::Exception )
-{
-}
-
-// ------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL X11Clipboard::getSupportedServiceNames(    )
     throw(RuntimeException)
 {
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.hxx b/vcl/unx/generic/dtrans/X11_clipboard.hxx
index 18c08b0..cb26b67 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.hxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.hxx
@@ -64,11 +64,6 @@ namespace x11 {
         static X11Clipboard* get( const OUString& rDisplayName, Atom aSelection );
 
         /*
-         *  XInitialization
-         */
-        virtual void SAL_CALL initialize( const Sequence< Any >& arguments ) throw(  ::com::sun::star::uno::Exception );
-
-        /*
          * XServiceInfo
          */
 


More information about the Libreoffice-commits mailing list