diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-19 13:15:15 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-19 13:16:38 +0200 |
commit | 03a9f139bd9ea1a4f9096fc982e6b326def58532 (patch) | |
tree | bfb7a08bb4831a1a46b48c3bb49afa77ca436349 /cui/source/customize | |
parent | e8a169c93d7e2443a2e56afe7e99cd0721a2c27b (diff) |
ComponentContext::getUnoContext -> getComponentContext simplification
...and some further clean-up.
Change-Id: If5dce53e382b56390c502d0d0d93fc06cbfe33ea
Diffstat (limited to 'cui/source/customize')
-rw-r--r-- | cui/source/customize/acccfg.cxx | 7 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 5 | ||||
-rw-r--r-- | cui/source/customize/cfgutil.cxx | 3 | ||||
-rw-r--r-- | cui/source/customize/selector.cxx | 76 |
4 files changed, 37 insertions, 54 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 8ed9d6c09381..4ba939ee736e 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -67,7 +67,6 @@ //----------------------------------------------- // include other projects -#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <svtools/acceleratorexecute.hxx> #include <svtools/svlbitm.hxx> @@ -853,7 +852,7 @@ void SfxAcceleratorConfigPage::InitAccCfg() m_xSMGR = ::comphelper::getProcessServiceFactory(); m_xUICmdDescription = css::frame::UICommandDescription::create( - comphelper::ComponentContext(m_xSMGR).getUNOContext()); + comphelper::getComponentContext(m_xSMGR)); // get the current active frame, which should be our "parent" // for this session @@ -866,7 +865,7 @@ void SfxAcceleratorConfigPage::InitAccCfg() // identify module css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( - css::frame::ModuleManager::create(comphelper::ComponentContext(m_xSMGR).getUNOContext())); + css::frame::ModuleManager::create(comphelper::getComponentContext(m_xSMGR))); m_sModuleLongName = xModuleManager->identify(m_xFrame); ::comphelper::SequenceAsHashMap lModuleProps(xModuleManager->getByName(m_sModuleLongName)); m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, ::rtl::OUString()); @@ -877,7 +876,7 @@ void SfxAcceleratorConfigPage::InitAccCfg() // get module accelerator configuration - css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(css::ui::ModuleUIConfigurationManagerSupplier::create(comphelper::ComponentContext(m_xSMGR).getUNOContext())); + css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(css::ui::ModuleUIConfigurationManagerSupplier::create(comphelper::getComponentContext(m_xSMGR))); css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName); m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 626a25dd6828..f7dc04eae4c4 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -65,7 +65,6 @@ #include "eventdlg.hxx" #include <dialmgr.hxx> -#include <comphelper/componentcontext.hxx> #include <comphelper/documentinfo.hxx> #include <comphelper/processfactory.hxx> #include <unotools/configmgr.hxx> @@ -915,7 +914,7 @@ SaveInData::SaveInData( uno::Reference< container::XNameAccess > xNameAccess( css::frame::UICommandDescription::create( - comphelper::ComponentContext(m_xServiceManager).getUNOContext()) ); + comphelper::getComponentContext(m_xServiceManager)) ); xNameAccess->getByName( aModuleId ) >>= m_xCommandToLabelMap; @@ -1915,7 +1914,7 @@ void SvxConfigPage::Reset( const SfxItemSet& ) } uno::Reference< css::frame::XModuleManager2 > xModuleManager( - css::frame::ModuleManager::create( comphelper::ComponentContext(xServiceManager).getUNOContext() ) ); + css::frame::ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ); try { diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 0f08675ec4da..405c6fa83e10 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -59,7 +59,6 @@ #include "cuires.hrc" #include <sfx2/app.hxx> #include <sfx2/minfitem.hxx> -#include <comphelper/componentcontext.hxx> #include <comphelper/documentinfo.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -587,7 +586,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul m_xGlobalCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICATEGORYDESCRIPTION), css::uno::UNO_QUERY_THROW); m_xModuleCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xGlobalCategoryInfo->getByName(m_sModuleLongName) , css::uno::UNO_QUERY_THROW); m_xUICmdDescription = css::frame::UICommandDescription::create( - ::comphelper::ComponentContext(m_xSMGR).getUNOContext()); + ::comphelper::getComponentContext(m_xSMGR)); InitModule(); InitBasic(); diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 280393a6486f..c0023032d8ea 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -44,7 +44,6 @@ #include <comphelper/documentinfo.hxx> #include <comphelper/processfactory.hxx> -#include <comphelper/componentcontext.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> @@ -352,8 +351,7 @@ void SvxConfigGroupListBox_Impl::fillScriptList( const Reference< browse::XBrows SvLBoxEntry* pNewEntry = InsertEntry( sUIName, _pParentEntry ); - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Image aImage = GetImage( theChild, aContext.getUNOContext(), bIsRootNode ); + Image aImage = GetImage( theChild, comphelper::getProcessComponentContext(), bIsRootNode ); SetExpandedEntryBmp( pNewEntry, aImage ); SetCollapsedEntryBmp( pNewEntry, aImage ); @@ -400,16 +398,11 @@ void SvxConfigGroupListBox_Impl::Init() SetUpdateMode(sal_False); ClearAll(); - Reference< XComponentContext > xContext; - Reference < beans::XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - - xContext.set( xProps->getPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), - UNO_QUERY ); + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); // are we showing builtin commands? - if ( m_bShowSlots && xContext.is() && m_xFrame.is() ) + if ( m_bShowSlots && m_xFrame.is() ) { Reference< lang::XMultiComponentFactory > xMCF = xContext->getServiceManager(); @@ -502,45 +495,38 @@ void SvxConfigGroupListBox_Impl::Init() } } - if ( xContext.is() ) - { - // Add Scripting Framework entries - Reference< browse::XBrowseNode > rootNode; - Reference< XComponentContext> xCtx; + // Add Scripting Framework entries + Reference< browse::XBrowseNode > rootNode; - try - { - Reference < beans::XPropertySet > _xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - xCtx.set( _xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW ); - Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName( - OUString(RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory")) ), UNO_QUERY_THROW ); - rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + try + { + Reference< browse::XBrowseNodeFactory > xFac( xContext->getValueByName( + OUString(RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory")) ), UNO_QUERY_THROW ); + rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } - if ( rootNode.is() ) + if ( rootNode.is() ) + { + if ( m_bShowSlots ) { - if ( m_bShowSlots ) - { - SvxGroupInfo_Impl *pInfo = - new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, rootNode ); + SvxGroupInfo_Impl *pInfo = + new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, rootNode ); - String aTitle = - String( CUI_RES( STR_SELECTOR_MACROS ) ); + String aTitle = + String( CUI_RES( STR_SELECTOR_MACROS ) ); - SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL ); - pNewEntry->SetUserData( pInfo ); - pNewEntry->EnableChildrenOnDemand( sal_True ); - aArr.push_back( pInfo ); - } - else - { - fillScriptList( rootNode, NULL, false ); - } + SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL ); + pNewEntry->SetUserData( pInfo ); + pNewEntry->EnableChildrenOnDemand( sal_True ); + aArr.push_back( pInfo ); + } + else + { + fillScriptList( rootNode, NULL, false ); } } MakeVisible( GetEntry( 0,0 ) ); |