Kaydet (Commit) 73cdc655 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 81a608e9
......@@ -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;
}; }; }; }; };
......
......@@ -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
{
......
......@@ -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;
......
......@@ -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 << "\"");
}
}
......
......@@ -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)
{
......
......@@ -63,11 +63,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
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment