summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-23 18:06:05 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-03 15:55:03 +0200
commit7a464263cc5c2ca2b7128734ff4860e02d662818 (patch)
tree4614aa57736484cb46c8702f6afee1c2e663e8a0 /sd
parent10362695c2060f6aa48bd88f6b8dd6cfa556392a (diff)
fdo#46808, Adapt UICommandDescription UNO service to new style
Change-Id: Ibca112904f137ff981ae9be3e5bd56aa11aec352
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/dlg/dlgass.cxx22
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx21
2 files changed, 17 insertions, 26 deletions
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 75f1217c00a0..84da6cadd5ae 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -64,6 +64,7 @@
#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/UICommandDescription.hpp>
#include <unotools/historyoptions.hxx>
#include <osl/file.hxx>
#include <sfx2/filedlghelper.hxx>
@@ -1752,18 +1753,12 @@ String AssistentDlgImpl::GetUiTextForCommand (const ::rtl::OUString& sCommandURL
break;
// Retrieve popup menu labels
- Reference<lang::XMultiServiceFactory> xFactory (
- ::comphelper::getProcessServiceFactory ());
- if ( ! xFactory.is())
+ Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ if ( ! xContext.is())
break;
- ::rtl::OUString sModuleIdentifier ("com.sun.star.presentation.PresentationDocument");
- Reference<container::XNameAccess> xNameAccess (
- xFactory->createInstance("com.sun.star.frame.UICommandDescription"),
- UNO_QUERY);
- if ( ! xNameAccess.is())
- break;
- Any a = xNameAccess->getByName(sModuleIdentifier);
+ Reference<container::XNameAccess> xNameAccess ( ui::UICommandDescription::create(xContext) );
+ Any a = xNameAccess->getByName( rtl::OUString("com.sun.star.presentation.PresentationDocument") );
a >>= xUICommandLabels;
if ( ! xUICommandLabels.is())
break;
@@ -1811,18 +1806,15 @@ Image AssistentDlgImpl::GetUiIconForCommand (const ::rtl::OUString& sCommandURL)
break;
// Retrieve popup menu labels
- Reference<uno::XComponentContext> xContext (
- ::comphelper::getProcessComponentContext());
+ Reference<uno::XComponentContext> xContext ( ::comphelper::getProcessComponentContext() );
if ( ! xContext.is())
break;
- ::rtl::OUString sModuleIdentifier ("com.sun.star.presentation.PresentationDocument");
-
Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier (
ui::ModuleUIConfigurationManagerSupplier::create(xContext));
Reference<com::sun::star::ui::XUIConfigurationManager> xManager (
- xSupplier->getUIConfigurationManager(sModuleIdentifier));
+ xSupplier->getUIConfigurationManager( rtl::OUString("com.sun.star.presentation.PresentationDocument") ));
if ( ! xManager.is())
break;
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;
}
}
}