summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/tabpages/autocdlg.cxx2
-rw-r--r--include/vcl/transfer.hxx5
-rw-r--r--vcl/source/treelist/transfer.cxx39
3 files changed, 29 insertions, 17 deletions
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 )