[Libreoffice-commits] core.git: Branch 'feature/jssidebar' - 5 commits - chart2/source desktop/source include/sfx2 include/svx sfx2/sdi sfx2/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 16 15:31:48 UTC 2019


Rebased ref, commits from common ancestor:
commit 9ee2d4f795838c87f91c29ba7d4a93580296e802
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Dec 15 21:12:17 2019 -0500
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 16 15:30:57 2019 +0000

    sfx2: sidebar: new .uno commands to show and hide sidebars
    
    Change-Id: I9afba5eec855d6de590086736177b543d52d3b20
    Reviewed-on: https://gerrit.libreoffice.org/85192
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 81c02c2c5d22..ad44965df7dd 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3310,12 +3310,12 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin
     }
     else if (aMap.find("id") != aMap.end())
     {
-        const OUString sClickAction("CLICK");
-        const OUString sSelectAction("SELECT");
-        const OUString sClearAction("CLEAR");
-        const OUString sTypeAction("TYPE");
-        const OUString sUpAction("UP");
-        const OUString sDownAction("DOWN");
+        static const OUString sClickAction("CLICK");
+        static const OUString sSelectAction("SELECT");
+        static const OUString sClearAction("CLEAR");
+        static const OUString sTypeAction("TYPE");
+        static const OUString sUpAction("UP");
+        static const OUString sDownAction("DOWN");
 
         try
         {
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 9fa90a5f6226..f7d77257350c 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -575,6 +575,8 @@ class SvxSearchItem;
 #define SID_TABLE_BORDER_TYPE               (SID_SVX_START + 1065)
 #define SID_TABLE_BORDER_INDEX              (SID_SVX_START + 1066)
 #define SID_TABLE_BORDER_OFFSET             (SID_SVX_START + 1067)
+#define SID_SHOW_SIDEBAR                    (SID_SVX_START + 1200)
+#define SID_HIDE_SIDEBAR                    (SID_SVX_START + 1201)
 
 #define FID_SVX_START                       (SID_LIB_START + 500)
 #define FID_SEARCH_NOW                      (FID_SVX_START + 2)
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index f12a326d0d2a..09fa766fbb5b 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -999,8 +999,11 @@ class SvxSetItem;
 #define SID_ULINE_VAL_DOUBLE                            (SID_SVX_START + 1197) /* double underline */
 #define SID_ULINE_VAL_DOTTED                            (SID_SVX_START + 1198) /* dotted underline */
 
+// #define SID_SHOW_SIDEBAR                                ( SID_SVX_START + 1200 ) -> sfxsids.hrc
+// #define SID_HIDE_SIDEBAR                                ( SID_SVX_START + 1201 ) -> sfxsids.hrc
+
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                               ( SID_SVX_START + 1198 + 1 )
+#define SID_SVX_FIRSTFREE                               ( SID_HIDE_SIDEBAR + 1 )
 
 // Overflow check for slot IDs
 #if SID_SVX_FIRSTFREE > SID_SVX_END
diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi
index 09aafef95b7d..53a13b479a7c 100644
--- a/sfx2/sdi/frmslots.sdi
+++ b/sfx2/sdi/frmslots.sdi
@@ -43,6 +43,16 @@ interface Window
         ExecMethod = ChildWindowExecute ;
         StateMethod = ChildWindowState ;
     ]
+    SID_SHOW_SIDEBAR // status(final|play)
+    [
+        ExecMethod = ChildWindowExecute ;
+        StateMethod = ChildWindowState ;
+    ]
+    SID_HIDE_SIDEBAR // status(final|play)
+    [
+        ExecMethod = ChildWindowExecute ;
+        StateMethod = ChildWindowState ;
+    ]
     SID_BROWSER // ole(no) api()
     [
         ExecMethod = ChildWindowExecute ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 624abe196661..f95610d07f5c 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -2594,6 +2594,42 @@ SfxBoolItem Sidebar SID_SIDEBAR
     GroupId = SfxGroupId::View;
 ]
 
+SfxBoolItem SidebarShow SID_SHOW_SIDEBAR
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::View;
+]
+
+SfxBoolItem SidebarHide SID_HIDE_SIDEBAR
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::View;
+]
+
 SfxBoolItem Menubar SID_MENUBAR
 [
     AutoUpdate = TRUE,
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 335b634da6e3..8d5e7f154650 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1223,7 +1223,7 @@ void SidebarController::RequestCloseDeck()
             // Mobile.
             std::stringstream aStream;
             boost::property_tree::ptree aTree;
-            aTree.put("id", mpParentWindow->get_id()); // TODO could be missing - sort out
+            aTree.put("id", mpCurrentDeck->GetLOKWindowId());
             aTree.put("type", "dockingwindow");
             aTree.put("text", mpParentWindow->GetText());
             aTree.put("enabled", false);
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 0ee2117875a5..5f731f6400a7 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -69,7 +69,9 @@ public:
             {
                 // Mobile.
                 std::stringstream aStream;
-                boost::property_tree::write_json(aStream, m_rSidebarDockingWin.DumpAsPropertyTree());
+                boost::property_tree::ptree aTree = m_rSidebarDockingWin.DumpAsPropertyTree();
+                aTree.put("id", m_rSidebarDockingWin.GetLOKWindowId());
+                boost::property_tree::write_json(aStream, aTree);
                 const std::string message = aStream.str();
                 if (message != m_LastNotificationMessage)
                 {
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 81f9d1fd4bdd..a19a89a91b91 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3217,17 +3217,28 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState )
             else if ( KnowsChildWindow(nSID) )
                 rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
         }
-        else if ( nSID == SID_SIDEBAR )
+        else if ( nSID == SID_SIDEBAR || nSID == SID_SHOW_SIDEBAR || nSID == SID_HIDE_SIDEBAR )
         {
-            if  ( !KnowsChildWindow( nSID ) )
+            if  ( !KnowsChildWindow( SID_SIDEBAR ) )
             {
                 SAL_WARN("sfx.view", "SID_SIDEBAR state requested, but no task pane child window exists for this ID!");
-                rState.DisableItem( nSID );
+                rState.DisableItem( SID_SIDEBAR );
             }
-            else
+            else if ( nSID == SID_SIDEBAR )
             {
+                // Toggle.
                 rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) );
             }
+            else if ( nSID == SID_SHOW_SIDEBAR )
+            {
+                // Show.
+                rState.Put( SfxBoolItem( nSID, false ) );
+            }
+            else if ( nSID == SID_HIDE_SIDEBAR )
+            {
+                // Hide.
+                rState.Put( SfxBoolItem( nSID, true ) );
+            }
         }
         else if ( KnowsChildWindow(nSID) )
             rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
commit 7c94ae570e198997eaa8afbf8ab51be11e7cb608
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Dec 11 18:19:43 2019 -0500
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 16 15:30:55 2019 +0000

    chart2: clear listener parents in dispose
    
    Change-Id: Icdab125589ab0f55255f683a1ea39e036de661b1
    Reviewed-on: https://gerrit.libreoffice.org/84997
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 2a3bd54a85e6..0971fd079ca1 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -74,6 +74,7 @@ ChartWindow::~ChartWindow()
 
 void ChartWindow::dispose()
 {
+    m_pWindowController = nullptr;
     m_pViewShellWindow.clear();
     vcl::Window::dispose();
 }
diff --git a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx
index b000e55c5aa6..0fa0b793b5b6 100644
--- a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx
+++ b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx
@@ -27,12 +27,17 @@ ChartSidebarModifyListener::~ChartSidebarModifyListener()
 
 void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/)
 {
-    mpParent->updateData();
+    if (mpParent)
+        mpParent->updateData();
 }
 
 void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEvent*/)
 {
+    if (!mpParent)
+        return;
+
     mpParent->modelInvalid();
+    mpParent = nullptr;
 }
 
 } }
diff --git a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
index e037fc39aa5f..e7d74c656a55 100644
--- a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
+++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
@@ -41,6 +41,9 @@ ChartSidebarSelectionListener::~ChartSidebarSelectionListener()
 
 void ChartSidebarSelectionListener::selectionChanged(const css::lang::EventObject& rEvent)
 {
+    if (!mpParent)
+        return;
+
     bool bCorrectObjectSelected = false;
 
     css::uno::Reference<css::frame::XController> xController(rEvent.Source, css::uno::UNO_QUERY);
@@ -66,6 +69,10 @@ void ChartSidebarSelectionListener::selectionChanged(const css::lang::EventObjec
 
 void ChartSidebarSelectionListener::disposing(const css::lang::EventObject& /*rEvent*/)
 {
+    if (!mpParent)
+        return;
+
+    mpParent = nullptr;
 }
 
 void ChartSidebarSelectionListener::setAcceptedTypes(const std::vector<ObjectType>& aTypes)
commit 60ed692b8fd759badeac42bd59171cb74ef176db
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Dec 11 12:23:08 2019 -0500
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 16 15:30:54 2019 +0000

    sfx2: sidebar: notify mobile when the sidebar closes
    
    Change-Id: Idb05346a9ccc8690cad566b74ec86d5fdd3bfb35
    Reviewed-on: https://gerrit.libreoffice.org/84973
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 14c78d918494..335b634da6e3 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -53,6 +53,8 @@
 #include <sal/log.hxx>
 #include <officecfg/Office/UI/Sidebar.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
 
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
@@ -1215,7 +1217,21 @@ void SidebarController::RequestCloseDeck()
     if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck.get())
     {
         const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier();
-        if (pNotifier)
+        auto pMobileNotifier = SfxViewShell::Current();
+        if (pMobileNotifier && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+        {
+            // Mobile.
+            std::stringstream aStream;
+            boost::property_tree::ptree aTree;
+            aTree.put("id", mpParentWindow->get_id()); // TODO could be missing - sort out
+            aTree.put("type", "dockingwindow");
+            aTree.put("text", mpParentWindow->GetText());
+            aTree.put("enabled", false);
+            boost::property_tree::write_json(aStream, aTree);
+            const std::string message = aStream.str();
+            pMobileNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
+        }
+        else if (pNotifier)
             pNotifier->notifyWindow(mpCurrentDeck->GetLOKWindowId(), "close");
     }
 
commit 1ed0d6e3ddb1106b7953421115b664c583a9fe7f
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Dec 8 12:36:58 2019 -0500
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 16 15:30:53 2019 +0000

    sidebar: sensible line and page sizes and invalidate
    
    Change-Id: Icf60480a47d7c93bad44f6457bb05af332e63c6d
    Reviewed-on: https://gerrit.libreoffice.org/84718
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index d6c485b1f3c8..aeaf6274e6f9 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -65,6 +65,8 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow,
     mpScrollContainer->Show();
 
     mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange));
+    mpVerticalScrollBar->SetLineSize(10);
+    mpVerticalScrollBar->SetPageSize(100);
 
 #ifdef DEBUG
     SetText(OUString("Deck"));
@@ -353,6 +355,7 @@ IMPL_LINK_NOARG(Deck, HandleVerticalScrollBarChange, ScrollBar*, void)
     const sal_Int32 nYOffset (-mpVerticalScrollBar->GetThumbPos());
     mpScrollContainer->SetPosPixel(Point(mpScrollContainer->GetPosPixel().X(),
                                          nYOffset));
+    mpScrollContainer->Invalidate();
 }
 
 //----- Deck::ScrollContainerWindow -------------------------------------------
commit 1d551af6f43c46d4aed4609d107c52581b3b3ead
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Dec 4 08:19:22 2019 -0500
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 16 15:30:52 2019 +0000

    LOK: don't send LOK notifications while switching views
    
    Changing the active view is done for virtually every
    LOK API, and in some cases simply changing the view
    results in a flurry of notifications that themselves
    caues further API calls that need to change the view.
    
    This moves the disabling of callbacks during setView
    to SfxLokHelper to make sure no view gets any
    notifications. This is needed because even when
    we disable notifications for the current view,
    the _other_ view(s) can still get notified as they
    lose their frame.
    
    Change-Id: Ia88a58d6a1162e48c40f4c4ce73c40ecb2c1fb7e
    Reviewed-on: https://gerrit.libreoffice.org/84417
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 68b75b3d181c..81c02c2c5d22 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4634,28 +4634,14 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis
     SfxLokHelper::destroyView(nId);
 }
 
-static void doc_setView(LibreOfficeKitDocument* pThis, int nId)
+static void doc_setView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int nId)
 {
     comphelper::ProfileZone aZone("doc_setView");
 
     SolarMutexGuard aGuard;
     SetLastExceptionMsg();
 
-    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
-    const auto handlerIt = pDocument->mpCallbackFlushHandlers.find(nId);
-    if (handlerIt != pDocument->mpCallbackFlushHandlers.end())
-        handlerIt->second->disableCallbacks();
-
-    try
-    {
-        SfxLokHelper::setView(nId);
-    }
-    catch (const std::exception&)
-    {
-    }
-
-    if (handlerIt != pDocument->mpCallbackFlushHandlers.end())
-        handlerIt->second->enableCallbacks();
+    SfxLokHelper::setView(nId);
 }
 
 static int doc_getView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/)
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 4670bd098663..3d549d5cf1e1 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -34,6 +34,36 @@
 
 using namespace com::sun::star;
 
+namespace {
+/// Used to disable callbacks.
+/// Needed to avoid recursion when switching views,
+/// which can cause clients to invoke LOKit API and
+/// implicitly set the view, which might cause an
+/// infinite recursion if not detected and prevented.
+class DisableCallbacks
+{
+public:
+    DisableCallbacks()
+    {
+        assert(m_nDisabled >= 0 && "Expected non-negative DisabledCallbacks state when disabling.");
+        ++m_nDisabled;
+    }
+
+    ~DisableCallbacks()
+    {
+        assert(m_nDisabled > 0 && "Expected positive DisabledCallbacks state when re-enabling.");
+        --m_nDisabled;
+    }
+
+    static bool disabled() { return m_nDisabled != 0; }
+
+private:
+    static int m_nDisabled;
+};
+
+int DisableCallbacks::m_nDisabled = 0;
+}
+
 int SfxLokHelper::createView()
 {
     SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst();
@@ -81,6 +111,8 @@ void SfxLokHelper::setView(int nId)
     {
         if (static_cast<sal_Int32>(pViewShell->GetViewShellId()) == nViewShellId)
         {
+            DisableCallbacks dc;
+
             // update the current LOK language for the dialog tunneling
             comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag());
 
@@ -166,6 +198,9 @@ static OString lcl_escapeQuotes(const OString &rStr)
 
 void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload)
 {
+    if (DisableCallbacks::disabled())
+        return;
+
     OString aPayload = OStringLiteral("{ \"viewId\": \"") + OString::number(SfxLokHelper::getView(pThisView)) +
                        "\", \"part\": \"" + OString::number(pThisView->getPart()) +
                        "\", \"" + rKey + "\": \"" + lcl_escapeQuotes(rPayload) + "\" }";
@@ -175,7 +210,7 @@ void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell const*
 
 void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload)
 {
-    if (SfxLokHelper::getViewsCount() <= 1)
+    if (SfxLokHelper::getViewsCount() <= 1 || DisableCallbacks::disabled())
         return;
 
     SfxViewShell* pViewShell = SfxViewShell::GetFirst();
@@ -212,7 +247,7 @@ namespace {
 
 void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem)
 {
-    if (!pShell || !pItem || pItem == INVALID_POOL_ITEM)
+    if (!pShell || !pItem || pItem == INVALID_POOL_ITEM || DisableCallbacks::disabled())
         return;
 
     boost::property_tree::ptree aItem = pItem->dumpAsJSON();
@@ -236,7 +271,7 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView,
 {
     assert(pThisView);
 
-    if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0)
+    if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0 || DisableCallbacks::disabled())
         return;
 
     OStringBuffer aPayload;
@@ -260,6 +295,10 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView,
 void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload)
 {
     OStringBuffer aBuf(32);
+
+    if (DisableCallbacks::disabled())
+        return;
+
     aBuf.append(rPayload);
     if (comphelper::LibreOfficeKit::isPartInInvalidation())
     {
@@ -271,10 +310,7 @@ void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OStri
 
 void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll)
 {
-    if (!comphelper::LibreOfficeKit::isActive())
-        return;
-
-    if (!pDoc)
+    if (!pDoc || !comphelper::LibreOfficeKit::isActive() || DisableCallbacks::disabled())
         return;
 
     if (bInvalidateAll)
@@ -291,7 +327,7 @@ void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, cons
 
 void SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc, bool bInvalidateAll)
 {
-    if (!comphelper::LibreOfficeKit::isActive())
+    if (!comphelper::LibreOfficeKit::isActive() || DisableCallbacks::disabled())
         return;
 
     SfxViewShell* pViewShell = SfxViewShell::GetFirst();
@@ -304,6 +340,9 @@ void SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc
 
 void SfxLokHelper::notifyVisCursorInvalidation(OutlinerViewShell const* pThisView, const OString& rRectangle)
 {
+    if (DisableCallbacks::disabled())
+        return;
+
     OString sPayload;
     if (comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation())
     {
@@ -319,6 +358,9 @@ void SfxLokHelper::notifyVisCursorInvalidation(OutlinerViewShell const* pThisVie
 
 void SfxLokHelper::notifyAllViews(int nType, const OString& rPayload)
 {
+    if (DisableCallbacks::disabled())
+        return;
+
     const auto payload = rPayload.getStr();
     SfxViewShell* pViewShell = SfxViewShell::GetFirst();
     while (pViewShell)
@@ -330,6 +372,9 @@ void SfxLokHelper::notifyAllViews(int nType, const OString& rPayload)
 
 void SfxLokHelper::notifyContextChange(SfxViewShell const* pViewShell, const OUString& aApplication, const OUString& aContext)
 {
+    if (DisableCallbacks::disabled())
+        return;
+
     OString aBuffer =
         OUStringToOString(aApplication.replace(' ', '_'), RTL_TEXTENCODING_UTF8) +
         " " +


More information about the Libreoffice-commits mailing list