summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMert Tumer <mert.tumer@collabora.com>2020-10-08 13:37:07 +0300
committerJan Holesovsky <kendy@collabora.com>2020-10-09 15:37:51 +0200
commitd90a404a078b9fc1baa98ec0eb3d6a90f869b336 (patch)
tree57e0cf761e5f8a42f32888edbdc4ae4dff0c4a13 /sd
parentd7a5298ac87453e7dbb343f93e6c70ce0508c44a (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/+/104083 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/uiimpress.cxx17
-rw-r--r--sd/source/ui/view/drviewse.cxx9
2 files changed, 25 insertions, 1 deletions
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();