summaryrefslogtreecommitdiff
path: root/vcl/source/treelist
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-09-24 12:24:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-09-24 17:23:43 +0200
commitd61214b7a864fb5006f1efa579383f3cc1c5f9cd (patch)
treeca6c4d5f90765715a58180e68b4154eb8bfa350b /vcl/source/treelist
parent8eb8636e02d23c6d23bcdbd0257b095ea844fbed (diff)
copy to clipboard without intermediate vcl::Window
Change-Id: I36d26e583e08ef66564e232b54fa00a468a280c6 Reviewed-on: https://gerrit.libreoffice.org/79453 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/treelist')
-rw-r--r--vcl/source/treelist/transfer.cxx39
1 files changed, 23 insertions, 16 deletions
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index f91f0aff0699..4415dc6fcf01 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -916,17 +916,10 @@ void TransferableHelper::PrepareOLE( const TransferableObjectDescriptor& rObjDes
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
}
-
-void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const
+void TransferableHelper::CopyToClipboard(const Reference<XClipboard>& rClipboard) const
{
- DBG_ASSERT( pWindow, "Window pointer is NULL" );
- Reference< XClipboard > xClipboard;
-
- if( pWindow )
- xClipboard = pWindow->GetClipboard();
-
- if( xClipboard.is() )
- mxClipboard = xClipboard;
+ if( rClipboard.is() )
+ mxClipboard = rClipboard;
if( !(mxClipboard.is() && !mxTerminateListener.is()) )
return;
@@ -945,16 +938,20 @@ void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const
}
}
-
-void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const
+void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const
{
DBG_ASSERT( pWindow, "Window pointer is NULL" );
- Reference< XClipboard > xSelection;
+ Reference< XClipboard > xClipboard;
if( pWindow )
- xSelection = pWindow->GetPrimarySelection();
+ xClipboard = pWindow->GetClipboard();
+
+ CopyToClipboard(xClipboard);
+}
- if( !(xSelection.is() && !mxTerminateListener.is()) )
+void TransferableHelper::CopyToSelection(const Reference<XClipboard>& rSelection) const
+{
+ if( !(rSelection.is() && !mxTerminateListener.is()) )
return;
try
@@ -964,13 +961,23 @@ void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const
Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
xDesktop->addTerminateListener( pThis->mxTerminateListener );
- xSelection->setContents( pThis, pThis );
+ rSelection->setContents( pThis, pThis );
}
catch( const css::uno::Exception& )
{
}
}
+void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const
+{
+ DBG_ASSERT( pWindow, "Window pointer is NULL" );
+ Reference< XClipboard > xSelection;
+
+ if( pWindow )
+ xSelection = pWindow->GetPrimarySelection();
+
+ CopyToSelection(xSelection);
+}
void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceActions )