sc/qa/unit/tiledrendering/tiledrendering.cxx | 25 +++++++++++++++++++++++++ sc/source/ui/app/scmod.cxx | 4 +++- sd/qa/unit/uiimpress.cxx | 17 +++++++++++++++++ sd/source/ui/view/drviewse.cxx | 9 ++++++++- svx/sdi/svx.sdi | 2 +- sw/qa/extras/uiwriter/uiwriter.cxx | 19 +++++++++++++++++++ sw/source/uibase/uiview/view0.cxx | 6 +++++- 7 files changed, 78 insertions(+), 4 deletions(-)
New commits: commit d90a404a078b9fc1baa98ec0eb3d6a90f869b336 Author: Mert Tumer <mert.tu...@collabora.com> AuthorDate: Thu Oct 8 13:37:07 2020 +0300 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Oct 9 15:37:51 2020 +0200 Added optional parameter Enabled for uno:SpellOnline Change-Id: I3578b0a002ea2cdcc7893972607f26732ce545ea Signed-off-by: Mert Tumer <mert.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104083 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 4962ebc5fb68..33a15349b70b 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -38,6 +38,7 @@ #include <vcl/unohelp2.hxx> #include <sc.hrc> #include <comphelper/string.hxx> +#include <docoptio.hxx> #include <chrono> #include <cstddef> @@ -110,6 +111,7 @@ public: void testSheetGeometryDataCorrectness(); void testDeleteCellMultilineContent(); void testFunctionDlg(); + void testSpellOnlineParameter(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnHeaders); @@ -155,6 +157,7 @@ public: CPPUNIT_TEST(testSheetGeometryDataCorrectness); CPPUNIT_TEST(testDeleteCellMultilineContent); CPPUNIT_TEST(testFunctionDlg); + CPPUNIT_TEST(testSpellOnlineParameter); CPPUNIT_TEST_SUITE_END(); private: @@ -1684,6 +1687,28 @@ void ScTiledRenderingTest::testFunctionDlg() 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)), + }; + lcl_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)), + }; + lcl_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 739d13322051..59fc059bf5ef 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -342,7 +342,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 diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index ce7a310bc289..738b09a3fd7d 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -275,6 +275,23 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testPageFillGradient) CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), aGradient.GetStartColor().AsRGBHexString()); CPPUNIT_ASSERT_EQUAL(OUString("0000ff"), aGradient.GetEndColor().AsRGBHexString()); } + +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testSpellOnlineParameter) +{ + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("sd/qa/unit/data/empty.fodp")); + auto pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get()); + bool bSet = pImpressDocument->GetDoc()->GetOnlineSpell(); + + uno::Sequence<beans::PropertyValue> params(comphelper::InitPropertySequence({{"Enable", uno::makeAny(!bSet)}})); + dispatchCommand(mxComponent, ".uno:SpellOnline", params); + CPPUNIT_ASSERT_EQUAL(!bSet, pImpressDocument->GetDoc()->GetOnlineSpell()); + + // set the same state as now and we don't expect any change (no-toggle) + params = comphelper::InitPropertySequence({{"Enable", uno::makeAny(!bSet)}}); + dispatchCommand(mxComponent, ".uno:SpellOnline", params); + CPPUNIT_ASSERT_EQUAL(!bSet, pImpressDocument->GetDoc()->GetOnlineSpell()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index fbb6edf50085..3ae9b37171b0 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1352,7 +1352,14 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) case SID_AUTOSPELL_CHECK: { - bool bOnlineSpell = !GetDoc()->GetOnlineSpell(); + bool bOnlineSpell; + const SfxPoolItem* pItem; + + if (rReq.GetArgs()->HasItem(FN_PARAM_1, &pItem)) + bOnlineSpell = static_cast<const SfxBoolItem*>(pItem)->GetValue(); + else // Toggle + bOnlineSpell = !GetDoc()->GetOnlineSpell(); + GetDoc()->SetOnlineSpell(bOnlineSpell); ::Outliner* pOL = mpDrawView->GetTextEditOutliner(); diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 3b4ae1fdd48c..04e6a3279bdb 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -8025,7 +8025,7 @@ SvxKerningItem Spacing SID_ATTR_CHAR_KERNING SfxBoolItem SpellOnline SID_AUTOSPELL_CHECK - +(SfxBoolItem Enable FN_PARAM_1) [ AutoUpdate = TRUE, FastCall = FALSE, diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 9af6bbfea528..2a649608a796 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -368,6 +368,7 @@ public: void testTdf38394(); void testTdf59666(); void testInconsistentBookmark(); + void testSpellOnlineParameter(); #if HAVE_FEATURE_PDFIUM void testInsertPdf(); #endif @@ -580,6 +581,7 @@ public: CPPUNIT_TEST(testTdf54409); CPPUNIT_TEST(testTdf38394); CPPUNIT_TEST(testTdf59666); + CPPUNIT_TEST(testSpellOnlineParameter); #if HAVE_FEATURE_PDFIUM CPPUNIT_TEST(testInsertPdf); #endif @@ -7295,6 +7297,23 @@ void SwUiWriterTest::testInconsistentBookmark() } } +void SwUiWriterTest::testSpellOnlineParameter() +{ + SwDoc* pDoc = createDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + const SwViewOption* pOpt = pWrtShell->GetViewOptions(); + bool bSet = pOpt->IsOnlineSpell(); + + uno::Sequence<beans::PropertyValue> params = comphelper::InitPropertySequence({{"Enable", uno::makeAny(!bSet)}}); + lcl_dispatchCommand(mxComponent, ".uno:SpellOnline", params); + CPPUNIT_ASSERT_EQUAL(!bSet, pOpt->IsOnlineSpell()); + + // set the same state as now and we don't expect any change (no-toggle) + params = comphelper::InitPropertySequence({{"Enable", uno::makeAny(!bSet)}}); + lcl_dispatchCommand(mxComponent, ".uno:SpellOnline", params); + CPPUNIT_ASSERT_EQUAL(!bSet, pOpt->IsOnlineSpell()); +} + void SwUiWriterTest::testTdf108423() { SwDoc* pDoc = createDoc(); diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 56f363cc0285..86491d13c9ae 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -525,7 +525,11 @@ void SwView::ExecViewOptions(SfxRequest &rReq) break; case SID_AUTOSPELL_CHECK: - if( STATE_TOGGLE == eState ) + const SfxPoolItem* pItem; + + if (pArgs->HasItem(FN_PARAM_1, &pItem)) + bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue(); + else if( STATE_TOGGLE == eState ) { bFlag = !pOpt->IsOnlineSpell(); bSet = bFlag; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits