[Libreoffice-commits] core.git: cui/source framework/inc framework/source officecfg/registry sfx2/inc sfx2/source shell/source unotools/inc unotools/source
Krisztian Pinter
pin.terminator at gmail.com
Thu Mar 7 01:12:10 PST 2013
cui/source/options/optsave.cxx | 31 +++++-
cui/source/options/optsave.hrc | 1
cui/source/options/optsave.hxx | 1
cui/source/options/optsave.src | 35 ++++--
framework/inc/services/autorecovery.hxx | 3
framework/source/services/autorecovery.cxx | 20 +++
officecfg/registry/data/org/openoffice/Office/Recovery.xcu | 4
officecfg/registry/schema/org/openoffice/Office/Recovery.xcs | 6 +
sfx2/inc/sfx2/sfxsids.hrc | 1
sfx2/source/appl/appcfg.cxx | 15 ++
shell/source/backends/gconfbe/gconfaccess.cxx | 21 ++++
shell/source/backends/gconfbe/gconfaccess.hxx | 1
unotools/inc/unotools/saveopt.hxx | 6 -
unotools/source/config/saveopt.cxx | 56 ++++++++++-
14 files changed, 181 insertions(+), 20 deletions(-)
New commits:
commit 895898596c72fd14db2abec3aeaab74d583769e5
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date: Tue Feb 26 16:43:48 2013 +0100
WIP: fdo#47011 autosave feature
Change-Id: Ib2cbcc33e6188c60c183b5f47e9ae9c9d4c91b95
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index d977cac..efced8d 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -55,8 +55,9 @@ using namespace comphelper;
#define CFG_PAGE_AND_GROUP OUString("General"), OUString("LoadSave")
// !! you have to update these index, if you changed the list of the child windows !!
-#define WININDEX_AUTOSAVE ((sal_uInt16)6)
-#define WININDEX_SAVEURL_RELFSYS ((sal_uInt16)9)
+#define WININDEX_AUTOSAVE ((sal_uInt16) 6)
+#define WININDEX_USERAUTOSAVE ((sal_uInt16) 9)
+#define WININDEX_SAVEURL_RELFSYS ((sal_uInt16)10)
// ----------------------------------------------------------------------
@@ -100,6 +101,7 @@ SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) :
aAutoSaveCB ( this, CUI_RES( BTN_AUTOSAVE ) ),
aAutoSaveEdit ( this, CUI_RES( ED_AUTOSAVE ) ),
aMinuteFT ( this, CUI_RES( FT_MINUTE ) ),
+ aUserAutoSaveCB ( this, CUI_RES( BTN_USERAUTOSAVE ) ),
aRelativeFsysCB ( this, CUI_RES( BTN_RELATIVE_FSYS ) ),
aRelativeInetCB ( this, CUI_RES( BTN_RELATIVE_INET ) ),
@@ -239,12 +241,23 @@ void SfxSaveTabPage::DetectHiddenControls()
aAutoSaveEdit.Hide();
aMinuteFT.Hide();
// the other controls have to move upwards the height of checkbox + space
- nDelta += aRelativeFsysCB.GetPosPixel().Y() - aAutoSaveCB.GetPosPixel().Y();
+ nDelta += aUserAutoSaveCB.GetPosPixel().Y() - aAutoSaveCB.GetPosPixel().Y();
}
else if ( nDelta > 0 )
// the "AutoSave" controls have to move upwards too
nWinIndex = WININDEX_AUTOSAVE;
+ if ( aOptionsDlgOpt.IsOptionHidden( "UserAutoSave", CFG_PAGE_AND_GROUP ) )
+ {
+ // hide controls of "UserAutoSave"
+ aUserAutoSaveCB.Hide();
+ // the other controls have to move upwards the height of checkbox + space
+ nDelta += aRelativeFsysCB.GetPosPixel().Y() - aUserAutoSaveCB.GetPosPixel().Y();
+ }
+ else if ( nDelta > 0 )
+ // the "UserAutoSave" controls have to move upwards too
+ nWinIndex = WININDEX_USERAUTOSAVE;
+
if ( nDelta > 0 )
{
sal_uInt16 i, nChildCount = GetChildCount();
@@ -315,6 +328,13 @@ sal_Bool SfxSaveTabPage::FillItemSet( SfxItemSet& rSet )
(sal_uInt16)aAutoSaveEdit.GetValue() ) );
bModified |= sal_True;
}
+
+ if ( aUserAutoSaveCB.IsChecked() != aUserAutoSaveCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_USERAUTOSAVE ),
+ aUserAutoSaveCB.IsChecked() ) );
+ bModified |= sal_True;
+ }
// save relatively
if ( aRelativeFsysCB.IsChecked() != aRelativeFsysCB.GetSavedValue() )
{
@@ -489,6 +509,7 @@ void SfxSaveTabPage::Reset( const SfxItemSet& )
aBackupFI.Show(bBackupRO);
aAutoSaveCB.Check(aSaveOpt.IsAutoSave());
+ aUserAutoSaveCB.Check(aSaveOpt.IsUserAutoSave());
aWarnAlienFormatCB.Check(aSaveOpt.IsWarnAlienFormat());
aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT));
@@ -515,6 +536,8 @@ void SfxSaveTabPage::Reset( const SfxItemSet& )
aAutoSaveCB.SaveValue();
aAutoSaveEdit.SaveValue();
+ aUserAutoSaveCB.SaveValue();
+
aRelativeFsysCB.SaveValue();
aRelativeInetCB.SaveValue();
aODFVersionLB.SaveValue();
@@ -530,11 +553,13 @@ IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
{
aAutoSaveEdit.Enable();
aMinuteFT.Enable();
+ aUserAutoSaveCB.Enable();
}
else
{
aAutoSaveEdit.Disable();
aMinuteFT.Disable();
+ aUserAutoSaveCB.Disable();
}
}
return 0;
diff --git a/cui/source/options/optsave.hrc b/cui/source/options/optsave.hrc
index 16891bc..36a95b6 100644
--- a/cui/source/options/optsave.hrc
+++ b/cui/source/options/optsave.hrc
@@ -29,6 +29,7 @@
#define BTN_AUTOSAVE 16
#define ED_AUTOSAVE 17
#define FT_MINUTE 18
+#define BTN_USERAUTOSAVE 19
#define BTN_NOPRETTYPRINTING 20
#define FI_BACKUP 21
#define BTN_WARNALIENFORMAT 22
diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx
index 4ab3082..00cb63f 100644
--- a/cui/source/options/optsave.hxx
+++ b/cui/source/options/optsave.hxx
@@ -54,6 +54,7 @@ private:
CheckBox aAutoSaveCB;
NumericField aAutoSaveEdit;
FixedText aMinuteFT;
+ CheckBox aUserAutoSaveCB;
CheckBox aRelativeFsysCB;
CheckBox aRelativeInetCB;
diff --git a/cui/source/options/optsave.src b/cui/source/options/optsave.src
index 6dc878e..3d3d8f4 100644
--- a/cui/source/options/optsave.src
+++ b/cui/source/options/optsave.src
@@ -110,36 +110,43 @@ TabPage RID_SFXPAGE_SAVE
Size = MAP_APPFONT ( 65 , 8 ) ;
Text [ en-US ] = "Minutes" ;
};
+ CheckBox BTN_USERAUTOSAVE
+ {
+ HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_USERAUTOSAVE"; //? FIX ME
+ Pos = MAP_APPFONT ( 21 , 74 ) ;
+ Size = MAP_APPFONT ( 163 , 10 ) ;
+ Text [ en-US ] = "Automatically save the document too" ;
+ };
CheckBox BTN_RELATIVE_FSYS
{
HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_RELATIVE_FSYS";
- Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Pos = MAP_APPFONT ( 12 , 85 ) ;
Size = MAP_APPFONT ( 236 , 10 ) ;
Text [ en-US ] = "Save URLs relative to file system" ;
};
CheckBox BTN_RELATIVE_INET
{
HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_RELATIVE_INET";
- Pos = MAP_APPFONT ( 12 , 85 ) ;
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
Size = MAP_APPFONT ( 248 , 10 ) ;
Text [ en-US ] = "Save URLs relative to internet" ;
};
FixedLine FL_FILTER
{
- Pos = MAP_APPFONT ( 6 , 97 ) ;
+ Pos = MAP_APPFONT ( 6 , 108 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
Text [ en-US ] = "Default file format and ODF settings" ;
};
FixedText FT_ODF_VERSION
{
- Pos = MAP_APPFONT ( 12 , 107 ) ;
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
Size = MAP_APPFONT ( 121 , 8 ) ;
Text [ en-US ] = "ODF format version" ;
};
ListBox LB_ODF_VERSION
{
HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_ODF_VERSION";
- Pos = MAP_APPFONT ( 136 , 105 ) ;
+ Pos = MAP_APPFONT ( 136 , 116 ) ;
Size = MAP_APPFONT ( 108 , 58 ) ;
Border = TRUE;
DropDown = TRUE;
@@ -154,33 +161,33 @@ TabPage RID_SFXPAGE_SAVE
CheckBox BTN_NOPRETTYPRINTING
{
HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_NOPRETTYPRINTING";
- Pos = MAP_APPFONT ( 12 , 120 ) ;
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
Size = MAP_APPFONT ( 248 , 10 ) ;
Text [ en-US ] = "Size optimization for ODF format" ;
};
CheckBox BTN_WARNALIENFORMAT
{
HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_WARNALIENFORMAT";
- Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Pos = MAP_APPFONT ( 12 , 142 ) ;
Size = MAP_APPFONT ( 248 , 10 ) ;
Text [ en-US ] = "Warn when not saving in ODF or default format" ;
};
FixedText FT_APP
{
- Pos = MAP_APPFONT ( 12 , 142 ) ;
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
Size = MAP_APPFONT ( 120 , 8 ) ;
Text [ en-US ] = "D~ocument type";
};
FixedText FT_FILTER
{
- Pos = MAP_APPFONT ( 136 , 142 ) ;
+ Pos = MAP_APPFONT ( 136 , 153 ) ;
Size = MAP_APPFONT ( 120 , 8 ) ;
Text [ en-US ] = "Always sa~ve as";
};
ListBox LB_APP
{
HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_APP";
- Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Pos = MAP_APPFONT ( 12 , 164 ) ;
Size = MAP_APPFONT ( 108 , 58 ) ;
Border = TRUE;
DropDown = TRUE;
@@ -197,14 +204,14 @@ TabPage RID_SFXPAGE_SAVE
};
FixedImage FI_FILTER
{
- Pos = MAP_APPFONT ( 129, 154 ) ;
+ Pos = MAP_APPFONT ( 129, 165 ) ;
Size = MAP_APPFONT ( 6 , 6 ) ;
Hide = TRUE;
};
ListBox LB_FILTER
{
HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_FILTER";
- Pos = MAP_APPFONT ( 136 , 153 ) ;
+ Pos = MAP_APPFONT ( 136 , 164 ) ;
Size = MAP_APPFONT ( 108 , 58 ) ;
Border = TRUE;
Sort = TRUE;
@@ -212,13 +219,13 @@ TabPage RID_SFXPAGE_SAVE
};
FixedImage FI_ODF_WARNING
{
- Pos = MAP_APPFONT ( 12, 169 ) ;
+ Pos = MAP_APPFONT ( 12, 170 ) ;
Size = MAP_APPFONT ( 8 , 8 ) ;
Hide = TRUE;
};
FixedText FT_WARN
{
- Pos = MAP_APPFONT ( 23 , 169 ) ;
+ Pos = MAP_APPFONT ( 23 , 170 ) ;
Size = MAP_APPFONT ( 239 , 8 ) ;
Hide = TRUE;
Text [ en-US ] = "Not using ODF 1.2 Extended may cause information to be lost.";
diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx
index c07ee9e..5632da9 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 f5e464f..d0f1fab 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
diff --git a/officecfg/registry/data/org/openoffice/Office/Recovery.xcu b/officecfg/registry/data/org/openoffice/Office/Recovery.xcu
index e5fbed4..92cbff7 100644
--- a/officecfg/registry/data/org/openoffice/Office/Recovery.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Recovery.xcu
@@ -25,6 +25,10 @@
<value oor:external=
"com.sun.star.configuration.backend.GconfBackend AutoSaveEnabled"/>
</prop>
+ <prop oor:name="UserAutoSaveEnabled">
+ <value oor:external=
+ "com.sun.star.configuration.backend.GconfBackend UserAutoSaveEnabled"/>
+ </prop>
<prop oor:name="TimeIntervall">
<value oor:external=
"com.sun.star.configuration.backend.GconfBackend AutoSaveTimeIntervall"/>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
index 19203f0..a44e611 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
@@ -131,6 +131,12 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="UserAutoSaveEnabled" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc> </desc>
+ </info>
+ <value>true</value>
+ </prop>
<prop oor:name="TimeIntervall" oor:type="xs:int" oor:nillable="false">
<info>
<desc> </desc>
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index d379d9f..0c21d0f 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -513,6 +513,7 @@
#define SID_ATTR_BACKUP (SID_OPTIONS_START + 1)
#define SID_ATTR_AUTOSAVE (SID_OPTIONS_START + 2)
#define SID_ATTR_AUTOSAVEPROMPT (SID_OPTIONS_START + 3)
+#define SID_ATTR_USERAUTOSAVE (SID_OPTIONS_START + 4)
#define SID_ATTR_AUTOSAVEMINUTE (SID_OPTIONS_START + 5)
#define SID_ATTR_WORKINGSET (SID_OPTIONS_START + 13)
#define SID_ATTR_UNDO_COUNT (SID_OPTIONS_START + 16)
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 11441cd..061f697 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -226,6 +226,14 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet )
bRet = sal_False;
}
break;
+ case SID_ATTR_USERAUTOSAVE :
+ {
+ bRet = sal_True;
+ if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_USERAUTOSAVE))
+ if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_USERAUTOSAVE ), aSaveOptions.IsUserAutoSave())))
+ bRet = sal_False;
+ }
+ break;
case SID_ATTR_DOCINFO :
{
bRet = sal_True;
@@ -582,6 +590,13 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
aSaveOptions.SetAutoSaveTime(((const SfxUInt16Item *)pItem)->GetValue());
}
+ // UserAutoSave
+ if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_USERAUTOSAVE), sal_True, &pItem))
+ {
+ DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
+ aSaveOptions.SetUserAutoSave( ( (const SfxBoolItem*)pItem )->GetValue() );
+ }
+
// DocInfo
if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_DOCINFO), sal_True, &pItem))
{
diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx
index 4705013..71276da 100644
--- a/shell/source/backends/gconfbe/gconfaccess.cxx
+++ b/shell/source/backends/gconfbe/gconfaccess.cxx
@@ -34,6 +34,7 @@
#define GCONF_PROXY_MODE_KEY "/system/proxy/mode"
#define GCONF_AUTO_SAVE_KEY "/apps/openoffice/auto_save"
+#define GCONF_USER_AUTO_SAVE_KEY "/apps/openoffice/user_auto_save"
namespace gconfaccess {
@@ -433,6 +434,18 @@ sal_Bool SAL_CALL isDependencySatisfied( GConfClient* pClient, const Configurati
}
}
break;
+ case SETTING_USER_AUTO_SAVE:
+ {
+ GConfValue* pGconfValue = gconf_client_get( pClient, GCONF_USER_AUTO_SAVE_KEY, NULL );
+
+ if( ( pGconfValue != NULL ) )
+ {
+ bool bOk = gconf_value_get_bool( pGconfValue );
+ gconf_value_free( pGconfValue );
+ if (bOk) return sal_True;
+ }
+ }
+ break;
#endif // ENABLE_LOCKDOWN
default:
@@ -599,6 +612,14 @@ ConfigurationValue const ConfigurationValues[] =
},
{
+ SETTING_USER_AUTO_SAVE,
+ GCONF_USER_AUTO_SAVE_KEY,
+ RTL_CONSTASCII_STRINGPARAM("UserAutoSaveEnabled"),
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
SETTING_AUTO_SAVE_INTERVAL,
"/apps/openoffice/auto_save_interval",
RTL_CONSTASCII_STRINGPARAM("AutoSaveTimeIntervall"),
diff --git a/shell/source/backends/gconfbe/gconfaccess.hxx b/shell/source/backends/gconfbe/gconfaccess.hxx
index 98ce947..7f0a52a 100644
--- a/shell/source/backends/gconfbe/gconfaccess.hxx
+++ b/shell/source/backends/gconfbe/gconfaccess.hxx
@@ -80,6 +80,7 @@ enum ConfigurationSetting
SETTING_CREATE_BACKUP,
SETTING_WARN_ALIEN_FORMAT,
SETTING_AUTO_SAVE,
+ SETTING_USER_AUTO_SAVE,
SETTING_AUTO_SAVE_INTERVAL,
SETTING_WRITER_DEFAULT_DOC_FORMAT,
SETTING_IMPRESS_DEFAULT_DOC_FORMAT,
diff --git a/unotools/inc/unotools/saveopt.hxx b/unotools/inc/unotools/saveopt.hxx
index 349b5e6..771c721 100644
--- a/unotools/inc/unotools/saveopt.hxx
+++ b/unotools/inc/unotools/saveopt.hxx
@@ -47,7 +47,8 @@ public:
E_LOADDOCPRINTER,
E_ODFDEFAULTVERSION,
E_USESHA1INODF12,
- E_USEBLOWFISHINODF12
+ E_USEBLOWFISHINODF12,
+ E_USERAUTOSAVE,
};
// keep enum values sorted that a less or greater compare maps to older and newer versions!
@@ -81,6 +82,9 @@ public:
void SetAutoSavePrompt( sal_Bool b );
sal_Bool IsAutoSavePrompt() const;
+ void SetUserAutoSave( sal_Bool b );
+ sal_Bool IsUserAutoSave() const;
+
void SetDocInfoSave(sal_Bool b);
sal_Bool IsDocInfoSave() const;
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index a6e27a6..452fcca 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -57,6 +57,7 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
bBackup,
bAutoSave,
bAutoSavePrompt,
+ bUserAutoSave,
bDocInfSave,
bSaveWorkingSet,
bSaveDocView,
@@ -76,6 +77,7 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
bROBackup,
bROAutoSave,
bROAutoSavePrompt,
+ bROUserAutoSave,
bRODocInfSave,
bROSaveWorkingSet,
bROSaveDocView,
@@ -101,6 +103,7 @@ public:
sal_Bool IsBackup() const { return bBackup; }
sal_Bool IsAutoSave() const { return bAutoSave; }
sal_Bool IsAutoSavePrompt() const { return bAutoSavePrompt; }
+ sal_Bool IsUserAutoSave() const { return bUserAutoSave; }
sal_Bool IsDocInfoSave() const { return bDocInfSave; }
sal_Bool IsSaveWorkingSet() const { return bSaveWorkingSet; }
sal_Bool IsSaveDocView() const { return bSaveDocView; }
@@ -121,6 +124,7 @@ public:
void SetBackup( sal_Bool b );
void SetAutoSave( sal_Bool b );
void SetAutoSavePrompt( sal_Bool b );
+ void SetUserAutoSave( sal_Bool b );
void SetDocInfoSave( sal_Bool b );
void SetSaveWorkingSet( sal_Bool b );
void SetSaveDocView( sal_Bool b );
@@ -181,6 +185,16 @@ void SvtSaveOptions_Impl::SetAutoSavePrompt( sal_Bool b )
}
}
+void SvtSaveOptions_Impl::SetUserAutoSave( sal_Bool b )
+{
+ if (!bROUserAutoSave && bUserAutoSave!=b)
+ {
+ bUserAutoSave = b;
+ SetModified();
+ Commit();
+ }
+}
+
void SvtSaveOptions_Impl::SetDocInfoSave(sal_Bool b)
{
if (!bRODocInfSave && bDocInfSave!=b)
@@ -282,6 +296,9 @@ sal_Bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) cons
case SvtSaveOptions::E_AUTOSAVEPROMPT :
bReadOnly = bROAutoSavePrompt;
break;
+ case SvtSaveOptions::E_USERAUTOSAVE :
+ bReadOnly = bROUserAutoSave;
+ break;
case SvtSaveOptions::E_DOCINFSAVE :
bReadOnly = bRODocInfSave;
break;
@@ -340,6 +357,7 @@ sal_Bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) cons
#define ODFDEFAULTVERSION 15
#define USESHA1INODF12 16
#define USEBLOWFISHINODF12 17
+#define USERAUTOSAVE 18
Sequence< OUString > GetPropertyNames()
{
@@ -362,7 +380,8 @@ Sequence< OUString > GetPropertyNames()
"WorkingSet",
"ODF/DefaultVersion",
"ODF/UseSHA1InODF12",
- "ODF/UseBlowfishInODF12"
+ "ODF/UseBlowfishInODF12",
+ "Document/UserAutoSave"
};
const int nCount = sizeof( aPropNames ) / sizeof( const char* );
@@ -383,6 +402,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
, bBackup( sal_False )
, bAutoSave( sal_False )
, bAutoSavePrompt( sal_False )
+ , bUserAutoSave( sal_False )
, bDocInfSave( sal_False )
, bSaveWorkingSet( sal_False )
, bSaveDocView( sal_False )
@@ -400,6 +420,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
, bROBackup( CFG_READONLY_DEFAULT )
, bROAutoSave( CFG_READONLY_DEFAULT )
, bROAutoSavePrompt( CFG_READONLY_DEFAULT )
+ , bROUserAutoSave( CFG_READONLY_DEFAULT )
, bRODocInfSave( CFG_READONLY_DEFAULT )
, bROSaveWorkingSet( CFG_READONLY_DEFAULT )
, bROSaveDocView( CFG_READONLY_DEFAULT )
@@ -479,6 +500,10 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
bAutoSave = bTemp;
bROAutoSave = pROStates[nProp];
break;
+ case USERAUTOSAVE :
+ bUserAutoSave = bTemp;
+ bROUserAutoSave = pROStates[nProp];
+ break;
case PROMPT :
bAutoSavePrompt = bTemp;
bROAutoSavePrompt = pROStates[nProp];
@@ -563,6 +588,11 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
xCFG,
::rtl::OUString("AutoSave"),
::rtl::OUString("TimeIntervall")) >>= nAutoSaveTime;
+
+ ::comphelper::ConfigurationHelper::readRelativeKey(
+ xCFG,
+ ::rtl::OUString("AutoSave"),
+ ::rtl::OUString("UserAutoSaveEnabled")) >>= bUserAutoSave;
}
catch(const css::uno::Exception&)
{ OSL_FAIL("Could not find needed information for AutoSave feature."); }
@@ -630,6 +660,14 @@ void SvtSaveOptions_Impl::Commit()
++nRealCount;
}
break;
+ case USERAUTOSAVE :
+ if (!bROUserAutoSave)
+ {
+ pValues[nRealCount] <<= bUserAutoSave;
+ pNames[nRealCount] = pOrgNames[i];
+ ++nRealCount;
+ }
+ break;
case EDITPROPERTY :
if (!bRODocInfSave)
{
@@ -753,6 +791,12 @@ void SvtSaveOptions_Impl::Commit()
::rtl::OUString("Enabled"),
css::uno::makeAny(bAutoSave));
+ ::comphelper::ConfigurationHelper::writeRelativeKey(
+ xCFG,
+ ::rtl::OUString("AutoSave"),
+ ::rtl::OUString("UserAutoSaveEnabled"),
+ css::uno::makeAny(bUserAutoSave));
+
::comphelper::ConfigurationHelper::flush(xCFG);
}
@@ -908,6 +952,16 @@ sal_Bool SvtSaveOptions::IsAutoSavePrompt() const
return pImp->pSaveOpt->IsAutoSavePrompt();
}
+void SvtSaveOptions::SetUserAutoSave( sal_Bool b )
+{
+ pImp->pSaveOpt->SetUserAutoSave( b );
+}
+
+sal_Bool SvtSaveOptions::IsUserAutoSave() const
+{
+ return pImp->pSaveOpt->IsUserAutoSave();
+}
+
void SvtSaveOptions::SetDocInfoSave(sal_Bool b)
{
pImp->pSaveOpt->SetDocInfoSave( b );
More information about the Libreoffice-commits
mailing list