diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2023-01-19 00:14:50 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-01-19 14:44:53 +0000 |
commit | 3a6b7e2c07566f22f33189ad4e8393767df5b9f8 (patch) | |
tree | 29afc54dfcd725ae217998889af8bcea5d8510be | |
parent | 69e41aa9c09cfe1344edce2ebadd89b7561bce78 (diff) |
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 <lpranam@collabora.com>
Change-Id: I93cf102c20b3861140508aee5d81e65f5b9207ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145753
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/source/core/crsr/bookmark.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/inc/bookmark.hxx | 1 |
2 files changed, 21 insertions, 0 deletions
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 <LibreOfficeKit/LibreOfficeKitEnums.h> #include <rtl/strbuf.hxx> #include <strings.hrc> +#include <tools/json_writer.hxx> 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; |