diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 4da325384247..73a7198bd89c 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -85,12 +86,9 @@ void StaticAddLog( const ::rtl::OUString& aMessage ) { try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - if ( aContext.is() ) - { - uno::Reference< logging::XSimpleLogRing > xLogRing( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW ); - xLogRing->logString( aMessage ); - } + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference< logging::XSimpleLogRing > xLogRing( logging::DocumentIOLogRing::get(xContext) ); + xLogRing->logString( aMessage ); } catch( const uno::Exception& ) { @@ -351,9 +349,8 @@ void OWriteStream_Impl::AddLog( const ::rtl::OUString& aMessage ) { try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - if ( aContext.is() ) - m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + m_xLogRing = logging::DocumentIOLogRing::get(xContext); } catch( const uno::Exception& ) { diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index bfd2302a47b7..8c98b87bab72 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -403,9 +404,8 @@ void OStorage_Impl::AddLog( const ::rtl::OUString& aMessage ) { try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - if ( aContext.is() ) - m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW ); + uno::Reference xContext( ::comphelper::getProcessComponentContext() ); + m_xLogRing = logging::DocumentIOLogRing::get(xContext); } catch( const uno::Exception& ) { diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index b6d1f85ac34a..907e0134d938 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -387,9 +388,8 @@ void SfxMedium::AddLog( const ::rtl::OUString& aMessage ) { try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - if ( aContext.is() ) - pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW ); + Reference xContext( ::comphelper::getProcessComponentContext() ); + pImp->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) ); } catch( const uno::Exception& ) {} diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index a1b3c26db956..e7edadcaa681 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -2030,9 +2031,8 @@ void SfxObjectShell::AddLog( const ::rtl::OUString& aMessage ) { try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - if ( aContext.is() ) - pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW ); + Reference xContext( ::comphelper::getProcessComponentContext() ); + pImp->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) ); } catch( uno::Exception& ) {} @@ -2066,9 +2066,8 @@ void SfxObjectShell::StoreLog() { try { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - if ( aContext.is() ) - pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW ); + Reference xContext( ::comphelper::getProcessComponentContext() ); + pImp->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) ); } catch( uno::Exception& ) {}