From 9e7e616a9c3363cf06801a1974711c4dcef97476 Mon Sep 17 00:00:00 2001 From: mert Date: Fri, 19 Feb 2021 09:37:19 +0300 Subject: Implemented MoveShapeHandle uno command for sw Change-Id: I9feccc4fa1a4d7426609afa474f87ab12c769090 Signed-off-by: mert Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111192 Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111512 Tested-by: Jenkins --- sw/sdi/_viewsh.sdi | 5 +++++ sw/sdi/drawsh.sdi | 5 +++++ sw/source/uibase/shells/drawsh.cxx | 16 +++++++++++++++- sw/source/uibase/uiview/view2.cxx | 18 ++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 7b11d4064d1f..f55496ee26a4 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -976,5 +976,10 @@ interface BaseTextEditView MenuConfig , AccelConfig , ToolBoxConfig ; ] + SID_MOVE_SHAPE_HANDLE + [ + ExecMethod = Execute ; + ] + } diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi index 5ea1f46d1ecc..a4e999872e48 100644 --- a/sw/sdi/drawsh.sdi +++ b/sw/sdi/drawsh.sdi @@ -537,5 +537,10 @@ shell SwDrawShell : SwDrawBaseShell StateMethod = GetState ; DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + + SID_MOVE_SHAPE_HANDLE + [ + ExecMethod = Execute ; + ] } diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 09b6bdbb3a0d..7589507511a9 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -197,7 +197,21 @@ void SwDrawShell::Execute(SfxRequest &rReq) GetView().FlipDrawRotate(); } break; - + case SID_MOVE_SHAPE_HANDLE: + { + if (pArgs && pArgs->Count() == 3) + { + const SfxUInt32Item* handleNumItem = rReq.GetArg(FN_PARAM_1); + const SfxUInt32Item* newPosXTwips = rReq.GetArg(FN_PARAM_2); + const SfxUInt32Item* newPosYTwips = rReq.GetArg(FN_PARAM_3); + + const sal_uLong handleNum = handleNumItem->GetValue(); + const sal_uLong newPosX = newPosXTwips->GetValue(); + const sal_uLong newPosY = newPosYTwips->GetValue(); + pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY)); + } + } + break; case SID_BEZIER_EDIT: if (GetView().IsDrawRotate()) { diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index e76fc2f30e41..1946f6a3a02d 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1348,6 +1348,24 @@ void SwView::Execute(SfxRequest &rReq) rReq.SetReturnValue(SfxBoolItem(nSlot, InsertGraphicDlg( rReq ))); } break; + case SID_MOVE_SHAPE_HANDLE: + { + if (pArgs && pArgs->Count() == 3) + { + SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr; + if (pSdrView == nullptr) + break; + const SfxUInt32Item* handleNumItem = rReq.GetArg(FN_PARAM_1); + const SfxUInt32Item* newPosXTwips = rReq.GetArg(FN_PARAM_2); + const SfxUInt32Item* newPosYTwips = rReq.GetArg(FN_PARAM_3); + + const sal_uLong handleNum = handleNumItem->GetValue(); + const sal_uLong newPosX = newPosXTwips->GetValue(); + const sal_uLong newPosY = newPosYTwips->GetValue(); + pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY)); + } + break; + } default: OSL_ENSURE(false, "wrong dispatcher"); -- cgit