summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-08 15:29:57 +0200
committerNoel Grandin <noel@peralex.com>2013-01-15 09:56:03 +0200
commitabcbababca2ff10bb78d36cf1a625b9d615eaa9a (patch)
tree1c95f7dc1e7f20c013f13c1f1fff637853e23256 /comphelper
parent251f1b0b38be7d1267339898e44e320f05849e22 (diff)
fdo#46808, Convert comphelper::MimeConfigurationHelper to XComponentContext
Change-Id: I74b4f0c4a84f02b218102405eaba24cf47f654ce
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/inc/comphelper/mimeconfighelper.hxx5
-rw-r--r--comphelper/source/misc/mimeconfighelper.cxx16
2 files changed, 10 insertions, 11 deletions
diff --git a/comphelper/inc/comphelper/mimeconfighelper.hxx b/comphelper/inc/comphelper/mimeconfighelper.hxx
index fbefc13bcd41..8cf7953394e7 100644
--- a/comphelper/inc/comphelper/mimeconfighelper.hxx
+++ b/comphelper/inc/comphelper/mimeconfighelper.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
@@ -36,7 +37,7 @@ namespace comphelper {
class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
{
::osl::Mutex m_aMutex;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xObjectConfig;
@@ -47,7 +48,7 @@ class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
public:
- MimeConfigurationHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ MimeConfigurationHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
static ::rtl::OUString GetStringClassIDRepresentation( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx
index e1b63bc68bc4..61c667e81cf0 100644
--- a/comphelper/source/misc/mimeconfighelper.cxx
+++ b/comphelper/source/misc/mimeconfighelper.cxx
@@ -34,10 +34,10 @@ using namespace ::com::sun::star;
using namespace comphelper;
//-----------------------------------------------------------------------
-MimeConfigurationHelper::MimeConfigurationHelper( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-: m_xFactory( xFactory )
+MimeConfigurationHelper::MimeConfigurationHelper( const uno::Reference< uno::XComponentContext >& rxContext )
+: m_xContext( rxContext )
{
- if ( !m_xFactory.is() )
+ if ( !m_xContext.is() )
throw uno::RuntimeException();
}
@@ -122,8 +122,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurati
try
{
if ( !m_xConfigProvider.is() )
- m_xConfigProvider = configuration::theDefaultProvider::get(
- getComponentContext( m_xFactory ) );
+ m_xConfigProvider = configuration::theDefaultProvider::get( m_xContext );
uno::Sequence< uno::Any > aArgs( 1 );
beans::PropertyValue aPathProp;
@@ -186,7 +185,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetFilterFacto
if ( !m_xFilterFactory.is() )
m_xFilterFactory.set(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ),
+ m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.FilterFactory", m_xContext),
uno::UNO_QUERY );
return m_xFilterFactory;
@@ -222,8 +221,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetFilterFacto
::rtl::OUString MimeConfigurationHelper::GetDocServiceNameFromMediaType( const ::rtl::OUString& aMediaType )
{
uno::Reference< container::XContainerQuery > xTypeCFG(
- m_xFactory->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" )) ),
+ m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", m_xContext),
uno::UNO_QUERY );
if ( xTypeCFG.is() )
@@ -585,7 +583,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu
// filter name is not specified, so type detection should be done
uno::Reference< document::XTypeDetection > xTypeDetection(
- m_xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" )) ),
+ m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", m_xContext),
uno::UNO_QUERY );
if ( !xTypeDetection.is() )