sc/source/ui/inc/gridwin.hxx | 5 +++-- sc/source/ui/view/gridwin.cxx | 14 +++++--------- 2 files changed, 8 insertions(+), 11 deletions(-)
New commits: commit 5648bcdd7478b500869415b9224d45825df1c2e4 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Jul 15 11:31:21 2021 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Fri Feb 18 14:48:52 2022 +0100 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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129465 Tested-by: Jenkins Reviewed-by: Henry Castro <hcas...@collabora.com> diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 5acb900dca6f..12535cd313e0 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; @@ -254,8 +255,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 6fd0976d424d..f5caec734daa 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3844,7 +3844,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 ) { @@ -3853,7 +3853,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. @@ -4066,7 +4065,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; } @@ -4084,7 +4083,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 { @@ -4343,15 +4342,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 ); } @@ -4721,7 +4717,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;