summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMert Tumer <mert.tumer@collabora.com>2020-10-08 13:37:07 +0300
committerMert Tumer <mert.tumer@collabora.com>2020-10-09 21:30:26 +0200
commit7aaa9ef2e5edaf468f116449776433e98fb1a2f3 (patch)
treef5f81527535507de15109320d71fcfc4639f7632 /sw
parente116efdeff09e8ce9a45d459af53216015cd5347 (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 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx20
-rw-r--r--sw/source/uibase/uiview/view0.cxx6
2 files changed, 25 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 525f4cc81d0e..8bacd6781b18 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -380,6 +380,7 @@ public:
void testTdf133589();
void testInconsistentBookmark();
void testInsertLongDateFormat();
+ void testSpellOnlineParameter();
#if HAVE_FEATURE_PDFIUM
void testInsertPdf();
#endif
@@ -599,6 +600,7 @@ public:
CPPUNIT_TEST(testTdf123786);
CPPUNIT_TEST(testTdf133589);
CPPUNIT_TEST(testInsertLongDateFormat);
+ CPPUNIT_TEST(testSpellOnlineParameter);
#if HAVE_FEATURE_PDFIUM
CPPUNIT_TEST(testInsertPdf);
#endif
@@ -7356,6 +7358,24 @@ 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) } });
+ 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) } });
+ 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 259721707259..59165885e5bd 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -531,7 +531,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;