diff options
author | mert <mert.tumer@collabora.com> | 2021-02-23 10:45:51 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2021-04-09 17:43:36 +0100 |
commit | 0304a3c2b7d1c8686dad117b919a956e6cb76595 (patch) | |
tree | e551497c4ae7ecb13a8bade7fc8c3e78389e2e14 | |
parent | 5874a2fbad9dc873ccaa671333b461f793c586ca (diff) |
Implemented MoveShapeHandle method
This method will be shared among 3 modules
via uno:MoveShapeHandle uno command
Change-Id: I921a1f7f004e2004e142954b40b4b93282eb8fed
Signed-off-by: mert <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111373
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111507
Tested-by: Jenkins
-rw-r--r-- | include/svx/svdview.hxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdview.cxx | 35 |
2 files changed, 37 insertions, 0 deletions
diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index f37cf109811d..149b17f9ece9 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -241,6 +241,8 @@ public: virtual sdr::contact::ObjectContact* createViewSpecificObjectContact( SdrPageWindow& rPageWindow, const char* pDebugName) const; + + bool MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint); }; // First of all the app creates a SdrModel. diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index f266478927b8..8015980c61eb 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -1408,6 +1408,41 @@ bool SdrView::BegMark(const Point& rPnt, bool bAddMark, bool bUnmark) } } +bool SdrView::MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint) +{ + if (!GetMarkedObjectList().GetMarkCount()) + return false; + + SdrHdl * pHdl = GetHdlList().GetHdl(handleNum); + if (pHdl == nullptr) + return false; + + const SdrDragStat& rDragStat = GetDragStat(); + // start dragging + BegDragObj(pHdl->GetPos(), nullptr, pHdl, 0); + if (!IsDragObj()) + return false; + + bool bWasNoSnap = rDragStat.IsNoSnap(); + bool bWasSnapEnabled = IsSnapEnabled(); + + // switch snapping off + if(!bWasNoSnap) + const_cast<SdrDragStat&>(rDragStat).SetNoSnap(); + if(bWasSnapEnabled) + SetSnapEnabled(false); + + MovAction(aEndPoint); + EndDragObj(); + + if (!bWasNoSnap) + const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap); + if (bWasSnapEnabled) + SetSnapEnabled(bWasSnapEnabled); + + return true; +} + void SdrView::ConfigurationChanged( ::utl::ConfigurationBroadcaster*p, ConfigurationHints nHint) { onAccessibilityOptionsChanged(); |