diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 24 |
2 files changed, 17 insertions, 10 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 1c78c9dab9e9..67df22bd05ad 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1223,7 +1223,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S { // 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); + // Replace curly braces with empty string in order to merge it with the resulting string. + OString objectRectangles = SdrObjList::GetObjectRectangles(*pPage).replaceAll("{"_ostr, ""_ostr).replaceAll("}"_ostr, ""_ostr); aExtraInfo.append(", \"ObjectRectangles\": "_ostr + objectRectangles); } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index cbf15673b12c..eefed8094632 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -30,6 +30,7 @@ #include <string.h> #include <tools/debug.hxx> +#include <tools/json_writer.hxx> #include <comphelper/diagnose_ex.hxx> #include <comphelper/lok.hxx> @@ -136,21 +137,26 @@ SdrObject* SdrObjList::getSdrObjectFromSdrObjList() const OString SdrObjList::GetObjectRectangles(const SdrObjList& rSrcList) { - OString result = "["_ostr; + tools::JsonWriter jsWriter; - for (const rtl::Reference<SdrObject>& item: rSrcList) { - if (item->IsPrintable() && item->IsVisible()) + auto array = jsWriter.startAnonArray(); + + for (const rtl::Reference<SdrObject>& item: rSrcList) { - tools::Rectangle rectangle = item->GetCurrentBoundRect(); - OString ordNum(std::to_string(item->GetOrdNum())); - result += "["_ostr + rectangle.toString() + ", "_ostr + ordNum + "]"_ostr; + if (item->IsPrintable() && item->IsVisible()) + { + tools::Rectangle rectangle = item->GetCurrentBoundRect(); + OString value(std::to_string(item->GetOrdNum())); + value = rectangle.toString() + ", "_ostr + value; + + auto subArray = jsWriter.startAnonArray(); + jsWriter.putRaw(value); + } } } - result = result.replaceAll("]["_ostr, "],["_ostr); - - return result + "]"_ostr; + return jsWriter.finishAndGetAsOString(); } void SdrObjList::CopyObjects(const SdrObjList& rSrcList) |