Bug 141667

Summary: [Calc] ThisComponent.CurrentController.ShowGrid => affects the grid of all sheets, but not the active one (inconsistent behavior)
Product: LibreOffice Reporter: Igor <eeigor>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: normal CC: himajin100000
Priority: medium Keywords: needsDevAdvice
Version: 7.1.2.2 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 127590    
Attachments: bt with debug symbols

Description Igor 2021-04-13 08:07:21 UTC
Description:
It's an example of a non-uniform approach.
E.g.
>>> ThisComponent.CurrentController.ShowGrid = True  'affects all sheets
>>> ThisComponent.CurrentController.freezeAtPosition(0, 1)  'affects active sheet

NOTE: This looks like a 10 year-old bug. ODS's file 'settings.xml' contains the 'ShowGrid' property for each sheet.
<config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>

Steps to Reproduce:
1. Select a sheet.
2. Run in code: ThisComponent.CurrentController.ShowGrid = False
3. 

Actual Results:
The grid of all sheets will be hidden.

Expected Results:
The grid of only the active sheet is hidden.


Reproducible: Always


User Profile Reset: No



Additional Info:
To hide the sheet grid via the GUI, right-click on the sheet tab and select "View Grid Lines" (menu: View/View Grid Lines)

Some links solve a contrived problem:
https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=38999
https://extensions.openoffice.org/en/project/gridlines
Comment 1 Julien Nabet 2021-04-13 17:35:12 UTC
Created attachment 171168 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.

I don't know if it's expected or not but attached a bt showing where the value for "ShowGrid" is set.
Comment 2 himajin100000 2021-04-14 18:06:59 UTC
What if you run?

Option Explicit

Sub Macro1()

	Dim dispatchhelper As com.sun.star.frame.XDispatchHelper
	dispatchhelper = createUnoService("com.sun.star.frame.DispatchHelper")

	rem ----------------------------------------------------------------------
	dispatchhelper.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:ToggleSheetGrid", "", 0, Array())


end sub
Comment 3 Igor 2021-04-15 03:36:02 UTC
The dispatcher method works. But the question was different. "Toggleā€¯ does not allow you to determine the current state.