diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-04 14:56:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-05 14:56:19 +0200 |
commit | 1c7a54e3a14ad932e68b9281420e6c469e5dd2e5 (patch) | |
tree | 8d2d64a9536e738cc6cda4f0690993c98b658bdd /forms/source/helper | |
parent | 55aa40bcd6ae3116c63a0eac18056bcfd011f43a (diff) |
fdo#46808, Adapt frame::ModuleManager UNO service to new style
Create a merged XModuleManager2 interface for this service to implement.
Which is backwards-compatible, but does not require creating a new service.
Explicitly document the XNameReplace interface in the IDL, which
is already implemented by the service, since there is code currently using it.
Change-Id: Ib46349174b1ce495c240031e93c9427fc33d9853
Diffstat (limited to 'forms/source/helper')
-rw-r--r-- | forms/source/helper/commanddescriptionprovider.cxx | 20 | ||||
-rw-r--r-- | forms/source/helper/commandimageprovider.cxx | 5 |
2 files changed, 14 insertions, 11 deletions
diff --git a/forms/source/helper/commanddescriptionprovider.cxx b/forms/source/helper/commanddescriptionprovider.cxx index b0c1b4e32384..2cfe8e7d2687 100644 --- a/forms/source/helper/commanddescriptionprovider.cxx +++ b/forms/source/helper/commanddescriptionprovider.cxx @@ -21,7 +21,7 @@ #include "commanddescriptionprovider.hxx" #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/UICommandDescription.hpp> @@ -45,8 +45,10 @@ namespace frm using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::frame::XModel; using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::frame::ModuleManager; using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::ui::UICommandDescription; @@ -58,9 +60,9 @@ namespace frm class DefaultCommandDescriptionProvider : public ICommandDescriptionProvider { public: - DefaultCommandDescriptionProvider( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ) + DefaultCommandDescriptionProvider( const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ) { - impl_init_nothrow( _rContext, _rxDocument ); + impl_init_nothrow( _rxContext, _rxDocument ); } ~DefaultCommandDescriptionProvider() @@ -71,7 +73,7 @@ namespace frm virtual ::rtl::OUString getCommandDescription( const ::rtl::OUString& _rCommandURL ) const; private: - void impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ); + void impl_init_nothrow( const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ); private: Reference< XNameAccess > m_xCommandAccess; @@ -79,7 +81,7 @@ namespace frm //-------------------------------------------------------------------- - void DefaultCommandDescriptionProvider::impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ) + void DefaultCommandDescriptionProvider::impl_init_nothrow( const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ) { OSL_ENSURE( _rxDocument.is(), "DefaultCommandDescriptionProvider::impl_init_nothrow: no document => no command descriptions!" ); if ( !_rxDocument.is() ) @@ -87,10 +89,10 @@ namespace frm try { - Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + Reference< XModuleManager > xModuleManager( ModuleManager::create(_rxContext), UNO_QUERY_THROW ); ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument ); - Reference< XNameAccess > xUICommandDescriptions( UICommandDescription::create(_rContext.getUNOContext()) ); + Reference< XNameAccess > xUICommandDescriptions( UICommandDescription::create(_rxContext) ); m_xCommandAccess.set( xUICommandDescriptions->getByName( sModuleID ), UNO_QUERY_THROW ); } catch( const Exception& ) @@ -120,9 +122,9 @@ namespace frm //-------------------------------------------------------------------- PCommandDescriptionProvider createDocumentCommandDescriptionProvider( - const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ) + const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ) { - PCommandDescriptionProvider pDescriptionProvider( new DefaultCommandDescriptionProvider( _rContext, _rxDocument ) ); + PCommandDescriptionProvider pDescriptionProvider( new DefaultCommandDescriptionProvider( _rxContext, _rxDocument ) ); return pDescriptionProvider; } diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx index 23d2023c18c3..7925985c9393 100644 --- a/forms/source/helper/commandimageprovider.cxx +++ b/forms/source/helper/commandimageprovider.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/ui/XImageManager.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/ImageType.hpp> #include <tools/diagnose_ex.h> @@ -59,6 +59,7 @@ namespace frm using ::com::sun::star::ui::XUIConfigurationManager; using ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier; using ::com::sun::star::ui::ModuleUIConfigurationManagerSupplier; + using ::com::sun::star::frame::ModuleManager; using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::graphic::XGraphic; /** === end UNO using === **/ @@ -111,7 +112,7 @@ namespace frm // obtain the image manager or the module try { - Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + Reference< XModuleManager > xModuleManager( ModuleManager::create(_rContext.getUNOContext()), UNO_QUERY_THROW ); ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument ); Reference< XModuleUIConfigurationManagerSupplier > xSuppUIConfig( |