Cannot hide menubar anymore upgrading from version 6.1

Hello,

I am having trouble getting rid of all menus & toolbars after upgrading to LibreOffice 6.4+. Previously, I could just use this macro to toggle show/hide everything - only sheets showing.

Sub showAllBars(opt as Boolean)
	oCurrentController = ThisComponent.getCurrentController()
	oCurrentController.SheetTabs = opt
	oCurrentController.HasColumnRowHeaders = opt
  	oLayout = oCurrentController.Frame.LayoutManager()
	oLayout.AutomaticToolbars = opt
	oLayout.MenuBarCloser = not(opt)
	oLayout.setVisible(opt)
End Sub

Now the Menubar still persists though

menubar-showing

I have also tried:

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "MenuBarVisible"
args9(0).Value = opt
dispatcher.executeDispatch(document, ".uno:MenuBarVisible", "", 0, args9())

I’ve tried versions 6.4.X and 7.X but it just won’t go away. Even adding the command manually from:

Tools->Customize->Menus->(Menubar)

But still can’t hide it.

This is running on CentOS 7.9 KDE (also does not work on CentOS 8/Stream KDE)

Have you tried doing this with a clean profile?

Hello,

There is now a toolbar item to toggle the menu:

image description

You can run from a macro (tested in Calc) with:

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:MenuBar", "", 0, Array())

Edit 2021-04-10:

Here is a sample. Works on Ubuntu 20.04 with LO v7.1.2.2 from TDF. Left a button on sheet to toggle menu if wanted.

Sample ----- HideMenuToolbars.ods

With running from Open Document event, needed to execute the dispatch command twice. Do not understand why but it works. See menus & toolbars for a brief moment & then all cleared.

It’s freezing the application & macro editor and have to force kill it. Said libreoffice-starter is the issue I think (error message I couldn’t reproduce)

Even with the provided file, it still seems to be freezing for me - ‘Application “libreoffice-calc” is not responding’. Will try installing some other versions

EDIT: Works on 7.0 - Thank you!

I use these macros, for Application Mode (spreadsheet only) and to return to normal.

'Application Mode Connect
Sub FullScreenON
'------------------------------------------------- -----------------------------
'xplan = opening worksheet (file menu)
'xtitulo = title that shows at the top of the screen
'To open FULL SCREEN on opening the file
'Tools / Customize / Events
'When opening document
'connect to MACRO ok.
Dim oSheet As Object
Dim oController As Object
dim args2(0) as new com.sun.star.beans.PropertyValue : args2(0).Name = "FullScreen" : args2(0).Value = true
CreateUnoService("com.sun.star.frame.DispatchHelper").executeDispatch(ThisComponent.CurrentController.Frame, ".uno:FullScreen", "", 0, args2())
With ThisComponent.CurrentController
.setActiveSheet(ThisComponent.Sheets.getByName( "Plan1" )) '<== Worksheet to View Initially.
.ColumnRowHeaders = False
.SheetTabs = False
.Frame.LayoutManager.HideCurrentUI = True
.HorizontalScrollBar = False
.VerticalScrollBar = False
'.Frame.Title = "Title in Application mode"
end With
end Sub

'Application Mode Shut Down
Sub FullScreenOFF
'------------------------------------------------------------------------------
Dim oController As Object
dim args2(0) as new com.sun.star.beans.PropertyValue : args2(0).Name = "FullScreen" : args2(0).Value = false
CreateUnoService("com.sun.star.frame.DispatchHelper").executeDispatch(ThisComponent.CurrentController.Frame, ".uno:FullScreen", "", 0, args2())
With ThisComponent.CurrentController
.ColumnRowHeaders = True
.SheetTabs = True
.Frame.LayoutManager.HideCurrentUI = False
.HorizontalScrollBar = False
.VerticalScrollBar = False
.Frame.ComponentWindow.SetFocus() '<<<< Return the focus to the window <<<<'
End With
End Sub

Unfortunately this still does not remove the top menubar for me. Get’s rid of everything else though.