sw/inc/txtrfmrk.hxx | 2 ++ sw/source/core/txtnode/atrref.cxx | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+)
New commits: commit 510b2ce1ca74ec7e70b54413d91b2fc84f4e07ae Author: Pranam Lashkari <[email protected]> AuthorDate: Thu Jan 19 15:27:31 2023 +0530 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Jan 23 07:13:14 2023 +0000 sw: send LOK call back on refmark deletion this helps with zotero when user deletes a refmark or use undo without this online will be unaware of any such changes made by user Signed-off-by: Pranam Lashkari <[email protected]> Change-Id: Ia4326fd03f6b7d27fdb59ccc25d60331ba7923d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145774 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx index 0d25090197c1..6c9eafc35fb6 100644 --- a/sw/inc/txtrfmrk.hxx +++ b/sw/inc/txtrfmrk.hxx @@ -33,6 +33,8 @@ public: SwTextRefMark( SwFormatRefMark& rAttr, sal_Int32 const nStart, sal_Int32 const*const pEnd = nullptr); + ~SwTextRefMark(); + virtual const sal_Int32* GetEnd() const override; // SwTextAttr virtual void SetEnd(sal_Int32) override; // SwTextAttr diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx index e281803050e3..d57aff71e688 100644 --- a/sw/source/core/txtnode/atrref.cxx +++ b/sw/source/core/txtnode/atrref.cxx @@ -22,6 +22,11 @@ #include <hintids.hxx> #include <hints.hxx> #include <txtrfmrk.hxx> +#include <sfx2/viewsh.hxx> +#include <tools/json_writer.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <doc.hxx> +#include <ndtxt.hxx> SwFormatRefMark::~SwFormatRefMark( ) { @@ -94,6 +99,27 @@ SwTextRefMark::SwTextRefMark( SwFormatRefMark& rAttr, SetOverlapAllowedAttr( true ); } +SwTextRefMark::~SwTextRefMark() +{ + if (GetTextNode().GetDoc().IsClipBoard()) + return; + + SfxViewShell* pViewShell = SfxViewShell::Current(); + if (!pViewShell) + return; + + OUString fieldCommand = GetRefMark().GetRefName(); + tools::JsonWriter aJson; + aJson.put("commandName", ".uno:DeleteField"); + aJson.put("success", true); + { + auto result = aJson.startNode("result"); + aJson.put("DeleteField", fieldCommand); + } + + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, aJson.extractData()); +} + const sal_Int32* SwTextRefMark::GetEnd() const { return m_pEnd;
