summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-11 17:14:33 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-12 09:57:50 +0200
commit9e4d84daf279a63052cfd0aeebd2d67dfaf07c67 (patch)
tree23d223df34a6636182947a9bf042945e879dbff5 /sfx2
parent9b157d37f15b34720fced0b94d4541f4149a8947 (diff)
drop document_io_logring.txt and use global logging
Change-Id: Ibda0ce925bc76355e636022c955077ac89e66cce Reviewed-on: https://gerrit.libreoffice.org/36434 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docfile.cxx57
-rw-r--r--sfx2/source/doc/objmisc.cxx101
-rw-r--r--sfx2/source/doc/objstor.cxx106
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx23
-rw-r--r--sfx2/source/inc/objshimp.hxx3
5 files changed, 55 insertions, 235 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 063fbf412f73..52384b439dd4 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -61,8 +61,6 @@
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/OpenCommandArgument2.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/beans/PropertyValue.hpp>
#include <com/sun/star/security/DocumentSignatureInformation.hpp>
#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
@@ -221,7 +219,6 @@ public:
uno::Reference<io::XStream> xStream;
uno::Reference<io::XStream> m_xLockingStream;
uno::Reference<task::XInteractionHandler> xInteraction;
- uno::Reference<logging::XSimpleLogRing> m_xLogRing;
sal_uInt32 nLastStorageError;
@@ -300,39 +297,16 @@ void SfxMedium::ResetError()
pImpl->m_pOutStream->ResetError();
}
-
sal_uInt32 SfxMedium::GetLastStorageCreationState()
{
return pImpl->nLastStorageError;
}
-
-void SfxMedium::AddLog( const OUString& aMessage )
-{
- if ( !pImpl->m_xLogRing.is() )
- {
- try
- {
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- pImpl->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) );
- }
- catch( const uno::Exception& )
- {}
- }
-
- if ( pImpl->m_xLogRing.is() )
- pImpl->m_xLogRing->logString( aMessage );
-}
-
-
-void SfxMedium::SetError( sal_uInt32 nError, const OUString& aLogMessage )
+void SfxMedium::SetError(sal_uInt32 nError)
{
pImpl->m_eError = nError;
- if ( pImpl->m_eError != ERRCODE_NONE && !aLogMessage.isEmpty() )
- AddLog( aLogMessage );
}
-
sal_uInt32 SfxMedium::GetErrorCode() const
{
sal_uInt32 lError = pImpl->m_eError;
@@ -343,7 +317,6 @@ sal_uInt32 SfxMedium::GetErrorCode() const
return lError;
}
-
void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
{
GetInitFileDate( true );
@@ -372,7 +345,7 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
{
- SetError( ERRCODE_ABORT, OSL_LOG_PREFIX );
+ SetError(ERRCODE_ABORT);
}
}
catch ( const uno::Exception& )
@@ -760,7 +733,7 @@ void SfxMedium::StorageBackup_Impl()
{
DoInternalBackup_Impl( aOriginalContent );
if( pImpl->m_aBackupURL.isEmpty() )
- SetError( ERRCODE_SFX_CANTCREATEBACKUP, OSL_LOG_PREFIX );
+ SetError(ERRCODE_SFX_CANTCREATEBACKUP);
}
}
@@ -819,7 +792,7 @@ void SfxMedium::SetEncryptionDataToStorage_Impl()
{
SAL_WARN( "sfx.doc", "It must be possible to set a common password for the storage" );
// TODO/LATER: set the error code in case of problem
- // SetError( ERRCODE_IO_GENERAL, OUString( OSL_LOG_PREFIX ) );
+ // SetError(ERRCODE_IO_GENERAL);
}
}
}
@@ -896,7 +869,7 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt
::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
{
- SetError( ERRCODE_ABORT, OSL_LOG_PREFIX );
+ SetError(ERRCODE_ABORT);
}
else if ( uno::Reference< task::XInteractionDisapprove >( xSelected.get(), uno::UNO_QUERY ).is() )
{
@@ -935,7 +908,7 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
}
else
- SetError( ERRCODE_IO_ACCESSDENIED, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_ACCESSDENIED);
}
@@ -1068,7 +1041,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
const SfxBoolItem* pReadOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pImpl->m_pSet, SID_DOC_READONLY, false);
if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) )
- SetError( ERRCODE_IO_ACCESSDENIED, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_ACCESSDENIED);
else
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
}
@@ -1286,7 +1259,7 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
const SfxBoolItem* pReadOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pImpl->m_pSet, SID_DOC_READONLY, false);
if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) )
- SetError( ERRCODE_IO_ACCESSDENIED, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_ACCESSDENIED);
else
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
}
@@ -1638,12 +1611,12 @@ bool SfxMedium::StorageCommit_Impl()
}
if (!GetError())
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
catch ( const uno::Exception& )
{
//TODO/LATER: improve error handling
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
}
}
@@ -1914,7 +1887,7 @@ void SfxMedium::Transfer_Impl()
else
{
SAL_WARN( "sfx.doc", "Illegal Output stream parameter!" );
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
// free the reference
@@ -2448,7 +2421,7 @@ void SfxMedium::GetMedium_Impl()
//TODO/MBA: ErrorHandling - how to transport error from MediaDescriptor
if ( !GetError() && !pImpl->xStream.is() && !pImpl->xInputStream.is() )
- SetError( ERRCODE_IO_ACCESSDENIED, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_ACCESSDENIED);
if ( !GetError() )
{
@@ -3365,7 +3338,7 @@ void SfxMedium::CreateTempFile( bool bReplace )
OUString aTmpURL = pImpl->pTempFile->GetURL();
if ( pImpl->m_aName.isEmpty() || aTmpURL.isEmpty() )
{
- SetError( ERRCODE_IO_CANTWRITE, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_CANTWRITE);
return;
}
@@ -3443,7 +3416,7 @@ void SfxMedium::CreateTempFile( bool bReplace )
if ( !bTransferSuccess )
{
- SetError( ERRCODE_IO_CANTWRITE, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_CANTWRITE);
return;
}
}
@@ -3463,7 +3436,7 @@ void SfxMedium::CreateTempFileNoCopy()
pImpl->m_aName = pImpl->pTempFile->GetFileName();
if ( pImpl->m_aName.isEmpty() )
{
- SetError( ERRCODE_IO_CANTWRITE, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_CANTWRITE);
return;
}
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index cfccb7d7fc41..95978350fb78 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -37,7 +37,6 @@
#include <com/sun/star/document/XScriptInvocationContext.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
#include <com/sun/star/embed/XEmbedPersist.hpp>
-#include <com/sun/star/logging/DocumentIOLogRing.hpp>
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/FinishEngineEvent.hpp>
#include <com/sun/star/script/InterruptReason.hpp>
@@ -210,25 +209,19 @@ void SfxObjectShell::FlushDocInfo()
(delay > 0) || !url.isEmpty() );
}
-
-void SfxObjectShell::SetError( sal_uInt32 lErr, const OUString& aLogMessage )
+void SfxObjectShell::SetError(sal_uInt32 lErr)
{
- if(pImpl->lErr==ERRCODE_NONE)
+ if (pImpl->lErr==ERRCODE_NONE)
{
pImpl->lErr=lErr;
-
- if( lErr != ERRCODE_NONE && !aLogMessage.isEmpty() )
- AddLog( aLogMessage );
}
}
-
sal_uInt32 SfxObjectShell::GetError() const
{
return ERRCODE_TOERROR(GetErrorCode());
}
-
sal_uInt32 SfxObjectShell::GetErrorCode() const
{
sal_uInt32 lError=pImpl->lErr;
@@ -237,19 +230,14 @@ sal_uInt32 SfxObjectShell::GetErrorCode() const
return lError;
}
-
void SfxObjectShell::ResetError()
{
- if( pImpl->lErr != ERRCODE_NONE )
- AddLog( OSL_LOG_PREFIX "Resetting Error." );
-
pImpl->lErr=0;
SfxMedium * pMed = GetMedium();
if( pMed )
pMed->ResetError();
}
-
void SfxObjectShell::EnableSetModified( bool bEnable )
{
SAL_INFO_IF( bEnable == pImpl->m_bEnableSetModified, "sfx", "SFX_PERSIST: EnableSetModified 2x called with the same value" );
@@ -1242,7 +1230,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad()
}
else
{
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
}
else
@@ -1848,89 +1836,6 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor
return bResult;
}
-void SfxObjectShell::AddLog( const OUString& aMessage )
-{
- if ( !pImpl->m_xLogRing.is() )
- {
- try
- {
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- pImpl->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) );
- }
- catch( uno::Exception& )
- {}
- }
-
- if ( pImpl->m_xLogRing.is() )
- pImpl->m_xLogRing->logString( aMessage );
-}
-
-namespace {
-
-void WriteStringInStream( const uno::Reference< io::XOutputStream >& xOutStream, const OUString& aString )
-{
- if ( xOutStream.is() )
- {
- OString aStrLog = OUStringToOString( aString, RTL_TEXTENCODING_UTF8 );
- uno::Sequence< sal_Int8 > aLogData( reinterpret_cast<const sal_Int8*>(aStrLog.getStr()), aStrLog.getLength() );
- xOutStream->writeBytes( aLogData );
-
- aLogData.realloc( 1 );
- aLogData[0] = '\n';
- xOutStream->writeBytes( aLogData );
- }
-}
-
-}
-
-void SfxObjectShell::StoreLog()
-{
- if ( !pImpl->m_xLogRing.is() )
- {
- try
- {
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- pImpl->m_xLogRing.set( logging::DocumentIOLogRing::get(xContext) );
- }
- catch( uno::Exception& )
- {}
- }
-
- if ( pImpl->m_xLogRing.is() )
- {
- OUString aFileURL = ( "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}" );
-
- ::rtl::Bootstrap::expandMacros( aFileURL );
-
- OUString aBuildID = ( "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("setup") ":buildid}" );
-
- ::rtl::Bootstrap::expandMacros( aBuildID );
-
- if ( !aFileURL.isEmpty() )
- {
- aFileURL += "/user/temp/document_io_logring.txt";
- try
- {
- uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- uno::Reference< ucb::XSimpleFileAccess3 > xSimpleFileAccess(ucb::SimpleFileAccess::create(xContext));
- uno::Reference< io::XStream > xStream( xSimpleFileAccess->openFileReadWrite( aFileURL ), uno::UNO_SET_THROW );
- uno::Reference< io::XOutputStream > xOutStream( xStream->getOutputStream(), uno::UNO_SET_THROW );
- uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY_THROW );
- xTruncate->truncate();
-
- if ( !aBuildID.isEmpty() )
- WriteStringInStream( xOutStream, aBuildID );
-
- uno::Sequence< OUString > aLogSeq = pImpl->m_xLogRing->getCollectedLog();
- for ( sal_Int32 nInd = 0; nInd < aLogSeq.getLength(); nInd++ )
- WriteStringInStream( xOutStream, aLogSeq[nInd] );
- }
- catch( uno::Exception& )
- {}
- }
- }
-}
-
bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMessage)
{
if (mbContinueImportOnFilterExceptions == undefined)
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 72eeba95925b..2b1e18853400 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -253,7 +253,7 @@ bool SfxObjectShell::PutURLContentsToVersionStream_Impl(
catch( uno::Exception& )
{
// TODO/LATER: handle the error depending on exception
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
return bResult;
@@ -285,7 +285,7 @@ OUString SfxObjectShell::CreateTempCopyOfStorage_Impl( const uno::Reference< emb
aTempURL.clear();
// TODO/LATER: may need error code setting based on exception
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
}
@@ -359,7 +359,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto
}
catch( uno::Exception& )
{
- const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ const_cast<SfxObjectShell*>( this )->SetError(ERRCODE_IO_GENERAL);
}
SvtSaveOptions::ODFDefaultVersion nDefVersion = SvtSaveOptions::ODFVER_012;
@@ -412,7 +412,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto
}
catch( uno::Exception& )
{
- const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ const_cast<SfxObjectShell*>( this )->SetError(ERRCODE_IO_GENERAL);
}
}
@@ -450,7 +450,7 @@ bool SfxObjectShell::GeneralInit_Impl( const uno::Reference< embed::XStorage >&
{
if ( bTypeMustBeSetAlready )
{
- SetError( ERRCODE_IO_BROKENPACKAGE, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_BROKENPACKAGE);
return false;
}
@@ -662,7 +662,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
{
sal_uInt32 nError = HandleFilter( pMedium, this );
if ( nError != ERRCODE_NONE )
- SetError( nError, OSL_LOG_PREFIX );
+ SetError(nError);
if (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARTPRESENTATION)
pSet->Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, true) );
@@ -702,12 +702,12 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
}
if ( bWarnMediaTypeFallback || !xStorage->getElementNames().getLength() )
- SetError( ERRCODE_IO_BROKENPACKAGE, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_BROKENPACKAGE);
}
catch( uno::Exception& )
{
// TODO/LATER: may need error code setting based on exception
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
// Load
@@ -724,11 +724,11 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
bHasName = true;
}
else
- SetError( ERRCODE_ABORT, OSL_LOG_PREFIX );
+ SetError(ERRCODE_ABORT);
}
}
else
- SetError( pMed->GetLastStorageCreationState(), OSL_LOG_PREFIX );
+ SetError(pMed->GetLastStorageCreationState());
}
else if ( GetError() == ERRCODE_NONE && InitNew(nullptr) )
{
@@ -1010,7 +1010,7 @@ bool SfxObjectShell::DoSave()
}
catch( uno::Exception& )
{
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
DBG_ASSERT( bOk, "The root storage must allow to set common password!\n" );
@@ -1050,7 +1050,7 @@ bool SfxObjectShell::DoSave()
}
catch( uno::Exception& )
{
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
bOk = false;
}
}
@@ -1100,8 +1100,6 @@ bool SfxObjectShell::SaveTo_Impl
UpdateDocInfoForSave();
- AddLog( OSL_LOG_PREFIX "Begin" );
-
ModifyBlocker_Impl aMod(this);
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
@@ -1123,7 +1121,7 @@ bool SfxObjectShell::SaveTo_Impl
// protected libraries exceed the size we can handler
if ( bOwnTarget && !QuerySaveSizeExceededModules_Impl( rMedium.GetInteractionHandler() ) )
{
- SetError( ERRCODE_IO_ABORT, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_ABORT);
return false;
}
@@ -1140,8 +1138,6 @@ bool SfxObjectShell::SaveTo_Impl
|| pImpl->nScriptingSignatureState == SignatureState::NOTVALIDATED
|| pImpl->nScriptingSignatureState == SignatureState::INVALID ) )
{
- AddLog( OSL_LOG_PREFIX "MacroSignaturePreserving" );
-
// the checking of the library modified state iterates over the libraries, should be done only when required
// currently the check is commented out since it is broken, we have to check the signature every time we save
// TODO/LATER: let isAnyContainerModified() work!
@@ -1186,7 +1182,6 @@ bool SfxObjectShell::SaveTo_Impl
&& ::utl::UCBContentHelper::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
{
bStoreToSameLocation = true;
- AddLog( OSL_LOG_PREFIX "Save" );
if ( pMedium->DocNeedsFileDateCheck() )
rMedium.CheckFileDate( pMedium->GetInitFileDate( false ) );
@@ -1194,7 +1189,7 @@ bool SfxObjectShell::SaveTo_Impl
if ( bCopyTo && GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
{
// export to the same location is forbidden
- SetError( ERRCODE_IO_CANTWRITE, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_CANTWRITE);
}
else
{
@@ -1203,11 +1198,10 @@ bool SfxObjectShell::SaveTo_Impl
const bool bDoBackup = SvtSaveOptions().IsBackup();
if ( bDoBackup )
{
- AddLog( OSL_LOG_PREFIX "DoBackup" );
rMedium.DoBackup_Impl();
if ( rMedium.GetError() )
{
- SetError( rMedium.GetErrorCode(), OSL_LOG_PREFIX );
+ SetError(rMedium.GetErrorCode());
rMedium.ResetError();
}
}
@@ -1231,8 +1225,6 @@ bool SfxObjectShell::SaveTo_Impl
// if the last step is failed the stream should stay to be transacted and should be committed on any flush
// so we can forget the stream in any way and the next storage commit will flush it
- AddLog( OSL_LOG_PREFIX "Save: Own to Own" );
-
bNeedsDisconnectionOnFail = DisconnectStorage_Impl(
*pMedium, rMedium );
if ( bNeedsDisconnectionOnFail
@@ -1254,8 +1246,6 @@ bool SfxObjectShell::SaveTo_Impl
// just disconnect the stream from the source format
// so that the target medium can use it
- AddLog( OSL_LOG_PREFIX "Save: Alien to Alien" );
-
pMedium->CloseAndRelease();
rMedium.CloseAndRelease();
rMedium.CreateTempFileNoCopy();
@@ -1267,8 +1257,6 @@ bool SfxObjectShell::SaveTo_Impl
// format is an own one so just disconnect the source
// medium
- AddLog( OSL_LOG_PREFIX "Save: Alien to Own" );
-
pMedium->CloseAndRelease();
rMedium.CloseAndRelease();
rMedium.GetOutputStorage();
@@ -1279,8 +1267,6 @@ bool SfxObjectShell::SaveTo_Impl
// an alien format, just connect the source to temporary
// storage
- AddLog( OSL_LOG_PREFIX "Save: Own to Alien" );
-
bNeedsDisconnectionOnFail = DisconnectStorage_Impl(
*pMedium, rMedium );
if ( bNeedsDisconnectionOnFail
@@ -1301,8 +1287,6 @@ bool SfxObjectShell::SaveTo_Impl
// but for now the framework has to be ready for it
// TODO/LATER: let the medium be prepared for alien formats as well
- AddLog( OSL_LOG_PREFIX "SaveAs/Export" );
-
rMedium.CloseAndRelease();
if ( bStorageBasedTarget )
{
@@ -1317,8 +1301,6 @@ bool SfxObjectShell::SaveTo_Impl
return false;
}
- AddLog( OSL_LOG_PREFIX "Locking" );
-
rMedium.LockOrigFileOnDemand( false, false );
if ( bStorageBasedTarget )
@@ -1366,14 +1348,12 @@ bool SfxObjectShell::SaveTo_Impl
// TODO/LATER: get rid of bOk
if (bOwnTarget && pFilter && !(pFilter->GetFilterFlags() & SfxFilterFlags::STARONEFILTER))
{
- AddLog( OSL_LOG_PREFIX "Storing in own format." );
uno::Reference< embed::XStorage > xMedStorage = rMedium.GetStorage();
if ( !xMedStorage.is() )
{
// no saving without storage, unlock UI and return
Lock_Impl( this, false );
pImpl->bForbidReload = bOldStat;
- AddLog( OSL_LOG_PREFIX "Storing failed, still no error set." );
return false;
}
@@ -1390,7 +1370,7 @@ bool SfxObjectShell::SaveTo_Impl
catch( uno::Exception& )
{
SAL_WARN( "sfx.doc", "Setting of common encryption key failed!" );
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
}
else
@@ -1408,18 +1388,15 @@ bool SfxObjectShell::SaveTo_Impl
if ( xMedStorage == GetStorage() )
{
OSL_ENSURE( !pVersionItem, "This scenario is impossible currently!\n" );
- AddLog( OSL_LOG_PREFIX "Should be impossible." );
// usual save procedure
bOk = Save();
}
else
{
// save to target
- AddLog( OSL_LOG_PREFIX "Save as own format." );
bOk = SaveAsOwnFormat( rMedium );
if ( bOk && pVersionItem )
{
- AddLog( OSL_LOG_PREFIX "pVersionItem != NULL" );
aTmpVersionURL = CreateTempCopyOfStorage_Impl( xMedStorage );
bOk = !aTmpVersionURL.isEmpty();
}
@@ -1432,7 +1409,6 @@ bool SfxObjectShell::SaveTo_Impl
{
// store the thumbnail representation image
// the thumbnail is not stored in case of encrypted document
- AddLog( OSL_LOG_PREFIX "Thumbnail creation." );
if ( !GenerateAndStoreThumbnail( bPasswdProvided,
pFilter->IsOwnTemplateFormat(),
xMedStorage ) )
@@ -1446,7 +1422,6 @@ bool SfxObjectShell::SaveTo_Impl
{
if ( pImpl->bIsSaving || pImpl->bPreserveVersions )
{
- AddLog( OSL_LOG_PREFIX "Preserve versions." );
try
{
Sequence < util::RevisionTag > aVersions = rMedium.GetVersionList();
@@ -1476,7 +1451,6 @@ bool SfxObjectShell::SaveTo_Impl
}
catch( uno::Exception& )
{
- AddLog( OSL_LOG_PREFIX "Preserve versions has failed." );
SAL_WARN( "sfx.doc", "Couldn't copy versions!" );
bOk = false;
// TODO/LATER: a specific error could be set
@@ -1527,7 +1501,6 @@ bool SfxObjectShell::SaveTo_Impl
}
else
{
- AddLog( OSL_LOG_PREFIX "Storing in alien format." );
// it's a "SaveAs" in an alien format
if ( rMedium.GetFilter() && ( rMedium.GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER ) )
bOk = ExportTo( rMedium );
@@ -1556,8 +1529,6 @@ bool SfxObjectShell::SaveTo_Impl
uno::Reference< security::XDocumentDigitalSignatures > xDDSigns;
if ( bOk && bTryToPreserveScriptSignature )
{
- AddLog( OSL_LOG_PREFIX "Copying scripting signature." );
-
// if the scripting code was not changed and it is signed the signature should be preserved
// unfortunately at this point we have only information whether the basic code has changed or not
// so the only way is to check the signature if the basic was not changed
@@ -1640,8 +1611,6 @@ bool SfxObjectShell::SaveTo_Impl
rMedium.CloseZipStorage_Impl();
}
- AddLog( OSL_LOG_PREFIX "Medium commit." );
-
OUString sName( rMedium.GetName( ) );
bOk = rMedium.Commit();
OUString sNewName( rMedium.GetName( ) );
@@ -1651,8 +1620,6 @@ bool SfxObjectShell::SaveTo_Impl
if ( bOk )
{
- AddLog( OSL_LOG_PREFIX "Storing is successful." );
-
// if the target medium is an alien format and the "old" medium was an own format and the "old" medium
// has a name, the object storage must be exchanged, because now we need a new temporary storage
// as object storage
@@ -1672,7 +1639,7 @@ bool SfxObjectShell::SaveTo_Impl
// copy storage of old medium to new temporary storage and take this over
if( !ConnectTmpStorage_Impl( pMedium->GetStorage(), pMedium ) )
{
- AddLog( OSL_LOG_PREFIX "Process after storing has failed." );
+ SAL_WARN( "sfx.doc", "Process after storing has failed." );
bOk = false;
}
}
@@ -1680,7 +1647,7 @@ bool SfxObjectShell::SaveTo_Impl
}
else
{
- AddLog( OSL_LOG_PREFIX "Storing has failed." );
+ SAL_WARN( "sfx.doc", "Storing has failed." );
// in case the document storage was connected to backup temporarely it must be disconnected now
if ( bNeedsDisconnectionOnFail )
@@ -1861,7 +1828,7 @@ bool SfxObjectShell::ConnectTmpStorage_Impl(
if ( !bResult )
{
// TODO/LATER: may need error code setting based on exception
- SetError( ERRCODE_IO_GENERAL, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_GENERAL);
}
}
else if (!GetMedium()->GetFilter()->IsOwnFormat())
@@ -1917,7 +1884,7 @@ bool SfxObjectShell::DoSaveAs( SfxMedium& rMedium )
{
// here only root storages are included, which are stored via temp file
rMedium.CreateTempFileNoCopy();
- SetError(rMedium.GetErrorCode(), OSL_LOG_PREFIX );
+ SetError(rMedium.GetErrorCode());
if ( GetError() )
return false;
@@ -1927,7 +1894,7 @@ bool SfxObjectShell::DoSaveAs( SfxMedium& rMedium )
bool bRet = SaveTo_Impl( rMedium, nullptr );
if ( !bRet )
- SetError(rMedium.GetErrorCode(), OSL_LOG_PREFIX );
+ SetError(rMedium.GetErrorCode());
return bRet;
}
@@ -2281,7 +2248,7 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium,
}
catch (const packages::zip::ZipIOException&)
{
- SetError( ERRCODE_IO_BROKENPACKAGE, "Badness in the underlying package format." );
+ SetError(ERRCODE_IO_BROKENPACKAGE);
}
catch (const lang::WrappedTargetRuntimeException& rWrapped)
{
@@ -2289,7 +2256,7 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium,
if (rWrapped.TargetException >>= e)
{
SetError(*new StringErrorInfo(ERRCODE_SFX_FORMAT_ROWCOL,
- e.Message, ErrorHandlerFlags::ButtonsOk | ErrorHandlerFlags::MessageError ), "");
+ e.Message, ErrorHandlerFlags::ButtonsOk | ErrorHandlerFlags::MessageError ));
}
}
catch (const std::exception& e)
@@ -2297,7 +2264,7 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium,
const char *msg = e.what();
OUString sError(msg, strlen(msg), RTL_TEXTENCODING_ASCII_US);
SetError(*new StringErrorInfo(ERRCODE_SFX_DOLOADFAILED,
- sError, ErrorHandlerFlags::ButtonsOk | ErrorHandlerFlags::MessageError), "");
+ sError, ErrorHandlerFlags::ButtonsOk | ErrorHandlerFlags::MessageError));
}
catch (...)
{
@@ -2513,7 +2480,7 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
pMediumTmp->SetLongName( pRetrMedium->GetLongName() );
if ( pMediumTmp->GetErrorCode() != ERRCODE_NONE )
{
- SetError( pMediumTmp->GetError(), OSL_LOG_PREFIX );
+ SetError(pMediumTmp->GetError());
delete pMediumTmp;
return false;
}
@@ -2539,7 +2506,7 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
pMediumTmp->GetItemSet()->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
}
- SetError(pMediumTmp->GetErrorCode(), OSL_LOG_PREFIX );
+ SetError(pMediumTmp->GetErrorCode());
bool bOpen( false );
bOpen = DoSaveCompleted( pMediumTmp );
@@ -2550,7 +2517,7 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
else
{
// transfer error code from medium to objectshell
- SetError( pMediumTmp->GetError(), OSL_LOG_PREFIX );
+ SetError(pMediumTmp->GetError());
// reconnect to object storage
DoSaveCompleted();
@@ -2573,11 +2540,10 @@ bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet )
{
if ( IsReadOnly() )
{
- SetError( ERRCODE_SFX_DOCUMENTREADONLY, OSL_LOG_PREFIX );
+ SetError(ERRCODE_SFX_DOCUMENTREADONLY);
return false;
}
-
pImpl->bIsSaving = true;
bool bSaved = false;
const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_DOC_SALVAGE, false);
@@ -2611,7 +2577,7 @@ bool SfxObjectShell::CommonSaveAs_Impl(const INetURLObject& aURL, const OUString
{
if( aURL.HasError() )
{
- SetError( ERRCODE_IO_INVALIDPARAMETER, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_INVALIDPARAMETER);
return false;
}
@@ -2633,7 +2599,7 @@ bool SfxObjectShell::CommonSaveAs_Impl(const INetURLObject& aURL, const OUString
if ( pDoc )
{
// Then error message: "already opened"
- SetError(ERRCODE_SFX_ALREADYOPEN, OSL_LOG_PREFIX);
+ SetError(ERRCODE_SFX_ALREADYOPEN);
return false;
}
}
@@ -2649,7 +2615,7 @@ bool SfxObjectShell::CommonSaveAs_Impl(const INetURLObject& aURL, const OUString
|| !pFilter->CanExport()
|| (!bSaveTo && !pFilter->CanImport()) )
{
- SetError( ERRCODE_IO_INVALIDPARAMETER, OSL_LOG_PREFIX );
+ SetError(ERRCODE_IO_INVALIDPARAMETER);
return false;
}
@@ -2671,7 +2637,7 @@ bool SfxObjectShell::CommonSaveAs_Impl(const INetURLObject& aURL, const OUString
if ( aURL == aActName && aURL != INetURLObject( OUString("private:stream") )
&& IsReadOnly() )
{
- SetError(ERRCODE_SFX_DOCUMENTREADONLY, OSL_LOG_PREFIX);
+ SetError(ERRCODE_SFX_DOCUMENTREADONLY);
return false;
}
@@ -2792,7 +2758,7 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
if ( pNewFile->GetErrorCode() != ERRCODE_NONE )
{
// creating temporary file failed ( f.e. floppy disk not inserted! )
- SetError( pNewFile->GetError(), OSL_LOG_PREFIX );
+ SetError(pNewFile->GetError());
delete pNewFile;
return false;
}
@@ -2813,7 +2779,7 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
if ( !pNewFile->GetErrorCode() && SaveTo_Impl( *pNewFile, nullptr ) )
{
// transfer a possible error from the medium to the document
- SetError( pNewFile->GetErrorCode(), OSL_LOG_PREFIX );
+ SetError(pNewFile->GetErrorCode());
// notify the document that saving was done successfully
if ( !bCopyTo )
@@ -2834,7 +2800,7 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
// and the DoSaveCompleted call should not be able to fail in general
DBG_ASSERT( !bCopyTo, "Error while reconnecting to medium, can't be handled!");
- SetError( pNewFile->GetErrorCode(), OSL_LOG_PREFIX );
+ SetError(pNewFile->GetErrorCode());
if ( !bCopyTo )
{
@@ -2853,7 +2819,7 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
}
else
{
- SetError( pNewFile->GetErrorCode(), OSL_LOG_PREFIX );
+ SetError(pNewFile->GetErrorCode());
// reconnect to the old storage
DoSaveCompleted();
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 36b6be463497..bd61032c379c 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1470,7 +1470,6 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue >
if ( m_pData->m_pObjectShell.is() )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "storeSelf" );
SfxSaveGuard aSaveGuard(this, m_pData);
bool bCheckIn = false;
@@ -1484,9 +1483,6 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue >
&& aSeqArgs[nInd].Name != "FailOnWarning"
&& aSeqArgs[nInd].Name != "CheckIn" )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "unexpected parameter for storeSelf, might be no problem if SaveAs is executed." );
- m_pData->m_pObjectShell->StoreLog();
-
OUString aMessage( "Unexpected MediaDescriptor parameter: " );
aMessage += aSeqArgs[nInd].Name;
throw lang::IllegalArgumentException( aMessage, Reference< XInterface >(), 1 );
@@ -1558,16 +1554,12 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue >
if ( bRet )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "successful saving." );
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDocDone, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCDONE), m_pData->m_pObjectShell.get() ) );
}
else
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "Storing failed!" );
- m_pData->m_pObjectShell->StoreLog();
-
// write the contents of the logger to the file
SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDocFailed, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell.get() ) );
@@ -1599,7 +1591,6 @@ void SAL_CALL SfxBaseModel::storeAsURL( const OUString& rURL
if ( m_pData->m_pObjectShell.is() )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "storeAsURL" );
SfxSaveGuard aSaveGuard(this, m_pData);
impl_store( rURL, rArgs, false );
@@ -1639,7 +1630,6 @@ void SAL_CALL SfxBaseModel::storeToURL( const OUString& rURL
if ( m_pData->m_pObjectShell.is() )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "storeToURL" );
SfxSaveGuard aSaveGuard(this, m_pData);
try {
impl_store(rURL, rArgs, true);
@@ -2901,9 +2891,6 @@ void SfxBaseModel::impl_store( const OUString& sURL
// TODO/LATER: need a new interaction for this case
if ( m_pData->m_pObjectShell->IsDocShared() )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "Can't store shared document!" );
- m_pData->m_pObjectShell->StoreLog();
-
uno::Sequence< beans::NamedValue > aNewEncryptionData = aArgHash.getUnpackedValueOrDefault("EncryptionData", uno::Sequence< beans::NamedValue >() );
if ( !aNewEncryptionData.getLength() )
{
@@ -2946,9 +2933,6 @@ void SfxBaseModel::impl_store( const OUString& sURL
if ( pCopyStreamItem && pCopyStreamItem->GetValue() && !bSaveTo )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "Misuse of CopyStreamIfPossible!" );
- m_pData->m_pObjectShell->StoreLog();
-
throw frame::IllegalArgumentIOException(
"CopyStreamIfPossible parameter is not acceptable for storeAsURL() call!" );
}
@@ -3005,7 +2989,7 @@ void SfxBaseModel::impl_store( const OUString& sURL
sal_uInt32 nErrCode = m_pData->m_pObjectShell->GetErrorCode();
if ( !bRet && !nErrCode )
{
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "Storing has failed, no error is set!" );
+ SAL_WARN("sfx.doc", "Storing has failed, no error is set!");
nErrCode = ERRCODE_IO_CANTWRITE;
}
m_pData->m_pObjectShell->ResetError();
@@ -3026,7 +3010,6 @@ void SfxBaseModel::impl_store( const OUString& sURL
}
}
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "Storing succeeded!" );
if ( !bSaveTo )
{
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
@@ -3044,10 +3027,6 @@ void SfxBaseModel::impl_store( const OUString& sURL
}
else
{
- // let the logring be stored to the related file
- m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "Storing failed!" );
- m_pData->m_pObjectShell->StoreLog();
-
m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash );
m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo );
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index a9348c1cfbbd..ac2de9a9e3dc 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -23,7 +23,6 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ref.hxx>
-#include <com/sun/star/logging/XSimpleLogRing.hpp>
#include <tools/datetime.hxx>
#include <unotools/securityoptions.hxx>
@@ -128,8 +127,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
OUString m_aSharedFileURL;
- css::uno::Reference< css::logging::XSimpleLogRing > m_xLogRing;
-
bool m_bIncomplEncrWarnShown;
// TODO/LATER: m_aModifyPasswordInfo should completely replace m_nModifyPasswordHash in future