diff options
author | Gökay Şatır <gokaysatir@collabora.com> | 2024-08-01 15:07:39 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-08-02 15:21:22 +0200 |
commit | 183078c3a4314f88c858cf0825ffa7bfcd384dd6 (patch) | |
tree | 7664b1b265ab16b96885747a1d98e76413ede997 /svx | |
parent | 6d795d6f04f62a9bd8085820d58ff2793dbca856 (diff) |
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.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I544e2c8089510f47b0cc0f25e368cad6d459cb2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171374
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 13 | ||||
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 19 |
2 files changed, 31 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 43a803d8b4dd..fbbbfcac0cad 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -947,7 +947,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) { @@ -1215,6 +1217,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 b15a8438d56e..cbf15673b12c 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -134,6 +134,25 @@ SdrObject* SdrObjList::getSdrObjectFromSdrObjList() const return nullptr; } +OString SdrObjList::GetObjectRectangles(const SdrObjList& rSrcList) +{ + OString result = "["_ostr; + + for (const rtl::Reference<SdrObject>& item: rSrcList) + { + if (item->IsPrintable() && item->IsVisible()) + { + tools::Rectangle rectangle = item->GetCurrentBoundRect(); + OString ordNum(std::to_string(item->GetOrdNum())); + result += "["_ostr + rectangle.toString() + ", "_ostr + ordNum + "]"_ostr; + } + } + + result = result.replaceAll("]["_ostr, "],["_ostr); + + return result + "]"_ostr; +} + void SdrObjList::CopyObjects(const SdrObjList& rSrcList) { CloneList aCloneList; |