From 7d5c839ebe7f6f6c9eac39e3da6b4e199d6f704d Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 15 Apr 2008 13:32:23 +0000 Subject: INTEGRATION: CWS calcshare2 (1.25.18); FILE MERGED 2008/03/29 18:40:17 mav 1.25.18.1: #i86677# fix handling of lock files after the crash --- framework/source/services/autorecovery.cxx | 31 +++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'framework') diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 3e2342a479a5..b4e86820572d 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -8,7 +8,7 @@ * * $RCSfile: autorecovery.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * * This file is part of OpenOffice.org. * @@ -91,6 +91,8 @@ #include #include #include +#include + #include //_______________________________________________ @@ -2044,6 +2046,30 @@ void AutoRecovery::implts_prepareSessionShutdown() // <- SAFE } +//----------------------------------------------- +/* Currently the document is not closed in case of crash, + so the lock file must be removed explicitly +*/ +void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo) +{ + if ( rInfo.Document.is() ) + { + try + { + css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW); + ::rtl::OUString aURL = xStore->getLocation(); + if ( aURL.getLength() ) + { + ::svt::DocumentLockFile aLockFile( aURL ); + aLockFile.RemoveFile(); + } + } + catch( const css::uno::Exception& ) + {} + } +} + + //----------------------------------------------- /* TODO WORKAROUND: @@ -2126,6 +2152,9 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl { AutoRecovery::TDocumentInfo aInfo = *pIt; + // WORKAROUND... Since the documents are not closed the lock file must be removed explicitly + lc_removeLockFile( aInfo ); + // WORKAROUND ... see comment of this method if (lc_checkIfSaveForbiddenByArguments(aInfo)) continue; -- cgit v1.2.3