The reproduction document has two sections (named Section1 and Section2, respectively) inside the frame, one visible and one not visible. The UI calls that "hidden" but the actual property is "IsVisible" and the negation of the UI "hidden" checkbox.
The button launches a Basic procedure that toggles the visibility of the two sections. Correct behaviour ("the macro works correctly") is that the section visible before procedure execution is hidden, and the section hidden before procedure execution is visible. Incorrect behaviour is that one or both sections are not toggled.
For ease of observation, each section contains the text saying that that section is visible, and the Basic procedure checks whether the change it requested has been performed, and indicates success or failure in a pop-up MessageBox.
Steps to Reproduce:
1. Set Macro security to medium (or low)
2. Open reproduction document
3. Accept macro execution (if prompted, i.e. macro security is on medium)
4. Click button (repeatedly)
5. Select the frame
6. Cut (Cntrl-X)
7. Paste (Cntrl-V)
8. Click button (once, repeatedly, ...)
9. save document
10. Use menu Format / Sections to see that the two sections are still there, and still have the same name, and its visibility can be successfully changed through the UI.
11. close document; do not save
12. open document again
13. Accept macro execution (if prompted, i.e. macro security is on medium)
14. Click button (repeatedly)
At step 4, the macro works correctly.
At step 8, the macro doesn't work.
At step 14, the macro works correctly.
The macro works at steps 4, 8 and 14.
User Profile Reset: No
OpenGL enabled: Yes
Build ID: 1:6.1.5-3
CPU threads: 8; OS: Linux 4.9; UI render: default; VCL: gtk3;
Locale: en-GB (en_GB.utf8); Calc: group threaded
Created attachment 153355 [details]
Build ID: 437dc68285dab0f08a1ded2193d86d64f560cd9b
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3;
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
reproduced with :
Version: 188.8.131.52 / LibreOffice Community
Build ID: 8a45595d069ef5570103caea1b71cc9d82b2aae4
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Note : I tested 2 documents + 1 I'm programming to toggle sections. When I open a document, sections are visbles and it's ok with checkbox. But when I'm playing with checkbox interface to toogle sections, all document could hide sections but never display it after that ... But I can then active check box to diplay section then close the document, open it and section is visible.