From 7aaa9ef2e5edaf468f116449776433e98fb1a2f3 Mon Sep 17 00:00:00 2001 From: Mert Tumer Date: Thu, 8 Oct 2020 13:37:07 +0300 Subject: Added optional parameter Enabled for uno:SpellOnline Change-Id: I3578b0a002ea2cdcc7893972607f26732ce545ea Signed-off-by: Mert Tumer Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103982 Tested-by: Jenkins --- sc/qa/unit/tiledrendering/tiledrendering.cxx | 25 +++++++++++++++++++++++++ sc/source/ui/app/scmod.cxx | 4 +++- 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'sc') diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 8a0c9f2f637f..8c03a19902d5 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -110,6 +111,7 @@ public: void testSheetGeometryDataInvariance(); void testSheetGeometryDataCorrectness(); void testDeleteCellMultilineContent(); + void testSpellOnlineParameter(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnHeaders); @@ -154,6 +156,7 @@ public: CPPUNIT_TEST(testSheetGeometryDataInvariance); CPPUNIT_TEST(testSheetGeometryDataCorrectness); CPPUNIT_TEST(testDeleteCellMultilineContent); + CPPUNIT_TEST(testSpellOnlineParameter); CPPUNIT_TEST_SUITE_END(); private: @@ -1632,6 +1635,28 @@ void ScTiledRenderingTest::testFilterDlg() SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); } +void ScTiledRenderingTest::testSpellOnlineParameter() +{ + ScModelObj* pModelObj = createDoc("empty.ods"); + ScDocument* pDoc = pModelObj->GetDocument(); + bool bSet = pDoc->GetDocOptions().IsAutoSpell(); + + uno::Sequence params = + { + comphelper::makePropertyValue("Enable", uno::makeAny(!bSet)), + }; + dispatchCommand(mxComponent, ".uno:SpellOnline", params); + CPPUNIT_ASSERT_EQUAL(!bSet, pDoc->GetDocOptions().IsAutoSpell()); + + // set the same state as now and we don't expect any change (no-toggle) + params = + { + comphelper::makePropertyValue("Enable", uno::makeAny(!bSet)), + }; + dispatchCommand(mxComponent, ".uno:SpellOnline", params); + CPPUNIT_ASSERT_EQUAL(!bSet, pDoc->GetDocOptions().IsAutoSpell()); +} + void ScTiledRenderingTest::testVbaRangeCopyPaste() { comphelper::LibreOfficeKit::setActive(); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 7f272e131192..688e52d3f54a 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -343,7 +343,9 @@ void ScModule::Execute( SfxRequest& rReq ) { bool bSet; const SfxPoolItem* pItem; - if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( nSlot, true, &pItem ) ) + if (pReqArgs->HasItem(FN_PARAM_1, &pItem)) + bSet = static_cast(pItem)->GetValue(); + else if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( nSlot, true, &pItem ) ) bSet = static_cast(pItem)->GetValue(); else { // Toggle -- cgit