From 5ead135faaee76bea78f481d7c63d54f56e9098c Mon Sep 17 00:00:00 2001 From: Attila Szűcs Date: Mon, 17 May 2021 15:26:34 +0200 Subject: tdf#126540 sc: toggling grid lines sets document as modified MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: László Németh --- sc/qa/unit/uicalc/uicalc.cxx | 13 +++++++++++++ sc/source/ui/view/tabvwshf.cxx | 2 ++ 2 files changed, 15 insertions(+) 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(); } -- cgit