Thanks a lot @darshan for sharing such knowledgeful resources , I have successfully create more than 20 function in python using script forge in past few months after enabling macros from coolwsd.xml. .
Please have a look on my basic macros and tell where I am lacking or going wrong:-
Sub HideRevealFrameObjects
Dim xCurrentController as Object
Dim xLayoutManager as Object
xCurrentController = ThisComponent.CurrentController
Rem If in design mode just exit routine
If xCurrentController.isFormDesignMode Then
Exit Sub
End If
doc = ThisComponent
frame = doc.CurrentController.Frame
lmgr = frame.LayoutManager
Rem Now set each item to be hidden (or revealed)
Rem Standard toolbar to be hidden
lmgr.hideElement(“private:resource/toolbar/standardbar”)
lmgr.hideElement(“private:resource/toolbar/singlemode”)
lmgr.hideElement(“private:resource/toolbar/singlemode-cell”)
lmgr.hideElement(“private:resource/menubar/menubar”)
lmgr.hideElement(“private:resource/statusbar/statusbar”)
Rem Standard toolbar to be revealed (would do if previously hidden)
’ lmgr.showElement(“private:resource/toolbar/standardbar”) ’
End Sub
This code perfectly works fine in libre office, but not working in Collab environment.
Also I tried below code with UNO but it also not able to hide the toolbar and menubar
Sub HideToolbar
Dim oDoc As Object
Dim oFrame As Object
Dim oDispatcher As Object
' Get the current document and frame
oDoc = ThisComponent
oFrame = oDoc.CurrentController.Frame
' Create the dispatcher
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
' Arguments to hide the toolbar
Dim args(0) As New com.sun.star.beans.PropertyValue
args(0).Name = "Hide"
args(0).Value = True
' Hide the "Standard" toolbar (change .uno:ToolbarStandard to the desired toolbar command)
oDispatcher.executeDispatch(oFrame, ".uno:hideMenubar", "", 0, args())
End Sub
Also I found below function in collab code but not able to figure our how to use it hide the toolbar or menubar
hideMenubar: function() {
this._menubarShouldBeHidden = true;
if (this.isMenubarHidden() || this.shouldUseNotebookbarMode())
return;
var notebookbarWasCollapsed = this.isNotebookbarCollapsed();
this.extendNotebookbar(); // The notebookbar has the button to show the menu bar, so having it hidden at the same time softlocks you
this._notebookbarShouldBeCollapsed = notebookbarWasCollapsed;
$('.main-nav').hide();
if (L.Params.closeButtonEnabled) {
$('#closebuttonwrapper').hide();
$('#closebuttonwrapperseparator').hide();
}
const obj = document.getElementById('fold-button');
obj.style.transform = 'rotate(180deg)';
$('#fold').prop('title', _('Show Menu'));
},
and
collapseNotebookbar: function() {
this._notebookbarShouldBeCollapsed = true;
if (this.isNotebookbarCollapsed() || this.isMenubarHidden())
return;
this.moveObjectVertically($('#formulabar'), -1);
$('#toolbar-wrapper').css('display', 'none');
$('#document-container').addClass('tabs-collapsed');
this.map._docLayer._syncTileContainerSize();
},
Actually, I want to hide/disable the clearcontent and other formatting function from menubar and toolbar and short short cut keys because they are working on unprotected cell which I don’t want to allow user when sheet is protected.
@darshan ,