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 b2f4e18f63457d11a783db939729450ddbe9d594
Author:     Mert Tumer <mert.tu...@collabora.com>
AuthorDate: Tue Oct 13 20:16:22 2020 +0300
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Nov 26 09:07:10 2020 +0100

    Check render parameters for AutoSpellChecking
    
    Conflicts:
            sc/qa/unit/tiledrendering/tiledrendering.cxx
            sw/qa/extras/tiledrendering/tiledrendering.cxx
    
    Change-Id: Ife2551b4023461da26e70ac3de505adf9d7db1e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106602
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index bb34928fef7d..ed6370e1dbe5 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -112,6 +112,7 @@ public:
     void testSheetGeometryDataCorrectness();
     void testDeleteCellMultilineContent();
     void testSpellOnlineParameter();
+    void testSpellOnlineRenderParameter();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnHeaders);
@@ -157,6 +158,7 @@ public:
     CPPUNIT_TEST(testSheetGeometryDataCorrectness);
     CPPUNIT_TEST(testDeleteCellMultilineContent);
     CPPUNIT_TEST(testSpellOnlineParameter);
+    CPPUNIT_TEST(testSpellOnlineRenderParameter);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -603,6 +605,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 ScTiledRenderingTest::testTextViewSelection()
 {
     comphelper::LibreOfficeKit::setActive();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index c677e3639fb1..7142e2807cf9 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1163,7 +1163,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;
 
@@ -1172,6 +1172,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 c9bd05d737d4..7464635e5e4d 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -128,6 +128,7 @@ public:
     void testRegenerateDiagram();
     void testLanguageAllText();
     void testInsertDeletePageInvalidation();
+    void testSpellOnlineRenderParameter();
 
     CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
     CPPUNIT_TEST(testCreateDestroy);
@@ -180,6 +181,7 @@ public:
     CPPUNIT_TEST(testRegenerateDiagram);
     CPPUNIT_TEST(testLanguageAllText);
     CPPUNIT_TEST(testInsertDeletePageInvalidation);
+    CPPUNIT_TEST(testSpellOnlineRenderParameter);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2461,6 +2463,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 314741f228cf..4160a8bdc3a6 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2443,6 +2443,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 afb261b4d4bc..752f2431630a 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -145,6 +145,7 @@ public:
     void testDropDownFormFieldButtonNoSelection();
     void testDropDownFormFieldButtonNoItem();
     void testTablePaintInvalidate();
+    void testSpellOnlineRenderParameter();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -217,6 +218,7 @@ public:
     CPPUNIT_TEST(testDropDownFormFieldButtonNoSelection);
     CPPUNIT_TEST(testDropDownFormFieldButtonNoItem);
     CPPUNIT_TEST(testTablePaintInvalidate);
+    CPPUNIT_TEST(testSpellOnlineRenderParameter);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2869,6 +2871,21 @@ void SwTiledRenderingTest::testTablePaintInvalidate()
     CPPUNIT_ASSERT_EQUAL(0, m_nInvalidations);
 }
 
+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 d3f70fb77a0b..2a723e185a64 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3471,6 +3471,8 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::Sequence<css::
             // switch.
             m_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

Reply via email to