summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorKrisztian Pinter <pin.terminator@gmail.com>2013-02-26 16:43:48 +0100
committerJan Holesovsky <kendy@suse.cz>2013-03-07 10:11:47 +0100
commit895898596c72fd14db2abec3aeaab74d583769e5 (patch)
tree61587b3cb2638b20931ede8114b6fc3ae5a32f87 /framework
parent98645ae6d4bc7b85730a0a9f00bd2de86dd09be9 (diff)
WIP: fdo#47011 autosave feature
Change-Id: Ib2cbcc33e6188c60c183b5f47e9ae9c9d4c91b95
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/services/autorecovery.hxx3
-rw-r--r--framework/source/services/autorecovery.cxx20
2 files changed, 22 insertions, 1 deletions
diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx
index c07ee9e2ec47..5632da9a39f9 100644
--- a/framework/inc/services/autorecovery.hxx
+++ b/framework/inc/services/autorecovery.hxx
@@ -213,7 +213,8 @@ class AutoRecovery : public css::lang::XTypeProvider
E_SESSION_RESTORE = 128,
E_DISABLE_AUTORECOVERY = 256,
E_SET_AUTOSAVE_STATE = 512,
- E_SESSION_QUIET_QUIT = 1024
+ E_SESSION_QUIET_QUIT = 1024,
+ E_USER_AUTO_SAVE = 2048
};
//---------------------------------------
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index f5e464f4986b..d0f1fab43739 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -21,6 +21,8 @@
#include "services/autorecovery.hxx"
#include <loadenv/loadenv.hxx>
+#include <sfx2/sfxbasemodel.hxx> //?
+
#include <loadenv/targethelper.hxx>
#include <pattern/frame.hxx>
#include <threadhelp/readguard.hxx>
@@ -124,6 +126,8 @@ static const char CFG_ENTRY_SESSIONDATA[] = "SessionData";
static const char CFG_ENTRY_AUTOSAVE_ENABLED[] = "AutoSave/Enabled";
static const char CFG_ENTRY_AUTOSAVE_TIMEINTERVALL[] = "AutoSave/TimeIntervall"; //sic!
+static const char CFG_ENTRY_USERAUTOSAVE_ENABLED[] = "AutoSave/UserAutoSaveEnabled";
+
static const char CFG_PATH_AUTOSAVE[] = "AutoSave";
static const char CFG_ENTRY_MINSPACE_DOCSAVE[] = "MinSpaceDocSave";
static const char CFG_ENTRY_MINSPACE_CONFIGSAVE[] = "MinSpaceConfigSave";
@@ -977,12 +981,21 @@ void AutoRecovery::implts_readAutoSaveConfig()
sal_Bool bEnabled = sal_False;
xCommonRegistry->getByHierarchicalName(rtl::OUString(CFG_ENTRY_AUTOSAVE_ENABLED)) >>= bEnabled;
+ // UserAutoSave [bool]
+ sal_Bool bUserEnabled = sal_False;
+ xCommonRegistry->getByHierarchicalName(rtl::OUString(CFG_ENTRY_USERAUTOSAVE_ENABLED)) >>= bUserEnabled;
+
// SAFE -> ------------------------------
WriteGuard aWriteLock(m_aLock);
if (bEnabled)
{
m_eJob |= AutoRecovery::E_AUTO_SAVE;
m_eTimerType = AutoRecovery::E_NORMAL_AUTOSAVE_INTERVALL;
+
+ if (bUserEnabled)
+ m_eJob |= AutoRecovery::E_USER_AUTO_SAVE;
+ else
+ m_eJob &= ~AutoRecovery::E_USER_AUTO_SAVE;
}
else
{
@@ -2328,6 +2341,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString&
// Mark AutoSave state as "INCOMPLETE" if it failed.
// Because the last temp file is to old and does not include all changes.
Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY_THROW);
+ Reference< XStorable > xDocSave(rInfo.Document, css::uno::UNO_QUERY_THROW);
// safe the state about "trying to save"
// ... we need it for recovery if e.g. a crash occures inside next line!
@@ -2342,6 +2356,12 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString&
{
xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() );
+ // if userautosave is enabled, also save to the original file
+ if((m_eJob & AutoRecovery::E_USER_AUTO_SAVE) == AutoRecovery::E_USER_AUTO_SAVE)
+ {
+ xDocSave->store();
+ }
+
#ifdef TRIGGER_FULL_DISC_CHECK
throw css::uno::Exception();
#else // TRIGGER_FULL_DISC_CHECK