sc/qa/unit/uicalc/uicalc.cxx   |   13 +++++++++++++
 sc/source/ui/view/tabvwshf.cxx |    2 ++
 2 files changed, 15 insertions(+)

New commits:
commit 5ead135faaee76bea78f481d7c63d54f56e9098c
Author:     Attila Szűcs <szucs.atti...@nisz.hu>
AuthorDate: Mon May 17 15:26:34 2021 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Jun 1 10:05:55 2021 +0200

    tdf#126540 sc: toggling grid lines sets document as modified
    
    View->View Grid Lines modifies a sheet-level option which must
    be saved in the document.
    
    Co-authored-by: Tibor Nagy (NISZ)
    
    Change-Id: Ifcee59d27fbe0bb50b9fe99e16c70e2062a714f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115711
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index aa5d8b5fcd02..d133876f6d04 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1640,6 +1640,19 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf99913)
     CPPUNIT_ASSERT(pDoc->RowFiltered(2, 0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126540_GridToggleModifiesTheDocument)
+{
+    ScModelObj* pModelObj = createDoc("tdf99913.xlsx");
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    // Toggling the grid of a sheet, must set the document modified state
+    ScDocShell* pDocSh = ScDocShell::GetViewData()->GetDocShell();
+    CPPUNIT_ASSERT(!pDocSh->IsModified());
+    dispatchCommand(mxComponent, ".uno:ToggleSheetGrid", {});
+    CPPUNIT_ASSERT(pDocSh->IsModified());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 40f78b7fc85b..57b0bf6696d1 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -735,6 +735,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                 rViewData.SetShowGrid(!bShowGrid);
                 SfxBindings& rBindings = GetViewFrame()->GetBindings();
                 rBindings.Invalidate( FID_TAB_TOGGLE_GRID );
+                ScDocShellModificator aModificator(*rViewData.GetDocShell());
+                aModificator.SetDocumentModified();
                 PaintGrid();
                 rReq.Done();
             }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to