summaryrefslogtreecommitdiffstats
path: root/svtools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-29 17:20:22 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-29 18:18:28 +0200
commitc2ca6fabd1afc3fc07001721c2069d3c8db7000a (patch)
tree350741d6d19564bcaf00506bd7d22b4c644e0fdc /svtools
parentSome clean up (diff)
downloadcore-c2ca6fabd1afc3fc07001721c2069d3c8db7000a.tar.gz
core-c2ca6fabd1afc3fc07001721c2069d3c8db7000a.zip
Use comphelper::getComponentContext
...and some further clean up. Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'svtools')
-rw-r--r--svtools/Library_hatchwindowfactory.mk1
-rw-r--r--svtools/source/hatchwindow/documentcloser.cxx17
-rw-r--r--svtools/source/misc/templatefoldercache.cxx36
3 files changed, 11 insertions, 43 deletions
diff --git a/svtools/Library_hatchwindowfactory.mk b/svtools/Library_hatchwindowfactory.mk
index a25abdb3bcf3..03f2566bfae9 100644
--- a/svtools/Library_hatchwindowfactory.mk
+++ b/svtools/Library_hatchwindowfactory.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_set_include,hatchwindowfactory,\
$(eval $(call gb_Library_use_sdk_api,hatchwindowfactory))
$(eval $(call gb_Library_use_libraries,hatchwindowfactory,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx
index fe934549d202..0cf4d7d120fd 100644
--- a/svtools/source/hatchwindow/documentcloser.cxx
+++ b/svtools/source/hatchwindow/documentcloser.cxx
@@ -22,9 +22,8 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/frame/DoubleInitializationException.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
-
+#include <comphelper/processfactory.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/dialog.hxx>
@@ -267,18 +266,8 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ODocumentCloser::impl_staticGetSupport
uno::Reference< uno::XInterface > SAL_CALL ODocumentCloser::impl_staticCreateSelfInstance(
const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
{
- uno::Reference< uno::XComponentContext > xContext;
- uno::Reference< beans::XPropertySet > xPropSet( xServiceManager, uno::UNO_QUERY );
- if ( xPropSet.is() )
- xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext;
-
- if ( !xContext.is() )
- {
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unable to obtain component context from service manager!" ) ),
- uno::Reference< uno::XInterface >() );
- }
-
+ uno::Reference< uno::XComponentContext > xContext(
+ comphelper::getComponentContext( xServiceManager ) );
return static_cast< cppu::OWeakObject * >( new ODocumentCloser( xContext ) );
}
diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx
index 139d84ad7336..b49d74aa0648 100644
--- a/svtools/source/misc/templatefoldercache.cxx
+++ b/svtools/source/misc/templatefoldercache.cxx
@@ -29,7 +29,6 @@
#include <svtools/templatefoldercache.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/localfilehelper.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -837,36 +836,15 @@ namespace svt
osl::MutexGuard aGuard( m_aMutex );
if ( !m_xOfficeInstDirs.is() )
{
- // @@@ This is bad!
- uno::Reference< lang::XMultiServiceFactory > xSMgr
- = comphelper::getProcessServiceFactory();
- OSL_ENSURE( xSMgr.is(), "No service manager!" );
-
- uno::Reference< beans::XPropertySet > xPropSet(
- xSMgr, uno::UNO_QUERY );
- if ( xPropSet.is() )
- {
- uno::Reference< uno::XComponentContext > xCtx;
- xPropSet->getPropertyValue(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) )
- >>= xCtx;
-
- OSL_ENSURE( xCtx.is(),
- "Unable to obtain component context from service manager!" );
-
- if ( xCtx.is() )
- {
- xCtx->getValueByName(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ uno::Reference< uno::XComponentContext > xCtx(
+ comphelper::getProcessComponentContext() );
+ xCtx->getValueByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) ) )
- >>= m_xOfficeInstDirs;
- }
+ >>= m_xOfficeInstDirs;
- OSL_ENSURE( m_xOfficeInstDirs.is(),
- "Unable to obtain office directories singleton!" );
-
- }
+ OSL_ENSURE( m_xOfficeInstDirs.is(),
+ "Unable to obtain office directories singleton!" );
}
}
return m_xOfficeInstDirs;