diff options
author | Mert Tumer <mert.tumer@collabora.com> | 2020-10-08 13:37:07 +0300 |
---|---|---|
committer | Mert Tumer <mert.tumer@collabora.com> | 2020-10-09 21:30:26 +0200 |
commit | 7aaa9ef2e5edaf468f116449776433e98fb1a2f3 (patch) | |
tree | f5f81527535507de15109320d71fcfc4639f7632 /sc | |
parent | e116efdeff09e8ce9a45d459af53216015cd5347 (diff) |
Added optional parameter Enabled for uno:SpellOnline
Change-Id: I3578b0a002ea2cdcc7893972607f26732ce545ea
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103982
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 4 |
2 files changed, 28 insertions, 1 deletions
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 <sc.hrc> #include <comphelper/string.hxx> #include <tools/json_writer.hxx> +#include <docoptio.hxx> #include <chrono> #include <cstddef> @@ -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<beans::PropertyValue> 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<const SfxBoolItem*>(pItem)->GetValue(); + else if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( nSlot, true, &pItem ) ) bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue(); else { // Toggle |