[Libreoffice-commits] core.git: sc/qa sc/source sd/qa sd/source svx/sdi sw/qa sw/source
Mert Tumer (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 9 19:31:03 UTC 2020
sc/qa/unit/tiledrendering/tiledrendering.cxx | 25 +++++++++++++++++++++++++
sc/source/ui/app/scmod.cxx | 4 +++-
sd/qa/unit/uiimpress.cxx | 18 ++++++++++++++++++
sd/source/ui/view/drviewse.cxx | 9 ++++++++-
svx/sdi/svx.sdi | 2 +-
sw/qa/extras/uiwriter/uiwriter.cxx | 20 ++++++++++++++++++++
sw/source/uibase/uiview/view0.cxx | 6 +++++-
7 files changed, 80 insertions(+), 4 deletions(-)
New commits:
commit 7aaa9ef2e5edaf468f116449776433e98fb1a2f3
Author: Mert Tumer <mert.tumer at collabora.com>
AuthorDate: Thu Oct 8 13:37:07 2020 +0300
Commit: Mert Tumer <mert.tumer at collabora.com>
CommitDate: Fri Oct 9 21:30:26 2020 +0200
Added optional parameter Enabled for uno:SpellOnline
Change-Id: I3578b0a002ea2cdcc7893972607f26732ce545ea
Signed-off-by: Mert Tumer <mert.tumer at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103982
Tested-by: Jenkins
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
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 56d1f8fc789b..fbd23a24eda0 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -379,6 +379,24 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf134053)
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Dot length", 706, fDotLength, 12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Dash length", 2822, fDashLength, 12);
}
+
+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 efed98db327d..80866c2b887f 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1340,7 +1340,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 42158cac9d81..9d31cea9643b 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -8160,7 +8160,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 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;
More information about the Libreoffice-commits
mailing list