From 3a6b7e2c07566f22f33189ad4e8393767df5b9f8 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Thu, 19 Jan 2023 00:14:50 +0530 Subject: sw: send LOK call back on fieldmark deletion this helps with zotero when user deletes a fieldmark or use undo without this online will be unaware of any such changes made by user Signed-off-by: Pranam Lashkari Change-Id: I93cf102c20b3861140508aee5d81e65f5b9207ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145753 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna --- sw/source/core/crsr/bookmark.cxx | 20 ++++++++++++++++++++ sw/source/core/inc/bookmark.hxx | 1 + 2 files changed, 21 insertions(+) diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 95de1b15a0df..23e7ed6f85fe 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -47,6 +47,7 @@ #include #include #include +#include using namespace ::sw::mark; using namespace ::com::sun::star; @@ -565,6 +566,25 @@ namespace sw::mark m_aName = rName; } + TextFieldmark::~TextFieldmark() + { + SfxViewShell* pViewShell = SfxViewShell::Current(); + if (!pViewShell) + return; + + OUString fieldCommand; + (*GetParameters())[OUString(ODF_CODE_PARAM)] >>= fieldCommand; + tools::JsonWriter aJson; + aJson.put("commandName", ".uno:DeleteTextFormField"); + aJson.put("success", true); + { + auto result = aJson.startNode("result"); + aJson.put("DeleteTextFormField", fieldCommand); + } + + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, aJson.extractData()); + } + void TextFieldmark::InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode const eMode, SwPosition const*const pSepPos) { diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx index 8769dfffb1ee..5d44c3454882 100644 --- a/sw/source/core/inc/bookmark.hxx +++ b/sw/source/core/inc/bookmark.hxx @@ -239,6 +239,7 @@ namespace sw::mark { { public: TextFieldmark(const SwPaM& rPaM, const OUString& rName); + ~TextFieldmark(); void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; void ReleaseDoc(SwDoc& rDoc) override; -- cgit