summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-04-15 13:32:23 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-04-15 13:32:23 +0000
commit7d5c839ebe7f6f6c9eac39e3da6b4e199d6f704d (patch)
treeb6e538fb8106ba2f14d3f273db624cf8e5a9389f /framework
parent62ee5e1a752033344c172ad2380a5f1e2492330a (diff)
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
Diffstat (limited to 'framework')
-rw-r--r--framework/source/services/autorecovery.cxx31
1 files changed, 30 insertions, 1 deletions
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 <osl/file.hxx>
#include <unotools/bootstrap.hxx>
#include <unotools/configmgr.hxx>
+#include <svtools/documentlockfile.hxx>
+
#include <tools/urlobj.hxx>
//_______________________________________________
@@ -2045,6 +2047,30 @@ void AutoRecovery::implts_prepareSessionShutdown()
}
//-----------------------------------------------
+/* 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:
#i64599#
@@ -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;