[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/svx svx/source

mert (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 24 07:33:10 UTC 2021


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

New commits:
commit a277cfaf3c24c8ae79da85a5e2b578af2fb62d83
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: Wed Feb 24 08:32:32 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>

diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx
index 6712c79fafc0..e4a6168ef425 100644
--- a/include/svx/svdview.hxx
+++ b/include/svx/svdview.hxx
@@ -241,6 +241,9 @@ public:
     virtual sdr::contact::ObjectContact* createViewSpecificObjectContact(
         SdrPageWindow& rPageWindow,
         const sal_Char* pDebugName) const;
+
+    // Interactive Move Action programmaticaly
+    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 76222cd30158..27b1c67c6551 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -1426,6 +1426,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