diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-05-06 11:32:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-05-06 17:06:50 +0200 |
commit | 130486015f03087aa4c2c43709ce95fb494df44b (patch) | |
tree | fdfc094a8ebc20e4a2e511928c7b53e4bc733475 /svx | |
parent | ed7271d9d44fe1a0195ae669644f23c01b6960d8 (diff) |
use Widget::get_clipboard
there's no different from GetSystemClipboard except potentially for
the libreofficekit case where per-frame clipboards are possible
Change-Id: I3173e39f81a03a7cbe114ebca6020d5ed36a659a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115179
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/weldeditview.cxx | 5 | ||||
-rw-r--r-- | svx/source/form/fmexch.cxx | 8 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 8 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 5 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 5 | ||||
-rw-r--r-- | svx/source/inc/fmexch.hxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 7 |
7 files changed, 28 insertions, 14 deletions
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx index 4f035f67df6f..cc6d0588109c 100644 --- a/svx/source/dialog/weldeditview.cxx +++ b/svx/source/dialog/weldeditview.cxx @@ -1624,6 +1624,11 @@ css::uno::Reference<css::datatransfer::dnd::XDropTarget> WeldEditView::GetDropTa return m_xDropTarget; } +css::uno::Reference<css::datatransfer::clipboard::XClipboard> WeldEditView::GetClipboard() const +{ + return weld::CustomWidgetController::GetClipboard(); +} + namespace { class WeldEditViewUIObject final : public DrawingAreaUIObject diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx index 002b3b6175fc..720c3720fe72 100644 --- a/svx/source/form/fmexch.cxx +++ b/svx/source/form/fmexch.cxx @@ -34,7 +34,7 @@ namespace svxform { } - void OLocalExchange::copyToClipboard(const GrantAccess&) + void OLocalExchange::copyToClipboard(const weld::Widget& rWidget, const GrantAccess&) { if ( m_bClipboardOwner ) { // simulate a lostOwnership to notify parties interested in @@ -42,7 +42,7 @@ namespace svxform } m_bClipboardOwner = true; - CopyToClipboard(GetSystemClipboard()); + CopyToClipboard(rWidget.get_clipboard()); } void OLocalExchange::clear() @@ -320,10 +320,10 @@ namespace svxform implReset(); } - void OLocalExchangeHelper::copyToClipboard( ) const + void OLocalExchangeHelper::copyToClipboard(const weld::Widget& rWidget) const { DBG_ASSERT( m_xTransferable.is(), "OLocalExchangeHelper::copyToClipboard: not prepared!" ); - m_xTransferable->copyToClipboard(OLocalExchange::GrantAccess()); + m_xTransferable->copyToClipboard(rWidget, OLocalExchange::GrantAccess()); } void OLocalExchangeHelper::implReset() diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index bade46460186..42947238be2d 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -700,7 +700,7 @@ namespace svxform return false; // get the clipboard - TransferableDataHelper aClipboardContent(TransferableDataHelper::CreateFromClipboard(GetSystemClipboard())); + TransferableDataHelper aClipboardContent(TransferableDataHelper::CreateFromClipboard(m_xTreeView->get_clipboard())); sal_Int8 nAction = m_aControlExchange.isClipboardOwner() && doingKeyboardCut( ) ? DND_ACTION_MOVE : DND_ACTION_COPY; std::unique_ptr<weld::TreeIter> xSelected(m_xTreeView->make_iterator()); @@ -1157,7 +1157,7 @@ namespace svxform else { // the clipboard content - Reference< XClipboard > xClipboard( GetSystemClipboard() ); + Reference< XClipboard > xClipboard(m_xTreeView->get_clipboard()); Reference< XTransferable > xTransferable; if ( xClipboard.is() ) xTransferable = xClipboard->getContents(); @@ -1177,7 +1177,7 @@ namespace svxform if ( implPrepareExchange( DND_ACTION_COPY ) ) { m_aControlExchange.setClipboardListener( LINK( this, NavigatorTree, OnClipboardAction ) ); - m_aControlExchange.copyToClipboard( ); + m_aControlExchange.copyToClipboard(*m_xTreeView); } } @@ -1210,7 +1210,7 @@ namespace svxform return; m_aControlExchange.setClipboardListener( LINK( this, NavigatorTree, OnClipboardAction ) ); - m_aControlExchange.copyToClipboard( ); + m_aControlExchange.copyToClipboard(*m_xTreeView); m_bKeyboardCut = true; // mark all the entries we just "cut" into the clipboard as "nearly moved" diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index cd3d943ec5e4..da0df464d71f 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -1145,13 +1145,14 @@ void GalleryBrowser2::Execute(std::string_view rIdent) } else if (rIdent == "copy") { - mpCurTheme->CopyToClipboard(mnCurActionPos); + mpCurTheme->CopyToClipboard(*GetViewWindow(), mnCurActionPos); } else if (rIdent == "paste") { if( !mpCurTheme->IsReadOnly() ) { - TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromClipboard(GetSystemClipboard())); + weld::Widget* pParent = GetViewWindow(); + TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromClipboard(pParent->get_clipboard())); mpCurTheme->InsertTransferable( aDataHelper.GetTransferable(), mnCurActionPos ); } } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index b9ce64c36f17..cf0e6c9c2d98 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -32,6 +32,7 @@ #include <sot/formats.hxx> #include <sot/filelist.hxx> #include <vcl/virdev.hxx> +#include <vcl/weld.hxx> #include <avmedia/mediawindow.hxx> #include <svx/svdograf.hxx> #include <svx/fmmodel.hxx> @@ -626,10 +627,10 @@ bool GalleryTheme::InsertTransferable(const uno::Reference< datatransfer::XTrans return bRet; } -void GalleryTheme::CopyToClipboard(sal_uInt32 nPos) +void GalleryTheme::CopyToClipboard(const weld::Widget& rWidget, sal_uInt32 nPos) { rtl::Reference<GalleryTransferable> pTransferable = new GalleryTransferable( this, nPos, false ); - pTransferable->CopyToClipboard(GetSystemClipboard()); + pTransferable->CopyToClipboard(rWidget.get_clipboard()); } DateTime GalleryTheme::getModificationDate() const diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx index ad8efc7faafe..ffc61af79685 100644 --- a/svx/source/inc/fmexch.hxx +++ b/svx/source/inc/fmexch.hxx @@ -58,7 +58,7 @@ namespace svxform bool isClipboardOwner() const { return m_bClipboardOwner; } void setDragging(bool bDragging); - void copyToClipboard(const GrantAccess&); + void copyToClipboard(const weld::Widget& rWidget, const GrantAccess&); void setClipboardListener( const Link<OLocalExchange&,void>& _rListener ) { m_aClipboardListener = _rListener; } @@ -94,7 +94,7 @@ namespace svxform void prepareDrag( ); - void copyToClipboard( ) const; + void copyToClipboard(const weld::Widget& rWidget) const; bool isDragSource() const { return m_xTransferable.is() && m_xTransferable->isDragging(); } bool isClipboardOwner() const { return m_xTransferable.is() && m_xTransferable->isClipboardOwner(); } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index e3c5379e54a5..26f27d294b29 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -656,6 +656,13 @@ OutputDevice& SdrObjEditView::EditViewOutputDevice() const { return *pTextEditWi Point SdrObjEditView::EditViewPointerPosPixel() const { return pTextEditWin->GetPointerPosPixel(); } +css::uno::Reference<css::datatransfer::clipboard::XClipboard> SdrObjEditView::GetClipboard() const +{ + if (!pTextEditWin) + return nullptr; + return pTextEditWin->GetClipboard(); +} + css::uno::Reference<css::datatransfer::dnd::XDropTarget> SdrObjEditView::GetDropTarget() { if (!pTextEditWin) |