diff options
Diffstat (limited to 'sw/source/ui/lingu/olmenu.cxx')
-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&) { |