summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Szűcs <szucs.attila3@nisz.hu>2021-05-17 15:26:34 +0200
committerLászló Németh <nemeth@numbertext.org>2021-06-01 10:05:55 +0200
commit5ead135faaee76bea78f481d7c63d54f56e9098c (patch)
treed91f49921e879926557162b42027daa422dbb46a
parent26d755840c318b7296276bdc526e1c860c3406ac (diff)
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 <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx13
-rw-r--r--sc/source/ui/view/tabvwshf.cxx2
2 files changed, 15 insertions, 0 deletions
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();
}