summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/doctemplates.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/doc/doctemplates.cxx')
-rw-r--r--sfx2/source/doc/doctemplates.cxx51
1 files changed, 13 insertions, 38 deletions
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 "