[Libreoffice-commits] core.git: cui/source include/unotools sfx2/source unotools/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Jul 25 06:37:46 UTC 2021
cui/source/options/optsave.cxx | 4 +-
include/unotools/saveopt.hxx | 4 --
sfx2/source/appl/appcfg.cxx | 9 +++--
unotools/source/config/saveopt.cxx | 59 +++----------------------------------
4 files changed, 14 insertions(+), 62 deletions(-)
New commits:
commit d5b9283985633fdb423269cab961bba2acc3539e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 23 20:39:57 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 25 08:37:08 2021 +0200
use officecfg to retrieve AutoSaveTime
Change-Id: I003be64cc46d6e781ab03d83bae0a3114ab6d56e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119460
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 51a1a77b177d..40ea7c7502db 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -445,8 +445,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
m_xWarnAlienFormatCB->set_active(aSaveOpt.IsWarnAlienFormat());
m_xWarnAlienFormatCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat));
- m_xAutoSaveEdit->set_value(aSaveOpt.GetAutoSaveTime());
- m_xAutoSaveEdit->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime));
+ m_xAutoSaveEdit->set_value(officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get());
+ m_xAutoSaveEdit->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::isReadOnly());
// save relatively
m_xRelativeFsysCB->set_active(officecfg::Office::Common::Save::URL::FileSystem::get());
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index c0bec6866287..ebc484d52d40 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -31,7 +31,6 @@ public:
enum class EOption
{
- AutoSaveTime,
UseUserData,
Backup,
WarnAlienFormat,
@@ -82,9 +81,6 @@ public:
SvtSaveOptions();
virtual ~SvtSaveOptions() override;
- void SetAutoSaveTime( sal_Int32 n );
- sal_Int32 GetAutoSaveTime() const;
-
void SetUseUserData( bool b );
bool IsUseUserData() const;
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 4a71912fae0e..4a5913bbe4b7 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -179,8 +179,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
case SID_ATTR_AUTOSAVEMINUTE :
{
bRet = true;
- if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime))
- if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ), static_cast<sal_uInt16>(aSaveOptions.GetAutoSaveTime()))))
+ if (!officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::isReadOnly())
+ if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ),
+ officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get() )))
bRet = false;
}
break;
@@ -476,7 +477,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEMINUTE), true, &pItem))
{
DBG_ASSERT(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "UInt16Item expected");
- aSaveOptions.SetAutoSaveTime(static_cast<const SfxUInt16Item *>(pItem)->GetValue());
+ officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::set(
+ static_cast<const SfxUInt16Item *>(pItem)->GetValue(),
+ batch);
}
// UserAutoSave
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index a8ffe9d01c23..47534ecdcf1e 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -67,8 +67,7 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion;
- bool bROAutoSaveTime,
- bROUseUserData,
+ bool bROUseUserData,
bROBackup,
bROWarnAlienFormat,
bROLoadDocPrinter,
@@ -81,7 +80,6 @@ public:
virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
- sal_Int32 GetAutoSaveTime() const { return nAutoSaveTime; }
bool IsUseUserData() const { return bUseUserData; }
bool IsBackup() const { return bBackup; }
bool IsWarnAlienFormat() const { return bWarnAlienFormat; }
@@ -90,7 +88,6 @@ public:
SvtSaveOptions::ODFDefaultVersion
GetODFDefaultVersion() const { return eODFDefaultVersion; }
- void SetAutoSaveTime( sal_Int32 n );
void SetUseUserData( bool b );
void SetBackup( bool b );
void SetWarnAlienFormat( bool _bDoPP );
@@ -102,16 +99,6 @@ public:
}
-void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n )
-{
- if (!bROAutoSaveTime && nAutoSaveTime!=n)
- {
- nAutoSaveTime = n;
- SetModified();
- Commit();
- }
-}
-
void SvtSaveOptions_Impl::SetUseUserData( bool b )
{
if (!bROUseUserData && bUseUserData!=b)
@@ -162,9 +149,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
bool bReadOnly = CFG_READONLY_DEFAULT;
switch(eOption)
{
- case SvtSaveOptions::EOption::AutoSaveTime :
- bReadOnly = bROAutoSaveTime;
- break;
case SvtSaveOptions::EOption::UseUserData :
bReadOnly = bROUseUserData;
break;
@@ -185,19 +169,17 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
}
#define FORMAT 0
-#define TIMEINTERVALL 1
-#define USEUSERDATA 2
-#define CREATEBACKUP 3
-#define WARNALIENFORMAT 4
-#define LOADDOCPRINTER 5
-#define ODFDEFAULTVERSION 6
+#define USEUSERDATA 1
+#define CREATEBACKUP 2
+#define WARNALIENFORMAT 3
+#define LOADDOCPRINTER 4
+#define ODFDEFAULTVERSION 5
static Sequence< OUString > GetPropertyNames()
{
static const char* aPropNames[] =
{
"Graphic/Format",
- "Document/AutoSaveTimeIntervall",
"Document/UseUserData",
"Document/CreateBackup",
"Document/WarnAlienFormat",
@@ -222,7 +204,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
, bWarnAlienFormat( true )
, bLoadDocPrinter( true )
, eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
- , bROAutoSaveTime( CFG_READONLY_DEFAULT )
, bROUseUserData( CFG_READONLY_DEFAULT )
, bROBackup( CFG_READONLY_DEFAULT )
, bROWarnAlienFormat( CFG_READONLY_DEFAULT )
@@ -243,22 +224,12 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
{
if ( pValues[nProp].hasValue() )
{
- sal_Int32 nTemp = 0;
switch ( nProp )
{
case FORMAT:
// not supported anymore
break;
- case TIMEINTERVALL :
- if ( pValues[nProp] >>= nTemp )
- nAutoSaveTime = nTemp;
- else {
- OSL_FAIL( "Wrong Type!" );
- };
- bROAutoSaveTime = pROStates[nProp];
- break;
-
case ODFDEFAULTVERSION :
{
sal_Int16 nTmp = 0;
@@ -347,14 +318,6 @@ void SvtSaveOptions_Impl::ImplCommit()
case FORMAT:
// not supported anymore
break;
- case TIMEINTERVALL :
- if (!bROAutoSaveTime)
- {
- pValues[nRealCount] <<= nAutoSaveTime;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
case USEUSERDATA :
if (!bROUseUserData)
{
@@ -497,16 +460,6 @@ SvtSaveOptions::~SvtSaveOptions()
}
}
-void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n )
-{
- pImp->pSaveOpt->SetAutoSaveTime( n );
-}
-
-sal_Int32 SvtSaveOptions::GetAutoSaveTime() const
-{
- return pImp->pSaveOpt->GetAutoSaveTime();
-}
-
void SvtSaveOptions::SetUseUserData( bool b )
{
pImp->pSaveOpt->SetUseUserData( b );
More information about the Libreoffice-commits
mailing list