[Libreoffice-commits] core.git: sc/qa sc/source

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 14 09:45:05 UTC 2021


 sc/qa/unit/tiledrendering/tiledrendering.cxx |   39 +++++++++++++++++++++++++++
 sc/source/ui/view/tabvwshc.cxx               |    9 +++---
 2 files changed, 44 insertions(+), 4 deletions(-)

New commits:
commit 9dda49734b65875d7b916a1867d86f8c161b32e8
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Wed Jul 15 13:01:33 2020 +0200
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Wed Apr 14 11:44:27 2021 +0200

    lok: sc: Desktop: Function wizard isn't properly async
    
    Open another view of the same spreadsheet when the function dialog is
    open. Note how the document in the new view can't be edited.
    
    This patch avoids to have a view locked after creation when in an
    other view the formula dialog is open.
    
    See also commit 009d275.
    
    Change-Id: Ie51f414c4ad83ef20526d10be3251e174158096c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98823
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114060
    Tested-by: Jenkins
    Reviewed-by: Marco Cecchetti <marco.cecchetti at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 9a9a5119c4a0..5e3f1494059d 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -108,6 +108,7 @@ public:
     void testSheetGeometryDataInvariance();
     void testSheetGeometryDataCorrectness();
     void testDeleteCellMultilineContent();
+    void testFunctionDlg();
     void testSpellOnlineParameter();
     void testSpellOnlineRenderParameter();
     void testPasteIntoWrapTextCell();
@@ -156,6 +157,7 @@ public:
     CPPUNIT_TEST(testSheetGeometryDataInvariance);
     CPPUNIT_TEST(testSheetGeometryDataCorrectness);
     CPPUNIT_TEST(testDeleteCellMultilineContent);
+    CPPUNIT_TEST(testFunctionDlg);
     CPPUNIT_TEST(testSpellOnlineParameter);
     CPPUNIT_TEST(testSpellOnlineRenderParameter);
     CPPUNIT_TEST(testPasteIntoWrapTextCell);
@@ -1622,6 +1624,43 @@ void ScTiledRenderingTest::testFilterDlg()
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
+void ScTiledRenderingTest::testFunctionDlg()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    createDoc("empty.ods");
+
+    // view #1
+    SfxViewShell* pView1 = SfxViewShell::Current();
+    int nView1 = SfxLokHelper::getView();
+    {
+        pView1->GetViewFrame()->GetDispatcher()->Execute(SID_OPENDLG_FUNCTION,
+            SfxCallMode::SLOT|SfxCallMode::RECORD);
+    }
+    Scheduler::ProcessEventsToIdle();
+    SfxChildWindow* pRefWindow = pView1->GetViewFrame()->GetChildWindow(SID_OPENDLG_FUNCTION);
+    CPPUNIT_ASSERT(pRefWindow);
+
+    // view #2
+    int nView2 = SfxLokHelper::createView();
+    SfxViewShell* pView2 = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pView1 != pView2);
+
+    // check loking
+    CPPUNIT_ASSERT_EQUAL(true, pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+
+    SfxLokHelper::setView(nView1);
+    pRefWindow->GetController()->response(RET_CANCEL);
+
+    CPPUNIT_ASSERT_EQUAL(false, pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView2);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+}
+
 void ScTiledRenderingTest::testSpellOnlineParameter()
 {
     ScModelObj* pModelObj = createDoc("empty.ods");
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 208623b1c4cb..2249f25decb2 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -121,12 +121,13 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
 
     if ( nCurRefDlgId != nSlotId )
     {
-        //  the dialog has been opened in a different view
-        //  -> lock the dispatcher for this view (modal mode)
+        if (!(comphelper::LibreOfficeKit::isActive() && nSlotId == SID_OPENDLG_FUNCTION))
+        {
+            //  the dialog has been opened in a different view
+            //  -> lock the dispatcher for this view (modal mode)
 
-        if (!comphelper::LibreOfficeKit::isActive())
             GetViewData().GetDispatcher().Lock( true );    // lock is reset when closing dialog
-
+        }
         return nullptr;
     }
 


More information about the Libreoffice-commits mailing list