sw/qa/uibase/uno/uno.cxx | 5 +++-- sw/source/uibase/uno/loktxdoc.cxx | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
New commits: commit 10eb0e5258cf1c07878be0bf995dbf29f4d4ae06 Author: Pranam Lashkari <lpra...@collabora.com> AuthorDate: Tue Jan 10 11:24:56 2023 +0530 Commit: Pranam Lashkari <lpra...@collabora.com> CommitDate: Tue Jan 10 20:36:35 2023 +0000 sw: return field under cursor inside field node Having values inside field node makes it easier to detect which commands value is being returned in online. otherwise its impossible to predict the command from "type" and "command" as "command" can be anything and "type" is very generic this also makes output more consistent with "GetTextFormFields" Signed-off-by: Pranam Lashkari <lpra...@collabora.com> Change-Id: I1b8b39bfd0de6d7b19c2944bd42f7031d60518af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145248 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index f24137e482a2..26e912fcfb2b 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -301,10 +301,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormField) // Without the accompanying fix in place, this test would have failed with: // - No such node (type) // i.e. the returned JSON was just an empty object. + auto field = aTree.get_child("field"); CPPUNIT_ASSERT_EQUAL(std::string("vnd.oasis.opendocument.field.UNHANDLED"), - aTree.get<std::string>("type")); + field.get<std::string>("type")); CPPUNIT_ASSERT_EQUAL(std::string("ADDIN ZOTERO_ITEM foo bar"), - aTree.get<std::string>("command")); + field.get<std::string>("command")); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/uno/loktxdoc.cxx b/sw/source/uibase/uno/loktxdoc.cxx index c8e50206e55a..d1b31238dff8 100644 --- a/sw/source/uibase/uno/loktxdoc.cxx +++ b/sw/source/uibase/uno/loktxdoc.cxx @@ -126,6 +126,7 @@ void GetTextFormField(tools::JsonWriter& rJsonWriter, SwDocShell* pDocShell, SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SwPosition& rCursor = *pWrtShell->GetCursor()->GetPoint(); sw::mark::IFieldmark* pFieldmark = rIDMA.getFieldmarkFor(rCursor); + auto typeNode = rJsonWriter.startNode("field"); if (!pFieldmark) { return;