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>
This commit is contained in:
Attila Szűcs
2021-05-17 15:26:34 +02:00
committed by László Németh
parent 26d755840c
commit 5ead135faa
2 changed files with 15 additions and 0 deletions

View File

@@ -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: */

View File

@@ -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();
}