[Libreoffice-commits] core.git: include/svx svx/source

mert (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 26 03:38:37 UTC 2021


 include/svx/svdview.hxx       |    2 ++
 svx/source/svdraw/svdview.cxx |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

New commits:
commit 958928086652c6a1c48663aa45e97f387fcf0b31
Author:     mert <mert.tumer at collabora.com>
AuthorDate: Tue Feb 23 10:45:51 2021 +0300
Commit:     Mert Tumer <mert.tumer at collabora.com>
CommitDate: Fri Feb 26 04:37:56 2021 +0100

    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 at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111373
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111507
    Tested-by: Jenkins

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 f591334dea08..6e26091a8e43 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -1407,6 +1407,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();


More information about the Libreoffice-commits mailing list