summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-07-11 10:21:15 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-07-11 10:24:13 +0200
commit73cdc655fb16fa229324d66eba01f0a3262314a4 (patch)
treec8cbec3f119508d99e5abc5ddbf61b8ff8920170
parent81a608e930c29f6210524df939c7a1d8b1093069 (diff)
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
-rw-r--r--offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl23
-rw-r--r--offapi/com/sun/star/datatransfer/clipboard/XSystemClipboard.idl2
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx5
-rw-r--r--vcl/source/window/window.cxx42
-rw-r--r--vcl/unx/generic/dtrans/X11_clipboard.cxx6
-rw-r--r--vcl/unx/generic/dtrans/X11_clipboard.hxx5
6 files changed, 27 insertions, 56 deletions
diff --git a/offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl b/offapi/com/sun/star/datatransfer/clipboard/SystemClipboard.idl
index 0041471b81b2..9c5c780c4962 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 146db5bf4653..1cb96db1ece8 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 5be6f14bc60c..afe3eb1a3f8f 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 9ad12cf1e126..a0de356ff3eb 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 6325e19e7f1e..0af14a460ff1 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 18c08b036f7e..cb26b67754ab 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
*/