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 <hcastro@collabora.com>
Reviewed-by: Justin Luth <jluth@mail.com>
(cherry picked from commit a99aea61c3199dc8188d4d873a10201082dff2e2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126686
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 7e310d12..20b2d73 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 )