diff options
Diffstat (limited to 'framework/source/uielement/menubarmanager.cxx')
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 49c35c4cc83f..4303f4e58bc1 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/PopupMenuControllerFactory.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/util/XStringWidth.hpp> @@ -853,7 +853,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu ) ::rtl::OUString aMenuCommand( m_aMenuItemCommand ); if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aMenuCommand == aSpecialWindowCommand ) - MenuManager::UpdateSpecialWindowMenu( pMenu,getServiceFactory(),m_aLock ); + MenuManager::UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock ); // Check if some modes have changed so we have to update our menu images sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle(); @@ -1078,27 +1078,24 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu ) { // window list menu item selected - Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) ); - if ( xDesktop.is() ) + sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; + Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); + sal_Int32 nCount = xList->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) { - sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; - Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); - sal_Int32 nCount = xList->getCount(); - for ( sal_Int32 i=0; i<nCount; ++i ) + Reference< XFrame > xFrame; + xList->getByIndex(i) >>= xFrame; + if ( xFrame.is() && nTaskId == nCurItemId ) { - Reference< XFrame > xFrame; - xList->getByIndex(i) >>= xFrame; - if ( xFrame.is() && nTaskId == nCurItemId ) - { - Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - pWin->GrabFocus(); - pWin->ToTop( TOTOP_RESTOREWHENMIN ); - break; - } - - nTaskId++; + Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + pWin->GrabFocus(); + pWin->ToTop( TOTOP_RESTOREWHENMIN ); + break; } + + nTaskId++; } } else |