summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2020-07-14 18:09:04 +0200
committerAndras Timar <andras.timar@collabora.com>2020-07-22 16:07:43 +0200
commitc50571d34723aa53ebba705c14c07a85c37faa93 (patch)
tree4a226f13958b8259531b211fb3e9427804d502a0
parente94d9c1c346a8b7e58c24bcf554c0a2bab77f59c (diff)
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/+/98822 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx42
-rw-r--r--sc/source/ui/view/tabvwshc.cxx9
2 files changed, 48 insertions, 3 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index e35233cbc3f0..1b7eb5343560 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -110,6 +110,7 @@ public:
void testJumpHorizontallyInvalidation();
void testJumpToLastRowInvalidation();
void testDeleteCellMultilineContent();
+ void testFunctionDlg();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnHeaders);
@@ -151,6 +152,7 @@ public:
CPPUNIT_TEST(testJumpHorizontallyInvalidation);
CPPUNIT_TEST(testJumpToLastRowInvalidation);
CPPUNIT_TEST(testDeleteCellMultilineContent);
+ CPPUNIT_TEST(testFunctionDlg);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1695,6 +1697,46 @@ 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);
+ KeyEvent aEvent(27, KEY_ESCAPE, 0);
+ Application::PostKeyEvent(VclEventId::WindowKeyInput, pRefWindow->GetWindow(), &aEvent);
+ Application::PostKeyEvent(VclEventId::WindowKeyUp, pRefWindow->GetWindow(), &aEvent);
+
+ Scheduler::ProcessEventsToIdle();
+ 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::testVbaRangeCopyPaste()
{
comphelper::LibreOfficeKit::setActive();
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 1f0cd9bf737b..d725b4bba9a3 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -129,10 +129,13 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
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)
- GetViewData().GetDispatcher().Lock( true ); // lock is reset when closing dialog
+ GetViewData().GetDispatcher().Lock( true ); // lock is reset when closing dialog
+ }
return nullptr;
}