Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version


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 =
    oFrame = oDoc.getCurrentController().getFrame()
    oCfgManager = oDoc.getUIConfigurationManager()
    oToolInfo = oCfgManager.getUIElementsInfo( iToolType )
    For Each x in oFrame.LayoutManager.getElements()
        s = s & x.ResourceURL & CHR$(10)
    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
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.