From b18bff18785cc194f9918f6bdf000069523827ef Mon Sep 17 00:00:00 2001 From: merttumer Date: Fri, 2 Apr 2021 16:18:05 +0300 Subject: 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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113517 Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114032 Tested-by: Jenkins --- svx/source/svdraw/svdoedge.cxx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'svx/source/svdraw/svdoedge.cxx') diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index 4084f1e91dbe..e31e2bf8a85e 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1911,7 +1911,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) { @@ -2132,7 +2132,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(); @@ -2155,11 +2155,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(requestedOrdNum)) + continue; + } if (rVisLayer.IsSet(pObj->GetLayer()) && pObj->IsVisible() && // only visible objects (pThis==nullptr || pObj!=static_cast(pThis))) // don't connect it to itself { -- cgit