Julien Galand wrote:
Hi to all,
My add-on has a toolbar created by a .xcu file, with the right protocol
handler declared (as a node
"org.openoffice.Office.ProtocolHandler/HandlerSet" of the configuration
file).
But there is no component registration in the package; in particular no
registration of the implementation of the service of the protocol handler.
Instead, the service of the protocol handler is registered dynamically
by the executable component of my add-on, therefore necessarily LATER
than OO's reading of the .xcu file.
=> The toolbar items are shown disabled, probably because the protocol
handler service couldn't be instanciated at the time the toolbar was
created.
Is there a way to ask OO to re-scan the toolbar items to bind them to
the protocol handler, which will likely make them enabled ?
Thank you if you have some hint...
Hi Julien,
I think the best solution would be to register your service before any
user interface element is created. This can be done by a Job which will
be activated on application startup. Nevertheless if you want to re-scan
toolbar items, you can use the com.sun.star.ui.XUIElementSettings
interface. It's available for all configurable user interface elements
(menubar, toolbar, statusbar). See the following Basic macro
REM ***** BASIC *****
Sub Main
REM *** Set this macro to a toolbar button to execute it
REM *** Retrieve the desktop service
oDesktop = createUnoService("com.sun.star.frame.Desktop")
REM *** Retrieve the current frame and layout manager
REM *** Just for this example.
oCurrFrame = oDesktop.getCurrentFrame()
oLayoutManager = oCurrFrame.LayoutManager
REM *** Refresh settings for all currently available toolbars
oUIElements() = oLayoutManager.getElements()
nStart = lbound(oUIElements())
nEnd = ubound(oUIElements())
for i = nStart to nEnd
oUIElement = oUIElements(i)
if oUIElement.Type = com.sun.star.ui.UIElementType.TOOLBAR then
oUIElement.updateSettings()
end if
next i
End Sub
Regards,
Carsten
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]