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 /desktop/source | |
parent | 10362695c2060f6aa48bd88f6b8dd6cfa556392a (diff) |
fdo#46808, Adapt UICommandDescription UNO service to new style
Change-Id: Ibca112904f137ff981ae9be3e5bd56aa11aec352
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/app.cxx | 74 | ||||
-rw-r--r-- | desktop/source/migration/migration.cxx | 10 |
2 files changed, 40 insertions, 44 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index e107c48b1efe..1ed400fd236b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -67,6 +67,7 @@ #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/task/XRestartManager.hpp> #include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIElementFactoryRegistration.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp> @@ -2090,8 +2091,8 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs ) void Desktop::PreloadConfigurationData() { Reference< XMultiServiceFactory > rFactory = ::comphelper::getProcessServiceFactory(); - Reference< XNameAccess > xNameAccess( rFactory->createInstance( - rtl::OUString( "com.sun.star.frame.UICommandDescription" )), UNO_QUERY ); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< XNameAccess > xNameAccess( css::ui::UICommandDescription::create(xContext) ); rtl::OUString aWriterDoc( "com.sun.star.text.TextDocument" ); rtl::OUString aCalcDoc( "com.sun.star.sheet.SpreadsheetDocument" ); @@ -2099,47 +2100,44 @@ void Desktop::PreloadConfigurationData() rtl::OUString aImpressDoc( "com.sun.star.presentation.PresentationDocument" ); // preload commands configuration - if ( xNameAccess.is() ) - { - Any a; - Reference< XNameAccess > xCmdAccess; + Any a; + Reference< XNameAccess > xCmdAccess; - try - { - a = xNameAccess->getByName( aWriterDoc ); - a >>= xCmdAccess; - if ( xCmdAccess.is() ) - { - xCmdAccess->getByName( rtl::OUString( ".uno:BasicShapes" )); - xCmdAccess->getByName( rtl::OUString( ".uno:EditGlossary" )); - } - } - catch ( const ::com::sun::star::uno::Exception& ) + try + { + a = xNameAccess->getByName( aWriterDoc ); + a >>= xCmdAccess; + if ( xCmdAccess.is() ) { + xCmdAccess->getByName( rtl::OUString( ".uno:BasicShapes" )); + xCmdAccess->getByName( rtl::OUString( ".uno:EditGlossary" )); } + } + catch ( const ::com::sun::star::uno::Exception& ) + { + } - try - { - a = xNameAccess->getByName( aCalcDoc ); - a >>= xCmdAccess; - if ( xCmdAccess.is() ) - xCmdAccess->getByName( rtl::OUString( ".uno:InsertObjectStarMath" )); - } - catch ( const ::com::sun::star::uno::Exception& ) - { - } + try + { + a = xNameAccess->getByName( aCalcDoc ); + a >>= xCmdAccess; + if ( xCmdAccess.is() ) + xCmdAccess->getByName( rtl::OUString( ".uno:InsertObjectStarMath" )); + } + catch ( const ::com::sun::star::uno::Exception& ) + { + } - try - { - // draw and impress share the same configuration file (DrawImpressCommands.xcu) - a = xNameAccess->getByName( aDrawDoc ); - a >>= xCmdAccess; - if ( xCmdAccess.is() ) - xCmdAccess->getByName( rtl::OUString( ".uno:Polygon" )); - } - catch ( const ::com::sun::star::uno::Exception& ) - { - } + try + { + // draw and impress share the same configuration file (DrawImpressCommands.xcu) + a = xNameAccess->getByName( aDrawDoc ); + a >>= xCmdAccess; + if ( xCmdAccess.is() ) + xCmdAccess->getByName( rtl::OUString( ".uno:Polygon" )); + } + catch ( const ::com::sun::star::uno::Exception& ) + { } // preload window state configuration diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 87702bade412..8424f0975400 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/embed/FileSystemStorageFactory.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationStorage.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> @@ -91,12 +92,9 @@ static const char XDG_CONFIG_PART[] = "/.config"; ::rtl::OUString sLabel; uno::Reference< container::XNameAccess > xUICommands; - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription")) ), uno::UNO_QUERY ); - if ( xNameAccess.is() ) - { - uno::Any a = xNameAccess->getByName( sModuleIdentifier ); - a >>= xUICommands; - } + uno::Reference< container::XNameAccess > xNameAccess( ui::UICommandDescription::create(::comphelper::getProcessComponentContext()) ); + uno::Any a = xNameAccess->getByName( sModuleIdentifier ); + a >>= xUICommands; if (xUICommands.is()) { if ( !sCommand.isEmpty() ) |