sc/source/ui/miscdlgs/anyrefdg.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit a99aea61c3199dc8188d4d873a10201082dff2e2
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Tue Dec 7 15:19:45 2021 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Thu Dec 9 15:12:03 2021 +0100

    tdf#121699 sc: wrap LOKit stuff with isActive
    
    This is a partial revert of LO 6.1
    commit 009d2756b1678477ec23d5647bd5004c4bff3a62.
    
    It is one thing to change code that you don't really
    know why it is setup that way, but it is another thing
    to ignore the resulting regression reports for 3 years.
    Not impressed.
    
    It look me only 1 hour to work through this,
    and this is completely outside of my normal
    line of programming.
    
    Change-Id: I8671677f38cc1332c6c5a76847801e2680097048
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126500
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcas...@collabora.com>
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx 
b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 7e310d12cb45..20b2d7318df4 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -458,6 +458,28 @@ void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
 
 void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock )
 {
+    if (!comphelper::LibreOfficeKit::isActive())
+    {
+        // lock / unlock only the dispatchers of Calc documents
+        ScDocShell* pDocShell = 
static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
+        while (pDocShell)
+        {
+            SfxViewFrame* pFrame = SfxViewFrame::GetFirst(pDocShell);
+            while (pFrame)
+            {
+                SfxDispatcher* pDisp = pFrame->GetDispatcher();
+                if (pDisp)
+                    pDisp->Lock(bLock);
+                pFrame = SfxViewFrame::GetNext(*pFrame, pDocShell);
+            }
+            pDocShell = 
static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, 
checkSfxObjectShell<ScDocShell>));
+        }
+        return;
+        // if a new view is created while the dialog is open,
+        // that view's dispatcher is locked when trying to create the dialog
+        // for that view (ScTabViewShell::CreateRefDialog)
+    }
+
     //  lock / unlock only the dispatcher of Calc document
     SfxDispatcher* pDisp = nullptr;
     if ( m_pBindings )

Reply via email to