I have crossed the question below, and the solution works well:
The only thing is that, I would like to remove all Toolbars except for the toolbar I created for my Document. How can I locate that toolbar and reshow it after hiding all toolbars…
I have crossed the question below, and the solution works well:
The only thing is that, I would like to remove all Toolbars except for the toolbar I created for my Document. How can I locate that toolbar and reshow it after hiding all toolbars…
Hello,
This is a response to comment submitted on other post & question here.
The solution is available in the following document → Andrew’s Macro Information and the following code was generated from some of the listings in Section 5.44 Toolbars.
To get a list of the toolbars in the current document:
Sub ListFrameElements
Dim oDoc, oFrame
Dim oCfgManager
Dim oToolInfo
Dim x
Dim s$
Dim iToolType as Integer
oDoc = ThisComponent
REM This is the integer value three.
iToolType = com.sun.star.ui.UIElementType.TOOLBAR
oFrame = oDoc.getCurrentController().getFrame()
oCfgManager = oDoc.getUIConfigurationManager()
oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
For Each x in oFrame.LayoutManager.getElements()
s = s & x.ResourceURL & CHR$(10)
Next
MsgBox s, 0, "Toolbars in Component"
End Sub
Once you have the list you can hide what you want:
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")
Rem Standard toolbar to be revealed (would do if previously hidden)
' lmgr.showElement("private:resource/toolbar/standardbar") '
End Sub
If this answers your question please tick the (upper left area of answer). It helps others to know there was an accepted answer.
where do i put this ?
When I see a comment such as yours, it usually indicates there is little to no knowledge of macros. Please see the LO documentation → here. In Getting started section see Chapter 13 - Getting Started with Macros and under the Base section see Chapter 9 - Macros
That should give you an idea for macro placement.