summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-19 17:06:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-19 20:24:29 +0100
commit3f3b2aa014fd8c610825ecdf0c91fe6271a8aad3 (patch)
tree02628caf8447c0fe42790741199b5ee1ca5854fe /vcl
parent6afb18bc5fbc530d6404eac1c9e7191e58de27fc (diff)
refactor CreateFromClipboard to support not passing in a vcl::Window
Change-Id: I0474f390b34649debae18defdd1e860d7806b045 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87044 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/treelist/transfer.cxx27
1 files changed, 16 insertions, 11 deletions
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 6383e43e0c70..51f6f2e14f8f 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -2118,28 +2118,21 @@ void TransferableDataHelper::StopClipboardListening( )
}
}
-
-TransferableDataHelper TransferableDataHelper::CreateFromSystemClipboard( vcl::Window * pWindow )
+TransferableDataHelper TransferableDataHelper::CreateFromClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& rClipboard)
{
- DBG_ASSERT( pWindow, "Window pointer is NULL" );
-
- Reference< XClipboard > xClipboard;
TransferableDataHelper aRet;
- if( pWindow )
- xClipboard = pWindow->GetClipboard();
-
- if( xClipboard.is() )
+ if( rClipboard.is() )
{
try
{
- Reference< XTransferable > xTransferable( xClipboard->getContents() );
+ Reference< XTransferable > xTransferable( rClipboard->getContents() );
if( xTransferable.is() )
{
aRet = TransferableDataHelper( xTransferable );
// also copy the clipboard
- aRet.mxClipboard = xClipboard;
+ aRet.mxClipboard = rClipboard;
}
}
catch( const css::uno::Exception& )
@@ -2150,6 +2143,18 @@ TransferableDataHelper TransferableDataHelper::CreateFromSystemClipboard( vcl::W
return aRet;
}
+TransferableDataHelper TransferableDataHelper::CreateFromSystemClipboard( vcl::Window * pWindow )
+{
+ DBG_ASSERT( pWindow, "Window pointer is NULL" );
+
+ Reference< XClipboard > xClipboard;
+
+ if( pWindow )
+ xClipboard = pWindow->GetClipboard();
+
+ return CreateFromClipboard(xClipboard);
+}
+
TransferableDataHelper TransferableDataHelper::CreateFromSelection( vcl::Window* pWindow )
{