fdo#46808, use service constructor for document::DocumentIOLogRing

Change-Id: I39f6d9f671dcb03779d594df5af60c9a0e3ca451
This commit is contained in:
Noel Grandin
2013-01-31 11:29:04 +02:00
parent 89fed427f0
commit 5bef4dc30c
4 changed files with 17 additions and 21 deletions

View File

@@ -23,6 +23,7 @@
#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/logging/DocumentIOLogRing.hpp>
#include <com/sun/star/io/TempFile.hpp> #include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/IOException.hpp> #include <com/sun/star/io/IOException.hpp>
@@ -85,12 +86,9 @@ void StaticAddLog( const ::rtl::OUString& aMessage )
{ {
try try
{ {
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
if ( aContext.is() ) uno::Reference< logging::XSimpleLogRing > xLogRing( logging::DocumentIOLogRing::get(xContext) );
{ xLogRing->logString( aMessage );
uno::Reference< logging::XSimpleLogRing > xLogRing( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW );
xLogRing->logString( aMessage );
}
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{ {
@@ -351,9 +349,8 @@ void OWriteStream_Impl::AddLog( const ::rtl::OUString& aMessage )
{ {
try try
{ {
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
if ( aContext.is() ) m_xLogRing = logging::DocumentIOLogRing::get(xContext);
m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{ {

View File

@@ -23,6 +23,7 @@
#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/io/TempFile.hpp> #include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/logging/DocumentIOLogRing.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -403,9 +404,8 @@ void OStorage_Impl::AddLog( const ::rtl::OUString& aMessage )
{ {
try try
{ {
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if ( aContext.is() ) m_xLogRing = logging::DocumentIOLogRing::get(xContext);
m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{ {

View File

@@ -57,6 +57,7 @@
#include <com/sun/star/ucb/TransferInfo.hpp> #include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/OpenCommandArgument2.hpp> #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/OpenMode.hpp> #include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/logging/DocumentIOLogRing.hpp>
#include <com/sun/star/logging/XSimpleLogRing.hpp> #include <com/sun/star/logging/XSimpleLogRing.hpp>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
@@ -387,9 +388,8 @@ void SfxMedium::AddLog( const ::rtl::OUString& aMessage )
{ {
try try
{ {
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if ( aContext.is() ) pImp->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) );
pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{} {}

View File

@@ -30,6 +30,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp>
#include <com/sun/star/logging/DocumentIOLogRing.hpp>
#include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/provider/XScriptProviderFactory.hpp> #include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
#include <com/sun/star/script/FinishEngineEvent.hpp> #include <com/sun/star/script/FinishEngineEvent.hpp>
@@ -2030,9 +2031,8 @@ void SfxObjectShell::AddLog( const ::rtl::OUString& aMessage )
{ {
try try
{ {
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if ( aContext.is() ) pImp->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) );
pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{} {}
@@ -2066,9 +2066,8 @@ void SfxObjectShell::StoreLog()
{ {
try try
{ {
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if ( aContext.is() ) pImp->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) );
pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{} {}