diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-23 18:06:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-03 15:55:03 +0200 |
commit | 7a464263cc5c2ca2b7128734ff4860e02d662818 (patch) | |
tree | 4614aa57736484cb46c8702f6afee1c2e663e8a0 /sd/source/ui/view | |
parent | fdo#46808, Adapt ModuleUIConfigurationManagerSupplier UNO service to new style (diff) | |
download | core-7a464263cc5c2ca2b7128734ff4860e02d662818.tar.gz core-7a464263cc5c2ca2b7128734ff4860e02d662818.zip |
fdo#46808, Adapt UICommandDescription UNO service to new style
Change-Id: Ibca112904f137ff981ae9be3e5bd56aa11aec352
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 6898081f5e55..748d2a6460db 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include "ViewShellBase.hxx" #include <algorithm> @@ -1139,6 +1140,7 @@ void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabB if ( !aCmdURL.isEmpty() ) try { Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext(), UNO_QUERY_THROW ); Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW ); @@ -1147,20 +1149,17 @@ void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabB if( !aModuleIdentifier.isEmpty() ) { - Reference< XNameAccess > xNameAccess( xServiceManager->createInstance( "com.sun.star.frame.UICommandDescription" ), UNO_QUERY ); - if( xNameAccess.is() ) + Reference< XNameAccess > xNameAccess( ui::UICommandDescription::create(xContext) ); + Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW ); + Sequence< PropertyValue > aPropSeq; + if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq ) { - Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW ); - Sequence< PropertyValue > aPropSeq; - if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq ) + for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) + if ( aPropSeq[i].Name == "Name" ) { - if ( aPropSeq[i].Name == "Name" ) - { - aPropSeq[i].Value >>= aLabel; - break; - } + aPropSeq[i].Value >>= aLabel; + break; } } } |