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 /xmlhelp | |
parent | f05d7abf93bbcf443cb0b5759ca19992e2fa85a3 (diff) |
Use comphelper::getComponentContext
...and some further clean up.
Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 25 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/provider.cxx | 13 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 18 |
3 files changed, 9 insertions, 47 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 1472bea879f2..8537685ae278 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -36,6 +36,7 @@ #include <rtl/ustrbuf.hxx> #include "inputstream.hxx" #include <algorithm> +#include <cassert> #include <string.h> #include <helpcompiler/HelpIndexer.hxx> @@ -44,7 +45,6 @@ #include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/deployment/thePackageManagerFactory.hpp" #include <comphelper/processfactory.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/beans/Optional.hpp> @@ -1406,12 +1406,14 @@ ExtensionIteratorBase::ExtensionIteratorBase( Reference< XComponentContext > xCo , m_aInitialModule( aInitialModule ) , m_aLanguage( aLanguage ) { + assert( m_xContext.is() ); init(); } ExtensionIteratorBase::ExtensionIteratorBase( Databases& rDatabases, const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage ) - : m_rDatabases( rDatabases ) + : m_xContext( comphelper::getProcessComponentContext() ) + , m_rDatabases( rDatabases ) , m_eState( INITIAL_MODULE ) , m_aInitialModule( aInitialModule ) , m_aLanguage( aLanguage ) @@ -1421,25 +1423,6 @@ ExtensionIteratorBase::ExtensionIteratorBase( Databases& rDatabases, void ExtensionIteratorBase::init() { - if( !m_xContext.is() ) - { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - Reference< XPropertySet > xProps( xFactory, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - if (xProps.is()) - { - xProps->getPropertyValue( - ::rtl::OUString( "DefaultContext" ) ) >>= m_xContext; - OSL_ASSERT( m_xContext.is() ); - } - } - if( !m_xContext.is() ) - { - throw RuntimeException( - ::rtl::OUString( "ExtensionIteratorBase::init(), no XComponentContext" ), - Reference< XInterface >() ); - } - m_xSFA = ucb::SimpleFileAccess::create(m_xContext); m_bUserPackagesLoaded = false; diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index 79e4c0a1e5bb..e3deabafd57e 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -44,7 +44,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> +#include <comphelper/processfactory.hxx> #include <unotools/configmgr.hxx> #include <rtl/bootstrap.hxx> @@ -345,15 +345,8 @@ void ContentProvider::init() rtl::Bootstrap::expandMacros(aPath); aImagesZipPaths[ 1 ] = aPath; - uno::Reference< uno::XComponentContext > xContext; - uno::Reference< beans::XPropertySet > xProps( m_xSMgr, uno::UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - if (xProps.is()) - { - xProps->getPropertyValue( - ::rtl::OUString( "DefaultContext" ) ) >>= xContext; - OSL_ASSERT( xContext.is() ); - } + uno::Reference< uno::XComponentContext > xContext( + comphelper::getComponentContext( m_xSMgr ) ); sal_Bool showBasic = getBooleanKey(xHierAccess,"Help/ShowBasic"); m_pDatabases = new Databases( showBasic, diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 39c72815a06e..cb44797bd343 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -53,7 +53,6 @@ #include <com/sun/star/ucb/XContentProvider.hpp> #include <com/sun/star/ucb/XContentIdentifierFactory.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> #include "urlparameter.hxx" #include "databases.hxx" @@ -993,21 +992,8 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, if( bAddExtensionPath ) { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - Reference< XPropertySet > xProps( xFactory, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - Reference< XComponentContext > xContext; - if (xProps.is()) - { - xProps->getPropertyValue( - ::rtl::OUString( "DefaultContext" ) ) >>= xContext; - } - if( !xContext.is() ) - { - throw RuntimeException( - ::rtl::OUString( "InputStreamTransformer::InputStreamTransformer(), no XComponentContext" ), - Reference< XInterface >() ); - } + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext() ); rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionRegistryPath, xContext ); rtl::OString aExpandedExtensionPath = rtl::OUStringToOString( aOUExpandedExtensionPath, osl_getThreadTextEncoding() ); |