diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 17:20:22 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 18:18:28 +0200 |
commit | c2ca6fabd1afc3fc07001721c2069d3c8db7000a (patch) | |
tree | 350741d6d19564bcaf00506bd7d22b4c644e0fdc /sc/source/ui/miscdlgs | |
parent | f05d7abf93bbcf443cb0b5759ca19992e2fa85a3 (diff) |
Use comphelper::getComponentContext
...and some further clean up.
Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'sc/source/ui/miscdlgs')
-rw-r--r-- | sc/source/ui/miscdlgs/solverutil.cxx | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx index 356eef7440e2..8ed768e1f760 100644 --- a/sc/source/ui/miscdlgs/solverutil.cxx +++ b/sc/source/ui/miscdlgs/solverutil.cxx @@ -29,6 +29,7 @@ #include "solverutil.hxx" #include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> @@ -84,19 +85,13 @@ void ScSolverUtil::GetImplementations( uno::Sequence<rtl::OUString>& rImplNames, rImplNames.realloc(0); // clear rDescriptions.realloc(0); - uno::Reference<uno::XComponentContext> xCtx; - uno::Reference<lang::XMultiServiceFactory> xMSF = comphelper::getProcessServiceFactory(); - uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY); - try - { - xPropset->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xCtx; - } - catch ( uno::Exception & ) - { - } + uno::Reference<uno::XComponentContext> xCtx( + comphelper::getProcessComponentContext() ); + uno::Reference<lang::XMultiServiceFactory> xMSF( + xCtx->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference<container::XContentEnumerationAccess> xEnAc( xMSF, uno::UNO_QUERY ); - if ( xCtx.is() && xEnAc.is() ) + if ( xEnAc.is() ) { uno::Reference<container::XEnumeration> xEnum = xEnAc->createContentEnumeration( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SCSOLVER_SERVICE)) ); @@ -140,19 +135,13 @@ uno::Reference<sheet::XSolver> ScSolverUtil::GetSolver( const rtl::OUString& rIm { uno::Reference<sheet::XSolver> xSolver; - uno::Reference<uno::XComponentContext> xCtx; - uno::Reference<lang::XMultiServiceFactory> xMSF = comphelper::getProcessServiceFactory(); - uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY); - try - { - xPropset->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xCtx; - } - catch ( uno::Exception & ) - { - } + uno::Reference<uno::XComponentContext> xCtx( + comphelper::getProcessComponentContext() ); + uno::Reference<lang::XMultiServiceFactory> xMSF( + xCtx->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference<container::XContentEnumerationAccess> xEnAc( xMSF, uno::UNO_QUERY ); - if ( xCtx.is() && xEnAc.is() ) + if ( xEnAc.is() ) { uno::Reference<container::XEnumeration> xEnum = xEnAc->createContentEnumeration( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SCSOLVER_SERVICE)) ); |