Julien Galand wrote:
Le 3 nov. 06, à 09:59, Carsten Driesner a écrit :
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
Hi Carsten,
It seems that a toolbar created by a .xcu file isn't considered as
"configurable". It doesn't appear in the list returned by
XLayoutManager.getElements.
It is maybe only a UIElement service instead of ConfigurableUIElement.
I am sorry that I cannot tell you more information, a colleague is
working on this and he has decided to give up that path because of this
failure.
But would you know where we have failed ?
Hi Julien,
You want to re-scan a add-on toolbar? Ok, that's why my "solution"
doesn't work. An add-on toolbar is not stored in the user interface
configuration, it's a part of the normal OpenOffice.org configuration.
Therefore it's not a ConfigurableUIElement. The only solution for this
would be to destroy and create the toolbar again via layout manager (see
Basic macro below)
REM ***** BASIC *****
Sub Main
REM *** Initialize strings
sToolbar = "private:resource/toolbar/addon_<name of your toolbar>"
REM *** Retrieve the desktop service
oDesktop = createUnoService("com.sun.star.frame.Desktop")
REM *** Retrieve the current frame and layout manager
REM *** Just for a quick example ***
oCurrFrame = oDesktop.getCurrentFrame()
oLayoutManager = oCurrFrame.LayoutManager
REM *** Destroy and create tool bar to refresh content
oLayoutManager.destroyElement( sToolbar )
oLayoutManager.createElement( sToolbar )
End Sub
What about my other proposed solution? Use a job and register your
service before any UI is visible.
Regards,
Carsten
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]