sw/qa/uibase/uno/uno.cxx          |    5 +++--
 sw/source/uibase/uno/loktxdoc.cxx |    1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 5dd5011eabc755d4ea8d282c32dd4854d532849a
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Tue Jan 10 11:24:56 2023 +0530
Commit:     Pranam Lashkari <lpra...@collabora.com>
CommitDate: Wed Jan 11 05:48:09 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/+/145295
    Tested-by: Jenkins

diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index b9158c44426d..4b21bca0bb0c 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -407,10 +407,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_TEST_FIXTURE(SwUibaseUnoTest, testGetSections)
diff --git a/sw/source/uibase/uno/loktxdoc.cxx 
b/sw/source/uibase/uno/loktxdoc.cxx
index 2291cf3f7ab5..a2f5b3cdd131 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;

Reply via email to