[Libreoffice-commits] core.git: cui/source include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 24 15:24:47 UTC 2019
cui/source/tabpages/autocdlg.cxx | 2 +-
include/vcl/transfer.hxx | 5 +++++
vcl/source/treelist/transfer.cxx | 39 +++++++++++++++++++++++----------------
3 files changed, 29 insertions(+), 17 deletions(-)
New commits:
commit d61214b7a864fb5006f1efa579383f3cc1c5f9cd
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 24 12:24:19 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 24 17:23:43 2019 +0200
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index ca22e820f569..5fa49a106d6a 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -2088,7 +2088,7 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const
#endif
}
pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() );
- pCntnr->CopyToClipboard( static_cast<vcl::Window*>(const_cast<OfaAutoCompleteTabPage *>(this)) );
+ pCntnr->CopyToClipboard(GetSystemClipboard());
}
}
diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx
index 3373f3e032a9..8d5e47548592 100644
--- a/include/vcl/transfer.hxx
+++ b/include/vcl/transfer.hxx
@@ -250,8 +250,13 @@ public:
void PrepareOLE( const TransferableObjectDescriptor& rObjDesc );
+ void CopyToClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard) const;
+ void CopyToSelection(const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard) const;
+
+ // convenience versions of the above which extract the XClipboard from the pWindow
void CopyToClipboard( vcl::Window *pWindow ) const;
void CopyToSelection( vcl::Window *pWindow ) const;
+
void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions );
static void ClearSelection( vcl::Window *pWindow );
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 )
More information about the Libreoffice-commits
mailing list