include/svx/svdpage.hxx | 1 + sd/qa/unit/tiledrendering/tiledrendering.cxx | 3 +++ svx/source/svdraw/svdmrkv.cxx | 13 ++++++++++++- svx/source/svdraw/svdpage.cxx | 19 +++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-)
New commits: commit de9e0ee798df858d124abbfaff10608672dee69d Author: Gökay Şatır <gokaysa...@collabora.com> AuthorDate: Thu Aug 1 15:07:39 2024 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Sep 3 16:03:36 2024 +0200 When a shape is selected, send other shapes' rectangles. GitHub issue link: * https://github.com/CollaboraOnline/online/issues/9689 Also add OrdNum property to ExtraInfo in order to exclude the selected shape from the list. Check new properties in tiledrendering test. Change-Id: I544e2c8089510f47b0cc0f25e368cad6d459cb2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172730 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 55f11379356d..f64af22e1353 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -92,6 +92,7 @@ public: virtual SdrObject* getSdrObjectFromSdrObjList() const; SAL_DLLPRIVATE void CopyObjects(const SdrObjList& rSrcList); + static OString GetObjectRectangles(const SdrObjList& rSrcList); // tdf#116879 clean up everything (without Undo), plus broadcasting // changes. Split to this call and a private one (impClearSdrObjList) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index d6e041519974..87371647db85 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2660,6 +2660,9 @@ void lcl_extractHandleParameters(std::string_view selection, sal_uInt32& id, sal id = handle0.get_child("id").get_value<int>(); x = handle0.get_child("point").get_child("x").get_value<int>(); y = handle0.get_child("point").get_child("y").get_value<int>(); + + CPPUNIT_ASSERT(aTree.get_child("OrdNum").get_value<int>() >= 0); + CPPUNIT_ASSERT(aTree.get_child("ObjectRectangles").size() >= 1); } } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index a39796d8081f..45c8072038bc 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -952,7 +952,9 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S aExtraInfo.append("{\"id\":\"" + OString::number(reinterpret_cast<sal_IntPtr>(pO)) + "\",\"type\":" - + OString::number(static_cast<sal_Int32>(pO->GetObjIdentifier()))); + + OString::number(static_cast<sal_Int32>(pO->GetObjIdentifier())) + + ",\"OrdNum\":" + OString::number(pO->GetOrdNum()) + ); if (mpMarkedObj && !pOtherShell) { @@ -1220,6 +1222,15 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S aExtraInfo.append(", \"url\": \"" + mediaObj->getTempURL().toUtf8() + "\""); } + SdrPage *pPage = pPageView ? pPageView->GetPage(): nullptr; + if (pPage) + { + // Send all objects' rectangles along with the selected object's information. + // Other rectangles can be used for aligning the selected object referencing the others. + OString objectRectangles = SdrObjList::GetObjectRectangles(*pPage); + aExtraInfo.append(", \"ObjectRectangles\": "_ostr + objectRectangles); + } + aExtraInfo.append(handleArrayStr + "}"); sSelectionText += ", " + aExtraInfo; diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 25d074c0a175..1cff663e1f08 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -128,6 +128,25 @@ SdrObject* SdrObjList::getSdrObjectFromSdrObjList() const return nullptr; } +OString SdrObjList::GetObjectRectangles(const SdrObjList& rSrcList) +{ + OStringBuffer aBuffer("["); + + for (const rtl::Reference<SdrObject>& item: rSrcList) + { + if (item->IsPrintable() && item->IsVisible()) + { + tools::Rectangle rectangle = item->GetCurrentBoundRect(); + aBuffer.append("["_ostr + rectangle.toString() + ", "_ostr + OString::number(item->GetOrdNum()) + "]"_ostr); + } + } + + OString aResult = aBuffer.makeStringAndClear(); + aResult = aResult.replaceAll("]["_ostr, "],["_ostr); + + return aResult + "]"_ostr; +} + void SdrObjList::CopyObjects(const SdrObjList& rSrcList) { CloneList aCloneList;