sd/qa/unit/uiimpress.cxx | 70 +++++++++++----------- sd/source/ui/unoidl/unomodel.cxx | 8 +- sw/qa/uibase/shells/shells.cxx | 113 +++++++++++++++++------------------- sw/source/uibase/shells/textsh1.cxx | 21 +++++- sw/source/uibase/uno/loktxdoc.cxx | 3 5 files changed, 114 insertions(+), 101 deletions(-)
New commits: commit 71be46acca22ca51d4def3fa8ea5aac076b08384 Author: Attila Szűcs <attila.sz...@collabora.com> AuthorDate: Thu Feb 13 18:01:49 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Feb 19 16:14:44 2025 +0100 FillApi: fixed JSON validity issues Changed extract to always extract a valid JSON file. Extract changed in 2 place: At charts: old format: "DataValues": [ "Row.0": [ "22", "24"], "Row.1": [ "18", "16"], "Row.2": [ "32", "32"], "Row.3": [ "25", "23"] ] New: "DataValues": [ [ "22", "24"], [ "18", "16"], [ "32", "32"], [ "25", "23"] ] At Slides the following arrays changed to objects: "MasterSlides" [ -> "MasterSlides" { "Slides" [ -> "Slides" { "Objects" [ -> "Texts" { "Texts" [ -> "Texts" { Change-Id: I18180db714c0d0701380376a72e608cb080b67cd --- Transform will still accept the old not valid JSON files also, But for now, they will also accept a bit different JSON format file that is valid JSON. "Transforms" now can be an array and all of its element an object old: "Transforms": { "Charts.ByEmbedIndex.0": { new: "Transforms": [ { "Charts.ByEmbedIndex.0": { The same chanes was at : "Charts.????" "UserDefinedProperties" //at Document Properties --- These changes was needed only becsuse of 2 JSON rule: 1: Arrays can not conatin propertyes. (only values, and objects are allower) 2: Objects cannot have 2 property with the same name. Also updated unit tests. Change-Id: I70311b1c6da57305dc1d9e8ec1f29ab5aa93ee56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181646 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index eebdeb82a6cc..cb9ab1ac4e5c 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -216,61 +216,61 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testDocumentStructureTransformExtractSlide pXPresDocument->getCommandValues(aJsonWriter, aCommand); OString aExpectedStr - = "{ \"DocStructure\": { \"SlideCount\": 7, \"MasterSlideCount\": 8, \"MasterSlides\": [ " + = "{ \"DocStructure\": { \"SlideCount\": 7, \"MasterSlideCount\": 8, \"MasterSlides\": { " "\"MasterSlide 0\": { \"Name\": \"Topic_Separator_Purple\"}, \"MasterSlide 1\": { " "\"Name\": \"Content_sidebar_White\"}, \"MasterSlide 2\": { \"Name\": \"Topic Separator " "white\"}, \"MasterSlide 3\": { \"Name\": \"Content_sidebar_White_\"}, \"MasterSlide " "4\": { \"Name\": \"Topic_Separator_Purple_\"}, \"MasterSlide 5\": { \"Name\": " "\"Content_White_Purple_Sidebar\"}, \"MasterSlide 6\": { \"Name\": \"Default 1\"}, " - "\"MasterSlide 7\": { \"Name\": \"Default 1_\"}], \"Slides\": [ \"Slide 0\": { " + "\"MasterSlide 7\": { \"Name\": \"Default 1_\"}}, \"Slides\": { \"Slide 0\": { " "\"SlideName\": \"Slide3-Renamed\", \"MasterSlideName\": " "\"Content_White_Purple_Sidebar\", \"LayoutId\": 3, \"LayoutName\": " - "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 4, \"Objects\": [ \"Objects 0\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " - "\"Friendly Open Source Project\"]}]}, \"Objects 1\": { }, \"Objects 2\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 9, \"Paragraphs\": [ \"Real " + "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 4, \"Objects\": { \"Objects 0\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " + "\"Friendly Open Source Project\"]}}}, \"Objects 1\": { }, \"Objects 2\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 9, \"Paragraphs\": [ \"Real " "Open Source\", \"100% open-source code\", \"Built with LibreOffice technology\", " "\"Built with Free Software technology stacks: primarily C++\", \"Runs best on Linux\", " "\"Open Development\", \"Anyone can contribute & participate\", \"Follow commits and " - "tickets\", \"Public community calls - forum has details\"]}]}, \"Objects 3\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 5, \"Paragraphs\": [ " + "tickets\", \"Public community calls - forum has details\"]}}}, \"Objects 3\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 5, \"Paragraphs\": [ " "\"Focus:\", \"a non-renewable resource.\", \"Office Productivity & Documents\", " "\"Excited about migrating your\u0001documents\", \"Grateful to our partners for " - "solving\u0001other problems.\"]}]}]}, \"Slide 1\": { \"SlideName\": \"Slide 2\", " + "solving\u0001other problems.\"]}}}}}, \"Slide 1\": { \"SlideName\": \"Slide 2\", " "\"MasterSlideName\": \"Topic_Separator_Purple\", \"LayoutId\": 3, \"LayoutName\": " - "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 1, \"Objects\": [ \"Objects 0\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 3, \"Paragraphs\": [ " - "\"Collabora Online\", \"\", \"Powerful Online Collaboration\"]}]}]}, \"Slide 2\": { " + "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 1, \"Objects\": { \"Objects 0\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 3, \"Paragraphs\": [ " + "\"Collabora Online\", \"\", \"Powerful Online Collaboration\"]}}}}}, \"Slide 2\": { " "\"SlideName\": \"Slide1-Duplicated\", \"MasterSlideName\": \"Topic_Separator_Purple\", " "\"LayoutId\": 3, \"LayoutName\": \"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 1, " - "\"Objects\": [ \"Objects 0\": { \"TextCount\": 1, \"Texts\": [ \"Text 0\": { " + "\"Objects\": { \"Objects 0\": { \"TextCount\": 1, \"Texts\": { \"Text 0\": { " "\"ParaCount\": 3, \"Paragraphs\": [ \"Collabora Online\", \"\", \"Powerful Online " - "Collaboration\"]}]}]}, \"Slide 3\": { \"SlideName\": \"SlideInserted-1\", " + "Collaboration\"]}}}}}, \"Slide 3\": { \"SlideName\": \"SlideInserted-1\", " "\"MasterSlideName\": \"Content_sidebar_White\", \"LayoutId\": 18, \"LayoutName\": " - "\"AUTOLAYOUT_TITLE_4CONTENT\", \"ObjectCount\": 5, \"Objects\": [ \"Objects 0\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " - "\"Click to add Title\"]}]}, \"Objects 1\": { \"TextCount\": 1, \"Texts\": [ \"Text 0\": " - "{ \"ParaCount\": 1, \"Paragraphs\": [ \"Click to add Text\"]}]}, \"Objects 2\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " - "\"Click to add Text\"]}]}, \"Objects 3\": { \"TextCount\": 1, \"Texts\": [ \"Text 0\": " - "{ \"ParaCount\": 1, \"Paragraphs\": [ \"Click to add Text\"]}]}, \"Objects 4\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " - "\"Click to add Text\"]}]}]}, \"Slide 4\": { \"SlideName\": \"Slide 6\", " + "\"AUTOLAYOUT_TITLE_4CONTENT\", \"ObjectCount\": 5, \"Objects\": { \"Objects 0\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " + "\"Click to add Title\"]}}}, \"Objects 1\": { \"TextCount\": 1, \"Texts\": { \"Text 0\": " + "{ \"ParaCount\": 1, \"Paragraphs\": [ \"Click to add Text\"]}}}, \"Objects 2\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " + "\"Click to add Text\"]}}}, \"Objects 3\": { \"TextCount\": 1, \"Texts\": { \"Text 0\": " + "{ \"ParaCount\": 1, \"Paragraphs\": [ \"Click to add Text\"]}}}, \"Objects 4\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " + "\"Click to add Text\"]}}}}}, \"Slide 4\": { \"SlideName\": \"Slide 6\", " "\"MasterSlideName\": \"Topic_Separator_Purple\", \"LayoutId\": 3, \"LayoutName\": " - "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 1, \"Objects\": [ \"Objects 0\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ \"With " - "thanks to our Partners, Customers & Community !\"]}]}]}, \"Slide 5\": { \"SlideName\": " + "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 1, \"Objects\": { \"Objects 0\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ \"With " + "thanks to our Partners, Customers & Community !\"]}}}}}, \"Slide 5\": { \"SlideName\": " "\"SlideInserted-Name\", \"MasterSlideName\": \"Topic Separator white\", \"LayoutId\": " - "3, \"LayoutName\": \"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 3, \"Objects\": [ " - "\"Objects 0\": { \"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 1, " - "\"Paragraphs\": [ \"first\"]}]}, \"Objects 1\": { \"TextCount\": 1, \"Texts\": [ \"Text " - "0\": { \"ParaCount\": 1, \"Paragraphs\": [ \"second\"]}]}, \"Objects 2\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " - "\"third\"]}]}]}, \"Slide 6\": { \"SlideName\": \"Slide 7\", \"MasterSlideName\": " + "3, \"LayoutName\": \"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 3, \"Objects\": { " + "\"Objects 0\": { \"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 1, " + "\"Paragraphs\": [ \"first\"]}}}, \"Objects 1\": { \"TextCount\": 1, \"Texts\": { \"Text " + "0\": { \"ParaCount\": 1, \"Paragraphs\": [ \"second\"]}}}, \"Objects 2\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 1, \"Paragraphs\": [ " + "\"third\"]}}}}}, \"Slide 6\": { \"SlideName\": \"Slide 7\", \"MasterSlideName\": " "\"Topic_Separator_Purple\", \"LayoutId\": 3, \"LayoutName\": " - "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 1, \"Objects\": [ \"Objects 0\": { " - "\"TextCount\": 1, \"Texts\": [ \"Text 0\": { \"ParaCount\": 3, \"Paragraphs\": [ " - "\"Collabora Online\", \"\", \"Powerful Online Collaboration\"]}]}]}]}}"_ostr; + "\"AUTOLAYOUT_TITLE_2CONTENT\", \"ObjectCount\": 1, \"Objects\": { \"Objects 0\": { " + "\"TextCount\": 1, \"Texts\": { \"Text 0\": { \"ParaCount\": 3, \"Paragraphs\": [ " + "\"Collabora Online\", \"\", \"Powerful Online Collaboration\"]}}}}}}}}"_ostr; CPPUNIT_ASSERT_EQUAL(aExpectedStr, aJsonWriter.finishAndGetAsOString()); } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 303132a567fd..e32edfa6daa9 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1649,7 +1649,7 @@ void GetDocStructureSlides(::tools::JsonWriter& rJsonWriter, SdXImpressDocument* // write data of every master slide if (nMasterPageCount > 0) { - auto aMasterPagesNode = rJsonWriter.startArray("MasterSlides"); + auto aMasterPagesNode = rJsonWriter.startNode("MasterSlides"); for (int nMPId = 0; nMPId < nMasterPageCount; nMPId++) { auto aMasterPageNode = rJsonWriter.startNode("MasterSlide " + std::to_string(nMPId)); @@ -1662,7 +1662,7 @@ void GetDocStructureSlides(::tools::JsonWriter& rJsonWriter, SdXImpressDocument* // write data of every slide if (nPageCount > 0) { - auto aPagesNode = rJsonWriter.startArray("Slides"); + auto aPagesNode = rJsonWriter.startNode("Slides"); for (int nPId = 0; nPId < nPageCount; nPId++) { auto aPageNode = rJsonWriter.startNode("Slide " + std::to_string(nPId)); @@ -1691,7 +1691,7 @@ void GetDocStructureSlides(::tools::JsonWriter& rJsonWriter, SdXImpressDocument* if (nObjCount > 0) { - auto aObjectsNode = rJsonWriter.startArray("Objects"); + auto aObjectsNode = rJsonWriter.startNode("Objects"); for (int nOId = 0; nOId < nObjCount; nOId++) { auto aObjectNode = rJsonWriter.startNode("Objects " + std::to_string(nOId)); @@ -1703,7 +1703,7 @@ void GetDocStructureSlides(::tools::JsonWriter& rJsonWriter, SdXImpressDocument* rJsonWriter.put("TextCount", nTextCount); if (nTextCount > 0) { - auto aTextsNode = rJsonWriter.startArray("Texts"); + auto aTextsNode = rJsonWriter.startNode("Texts"); for (int nTId = 0; nTId < nTextCount; nTId++) { auto aTextNode diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index 337dbcd8dee6..e49d574c4f7f 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -597,34 +597,33 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDocumentStructureTransformChart) createSwDoc("docStructureChartExampleOriginal.odt"); OString aJson = R"json( { - "Transforms": { - "Charts.ByEmbedIndex.0": { - "modifyrow.1": [ 19, 15 ], - "datayx.3.1": 37, - "deleterow.0": "", - "deleterow.1": "", - "insertrow.0": [ 15, 17 ], - "setrowdesc.0": "Paul", - "insertrow.2": [ 19, 22 ], - "setrowdesc.2": "Barbara", - "insertrow.4": [ 29, 27 ], - "setrowdesc.4": "Elizabeth", - "insertrow.5": [ 14, 26 ], - "setrowdesc.5": "William", - "insertcolumn.1": [ 1,2,3,4,5,6 ], - "insertcolumn.0": [ 2,1,2,1,2,1 ], - "insertcolumn.4": [ 7,7,7,7,7,7 ], - "setcolumndesc.4": "c4", - "setcolumndesc.0": "c0", - "setcolumndesc.2": "c2" - }, - "Charts.BySubTitle.Subtitle2": { + "Transforms": [ + {"Charts.ByEmbedIndex.0": [ + {"modifyrow.1": [ 19, 15 ]}, + {"datayx.3.1": 37}, + {"deleterow.0": ""}, + {"deleterow.1": ""}, + {"insertrow.0": [ 15, 17 ]}, + {"setrowdesc.0": "Paul"}, + {"insertrow.2": [ 19, 22 ]}, + {"setrowdesc.2": "Barbara"}, + {"insertrow.4": [ 29, 27 ]}, + {"setrowdesc.4": "Elizabeth"}, + {"insertrow.5": [ 14, 26 ]}, + {"setrowdesc.5": "William"}, + {"insertcolumn.1": [ 1,2,3,4,5,6 ]}, + {"insertcolumn.0": [ 2,1,2,1,2,1 ]}, + {"insertcolumn.4": [ 7,7,7,7,7,7 ]}, + {"setcolumndesc.4": "c4"}, + {"setcolumndesc.0": "c0"}, + {"setcolumndesc.2": "c2"} + ]}, + {"Charts.BySubTitle.Subtitle2": { "deletecolumn.3": "" - }, - "Charts.ByEmbedName.Object3": { - "resize": [ 12, 3 ], - "setrowdesc": - [ + }}, + {"Charts.ByEmbedName.Object3": [ + {"resize": [ 12, 3 ]}, + {"setrowdesc": [ "United Kingdom", "United States of America", "Canada", @@ -637,11 +636,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDocumentStructureTransformChart) "Italy", "France", "Egypt" - ], - "modifycolumn.0": [ 12, 9, 8, 5, 5, 4, 3, 3, 2, 2, 1, 1], - "resize": [ 12, 2 ] - }, - "Charts.ByTitle.Fixed issues": { + ]}, + {"modifycolumn.0": [ 12, 9, 8, 5, 5, 4, 3, 3, 2, 2, 1, 1]}, + {"resize": [ 12, 2 ]} + ]}, + {"Charts.ByTitle.Fixed issues": { "data": [ [ 3,1,2 ], [ 2,0,1 ], [ 3,2,0 ], @@ -662,8 +661,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDocumentStructureTransformChart) [ 2,2,2,1,2,3 ] ], "setrowdesc": ["2023.01",".02",".03",".04",".05",".06",".07",".08",".09",".10",".11",".12","2023.01",".02",".03",".04",".05",".06"], "setcolumndesc": ["Jennifer", "Charles", "Thomas", "Maria", "Lisa", "Daniel"] - } - } + }} + ] } )json"_ostr; @@ -771,14 +770,14 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDocumentStructureExtractChart) = "{ \"DocStructure\": { \"Charts.ByEmbedIndex.0\": { \"name\": \"Object1\", \"title\": " "\"Paid leave days\", \"subtitle\": \"Subtitle2\", \"RowDescriptions\": [ \"James\", " "\"Mary\", \"Patricia\", \"David\"], \"ColumnDescriptions\": [ \"2022\", \"2023\"], " - "\"DataValues\": [ \"Row.0\": [ \"22\", \"24\"], \"Row.1\": [ \"18\", \"16\"], " - "\"Row.2\": [ \"32\", \"32\"], \"Row.3\": [ \"25\", \"23\"]]}, " + "\"DataValues\": [ [ \"22\", \"24\"], [ \"18\", \"16\"], [ \"32\", \"32\"], " + "[ \"25\", \"23\"]]}, " "\"Charts.ByEmbedIndex.1\": { \"name\": \"Object2\", \"title\": \"Fixed issues\", " "\"subtitle\": \"Subtitle1\", \"RowDescriptions\": [ \"\"], \"ColumnDescriptions\": [ \" " - "\"], \"DataValues\": [ \"Row.0\": [ \"NaN\"]]}, \"Charts.ByEmbedIndex.2\": { \"name\": " + "\"], \"DataValues\": [ [ \"NaN\"]]}, \"Charts.ByEmbedIndex.2\": { \"name\": " "\"Object3\", \"title\": \"Employees from countries\", \"subtitle\": \"Subtitle3\", " "\"RowDescriptions\": [ \"\"], \"ColumnDescriptions\": [ \"Column 1\"], \"DataValues\": " - "[ \"Row.0\": [ \"NaN\"]]}}}"_ostr; + "[ [ \"NaN\"]]}}}"_ostr; CPPUNIT_ASSERT_EQUAL(aExpectedStr, aJsonWriter.finishAndGetAsOString()); } @@ -788,8 +787,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDocumentStructureDocProperties) createSwDoc("docStructureChartExampleOriginal.odt"); OString aJson = R"json( { - "Transforms": { - "DocumentProperties": { + "Transforms": [ + { "DocumentProperties": { "Author":"Author TxT", "Generator":"Generator TxT", "CreationDate":"2024-01-21T14:45:00", @@ -828,35 +827,35 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDocumentStructureDocProperties) "Rights":"Rights TxT", "Source":"Source TxT", "Type":"Type TxT", - "UserDefinedProperties":{ - "Add.NewPropName Str": { + "UserDefinedProperties": [ + {"Add.NewPropName Str": { "type": "string", "value": "this is a string" - }, - "Add.NewPropName Str": { + }}, + {"Add.NewPropName Str": { "type": "boolean", "value": false - }, - "Add.NewPropName Bool": { + }}, + {"Add.NewPropName Bool": { "type": "boolean", "value": true - }, - "Add.NewPropName Numb": { + }}, + {"Add.NewPropName Numb": { "type": "long", "value": 1245 - }, - "Add.NewPropName float": { + }}, + {"Add.NewPropName float": { "type": "float", "value": 12.45 - }, - "Add.NewPropName Double": { + }}, + {"Add.NewPropName Double": { "type": "double", "value": 124.578 - }, - "Delete": "NewPropName Double" - } - } - } + }}, + {"Delete": "NewPropName Double"} + ] + } } + ] } )json"_ostr; diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 380b35cc2965..f95ad1e07283 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -2410,8 +2410,13 @@ void SwTextShell::Execute(SfxRequest &rReq) if (aItem.first == "Transforms") { // Handle all transformations - for (const auto& aItem2 : aItem.second) + for (const auto& aItem2Obj : aItem.second) { + // handle `"Transforms": { ` and `"Transforms": [` cases as well + // if an element is an object `{...}`, then get the first element of the object + const auto& aItem2 + = aItem2Obj.first == "" ? *aItem2Obj.second.ordered_begin() : aItem2Obj; + if (aItem2.first == "DocumentProperties") { uno::Reference<document::XDocumentPropertiesSupplier> @@ -2662,8 +2667,13 @@ void SwTextShell::Execute(SfxRequest &rReq) if (!xUserPropsAccess.is()) continue; - for (const auto& aItem4 : aItem3.second) + for (const auto& aItem4Obj : aItem3.second) { + // handle [{},{}...] case as well as {}...} + const auto& aItem4 = aItem4Obj.first == "" + ? *aItem4Obj.second.ordered_begin() + : aItem4Obj; + if (aItem4.first == "Delete") { std::string aPropName @@ -2879,8 +2889,13 @@ void SwTextShell::Execute(SfxRequest &rReq) } } - for (const auto& aItem3 : aItem2.second) + for (const auto& aItem3Obj : aItem2.second) { + //handle [] and {} cases + const auto& aItem3 = aItem3Obj.first == "" + ? *aItem3Obj.second.ordered_begin() + : aItem3Obj; + if (aItem3.first.starts_with("deletecolumn.") || aItem3.first.starts_with("deleterow.") || aItem3.first.starts_with("insertcolumn.") diff --git a/sw/source/uibase/uno/loktxdoc.cxx b/sw/source/uibase/uno/loktxdoc.cxx index fe844e942de3..42e0262a2538 100644 --- a/sw/source/uibase/uno/loktxdoc.cxx +++ b/sw/source/uibase/uno/loktxdoc.cxx @@ -638,8 +638,7 @@ void GetDocStructureCharts(tools::JsonWriter& rJsonWriter, SwDocShell* /*pDocShe auto aDataValuesNode = rJsonWriter.startArray("DataValues"); for (int j = 0; j < aData.getLength(); j++) { - OString aRowNodeName("Row."_ostr + OString::number(j)); - auto aRowNode = rJsonWriter.startArray(aRowNodeName); + auto aRowNode = rJsonWriter.startAnonArray(); for (int k = 0; k < aData[j].getLength(); k++) { rJsonWriter.putSimpleValue(OUString::number(aData[j][k]));