diff options
author | merttumer <mert.tumer@collabora.com> | 2021-05-24 10:52:13 +0300 |
---|---|---|
committer | Mert Tumer <mert.tumer@collabora.com> | 2021-06-04 10:39:44 +0200 |
commit | 6c879cd2dc4517c8ee9dbff0f228f95702e7f88b (patch) | |
tree | 34c35d4fdcb86e9b260c282cb173cdb85b27164e /sw | |
parent | 13f981e262b04f40c377d0e4fff717b57855d8a3 (diff) |
Extended MoveShapeHandle command for Anchors as well
Change-Id: I0e2811802f17831097a86103571b505a7557717a
Signed-off-by: merttumer <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116040
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116299
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/draw/dview.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/shells/drawsh.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 7 |
3 files changed, 19 insertions, 4 deletions
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index dfa884e80db5..b2ad0f39c14e 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -243,8 +243,10 @@ void SwDrawView::AddCustomHdl() } // add anchor handle: - maHdlList.AddHdl( std::make_unique<SwSdrHdl>( aPos, ( pAnch->IsVertical() && !pAnch->IsVertLR() ) || - pAnch->IsRightToLeft() ) ); + std::unique_ptr<SdrHdl> hdl = std::make_unique<SwSdrHdl>( aPos, ( pAnch->IsVertical() && !pAnch->IsVertLR() ) || + pAnch->IsRightToLeft() ); + hdl->SetObjHdlNum(maHdlList.GetHdlCount()); + maHdlList.AddHdl(std::move(hdl)); } SdrObject* SwDrawView::GetMaxToTopObj( SdrObject* pObj ) const diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 9f0de0c2a0f1..bd1e50e26871 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -210,7 +210,15 @@ void SwDrawShell::Execute(SfxRequest &rReq) const sal_uLong handleNum = handleNumItem->GetValue(); const sal_uLong newPosX = newPosXTwips->GetValue(); const sal_uLong newPosY = newPosYTwips->GetValue(); - pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1); + const Point mPoint(newPosX, newPosY); + const SdrHdl* handle = pSdrView->GetHdlList().GetHdl(handleNum); + if (handle->GetKind() == SdrHdlKind::Anchor || handle->GetKind() == SdrHdlKind::Anchor_TR) + { + rSh.FindAnchorPos(mPoint, /*bMoveIt=*/true); + pSdrView->ModelHasChanged(); + } + else + pSdrView->MoveShapeHandle(handleNum, mPoint, OrdNum ? OrdNum->GetValue() : -1); } } break; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 7a30c9e8db0c..a9e71660dd10 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1402,7 +1402,12 @@ void SwView::Execute(SfxRequest &rReq) const sal_uLong handleNum = handleNumItem->GetValue(); const sal_uLong newPosX = newPosXTwips->GetValue(); const sal_uLong newPosY = newPosYTwips->GetValue(); - pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1); + const Point mPoint(newPosX, newPosY); + const SdrHdl* handle = pSdrView->GetHdlList().GetHdl(handleNum); + if (handle->GetKind() == SdrHdlKind::Anchor || handle->GetKind() == SdrHdlKind::Anchor_TR) + m_pWrtShell->FindAnchorPos(mPoint, /*bMoveIt=*/true); + else + pSdrView->MoveShapeHandle(handleNum, mPoint, OrdNum ? OrdNum->GetValue() : -1); } break; } |