comphelper/source/misc/hash.cxx  |    5 ++++-
 sw/source/core/crsr/bookmark.cxx |   21 +++++++++++++++++++++
 sw/source/core/doc/docbm.cxx     |   18 ++++++++++++++++++
 sw/source/core/docnode/nodes.cxx |   20 ++++++++++++++++++++
 sw/source/core/inc/bookmark.hxx  |    1 +
 5 files changed, 64 insertions(+), 1 deletion(-)

New commits:
commit 15397a10585e223733c651287c9f84a719180128
Author:     Andras Timar <andras.ti...@collabora.com>
AuthorDate: Fri Nov 4 17:44:10 2022 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Jan 25 08:33:41 2023 +0000

    more detailed NSS error report
    
    Change-Id: I1b005a331aeed1c00d6bf18a6dff0ffa844ba6f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142286
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146041
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/comphelper/source/misc/hash.cxx b/comphelper/source/misc/hash.cxx
index 50fd8cd0f961..980097e234d0 100644
--- a/comphelper/source/misc/hash.cxx
+++ b/comphelper/source/misc/hash.cxx
@@ -18,6 +18,7 @@
 
 #if USE_TLS_NSS
 #include <nss.h>
+#include <nspr.h>
 #include <sechash.h>
 #elif USE_TLS_OPENSSL
 #include <openssl/evp.h>
@@ -78,7 +79,9 @@ struct HashImpl
 #if USE_TLS_NSS
         auto const e = NSS_NoDB_Init(nullptr);
         if (e != SECSuccess) {
-            throw css::uno::RuntimeException("NSS_NoDB_Init failed with " + 
OUString::number(e));
+            PRErrorCode error = PR_GetError();
+            const char* errorText = PR_ErrorToName(error);
+            throw css::uno::RuntimeException("NSS_NoDB_Init failed with " + 
OUString(errorText, strlen(errorText), RTL_TEXTENCODING_UTF8) + " (" + 
OUString::number(static_cast<int>(error)) + ")");
         }
         mpContext = HASH_Create(getNSSType());
         HASH_Begin(mpContext);
commit b03790dac08f97594b2cdc8a4ab0394d62fb851f
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Mon Jan 23 19:55:58 2023 +0530
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jan 25 08:33:36 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146101
    Tested-by: Jenkins

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index afef83e76df5..7fcba8858721 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -20,6 +20,10 @@
 #include <stdlib.h>
 #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>
 #include <IDocumentUndoRedo.hxx>
@@ -2438,6 +2442,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;
commit c8e49e7a49a99fd76a25ea825319d2243fed5c22
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Thu Jan 19 15:57:26 2023 +0530
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jan 25 08:33:28 2023 +0000

    sw: send LOK call back on bookmark deletion
    
    this helps with zotero when user deletes a bookmark or use undo
    without this online will be unaware of any such changes made by user
    
    Signed-off-by: Pranam Lashkari <lpra...@collabora.com>
    Change-Id: Id5ea4ee0ee1d16c399460cd177ec8e33256ce3dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145777
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit ea112b6d85a6914e1df40e064cd5df6d46248d68)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146022
    Tested-by: Jenkins

diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx
index 8165b30a98b1..c43dd04c2496 100644
--- a/sw/source/core/crsr/bookmark.cxx
+++ b/sw/source/core/crsr/bookmark.cxx
@@ -420,6 +420,27 @@ namespace sw::mark
         m_aName = rName;
     }
 
+    void Bookmark::sendLOKDeleteCallback()
+    {
+        if (GetMarkPos().GetDoc().IsClipBoard())
+            return;
+
+        SfxViewShell* pViewShell = SfxViewShell::Current();
+        if (!pViewShell)
+            return;
+
+        OUString fieldCommand = GetName();
+        tools::JsonWriter aJson;
+        aJson.put("commandName", ".uno:DeleteBookmark");
+        aJson.put("success", true);
+        {
+            auto result = aJson.startNode("result");
+            aJson.put("DeleteBookmark", fieldCommand);
+        }
+
+        
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.extractData());
+    }
+
     void Bookmark::InitDoc(SwDoc& io_rDoc,
             sw::mark::InsertMode const, SwPosition const*const)
     {
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index cd6afc472350..e074d104b905 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1262,6 +1262,24 @@ namespace sw::mark
         switch(IDocumentMarkAccess::GetType(*pMark))
         {
             case IDocumentMarkAccess::MarkType::BOOKMARK:
+                {
+                    auto const ppBookmark = lcl_FindMark(m_vBookmarks, 
*ppMark.get());
+                    if ( ppBookmark != m_vBookmarks.end() )
+                    {
+                        Bookmark* pBookmark = 
dynamic_cast<Bookmark*>(*ppBookmark);
+
+                        if(pBookmark)
+                            pBookmark->sendLOKDeleteCallback();
+
+                        m_vBookmarks.erase(ppBookmark);
+                    }
+                    else
+                    {
+                        assert(false &&
+                            "<MarkManager::deleteMark(..)> - Bookmark not 
found in Bookmark container.");
+                    }
+                }
+                break;
             case IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK:
             case IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK:
                 {
diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx
index b4630b18701c..6ba9484b3bd8 100644
--- a/sw/source/core/inc/bookmark.hxx
+++ b/sw/source/core/inc/bookmark.hxx
@@ -188,6 +188,7 @@ namespace sw::mark {
             bool IsInClipboard() const override;
             bool IsInUndo() const override;
             bool IsInContent() const override;
+            void sendLOKDeleteCallback();
             css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() 
override;
 
         private:

Reply via email to