sc/qa/unit/tiledrendering/tiledrendering.cxx | 17 +++++++++++++++++ sc/source/ui/unoobj/docuno.cxx | 12 +++++++++++- sd/qa/unit/tiledrendering/tiledrendering.cxx | 16 ++++++++++++++++ sd/source/ui/unoidl/unomodel.cxx | 2 ++ sw/qa/extras/tiledrendering/tiledrendering.cxx | 17 +++++++++++++++++ sw/source/uibase/uno/unotxdoc.cxx | 2 ++ 6 files changed, 65 insertions(+), 1 deletion(-)
New commits: commit 5c5fa6597af973ebce48f983af8fdbb87789d03f Author: Mert Tumer <mert.tu...@collabora.com> AuthorDate: Tue Oct 13 20:16:22 2020 +0300 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Mon Oct 19 09:51:03 2020 +0200 Check render parameters for AutoSpellChecking Change-Id: Ife2551b4023461da26e70ac3de505adf9d7db1e8 Signed-off-by: Mert Tumer <mert.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104274 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 33a15349b70b..b6db96dc5473 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -112,6 +112,7 @@ public: void testDeleteCellMultilineContent(); void testFunctionDlg(); void testSpellOnlineParameter(); + void testSpellOnlineRenderParameter(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnHeaders); @@ -158,6 +159,7 @@ public: CPPUNIT_TEST(testDeleteCellMultilineContent); CPPUNIT_TEST(testFunctionDlg); CPPUNIT_TEST(testSpellOnlineParameter); + CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST_SUITE_END(); private: @@ -604,6 +606,21 @@ void ScTiledRenderingTest::testViewCursors() CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated); } +void ScTiledRenderingTest::testSpellOnlineRenderParameter() +{ + ScModelObj* pModelObj = createDoc("empty.ods"); + ScDocument* pDoc = pModelObj->GetDocument(); + bool bSet = pDoc->GetDocOptions().IsAutoSpell(); + + uno::Sequence<beans::PropertyValue> aPropertyValues = + { + comphelper::makePropertyValue(".uno:SpellOnline", uno::makeAny(!bSet)), + }; + pModelObj->initializeForTiledRendering(aPropertyValues); + + CPPUNIT_ASSERT_EQUAL(!bSet, pDoc->GetDocOptions().IsAutoSpell()); +} + void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rArguments) { uno::Reference<frame::XController> xController = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index b51e63419f57..9d2539a25bcd 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1173,7 +1173,7 @@ void ScModelObj::completeFunction(const OUString& rFunctionName) } } -void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/) +void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) { SolarMutexGuard aGuard; @@ -1182,6 +1182,16 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans aAppOptions.SetAutoComplete(false); SC_MOD()->SetAppOptions(aAppOptions); + for (const beans::PropertyValue& rValue : rArguments) + { + if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>()) + { + ScDocOptions options = GetDocument()->GetDocOptions(); + options.SetAutoSpell(rValue.Value.get<bool>()); + GetDocument()->SetDocOptions(options); + } + } + // show us the text exactly ScInputOptions aInputOptions(SC_MOD()->GetInputOptions()); aInputOptions.SetTextWysiwyg(true); diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index d7c2719e105a..79163b0cea67 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -126,6 +126,7 @@ public: void testRegenerateDiagram(); void testLanguageAllText(); void testInsertDeletePageInvalidation(); + void testSpellOnlineRenderParameter(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testCreateDestroy); @@ -177,6 +178,7 @@ public: CPPUNIT_TEST(testRegenerateDiagram); CPPUNIT_TEST(testLanguageAllText); CPPUNIT_TEST(testInsertDeletePageInvalidation); + CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST_SUITE_END(); @@ -2429,6 +2431,20 @@ void SdTiledRenderingTest::testInsertDeletePageInvalidation() CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size()); } +void SdTiledRenderingTest::testSpellOnlineRenderParameter() +{ + // Load the document. + SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); + bool bSet = pXImpressDocument->GetDoc()->GetOnlineSpell(); + + uno::Sequence<beans::PropertyValue> aPropertyValues = + { + comphelper::InitPropertySequence({ { ".uno:SpellOnline", uno::makeAny(!bSet) } }), + }; + pXImpressDocument->initializeForTiledRendering(aPropertyValues); + CPPUNIT_ASSERT_EQUAL(!bSet, pXImpressDocument->GetDoc()->GetOnlineSpell()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index f02868f0ca83..17d07ec02cef 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2442,6 +2442,8 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs pDrawView->SetPageShadowVisible(rValue.Value.get<bool>()); else if (rValue.Name == ".uno:Author" && rValue.Value.has<OUString>()) pDrawView->SetAuthor(rValue.Value.get<OUString>()); + else if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>()) + mpDoc->SetOnlineSpell(rValue.Value.get<bool>()); } // Disable comments if requested diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 320ee898a2ed..1f48de38d086 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -130,6 +130,7 @@ public: void testDropDownFormFieldButtonEditing(); void testDropDownFormFieldButtonNoSelection(); void testDropDownFormFieldButtonNoItem(); + void testSpellOnlineRenderParameter(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -198,6 +199,7 @@ public: CPPUNIT_TEST(testDropDownFormFieldButtonEditing); CPPUNIT_TEST(testDropDownFormFieldButtonNoSelection); CPPUNIT_TEST(testDropDownFormFieldButtonNoItem); + CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST_SUITE_END(); private: @@ -2743,6 +2745,21 @@ void SwTiledRenderingTest::testDropDownFormFieldButtonNoItem() } } +void SwTiledRenderingTest::testSpellOnlineRenderParameter() +{ + SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + const SwViewOption* pOpt = pWrtShell->GetViewOptions(); + bool bSet = pOpt->IsOnlineSpell(); + + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + {".uno:SpellOnline", uno::makeAny(!bSet)}, + })); + pXTextDocument->initializeForTiledRendering(aPropertyValues); + CPPUNIT_ASSERT_EQUAL(!bSet, pOpt->IsOnlineSpell()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index be5c2ff289c3..2c4d8066b035 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3489,6 +3489,8 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: // switch. pDocShell->SetView(pView); } + else if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>()) + aViewOption.SetOnlineSpell(rValue.Value.get<bool>()); } // Set the initial zoom value to 1; usually it is set in setClientZoom and _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits