summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2023-01-19 15:27:31 +0530
committerMiklos Vajna <vmiklos@collabora.com>2023-01-23 07:13:14 +0000
commit510b2ce1ca74ec7e70b54413d91b2fc84f4e07ae (patch)
treefa1b079e8b9ef9aa5387325d18c101a0a3db9050
parentea112b6d85a6914e1df40e064cd5df6d46248d68 (diff)
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 <lpranam@collabora.com> Change-Id: Ia4326fd03f6b7d27fdb59ccc25d60331ba7923d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145774 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/inc/txtrfmrk.hxx2
-rw-r--r--sw/source/core/txtnode/atrref.cxx26
2 files changed, 28 insertions, 0 deletions
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;