I think I'm in a dead point right now, I can't figure this out :-(
I've been trying to get the menubar retrieving done for the
whole afternoon, yet without effect.
First, I implemented your basic example in my component,
more less like this :
Reference< css::beans::XPropertySet > xFrameProp(xFrame, UNO_QUERY_THROW);
Reference< XLayoutManager > xLayout;
Any aProp = xFrameProp->getPropertyValue(::rtl::OUString::createFromAscii("LayoutManager"));
aProp >>= xLayout;
Reference< css::ui::XUIElement > xMenu (xLayout->getElement(::rtl::OUString::createFromAscii("private:resource/menubar/menubar")));
if( xMenu.is()) printf("*** properly retrieved xMenu ***\n");
else {
xLayout->createElement(::rtl::OUString::createFromAscii("private:resource/menubar/menubar"));
xMenu = Reference<css::ui::XUIElement >(xLayout->getElement(::rtl::OUString::createFromAscii("private:resource/menubar/menubar")
but I couldn't retrieve the menubar.
I also tried to retrieve the "_blank" frame from the desktop and get the layout manager for that frame, that didn't work either. I made a couple of other tryes, I even tried retrieving an XTopWindow using the XExtendedToolkit, but nothing worked.
Then I tried doing a similar thing from basic (using the child frame returned by
my component's createInstance) - still no joy.
Then I figured I'll check the interfaces supported by the tabcontrol's parent :
oTabWinFactory = createUnoService( "com.sun.star.frame.TabWindowFactory" )
oTabWindow = oTabWinFactory.createInstanceWithContext( GetDefaultContext() )
oParentWindow = oTabWindow.getPropertyValue("ParentWindow")
msgbox oParentWindow.dbg_supportedInterfaces
the XTopWindow isn't on that list :/
is that why I can't get the menu? You said that only the windows that implement this interface have a menubar. But why can't I create one?
I'll sit on this a bit more, maybe I'll come up with something...
Regards,
Andrzej
I've been trying to get the menubar retrieving done for the
whole afternoon, yet without effect.
First, I implemented your basic example in my component,
more less like this :
Reference< css::beans::XPropertySet > xFrameProp(xFrame, UNO_QUERY_THROW);
Reference< XLayoutManager > xLayout;
Any aProp = xFrameProp->getPropertyValue(::rtl::OUString::createFromAscii("LayoutManager"));
aProp >>= xLayout;
Reference< css::ui::XUIElement > xMenu (xLayout->getElement(::rtl::OUString::createFromAscii("private:resource/menubar/menubar")));
if( xMenu.is()) printf("*** properly retrieved xMenu ***\n");
else {
xLayout->createElement(::rtl::OUString::createFromAscii("private:resource/menubar/menubar"));
xMenu = Reference<css::ui::XUIElement >(xLayout->getElement(::rtl::OUString::createFromAscii("private:resource/menubar/menubar")
but I couldn't retrieve the menubar.
I also tried to retrieve the "_blank" frame from the desktop and get the layout manager for that frame, that didn't work either. I made a couple of other tryes, I even tried retrieving an XTopWindow using the XExtendedToolkit, but nothing worked.
Then I tried doing a similar thing from basic (using the child frame returned by
my component's createInstance) - still no joy.
Then I figured I'll check the interfaces supported by the tabcontrol's parent :
oTabWinFactory = createUnoService( "com.sun.star.frame.TabWindowFactory" )
oTabWindow = oTabWinFactory.createInstanceWithContext( GetDefaultContext() )
oParentWindow = oTabWindow.getPropertyValue("ParentWindow")
msgbox oParentWindow.dbg_supportedInterfaces
the XTopWindow isn't on that list :/
is that why I can't get the menu? You said that only the windows that implement this interface have a menubar. But why can't I create one?
I'll sit on this a bit more, maybe I'll come up with something...
Regards,
Andrzej