summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-06 11:32:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-06 17:06:50 +0200
commit130486015f03087aa4c2c43709ce95fb494df44b (patch)
treefdfc094a8ebc20e4a2e511928c7b53e4bc733475
parented7271d9d44fe1a0195ae669644f23c01b6960d8 (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>
-rw-r--r--cui/source/tabpages/autocdlg.cxx2
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx2
-rw-r--r--editeng/source/editeng/editview.cxx13
-rw-r--r--editeng/source/editeng/impedit.cxx3
-rw-r--r--include/editeng/editview.hxx9
-rw-r--r--include/svx/galtheme.hxx2
-rw-r--r--include/svx/svdedxv.hxx1
-rw-r--r--include/svx/weldeditview.hxx2
-rw-r--r--include/vcl/customweld.hxx4
-rw-r--r--sc/source/ui/view/editsh.cxx4
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx2
-rw-r--r--starmath/source/accessibility.cxx2
-rw-r--r--svx/source/dialog/weldeditview.cxx5
-rw-r--r--svx/source/form/fmexch.cxx8
-rw-r--r--svx/source/form/navigatortree.cxx8
-rw-r--r--svx/source/gallery2/galbrws2.cxx5
-rw-r--r--svx/source/gallery2/galtheme.cxx5
-rw-r--r--svx/source/inc/fmexch.hxx4
-rw-r--r--svx/source/svdraw/svdedxv.cxx7
19 files changed, 62 insertions, 26 deletions
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index c682662f4fa7..f1f4ee2bd0b1 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -2115,7 +2115,7 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const
#endif
}
pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() );
- pCntnr->CopyToClipboard(GetSystemClipboard());
+ pCntnr->CopyToClipboard(m_xLBEntries->get_clipboard());
}
IMPL_LINK(OfaAutoCompleteTabPage, KeyReleaseHdl, const KeyEvent&, rEvent, bool)
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 8bbcb305e106..9009d0b467c3 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -1222,7 +1222,7 @@ bool OFieldDescControl::isPasteAllowed()
bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget();
if ( bAllowed )
{
- TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromClipboard(GetSystemClipboard()));
+ TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromClipboard(m_pActFocusWindow->get_clipboard()));
bAllowed = aTransferData.HasFormat(SotClipboardFormatId::STRING);
}
return bAllowed;
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 08223368ea20..512a3bf54915 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -630,10 +630,15 @@ ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterat
void EditView::Cut()
{
- Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(pImpEditView->GetClipboard());
+ Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
pImpEditView->CutCopy( aClipBoard, true );
}
+Reference<css::datatransfer::clipboard::XClipboard> EditView::GetClipboard() const
+{
+ return pImpEditView->GetClipboard();
+}
+
css::uno::Reference< css::datatransfer::XTransferable > EditView::GetTransferable() const
{
uno::Reference< datatransfer::XTransferable > xData =
@@ -643,19 +648,19 @@ css::uno::Reference< css::datatransfer::XTransferable > EditView::GetTransferabl
void EditView::Copy()
{
- Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(pImpEditView->GetClipboard());
+ Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
pImpEditView->CutCopy( aClipBoard, false );
}
void EditView::Paste()
{
- Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(pImpEditView->GetClipboard());
+ Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
pImpEditView->Paste( aClipBoard );
}
void EditView::PasteSpecial()
{
- Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(pImpEditView->GetClipboard());
+ Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
pImpEditView->Paste(aClipBoard, true );
}
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index ef5277bbc049..1d852ecec784 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1605,8 +1605,11 @@ Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRa
Reference<css::datatransfer::clipboard::XClipboard> ImpEditView::GetClipboard() const
{
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+ return pCallbacks->GetClipboard();
if (vcl::Window* pWindow = GetWindow())
return pWindow->GetClipboard();
+ SAL_WARN("editeng", "falling back to using GetSystemClipboard");
return GetSystemClipboard();
}
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index cbc65bf93e1c..6ba2e01b285a 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -66,6 +66,9 @@ namespace sun {
namespace star {
namespace datatransfer {
class XTransferable;
+ namespace clipboard {
+ class XClipboard;
+ }
namespace dnd {
class XDropTarget;
}
@@ -128,6 +131,9 @@ public:
{
}
+ // Access to clipboard
+ virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const = 0;
+
// implemented if drag and drop support is wanted
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget()
{
@@ -273,7 +279,8 @@ public:
void InsertText( const EditTextObject& rTextObject );
void InsertText( css::uno::Reference< css::datatransfer::XTransferable > const & xDataObj, const OUString& rBaseURL, bool bUseSpecial );
- css::uno::Reference< css::datatransfer::XTransferable > GetTransferable() const;
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const;
+ css::uno::Reference<css::datatransfer::XTransferable> GetTransferable() const;
// An EditView, so that when TRUE the update will be free from flickering:
void SetEditEngineUpdateMode( bool bUpdate );
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index d2015b153437..0630262c040c 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -148,7 +148,7 @@ public:
SAL_DLLPRIVATE bool InsertTransferable(const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable, sal_uInt32 nInsertPos);
- SAL_DLLPRIVATE void CopyToClipboard(sal_uInt32 nPos);
+ SAL_DLLPRIVATE void CopyToClipboard(const weld::Widget& rWidget, sal_uInt32 nPos);
DateTime getModificationDate() const;
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 2d50d1f3e6fa..1b6e6c6b4501 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -69,6 +69,7 @@ class SVXCORE_DLLPUBLIC SdrObjEditView : public SdrGlueEditView, public EditView
virtual void EditViewSelectionChange() override;
virtual OutputDevice& EditViewOutputDevice() const override;
virtual Point EditViewPointerPosPixel() const override;
+ virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const override;
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override;
virtual void EditViewInputContext(const InputContext& rInputContext) override;
virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override;
diff --git a/include/svx/weldeditview.hxx b/include/svx/weldeditview.hxx
index 65bc9c979bf3..4593d0ecf26a 100644
--- a/include/svx/weldeditview.hxx
+++ b/include/svx/weldeditview.hxx
@@ -72,6 +72,8 @@ public:
virtual void LoseFocus() override;
virtual void Resize() override;
+ virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
+ GetClipboard() const override;
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override;
// Whether Tab will result in entering a tab or not
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index 8350c065a704..2780548e15c5 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -104,6 +104,10 @@ public:
{
return m_pDrawingArea->get_drop_target();
}
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const
+ {
+ return m_pDrawingArea->get_clipboard();
+ }
void SetDragDataTransferrable(rtl::Reference<TransferDataContainer>& rTransferrable,
sal_uInt8 eDNDConstants)
{
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 68a186f1dd5d..451b73a9a208 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -637,8 +637,8 @@ void ScEditShell::Execute( SfxRequest& rReq )
const SvxFieldData* pField = pEditView->GetFieldAtCursor();
if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
{
- uno::Reference<datatransfer::clipboard::XClipboard> xClipboard = GetSystemClipboard();
-
+ uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
+ = pEditView->GetClipboard();
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, SfxViewShell::Current());
}
}
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 89ffb94ff106..0022b84c9625 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -720,7 +720,7 @@ bool AnnotationTextWindow::Command(const CommandEvent& rCEvt)
bool bCanPaste = false;
if (bEditable)
{
- TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromClipboard(GetSystemClipboard()));
+ TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromClipboard(GetClipboard()));
bCanPaste = aDataHelper.GetFormatCount() != 0;
}
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 0ca086397716..b66ba5c9c276 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -704,7 +704,7 @@ sal_Bool SAL_CALL SmGraphicAccessible::copyText(
if (!pWin)
throw RuntimeException();
- Reference< datatransfer::clipboard::XClipboard > xClipboard = GetSystemClipboard();
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = pWin->GetClipboard();
if ( xClipboard.is() )
{
OUString sText( getTextRange(nStartIndex, nEndIndex) );
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)