[Libreoffice-commits] core.git: include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Jan 19 19:25:07 UTC 2020
include/vcl/transfer.hxx | 1 +
vcl/source/treelist/transfer.cxx | 27 ++++++++++++++++-----------
2 files changed, 17 insertions(+), 11 deletions(-)
New commits:
commit 3f3b2aa014fd8c610825ecdf0c91fe6271a8aad3
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jan 19 17:06:43 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jan 19 20:24:29 2020 +0100
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 at redhat.com>
diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx
index 188e78132380..2a72fd6fab23 100644
--- a/include/vcl/transfer.hxx
+++ b/include/vcl/transfer.hxx
@@ -363,6 +363,7 @@ public:
css::uno::Reference<css::io::XInputStream> GetInputStream( SotClipboardFormatId nFormat, const OUString& rDestDoc );
css::uno::Reference<css::io::XInputStream> GetInputStream( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
+ static TransferableDataHelper CreateFromClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& rClipboard);
static TransferableDataHelper CreateFromSystemClipboard( vcl::Window * pWindow );
static TransferableDataHelper CreateFromSelection( vcl::Window * pWindow );
static bool IsEqual( const css::datatransfer::DataFlavor& rInternalFlavor,
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 )
{
More information about the Libreoffice-commits
mailing list