sc/source/ui/inc/gridwin.hxx | 5 +++-- sc/source/ui/view/gridwin.cxx | 14 +++++--------- 2 files changed, 8 insertions(+), 11 deletions(-)
New commits: commit 61c5f258ed162a8e947177736eef7a7c9412e0dd Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Jul 15 11:31:21 2021 -0400 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Oct 8 08:08:43 2021 +0200 lok: sc: simplify drag & drop functions The ScDragData is a global use for private drag & drop in a desktop case, it will be used by tiled rendering case to pass its own local ScDragData per user. Change-Id: I0bca8e6d5c0eab82b69374a67425e2a8d746ef4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118990 Tested-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index afcfe268b95f..a4eab900b548 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -44,6 +44,7 @@ namespace sdr::overlay { class OverlayManager; } class FmFormView; struct ScTableInfo; +struct ScDragData; class ScDPObject; class ScDPFieldButton; class ScOutputData; @@ -253,8 +254,8 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, public DropTargetHel void DropScroll( const Point& rMousePos ); - sal_Int8 AcceptPrivateDrop( const AcceptDropEvent& rEvt ); - sal_Int8 ExecutePrivateDrop( const ExecuteDropEvent& rEvt ); + sal_Int8 AcceptPrivateDrop( const AcceptDropEvent& rEvt, const ScDragData& rData ); + sal_Int8 ExecutePrivateDrop( const ExecuteDropEvent& rEvt, const ScDragData& rData ); sal_Int8 DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPosX, SCROW nDestPosY, const Point& rLogicPos, sal_Int8 nDndAction ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 995c3009b28c..5eba46011335 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3545,7 +3545,7 @@ static ScRange lcl_MakeDropRange( const ScDocument& rDoc, SCCOL nPosX, SCROW nPo return ScRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab ); } -sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt ) +sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt, const ScDragData& rData ) { if ( rEvt.mbLeaving ) { @@ -3554,7 +3554,6 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt ) return rEvt.mnAction; } - const ScDragData& rData = SC_MOD()->GetDragData(); if ( rData.pCellTransfer ) { // Don't move source that would include filtered rows. @@ -3767,7 +3766,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) { DrawMarkDropObj( nullptr ); if ( rData.pCellTransfer ) - return AcceptPrivateDrop( rEvt ); // hide drop marker for internal D&D + return AcceptPrivateDrop( rEvt, rData ); // hide drop marker for internal D&D else return rEvt.mnAction; } @@ -3785,7 +3784,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) aSource.aStart.Row() != 0 || aSource.aEnd.Row() != rThisDoc.MaxRow() ) DropScroll( rEvt.maPosPixel ); - nRet = AcceptPrivateDrop( rEvt ); + nRet = AcceptPrivateDrop( rEvt, rData ); } else { @@ -4044,15 +4043,12 @@ static SotClipboardFormatId lcl_GetDropLinkId( const uno::Reference<datatransfer return nFormatId; } -sal_Int8 ScGridWindow::ExecutePrivateDrop( const ExecuteDropEvent& rEvt ) +sal_Int8 ScGridWindow::ExecutePrivateDrop( const ExecuteDropEvent& rEvt, const ScDragData& rData ) { // hide drop marker bDragRect = false; UpdateDragRectOverlay(); - ScModule* pScMod = SC_MOD(); - const ScDragData& rData = pScMod->GetDragData(); - return DropTransferObj( rData.pCellTransfer, nDragStartX, nDragStartY, PixelToLogic(rEvt.maPosPixel), rEvt.mnAction ); } @@ -4421,7 +4417,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) ScModule* pScMod = SC_MOD(); const ScDragData& rData = pScMod->GetDragData(); if (rData.pCellTransfer) - return ExecutePrivateDrop( rEvt ); + return ExecutePrivateDrop( rEvt, rData ); Point aPos = rEvt.maPosPixel;