summaryrefslogtreecommitdiff
path: root/framework/source/services/autorecovery.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2006-05-08 13:43:52 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2006-05-08 13:43:52 +0000
commit6a38af1ed65824ea0b47f2625d9f4a162cf5afaf (patch)
tree6a629bead1c82f445231c181375e06185c5b1a36 /framework/source/services/autorecovery.cxx
parent96dcdde3aa9ada7f8edfd11f4ad5cd47f22c8436 (diff)
INTEGRATION: CWS mbapp3 (1.16.58); FILE MERGED
2006/04/26 07:09:37 as 1.16.58.1: #i64599# use MediaDescriptor property NoAutoSave to ignore documents inside recovery
Diffstat (limited to 'framework/source/services/autorecovery.cxx')
-rw-r--r--framework/source/services/autorecovery.cxx45
1 files changed, 42 insertions, 3 deletions
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 59d7f54d6505..21a0abd6cf7f 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: autorecovery.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: rt $ $Date: 2006-02-07 10:24:20 $
+ * last change: $Author: hr $ $Date: 2006-05-08 14:43:52 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -1733,6 +1733,14 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame
aCacheLock.unlock();
+ ::comphelper::MediaDescriptor lDescriptor(xDocument->getArgs());
+
+ // check if this document must be ignored for recovery !
+ // Some use cases dont wish support for AutoSave/Recovery ... as e.g. OLE-Server / ActiveX Control etcpp.
+ sal_Bool bNoAutoSave = lDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_NOAUTOSAVE(), (sal_Bool)(sal_False));
+ if (bNoAutoSave)
+ return;
+
// Check if doc is well known on the desktop. Otherwhise ignore it!
// Other frames mostly are used from external programs - e.g. the bean ...
css::uno::Reference< css::frame::XController > xController = xDocument->getCurrentController();
@@ -1778,7 +1786,6 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame
// and save an information about the real used filter by this document.
// We save this document with DefaultFilter ... and load it with the RealFilter.
implts_specifyDefaultFilterAndExtension(aNew);
- ::comphelper::MediaDescriptor lDescriptor(xDocument->getArgs());
aNew.RealFilter = lDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_FILTERNAME() , ::rtl::OUString());
// Further we must know, if this document base on a template.
@@ -2099,6 +2106,34 @@ void AutoRecovery::implts_prepareSessionShutdown()
}
//-----------------------------------------------
+/* TODO WORKAROUND:
+
+ #i64599#
+
+ Normaly the MediaDescriptor argument NoAutoSave indicates,
+ that a document must be ignored for AutoSave and Recovery.
+ But sometimes XModel->getArgs() does not contained this information
+ if implts_registerDocument() was called.
+ So we have to check a second time, if this property is set ....
+ Best place doing so is to check it immeditaly before saving
+ and supressingd saving the document then.
+ Of course removing the corresponding cache entry isnt an option.
+ Because it would disturb iteration over the cache !
+ So we ignore such documents only ...
+ Hopefully next time they are not inserted in our cache.
+*/
+sal_Bool lc_checkIfSaveForbiddenByArguments(AutoRecovery::TDocumentInfo& rInfo)
+{
+ if (! rInfo.Document.is())
+ return sal_True;
+
+ ::comphelper::MediaDescriptor lDescriptor(rInfo.Document->getArgs());
+ sal_Bool bNoAutoSave = lDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_NOAUTOSAVE(), (sal_Bool)(sal_False));
+
+ return bNoAutoSave;
+}
+
+//-----------------------------------------------
AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAllowUserIdleLoop,
const DispatchParams* pParams )
{
@@ -2152,6 +2187,10 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl
{
AutoRecovery::TDocumentInfo aInfo = *pIt;
+ // WORKAROUND ... see comment of this method
+ if (lc_checkIfSaveForbiddenByArguments(aInfo))
+ continue;
+
// already auto saved during this session :-)
// This state must be reseted for all documents
// if timer is started with normnal AutoSaveTimerIntervall!