Fhomasp wrote:
Hey, and thanks! :)
You mean an XLayoutManagerEventBroadcaster I assume?
I can't say I found many examples of an XLayoutManagerEventBroadcaster. And
I'm not sure where and which listener I need to attach.
Hi Fhomasp,
This is trivial if you look at the interface declaration of
com.sun.star.frame.XLayoutManagerEventBroadcaster. You need to implement
the interface com.sun.star.frame.XLayoutManagerListener. It contains
just on method called:
void layoutEvent( [in] com::sun::star::lang::EventObject aSource, [in]
short eLayoutEvent, [in] any aInfo );
As your code already retrieves the LayoutManager from the frame it's
fairly simple to query for
com.sun.star.frame.XLayoutManagerEventBroadcaster and call
addLayoutManagerEventListener( yourlistenerinstance ).
In your implementation for layoutEvent(...) you should first look for
the interesting eLayoutEvent called UIELEMENT_VISIBLE. The aInfo
parameter contains the resource url of the user interface element. E.g.
for your use case this is "private:resource/menubar/menubar". So if you
receive an event with eLayoutEvent == UIELEMENT_VISIBLE and aInfo ==
"private:resource/menubar/menubar" than you should use the source (which
is the LayoutManager) to query for the menu bar. If the menu bar needs
to be changed you should call your configuration code.
Regards,
Carsten
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]