[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 9 commits - include/svx sc/source sd/source svx/sdi svx/source sw/source

merttumer (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 20 07:54:20 UTC 2021


 include/svx/svddrag.hxx                            |   12 ++
 include/svx/svdmrkv.hxx                            |    1 
 include/svx/svdoedge.hxx                           |    2 
 include/svx/svdview.hxx                            |    3 
 sc/source/ui/drawfunc/drawsh.cxx                   |    5 -
 sc/source/ui/view/tabvwsh2.cxx                     |    2 
 sd/source/ui/view/drviews2.cxx                     |    6 -
 sd/source/ui/view/drviewse.cxx                     |    4 
 svx/sdi/svx.sdi                                    |    2 
 svx/source/sdr/contact/objectcontactofpageview.cxx |    3 
 svx/source/sdr/contact/viewobjectcontact.cxx       |    7 +
 svx/source/svdraw/svddrgv.cxx                      |   13 +-
 svx/source/svdraw/svdglue.cxx                      |    5 +
 svx/source/svdraw/svdmrkv.cxx                      |   98 ++++++++++++++++++++-
 svx/source/svdraw/svdoedge.cxx                     |   22 ++++
 svx/source/svdraw/svdpntv.cxx                      |    5 +
 svx/source/svdraw/svdview.cxx                      |   17 ++-
 sw/source/uibase/shells/drawsh.cxx                 |    5 -
 sw/source/uibase/uiview/view2.cxx                  |    5 -
 sw/source/uibase/uiview/viewdraw.cxx               |    3 
 20 files changed, 194 insertions(+), 26 deletions(-)

New commits:
commit f241aaec7895b1f72fec3433a43404468ec68a3e
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Fri Apr 2 16:18:05 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:43 2021 +0200

    lok: Pass object ord num in the uno command
    
    When multiple objects' glue points collide the ordnum
    will be used to decide which glue point to connect to
    for the connectors. Without that the default logic chooses
    the lowest ordered object which is searched and found in the object list
    
    Change-Id: I64579d28bbe6cbd92bab745838fe2995585b6a3f
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113517
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114032
    Tested-by: Jenkins

diff --git a/include/svx/svddrag.hxx b/include/svx/svddrag.hxx
index 80c2406b9046..6718e5f36b5d 100644
--- a/include/svx/svddrag.hxx
+++ b/include/svx/svddrag.hxx
@@ -79,6 +79,16 @@ class SVXCORE_DLLPUBLIC SdrDragStat final
 
     sal_Int32 GetPrevPos() const { return mvPnts.size()-(mvPnts.size()>1 ? 2 : 1); }
 
+    // This is passed all the way through to ApplySpecialDrag of the Edge Object
+    // For LOK, we cannot really specify which glue point to select by default
+    // It selects the nearest glue points after DragEnd event.
+    // When multiple objects are on top of each other or somehow their glue points
+    // collide, the glue point is selected from the lowest order numbered object
+    // We can pass the ord number information inside the draginfo and choose the correct shape
+    struct {
+        sal_Int32 objectOrdNum = -1;
+    } mGlueOptions;
+
 public:
     SdrDragStat()                                    { Reset(); }
     ~SdrDragStat();
@@ -158,6 +168,8 @@ public:
 
     // Also considering 1stPointAsCenter
     void         TakeCreateRect(tools::Rectangle& rRect) const;
+
+    auto&        GetGlueOptions() { return mGlueOptions; }
 };
 
 #endif // INCLUDED_SVX_SVDDRAG_HXX
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index 5d0116cb97d8..8a927494714d 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -177,7 +177,7 @@ protected:
     XPolygon ImpCalcEdgeTrack(const Point& rPt1, tools::Long nAngle1, const tools::Rectangle& rBoundRect1, const tools::Rectangle& rBewareRect1,
         const Point& rPt2, tools::Long nAngle2, const tools::Rectangle& rBoundRect2, const tools::Rectangle& rBewareRect2,
         sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const;
-    static bool ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=nullptr);
+    static bool ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=nullptr, SdrDragStat* pDragStat = nullptr);
     static SdrEscapeDirection ImpCalcEscAngle(SdrObject const * pObj, const Point& aPt2);
     void ImpSetTailPoint(bool bTail1, const Point& rPt);
     void ImpUndirtyEdgeTrack();  // potential recalculation of the connection track
diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx
index 149b17f9ece9..7020f6447b4d 100644
--- a/include/svx/svdview.hxx
+++ b/include/svx/svdview.hxx
@@ -242,7 +242,8 @@ public:
         SdrPageWindow& rPageWindow,
         const char* pDebugName) const;
 
-    bool MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint);
+    // Interactive Move Action programmaticaly
+    bool MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint, const sal_Int32 aObjectOrdNum = -1);
 };
 
 // First of all the app creates a SdrModel.
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index f8cc7c5d2a2c..a0bcc3a78a3b 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -206,16 +206,17 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
         case SID_MOVE_SHAPE_HANDLE:
         {
             const SfxItemSet *pArgs = rReq.GetArgs ();
-            if (pArgs && pArgs->Count () == 3)
+            if (pArgs && pArgs->Count () >= 3)
             {
                 const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1);
                 const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
                 const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3);
+                const SfxInt32Item* OrdNum = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
 
                 const sal_uLong handleNum = handleNumItem->GetValue();
                 const sal_uLong newPosX = convertTwipToMm100(newPosXTwips->GetValue());
                 const sal_uLong newPosY = convertTwipToMm100(newPosYTwips->GetValue());
-                pView->MoveShapeHandle(handleNum, Point(newPosX, newPosY));
+                pView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1);
             }
         }
         break;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 0c7f0cd1278a..f405893c139d 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1498,16 +1498,18 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_MOVE_SHAPE_HANDLE:
         {
             const SfxItemSet *pArgs = rReq.GetArgs ();
-            if (pArgs && pArgs->Count () == 3)
+            if (pArgs && pArgs->Count () >= 3)
             {
                 const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1);
                 const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
                 const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3);
+                const SfxInt32Item* OrdNum = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
 
                 const sal_uLong handleNum = handleNumItem->GetValue();
                 const sal_uLong newPosX = convertTwipToMm100(newPosXTwips->GetValue());
                 const sal_uLong newPosY = convertTwipToMm100(newPosYTwips->GetValue());
-                mpDrawView->MoveShapeHandle(handleNum, Point(newPosX, newPosY));
+
+                mpDrawView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1);
                 Cancel();
             }
             break;
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 5ab763d7a2db..e2209b20d775 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12499,7 +12499,7 @@ SdrMetricItem SoftEdgeRadius SID_ATTR_SOFTEDGE_RADIUS
 ]
 
 SfxVoidItem MoveShapeHandle SID_MOVE_SHAPE_HANDLE
-(SfxUInt32Item HandleNum FN_PARAM_1 SfxUInt32Item NewPosX FN_PARAM_2 SfxUInt32Item NewPosY FN_PARAM_3)
+(SfxUInt32Item HandleNum FN_PARAM_1 SfxUInt32Item NewPosX FN_PARAM_2 SfxUInt32Item NewPosY FN_PARAM_3 SfxInt32Item OrdNum FN_PARAM_4)
 [
     AutoUpdate = FALSE,
     FastCall = TRUE,
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 804543fe0d5a..1f6dd9078743 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -1904,7 +1904,7 @@ bool SdrEdgeObj::applySpecialDrag(SdrDragStat& rDragStat)
             DisconnectFromNode(bDragA);
 
             // look for new connection
-            ImpFindConnector(aPointNow, *rDragStat.GetPageView(), *pDraggedOne, pOriginalEdge);
+            ImpFindConnector(aPointNow, *rDragStat.GetPageView(), *pDraggedOne, pOriginalEdge, nullptr, &rDragStat);
 
             if(pDraggedOne->pObj)
             {
@@ -2125,7 +2125,7 @@ PointerStyle SdrEdgeObj::GetCreatePointer() const
     return PointerStyle::DrawConnect;
 }
 
-bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut)
+bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut, SdrDragStat* pDragStat)
 {
     rCon.ResetVars();
     if (pOut==nullptr) pOut=rPV.GetView().GetFirstOutputDevice();
@@ -2148,11 +2148,29 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO
     size_t no=pOL->GetObjCount();
     bool bFnd = false;
     SdrObjConnection aTestCon;
+    bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
+    bool bHasRequestedOrdNum = false;
+    sal_Int32 requestedOrdNum = -1;
+
+    if (bTiledRendering && pDragStat)
+    {
+        auto& glueOptions = pDragStat->GetGlueOptions();
+        if (glueOptions.objectOrdNum != -1)
+        {
+            requestedOrdNum = glueOptions.objectOrdNum;
+            bHasRequestedOrdNum = true;
+        }
+    }
 
     while (no>0 && !bFnd) {
         // issue: group objects on different layers return LayerID=0!
         no--;
         SdrObject* pObj=pOL->GetObj(no);
+        if (bHasRequestedOrdNum)
+        {
+            if (pObj->GetOrdNumDirect() != static_cast<sal_uInt32>(requestedOrdNum))
+                continue;
+        }
         if (rVisLayer.IsSet(pObj->GetLayer()) && pObj->IsVisible() &&      // only visible objects
             (pThis==nullptr || pObj!=static_cast<SdrObject const *>(pThis))) // don't connect it to itself
         {
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 6b03a716b4af..6dad758bbd33 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -1408,7 +1408,7 @@ bool SdrView::BegMark(const Point& rPnt, bool bAddMark, bool bUnmark)
     }
 }
 
-bool SdrView::MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint)
+bool SdrView::MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint, const sal_Int32 aObjectOrdNum)
 {
     if (GetHdlList().IsMoveOutside())
         return false;
@@ -1420,7 +1420,7 @@ bool SdrView::MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint
     if (pHdl == nullptr)
         return false;
 
-    const SdrDragStat& rDragStat = GetDragStat();
+    SdrDragStat& rDragStat = const_cast<SdrDragStat&>(GetDragStat());
     // start dragging
     BegDragObj(pHdl->GetPos(), nullptr, pHdl, 0);
     if (!IsDragObj())
@@ -1431,15 +1431,22 @@ bool SdrView::MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint
 
     // switch snapping off
     if(!bWasNoSnap)
-        const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
+        rDragStat.SetNoSnap();
     if(bWasSnapEnabled)
         SetSnapEnabled(false);
 
-    MovAction(aEndPoint);
+    if (aObjectOrdNum != -1)
+    {
+        rDragStat.GetGlueOptions().objectOrdNum = aObjectOrdNum;
+    }
+    MovDragObj(aEndPoint);
     EndDragObj();
 
+    // Clear Glue Options
+    rDragStat.GetGlueOptions().objectOrdNum = -1;
+
     if (!bWasNoSnap)
-        const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
+       rDragStat.SetNoSnap(bWasNoSnap);
     if (bWasSnapEnabled)
         SetSnapEnabled(bWasSnapEnabled);
 
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 5bdbdc71f81d..ebc014e8fb45 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -203,16 +203,17 @@ void SwDrawShell::Execute(SfxRequest &rReq)
             break;
         case SID_MOVE_SHAPE_HANDLE:
         {
-            if (pArgs && pArgs->Count() == 3)
+            if (pArgs && pArgs->Count() >= 3)
             {
                 const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1);
                 const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
                 const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3);
+                const SfxInt32Item* OrdNum = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
 
                 const sal_uLong handleNum = handleNumItem->GetValue();
                 const sal_uLong newPosX = newPosXTwips->GetValue();
                 const sal_uLong newPosY = newPosYTwips->GetValue();
-                pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY));
+                pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1);
             }
         }
         break;
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index dbc9fbd26c0a..3fe8a7e6c593 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1345,7 +1345,7 @@ void SwView::Execute(SfxRequest &rReq)
         break;
         case SID_MOVE_SHAPE_HANDLE:
         {
-            if (pArgs && pArgs->Count() == 3)
+            if (pArgs && pArgs->Count() >= 3)
             {
                 SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr;
                 if (pSdrView == nullptr)
@@ -1353,11 +1353,12 @@ void SwView::Execute(SfxRequest &rReq)
                 const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1);
                 const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
                 const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3);
+                const SfxInt32Item* OrdNum = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
 
                 const sal_uLong handleNum = handleNumItem->GetValue();
                 const sal_uLong newPosX = newPosXTwips->GetValue();
                 const sal_uLong newPosY = newPosYTwips->GetValue();
-                pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY));
+                pSdrView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1);
             }
             break;
         }
commit efc974104c1e632d50e136314d7730604cfe340a
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Fri Apr 2 16:14:55 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:42 2021 +0200

    Improve dumpGluePointsAsJSON
    
    added gridoffset for the shape for calc
    changed the logic, now the ordnum would be enough
    
    Change-Id: Iebe7d29c569a4cb968fe2e5ef1692b59f0c4b2d8
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113516
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114031
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index b7046ab17dcc..80bca0ef12c9 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -692,37 +692,51 @@ bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
         if (rOutDev->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
             bConvertUnit = true;
         const SdrObjList* pOL = mpMarkedPV->GetObjList();
+        if (!pOL)
+            return false;
         const size_t nObjCount = pOL->GetObjCount();
         boost::property_tree::ptree elements;
         for (size_t nObjNum = 0; nObjNum < nObjCount; ++nObjNum)
         {
-            const SdrObject* pObj = pOL->GetObj(nObjNum);
+            SdrObject* pObj = pOL->GetObj(nObjNum);
+            if (!pObj)
+                continue;
+            if (pObj == GetMarkedObjectByIndex(0))
+                continue;
             const SdrGluePointList* pGPL = pObj->GetGluePointList();
-            if (pGPL != nullptr && pGPL->GetCount())
+            bool VertexObject = !(pGPL && pGPL->GetCount());
+            const size_t count = !VertexObject ? pGPL->GetCount() : 4;
+            boost::property_tree::ptree object;
+            boost::property_tree::ptree points;
+            for (size_t i = 0; i < count; ++i)
             {
-                boost::property_tree::ptree object;
-                boost::property_tree::ptree points;
-                for (size_t i = 0; i < pGPL->GetCount(); ++i)
-                {
-                    boost::property_tree::ptree node;
-                    boost::property_tree::ptree point;
-                    const SdrGluePoint& rGP = (*pGPL)[i];
-                    // coordinates are relative to the OBJ snap rect
-                    Point rPoint = pObj->GetSnapRect().TopLeft();
-                    rPoint.Move(rGP.GetPos().getX(), rGP.GetPos().getY());
-                    if (bConvertUnit)
-                        rPoint = OutputDevice::LogicToLogic(rPoint, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
-                    point.put("x", rPoint.getX());
-                    point.put("y", rPoint.getY());
-                    node.put("glueId", rGP.GetId());
-                    node.add_child("point", point);
-                    points.push_back(std::make_pair("", node));
-                }
-                object.put("id", reinterpret_cast<sal_IntPtr>(pObj));
-                object.add_child("gluepoints", points);
-                elements.push_back(std::make_pair("", object));
-                result = true;
+                boost::property_tree::ptree node;
+                boost::property_tree::ptree point;
+                const SdrGluePoint& rGP = !VertexObject ? (*pGPL)[i] : pObj->GetVertexGluePoint(i);
+                Point rPoint = rGP.GetAbsolutePos(*pObj);
+                if (bConvertUnit)
+                    rPoint = OutputDevice::LogicToLogic(rPoint, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+                point.put("x", rPoint.getX());
+                point.put("y", rPoint.getY());
+                node.add_child("point", point);
+                points.push_back(std::make_pair("", node));
+            }
+            basegfx::B2DVector aGridOffset(0.0, 0.0);
+            Point objLogicRectTopLeft = pObj->GetLogicRect().TopLeft();
+            if(getPossibleGridOffsetForPosition(aGridOffset, basegfx::B2DPoint(objLogicRectTopLeft.X(), objLogicRectTopLeft.Y()), GetSdrPageView()))
+            {
+                Point p(aGridOffset.getX(), aGridOffset.getY());
+                if (bConvertUnit)
+                    p = OutputDevice::LogicToLogic(p, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+                boost::property_tree::ptree gridOffset;
+                gridOffset.put("x", p.getX());
+                gridOffset.put("y", p.getY());
+                object.add_child("gridoffset", gridOffset);
             }
+            object.put("ordnum", pObj->GetOrdNum());
+            object.add_child("gluepoints", points);
+            elements.push_back(std::make_pair("", object));
+            result = true;
         }
         rTree.add_child("shapes", elements);
     }
commit fd5ee56ef6e48aa9b5c369f70469280ba16c4e71
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Thu Mar 11 12:16:51 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:42 2021 +0200

    Get Glue Points in the selection callback
    
    Change-Id: I0d038517710c68f80f8e35b8ebebd34f264434f3
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112324
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114030
    Tested-by: Jenkins

diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 17e9ad2b15f9..bbe0e8eb2446 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -148,6 +148,7 @@ private:
     void UndirtyMrkPnt() const;
 
     void SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const SfxViewShell* pOtherShell);
+    bool dumpGluePointsToJSON(boost::property_tree::ptree& rTree);
 
 protected:
     virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 1221ab486fc8..b7046ab17dcc 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -683,6 +683,52 @@ OUString lcl_getDragParameterString( const OUString& rCID )
 }
 } // anonymous namespace
 
+bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
+{
+    bool result = false;
+    if (OutputDevice* rOutDev = mpMarkedPV->GetView().GetFirstOutputDevice())
+    {
+        bool bConvertUnit = false;
+        if (rOutDev->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+            bConvertUnit = true;
+        const SdrObjList* pOL = mpMarkedPV->GetObjList();
+        const size_t nObjCount = pOL->GetObjCount();
+        boost::property_tree::ptree elements;
+        for (size_t nObjNum = 0; nObjNum < nObjCount; ++nObjNum)
+        {
+            const SdrObject* pObj = pOL->GetObj(nObjNum);
+            const SdrGluePointList* pGPL = pObj->GetGluePointList();
+            if (pGPL != nullptr && pGPL->GetCount())
+            {
+                boost::property_tree::ptree object;
+                boost::property_tree::ptree points;
+                for (size_t i = 0; i < pGPL->GetCount(); ++i)
+                {
+                    boost::property_tree::ptree node;
+                    boost::property_tree::ptree point;
+                    const SdrGluePoint& rGP = (*pGPL)[i];
+                    // coordinates are relative to the OBJ snap rect
+                    Point rPoint = pObj->GetSnapRect().TopLeft();
+                    rPoint.Move(rGP.GetPos().getX(), rGP.GetPos().getY());
+                    if (bConvertUnit)
+                        rPoint = OutputDevice::LogicToLogic(rPoint, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+                    point.put("x", rPoint.getX());
+                    point.put("y", rPoint.getY());
+                    node.put("glueId", rGP.GetId());
+                    node.add_child("point", point);
+                    points.push_back(std::make_pair("", node));
+                }
+                object.put("id", reinterpret_cast<sal_IntPtr>(pObj));
+                object.add_child("gluepoints", points);
+                elements.push_back(std::make_pair("", object));
+                result = true;
+            }
+        }
+        rTree.add_child("shapes", elements);
+    }
+    return result;
+}
+
 void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const SfxViewShell* pOtherShell)
 {
     SfxViewShell* pViewShell = GetSfxViewShell();
@@ -735,13 +781,19 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
         OString sSelectionText;
         OString sSelectionTextView;
         boost::property_tree::ptree aTableJsonTree;
+        boost::property_tree::ptree aGluePointsTree;
         bool bTableSelection = false;
+        bool bConnectorSelection = false;
 
         if (mpMarkedObj && mpMarkedObj->GetObjIdentifier() == OBJ_TABLE)
         {
             auto& rTableObject = dynamic_cast<sdr::table::SdrTableObj&>(*mpMarkedObj);
             bTableSelection = rTableObject.createTableEdgesJson(aTableJsonTree);
         }
+        if (mpMarkedObj && mpMarkedObj->GetObjIdentifier() == OBJ_EDGE)
+        {
+            bConnectorSelection = dumpGluePointsToJSON(aGluePointsTree);
+        }
         if (GetMarkedObjectCount())
         {
             SdrMark* pM = GetSdrMarkByIndex(0);
@@ -974,6 +1026,13 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
                 boost::property_tree::write_json(aStream, responseJSON, /*pretty=*/ false);
                 handleArrayStr = ", \"handles\":";
                 handleArrayStr = handleArrayStr + aStream.str().c_str();
+                if (bConnectorSelection)
+                {
+                    aStream.str("");
+                    boost::property_tree::write_json(aStream, aGluePointsTree, /*pretty=*/ false);
+                    handleArrayStr = handleArrayStr + ", \"GluePoints\":";
+                    handleArrayStr = handleArrayStr + aStream.str().c_str();
+                }
             }
             sSelectionText = aSelection.toString() +
                 ", " + OString::number(nRotAngle);
commit 46a62b75244f6e4620da6a90edaa44e943dc35a4
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Thu Mar 11 10:33:04 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:42 2021 +0200

    lok: Don't invalidate GluePoints
    
    Change-Id: Ie579b31e6ee2067f5b88464c62c0870b68a461a2
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112315
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114029
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
index 0d3db7f8d57d..edec145c8d67 100644
--- a/svx/source/svdraw/svdglue.cxx
+++ b/svx/source/svdraw/svdglue.cxx
@@ -23,6 +23,7 @@
 #include <svx/svdglue.hxx>
 #include <svx/svdobj.hxx>
 #include <svx/svdtrans.hxx>
+#include <comphelper/lok.hxx>
 
 const Size aGlueHalfSize(4,4);
 
@@ -253,6 +254,8 @@ void SdrGluePoint::Shear(const Point& rRef, double tn, bool bVShear, const SdrOb
 
 void SdrGluePoint::Invalidate(vcl::Window& rWin, const SdrObject* pObj) const
 {
+    if (comphelper::LibreOfficeKit::isActive())
+        return;
     bool bMapMode=rWin.IsMapModeEnabled();
     Point aPt(pObj!=nullptr ? GetAbsolutePos(*pObj) : GetPos());
     aPt=rWin.LogicToPixel(aPt);
@@ -324,6 +327,8 @@ sal_uInt16 SdrGluePointList::Insert(const SdrGluePoint& rGP)
 
 void SdrGluePointList::Invalidate(vcl::Window& rWin, const SdrObject* pObj) const
 {
+    if (comphelper::LibreOfficeKit::isActive())
+        return;
     for (auto& xGP : aList)
         xGP->Invalidate(rWin,pObj);
 }
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 4d2b7b636a37..3395170406ac 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -779,6 +779,11 @@ bool SdrPaintView::KeyInput(const KeyEvent& /*rKEvt*/, vcl::Window* /*pWin*/)
 
 void SdrPaintView::GlueInvalidate() const
 {
+    // Do not invalidate GluePoints in Online
+    // They are handled on front-end
+    if (comphelper::LibreOfficeKit::isActive())
+        return;
+
     const sal_uInt32 nWindowCount(PaintWindowCount());
 
     for(sal_uInt32 nWinNum(0); nWinNum < nWindowCount; nWinNum++)
commit c33647d4d771b74ce8087b7cec5d62f87bb6b375
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Thu Mar 11 09:52:00 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:42 2021 +0200

    Hide GluePoints in LOK
    
    Change-Id: Ibf6bba4cdc69bd8479ccc08b5d9695253ef81890
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112314
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114028
    Tested-by: Jenkins

diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 364b0d90bfea..41717d276381 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -340,7 +340,8 @@ namespace sdr::contact
         // Get info about the need to visualize GluePoints
         bool ObjectContactOfPageView::AreGluePointsVisible() const
         {
-            return GetPageWindow().GetPageView().GetView().ImpIsGlueVisible();
+            bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
+            return !bTiledRendering && GetPageWindow().GetPageView().GetView().ImpIsGlueVisible();
         }
 
         // check if text animation is allowed.
commit 1fb852809d7bd9d149987d081ca99e51551f9d4e
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Thu Mar 25 12:44:17 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:42 2021 +0200

    lok: Send gridOffset of the shape
    
    In core, the gridOffset is calculated based on the LogicRect's TopLeft coordinate
    In online, we have the SnapRect and we calculate it based on its TopLeft coordinate
    SnapRect's TopLeft and LogicRect's TopLeft match when there is no rotation
    but the rotation is not applied to the LogicRect. Therefore,
    what we calculate in online does not match in case of the rotated shape.
    Here we can send the correct gridOffset in the selection callback.
    whether the shape is rotated or not, we will always have the correct gridOffset
    Note that the gridOffset is always calculated from the first selected obj
    
    Change-Id: Icc62a94879367f9b55ad05887945393452021777
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113078
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114027
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index f75bb22f3dda..1221ab486fc8 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -690,6 +690,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
     tools::Rectangle aSelection(rRect);
     bool bIsChart = false;
     Point addLogicOffset(0, 0);
+    bool convertMapMode = false;
     if (!rRect.IsEmpty())
     {
         sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
@@ -719,7 +720,10 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
             if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
             {
                 if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+                {
                     aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+                    convertMapMode = true;
+                }
             }
         }
 
@@ -760,6 +764,26 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
             aExtraInfo.append("\",\"type\":");
             aExtraInfo.append(OString::number(pO->GetObjIdentifier()));
 
+            // In core, the gridOffset is calculated based on the LogicRect's TopLeft coordinate
+            // In online, we have the SnapRect and we calculate it based on its TopLeft coordinate
+            // SnapRect's TopLeft and LogicRect's TopLeft match unless there is rotation
+            // but the rotation is not applied to the LogicRect. Therefore,
+            // what we calculate in online does not match with the core in case of the rotation.
+            // Here we can send the correct gridOffset in the selection callback, this way
+            // whether the shape is rotated or not, we will always have the correct gridOffset
+            // Note that the gridOffset is calculated from the first selected obj
+            basegfx::B2DVector aGridOffset(0.0, 0.0);
+            if(getPossibleGridOffsetForSdrObject(aGridOffset, GetMarkedObjectByIndex(0), GetSdrPageView()))
+            {
+                Point p(aGridOffset.getX(), aGridOffset.getY());
+                if (convertMapMode)
+                    p = OutputDevice::LogicToLogic(p, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+                aExtraInfo.append(",\"gridOffsetX\":");
+                aExtraInfo.append(OString::number(p.getX()));
+                aExtraInfo.append(",\"gridOffsetY\":");
+                aExtraInfo.append(OString::number(p.getY()));
+            }
+
             if (bWriterGraphic)
             {
                 aExtraInfo.append(", \"isWriterGraphic\": true");
@@ -896,7 +920,6 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
                 boost::property_tree::ptree poly;
                 boost::property_tree::ptree custom;
                 boost::property_tree::ptree nodes;
-                const bool convertMapMode = mpMarkedPV->GetView().GetFirstOutputDevice()->GetMapMode().GetMapUnit() == MapUnit::Map100thMM;
                 for (size_t i = 0; i < maHdlList.GetHdlCount(); i++)
                 {
                     SdrHdl *pHdl = maHdlList.GetHdl(i);
commit 51442a26852b54a6ef35406689bdae4c94f1b2c8
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Wed Mar 24 12:06:08 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:42 2021 +0200

    LOK: Fix Moving drag handles calculates wrong offset
    
    When dragging the shape handles for resizing,
    the handle's grid offset must be the shapes grid
    offset. In small numbered row&column orders, it is
    not visible much since the difference is very little
    but as the number gets greater, the difference becomes more visible.
    
    Change-Id: I44d03cc67a239c8b7758206930def331ed8e5e42
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113028
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114026
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 62aea371e758..27fc6f84c4ce 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -35,6 +35,7 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <svx/sdr/overlay/overlaymanager.hxx>
 #include <svx/sdrpagewindow.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace sdr;
 
@@ -205,10 +206,12 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
 
         // Coordinate maybe affected by GridOffset, so we may need to
         // adapt to Model-coordinates here
-        if(getPossibleGridOffsetForPosition(
+        if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
+            && getPossibleGridOffsetForSdrObject(aGridOffset, GetMarkedObjectByIndex(0), GetSdrPageView()))
+            || (getPossibleGridOffsetForPosition(
             aGridOffset,
             basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
-            GetSdrPageView()))
+            GetSdrPageView())))
         {
             aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
             aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
@@ -507,10 +510,12 @@ void SdrDragView::MovDragObj(const Point& rPnt)
 
     // Coordinate maybe affected by GridOffset, so we may need to
     // adapt to Model-coordinates here
-    if(getPossibleGridOffsetForPosition(
+    if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
+        && getPossibleGridOffsetForSdrObject(aGridOffset, GetMarkedObjectByIndex(0), GetSdrPageView()))
+        || (getPossibleGridOffsetForPosition(
         aGridOffset,
         basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
-        GetSdrPageView()))
+        GetSdrPageView())))
     {
         aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
         aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
commit 2969f047033c9188cfed0f688a8721d5a893147a
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Fri Mar 19 12:31:42 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:42 2021 +0200

    Fix Line and Connectors enable interactive drawing
    
    We add them directly for LOK case and have no functionality
    for interactive drawing.
    
    Noticed that in Writer we didnt even add them directly
    I also implemented that as well.
    
    Change-Id: If90bfc8d2cdf84f200bc7963ae4126ef789524ff
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112703
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114025
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index 5a7bcc2088b6..66265311f56a 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -229,6 +229,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
         case SID_DRAW_ELLIPSE:
         case SID_DRAW_MEASURELINE:
             pTabView->SetDrawFuncPtr(new FuConstRectangle(*this, pWin, pView, pDoc, aNewReq));
+            bCreateDirectly = comphelper::LibreOfficeKit::isActive();
             break;
 
         case SID_DRAW_CAPTION:
@@ -330,6 +331,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
     }
     else
     {
+        GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
         ScViewData& rViewData = GetViewData();
         aInsertPos = rViewData.getLOKVisibleArea().Center();
         if (comphelper::LibreOfficeKit::isCompatFlagSet(
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index bd4c3775300d..ca4b46223954 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -605,6 +605,10 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
     if(!(HasCurrentFunction() && ((rReq.GetModifier() & KEY_MOD1) || bCreateDirectly)))
         return;
 
+    // disable interactive drawing for LOK
+    if (bCreateDirectly)
+            GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
+
     // get SdOptions
     SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
     sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth());
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 6ee6e4eafe22..dc28ec597b4e 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -259,6 +259,7 @@ void SwView::ExecDraw(SfxRequest& rReq)
         case SID_DRAW_CAPTION:
         case SID_DRAW_CAPTION_VERTICAL:
             pFuncPtr.reset( new ConstRectangle(m_pWrtShell.get(), m_pEditWin, this) );
+            bCreateDirectly = comphelper::LibreOfficeKit::isActive();
             m_nDrawSfxId = nSlotId;
             m_sDrawCustom.clear();
             break;
@@ -340,6 +341,8 @@ void SwView::ExecDraw(SfxRequest& rReq)
         NoRotate();
         if(rReq.GetModifier() == KEY_MOD1 || bCreateDirectly)
         {
+            if (bCreateDirectly)
+                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
             if(SID_OBJECT_SELECT == m_nDrawSfxId )
             {
                 m_pWrtShell->GotoObj(true);
commit e941a8a269855eaa96f45437dd7f8b3f942beb47
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Wed Mar 17 09:01:45 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Apr 20 09:53:41 2021 +0200

    LOK: Fix wrong gridOffset when shape is moved on calc
    
    Change-Id: I37501128068943cee8f67a5d91a35ec1a76fe550
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112599
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114024
    Tested-by: Jenkins

diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx
index 7e214b76199e..6387c39afcbf 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -224,8 +224,11 @@ void ViewObjectContact::ActionChanged()
         // invalidate current valid range
         GetObjectContact().InvalidatePartOfView(maObjectRange);
 
-        // reset ObjectRange, it needs to be recalculated
-        maObjectRange.reset();
+        // reset gridOffset, it needs to be recalculated
+        if (GetObjectContact().supportsGridOffsets())
+            resetGridOffset();
+        else
+            maObjectRange.reset();
     }
 
     // register at OC for lazy invalidate


More information about the Libreoffice-commits mailing list