sw/source/core/docnode/nodes.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 4223b65194bfc5ecf9448c1c4b8236464654bd3d
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Mon Jan 23 19:55:58 2023 +0530
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jan 24 15:37:30 2023 +0000

    sw: send LOK call back on section deletion
    
    this helps with zotero when user deletes or undo a bibliography stored as a 
section
    without this online will be unaware of any such changes made by user
    
    Signed-off-by: Pranam Lashkari <lpra...@collabora.com>
    Change-Id: I6a8ae3924d548e97299a8d74f8c93c3345d1a430
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146007
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index d352cfb41057..c59b949a94df 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -21,6 +21,9 @@
 
 #include <libxml/xmlwriter.h>
 #include <osl/diagnose.h>
+#include <tools/json_writer.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <sfx2/viewsh.hxx>
 
 #include <node.hxx>
 #include <doc.hxx>
@@ -2296,6 +2299,22 @@ void SwNodes::RemoveNode( SwNodeOffset nDelPos, 
SwNodeOffset nSz, bool bDel )
             // 'Extra Redlines' array
             pTableNode->RemoveRedlines();
         }
+
+        SwSectionNode* pSectionNode = pNode->GetSectionNode();
+        if (pSectionNode && !GetDoc().IsClipBoard() && SfxViewShell::Current())
+        {
+            OUString fieldCommand = 
pSectionNode->GetSection().GetSectionName();
+            tools::JsonWriter aJson;
+            aJson.put("commandName", ".uno:DeleteSection");
+            aJson.put("success", true);
+            {
+                auto result = aJson.startNode("result");
+                aJson.put("DeleteSection", fieldCommand);
+            }
+
+            
SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT,
 aJson.extractData());
+
+        }
     }
 
     SwNodeOffset nEnd = nDelPos + nSz;

Reply via email to