summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-11 16:02:21 +0200
committerNoel Grandin <noel@peralex.com>2012-12-21 09:12:06 +0200
commitcd0b83b531e7cfa424299f1e263e08ff77e1a7a5 (patch)
tree9dd5e6e6257318b31d7a7ad09b228fa29162377e
parent5f841460593a3bf9741dfc9c32c617a7b8f73587 (diff)
fdo#46808, Use service constructor for frame::UICommandDescription
Change-Id: I8950afd1e49fda9e3336a79024e603262d717dad
-rw-r--r--framework/inc/helper/mischelper.hxx2
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/source/fwi/helper/mischelper.cxx12
-rw-r--r--framework/source/uiconfiguration/imagemanager.cxx2
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx29
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.hxx10
-rw-r--r--framework/source/uiconfiguration/moduleimagemanager.cxx2
-rw-r--r--framework/source/uielement/macrosmenucontroller.cxx2
-rw-r--r--framework/source/uielement/menubarmanager.cxx2
-rw-r--r--framework/source/uielement/statusbarmanager.cxx2
-rw-r--r--framework/source/uielement/toolbarmanager.cxx6
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx5
-rw-r--r--framework/source/uielement/uicommanddescription.cxx2
13 files changed, 36 insertions, 41 deletions
diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx
index f0c3a90d0281..b559de74707e 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -101,7 +101,7 @@ public:
};
FWI_DLLPUBLIC ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels
,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame
,::rtl::OUString& _rModuleIdentifier
diff --git a/framework/inc/services.h b/framework/inc/services.h
index e815122c3138..b56877cc758e 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -56,7 +56,6 @@ namespace framework{
#define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" )
#define SERVICENAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory" )
#define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" )
-#define SERVICENAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.frame.UICommandDescription" )
#define SERVICENAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager" )
#define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" )
#define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" )
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index bf7d275b85e7..cc22e5b1e668 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/document/XDocumentLanguages.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/frame/UICommandDescription.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <tools/debug.hxx>
@@ -68,7 +69,7 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
::rtl::OUString RetrieveLabelFromCommand(
const ::rtl::OUString& aCmdURL,
- const uno::Reference< lang::XMultiServiceFactory >& _xServiceFactory,
+ const uno::Reference< uno::XComponentContext >& _xContext,
uno::Reference< container::XNameAccess >& _xUICommandLabels,
const uno::Reference< frame::XFrame >& _xFrame,
::rtl::OUString& _rModuleIdentifier,
@@ -85,7 +86,7 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
if ( !_rIni )
{
_rIni = sal_True;
- Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(_xServiceFactory) );
+ Reference< XModuleManager2 > xModuleManager = ModuleManager::create( _xContext );
try
{
@@ -96,11 +97,8 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues
}
}
- Reference< XNameAccess > xNameAccess( _xServiceFactory->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY );
- if ( xNameAccess.is() )
- {
- xNameAccess->getByName( _rModuleIdentifier ) >>= _xUICommandLabels;
- }
+ Reference< XNameAccess > xNameAccess = frame::UICommandDescription::create( _xContext );
+ xNameAccess->getByName( _rModuleIdentifier ) >>= _xUICommandLabels;
}
catch ( const Exception& )
{
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) )
{
}
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index fc947dae4441..58641d100d4d 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -160,7 +160,7 @@ IMPL_STATIC_LINK_NOINSTANCE( MacrosMenuController, ExecuteHdl_Impl, ExecuteInfo*
String MacrosMenuController::RetrieveLabelFromCommand( const String& aCmdURL )
{
sal_Bool bModuleIdentified = !m_aModuleIdentifier.isEmpty();
- return framework::RetrieveLabelFromCommand(aCmdURL,m_xServiceManager,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,bModuleIdentified,"Label");
+ return framework::RetrieveLabelFromCommand(aCmdURL, comphelper::getComponentContext(m_xServiceManager),m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,bModuleIdentified,"Label");
}
void MacrosMenuController::addScriptItems( PopupMenu* pPopupMenu, sal_uInt16 startItemId )
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 846d2cebf57d..f12dca4a8cab 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1185,7 +1185,7 @@ sal_Bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< X
}
String MenuBarManager::RetrieveLabelFromCommand( const String& aCmdURL )
{
- return framework::RetrieveLabelFromCommand(aCmdURL,mxServiceFactory,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Label");
+ return framework::RetrieveLabelFromCommand(aCmdURL, comphelper::getComponentContext(mxServiceFactory), m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Label");
}
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 25b29a4900bc..da48fa794bb9 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -318,7 +318,7 @@ void StatusBarManager::RemoveControllers()
rtl::OUString StatusBarManager::RetrieveLabelFromCommand( const rtl::OUString& aCmdURL )
{
- return framework::RetrieveLabelFromCommand(aCmdURL,m_xServiceManager,m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name");
+ return framework::RetrieveLabelFromCommand(aCmdURL, comphelper::getComponentContext(m_xServiceManager), m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Name");
}
void StatusBarManager::CreateControllers()
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index af16d7308079..8ab834070e31 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/UICommandDescription.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XDockableWindow.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -829,9 +830,8 @@ uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const
if ( !m_aModuleIdentifier.isEmpty() )
{
- Reference< XNameAccess > xNameAccess( m_xServiceManager->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY );
- if ( xNameAccess.is() )
- xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandLabels;
+ Reference< XNameAccess > xNameAccess = frame::UICommandDescription::create( comphelper::getComponentContext(m_xServiceManager) );
+ xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandLabels;
}
}
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 75b8351ff620..793aad7a97e7 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/awt/MenuItemStyle.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/UICommandDescription.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -224,9 +225,7 @@ rtl::OUString ToolbarsMenuController::getUINameFromCommand( const rtl::OUString&
{
Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) );
m_aModuleIdentifier = xModuleManager->identify( m_xFrame );
- Reference< XNameAccess > xNameAccess( m_xServiceManager->createInstance(
- SERVICENAME_UICOMMANDDESCRIPTION ),
- UNO_QUERY );
+ Reference< XNameAccess > xNameAccess = frame::UICommandDescription::create( comphelper::getComponentContext(m_xServiceManager) );
xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandDescription;
}
catch ( const Exception& )
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 78936cb4cb61..efaa72c84942 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -617,7 +617,7 @@ void SAL_CALL ConfigurationAccess_UICommand::disposing( const EventObject& aEven
//*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UICommandDescription ,
::cppu::OWeakObject ,
- SERVICENAME_UICOMMANDDESCRIPTION ,
+ DECLARE_ASCII("com.sun.star.frame.UICommandDescription"),
IMPLEMENTATIONNAME_UICOMMANDDESCRIPTION
)