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 /sw | |
parent | 10362695c2060f6aa48bd88f6b8dd6cfa556392a (diff) |
fdo#46808, Adapt UICommandDescription UNO service to new style
Change-Id: Ibca112904f137ff981ae9be3e5bd56aa11aec352
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/lingu/olmenu.cxx | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 0539d19e4a0d..7a4cdb95518b 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -89,6 +89,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> using namespace ::com::sun::star; @@ -332,29 +333,26 @@ OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) { try { - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.frame.UICommandDescription" ), uno::UNO_QUERY ); - if ( xNameAccess.is() ) + uno::Reference< container::XNameAccess > xNameAccess( ui::UICommandDescription::create(::comphelper::getProcessComponentContext() ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xUICommandLabels; + uno::Any a = xNameAccess->getByName( "com.sun.star.text.TextDocument" ); + uno::Reference< container::XNameAccess > xUICommands; + a >>= xUICommandLabels; + OUString aStr; + uno::Sequence< beans::PropertyValue > aPropSeq; + a = xUICommandLabels->getByName( aCmdURL ); + if ( a >>= aPropSeq ) { - uno::Reference< container::XNameAccess > xUICommandLabels; - uno::Any a = xNameAccess->getByName( "com.sun.star.text.TextDocument" ); - uno::Reference< container::XNameAccess > xUICommands; - a >>= xUICommandLabels; - OUString aStr; - uno::Sequence< beans::PropertyValue > aPropSeq; - a = xUICommandLabels->getByName( aCmdURL ); - if ( a >>= 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 >>= aStr; - break; - } + aPropSeq[i].Value >>= aStr; + break; } } - aLabel = aStr; } + aLabel = aStr; } catch (const uno::Exception&) { |