summaryrefslogtreecommitdiffstats
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-29 17:20:22 +0200
committerAndras Timar <atimar@suse.com>2012-10-01 13:55:48 +0200
commitf5f06fb016766cc40817f1fcc3feec0b464845b0 (patch)
treeaefab28b58cbac33a616b4110ee8db43c831891b /sfx2
parentSome clean up (diff)
downloadcore-f5f06fb016766cc40817f1fcc3feec0b464845b0.tar.gz
core-f5f06fb016766cc40817f1fcc3feec0b464845b0.zip
Use comphelper::getComponentContext
...and some further clean up. Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/dockwin.cxx15
-rw-r--r--sfx2/source/doc/doctemplates.cxx51
2 files changed, 18 insertions, 48 deletions
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 7106771db298..d95318b00704 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -163,17 +163,12 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
uno::Reference< awt::XWindow > xWindow;
try
{
- uno::Reference< beans::XPropertySet > xProps( xServiceManager, uno::UNO_QUERY );
- uno::Reference< uno::XComponentContext > xContext;
+ uno::Reference< uno::XComponentContext > xContext(
+ comphelper::getComponentContext( xServiceManager ) );
- if ( xProps.is() )
- xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
- if ( xContext.is() )
- {
- xWindow = uno::Reference< awt::XWindow>(
- xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
- uno::UNO_QUERY );
- }
+ xWindow = uno::Reference< awt::XWindow>(
+ xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
+ uno::UNO_QUERY );
static uno::WeakReference< frame::XModuleManager2 > m_xModuleManager;
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index c7a2fa62d6b5..25ed45909bcc 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -581,29 +581,18 @@ void SfxDocTplService_Impl::getDirList()
maTemplateDirs = Sequence< OUString >( nCount );
- uno::Reference< XComponentContext > xCtx;
+ uno::Reference< XComponentContext > xCtx(
+ comphelper::getComponentContext( mxFactory ) );
uno::Reference< util::XMacroExpander > xExpander;
- uno::Reference< XPropertySet > xPropSet( mxFactory, UNO_QUERY );
const rtl::OUString aPrefix(
"vnd.sun.star.expand:" );
- if ( xPropSet.is() )
- {
- xPropSet->getPropertyValue(
- rtl::OUString(
- "DefaultContext" ) )
- >>= xCtx;
- }
+ xCtx->getValueByName(
+ rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) )
+ >>= xExpander;
- if ( xCtx.is() )
- {
- xCtx->getValueByName(
- rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) )
- >>= xExpander;
-
- OSL_ENSURE( xExpander.is(),
- "Unable to obtain macro expander singleton!" );
- }
+ OSL_ENSURE( xExpander.is(),
+ "Unable to obtain macro expander singleton!" );
for ( sal_uInt16 i=0; i<nCount; i++ )
{
@@ -2861,28 +2850,14 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
{
OSL_ENSURE( mxFactory.is(), "No service manager!" );
- uno::Reference< XComponentContext > xCtx;
- uno::Reference< XPropertySet > xPropSet( mxFactory, UNO_QUERY );
- if ( xPropSet.is() )
- {
- xPropSet->getPropertyValue(
- rtl::OUString(
- "DefaultContext" ) )
- >>= xCtx;
- }
-
- OSL_ENSURE( xCtx.is(),
- "Unable to obtain component context from "
- "service manager!" );
+ uno::Reference< XComponentContext > xCtx(
+ comphelper::getComponentContext( mxFactory ) );
- if ( xCtx.is() )
- {
- xCtx->getValueByName(
- rtl::OUString(
- "/singletons/"
- "com.sun.star.util.theOfficeInstallationDirectories" ) )
+ xCtx->getValueByName(
+ rtl::OUString(
+ "/singletons/"
+ "com.sun.star.util.theOfficeInstallationDirectories" ) )
>>= mxOfficeInstDirs;
- }
OSL_ENSURE( mxOfficeInstDirs.is(),
"Unable to obtain office installation directory "