diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-11 16:02:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-21 09:12:06 +0200 |
commit | cd0b83b531e7cfa424299f1e263e08ff77e1a7a5 (patch) | |
tree | 9dd5e6e6257318b31d7a7ad09b228fa29162377e /framework/source/uiconfiguration | |
parent | 5f841460593a3bf9741dfc9c32c617a7b8f73587 (diff) |
fdo#46808, Use service constructor for frame::UICommandDescription
Change-Id: I8950afd1e49fda9e3336a79024e603262d717dad
Diffstat (limited to 'framework/source/uiconfiguration')
4 files changed, 21 insertions, 22 deletions
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx index e576836991d9..5d77a3cbfc46 100644 --- a/framework/source/uiconfiguration/imagemanager.cxx +++ b/framework/source/uiconfiguration/imagemanager.cxx @@ -88,7 +88,7 @@ DEFINE_INIT_SERVICE ( ImageManager, {} ) ImageManager::ImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) : ThreadHelpBase( &Application::GetSolarMutex() ) - , m_pImpl( new ImageManagerImpl(xServiceManager,this,false) ) + , m_pImpl( new ImageManagerImpl(comphelper::getComponentContext(xServiceManager),this,false) ) { } diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 83c45c739076..c50fe91db2a4 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -26,6 +26,7 @@ #include "properties.h" +#include <com/sun/star/frame/UICommandDescription.hpp> #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/ui/ConfigurationEvent.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -110,12 +111,12 @@ static osl::Mutex& getGlobalImageListMutex() return theGlobalImageListMutex::get(); } -static GlobalImageList* getGlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager ) +static GlobalImageList* getGlobalImageList( const uno::Reference< uno::XComponentContext >& rxContext ) { osl::MutexGuard guard( getGlobalImageListMutex() ); if ( pGlobalImageList == 0 ) - pGlobalImageList = new GlobalImageList( rServiceManager ); + pGlobalImageList = new GlobalImageList( rxContext ); return pGlobalImageList; } @@ -151,10 +152,10 @@ static rtl::OUString getCanonicalName( const rtl::OUString& rFileName ) //_________________________________________________________________________________________________________________ -CmdImageList::CmdImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager, const rtl::OUString& aModuleIdentifier ) : +CmdImageList::CmdImageList( const uno::Reference< uno::XComponentContext >& rxContext, const rtl::OUString& aModuleIdentifier ) : m_bVectorInit( sal_False ), m_aModuleIdentifier( aModuleIdentifier ), - m_xServiceManager( rServiceManager ), + m_xContext( rxContext ), m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ) { for ( sal_Int32 n=0; n < ImageType_COUNT; n++ ) @@ -175,9 +176,7 @@ void CmdImageList::impl_fillCommandToImageNameMap() { const rtl::OUString aCommandImageList( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST ); Sequence< OUString > aCmdImageSeq; - uno::Reference< XNameAccess > xCmdDesc( m_xServiceManager->createInstance( - SERVICENAME_UICOMMANDDESCRIPTION ), - UNO_QUERY ); + uno::Reference< XNameAccess > xCmdDesc = frame::UICommandDescription::create( m_xContext ); if ( !m_aModuleIdentifier.isEmpty() ) { @@ -327,8 +326,8 @@ bool CmdImageList::hasImage( sal_Int16 /*nImageType*/, const rtl::OUString& rCom //_________________________________________________________________________________________________________________ -GlobalImageList::GlobalImageList( const uno::Reference< XMultiServiceFactory >& rServiceManager ) : - CmdImageList( rServiceManager, rtl::OUString() ), +GlobalImageList::GlobalImageList( const uno::Reference< uno::XComponentContext >& rxContext ) : + CmdImageList( rxContext, rtl::OUString() ), m_nRefCount( 0 ) { } @@ -484,7 +483,7 @@ sal_Bool ImageManagerImpl::implts_loadUserImages( uno::Reference< XInputStream > xInputStream = xStream->getInputStream(); ImageListsDescriptor aUserImageListInfo; - ImagesConfiguration::LoadImages( comphelper::getComponentContext(m_xServiceManager), + ImagesConfiguration::LoadImages( m_xContext, xInputStream, aUserImageListInfo ); if (( aUserImageListInfo.pImageList != 0 ) && @@ -605,7 +604,7 @@ sal_Bool ImageManagerImpl::implts_storeUserImages( xOutputStream = xStream->getOutputStream(); if ( xOutputStream.is() ) - ImagesConfiguration::StoreImages( comphelper::getComponentContext(m_xServiceManager), xOutputStream, aUserImageListInfo ); + ImagesConfiguration::StoreImages( m_xContext, xOutputStream, aUserImageListInfo ); // Commit user image storage xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY ); @@ -658,7 +657,7 @@ const rtl::Reference< GlobalImageList >& ImageManagerImpl::implts_getGlobalImage ResetableGuard aGuard( m_aLock ); if ( !m_pGlobalImageList.is() ) - m_pGlobalImageList = getGlobalImageList( m_xServiceManager ); + m_pGlobalImageList = getGlobalImageList( m_xContext ); return m_pGlobalImageList; } @@ -667,14 +666,14 @@ CmdImageList* ImageManagerImpl::implts_getDefaultImageList() ResetableGuard aGuard( m_aLock ); if ( !m_pDefaultImageList ) - m_pDefaultImageList = new CmdImageList( m_xServiceManager, m_aModuleIdentifier ); + m_pDefaultImageList = new CmdImageList( m_xContext, m_aModuleIdentifier ); return m_pDefaultImageList; } -ImageManagerImpl::ImageManagerImpl( const uno::Reference< XMultiServiceFactory >& xServiceManager,::cppu::OWeakObject* pOwner,bool _bUseGlobal ) : +ImageManagerImpl::ImageManagerImpl( const uno::Reference< uno::XComponentContext >& rxContext,::cppu::OWeakObject* pOwner,bool _bUseGlobal ) : ThreadHelpBase( &Application::GetSolarMutex() ) - , m_xServiceManager( xServiceManager ) + , m_xContext( rxContext ) , m_pOwner(pOwner) , m_pDefaultImageList( 0 ) , m_aXMLPostfix( ".xml" ) diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx index 15fa74db7f8e..50307c746809 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.hxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx @@ -60,7 +60,7 @@ namespace framework class CmdImageList { public: - CmdImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + CmdImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& aModuleIdentifier ); virtual ~CmdImageList(); @@ -80,7 +80,7 @@ namespace framework rtl::OUString m_aModuleIdentifier; ImageList* m_pImageList[ImageType_COUNT]; CommandToImageNameMap m_aCommandToImageNameMap; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::std::vector< rtl::OUString > m_aImageNameVector; ::std::vector< rtl::OUString > m_aImageCommandNameVector; sal_Int16 m_nSymbolsStyle; @@ -89,7 +89,7 @@ namespace framework class GlobalImageList : public CmdImageList, public rtl::IReference { public: - GlobalImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + GlobalImageList( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~GlobalImageList(); virtual Image getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString& rCommandURL ); @@ -109,7 +109,7 @@ namespace framework { public: - ImageManagerImpl(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager + ImageManagerImpl(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ,::cppu::OWeakObject *pOwner ,bool _bUseGlobal); ~ImageManagerImpl(); @@ -180,7 +180,7 @@ namespace framework com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserImageStorage; com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserBitmapsStorage; com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit; - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; ::cppu::OWeakObject* m_pOwner; rtl::Reference< GlobalImageList > m_pGlobalImageList; CmdImageList* m_pDefaultImageList; diff --git a/framework/source/uiconfiguration/moduleimagemanager.cxx b/framework/source/uiconfiguration/moduleimagemanager.cxx index d2fb7ecbd872..8bda564dcac3 100644 --- a/framework/source/uiconfiguration/moduleimagemanager.cxx +++ b/framework/source/uiconfiguration/moduleimagemanager.cxx @@ -75,7 +75,7 @@ namespace framework { ModuleImageManager::ModuleImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) : ThreadHelpBase( &Application::GetSolarMutex() ) - , m_pImpl( new ImageManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),true) ) + , m_pImpl( new ImageManagerImpl(comphelper::getComponentContext(xServiceManager),static_cast< OWeakObject* >(this),true) ) { } |