cui/source/options/optsave.cxx | 4 +-- include/unotools/saveopt.hxx | 4 --- sfx2/source/appl/appcfg.cxx | 9 +++++-- sfx2/source/doc/objstor.cxx | 2 - unotools/source/config/saveopt.cxx | 44 ------------------------------------- 5 files changed, 10 insertions(+), 53 deletions(-)
New commits: commit f4fc908d00bf1fb05cdca89cdfd2f0c3b83723eb Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sat Jul 24 10:46:29 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Jul 25 13:40:07 2021 +0200 use officecfg to retrieve CreateBackup Change-Id: I4aeb1224f0d42dadd5a69dd49b8df9ee2f776b04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119471 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 8b3d3f1b86fa..8748f55f4a7d 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -437,8 +437,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* ) m_xDocInfoCB->set_active(officecfg::Office::Common::Save::Document::EditProperty::get()); m_xDocInfoCB->set_sensitive(!officecfg::Office::Common::Save::Document::EditProperty::isReadOnly()); - m_xBackupCB->set_active(aSaveOpt.IsBackup()); - m_xBackupCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::Backup)); + m_xBackupCB->set_active(officecfg::Office::Common::Save::Document::CreateBackup::get()); + m_xBackupCB->set_sensitive(!officecfg::Office::Common::Save::Document::CreateBackup::isReadOnly()); m_xAutoSaveCB->set_active(officecfg::Office::Common::Save::Document::AutoSave::get()); m_xAutoSaveCB->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSave::isReadOnly()); diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx index fafab60f3568..008c139a5ff6 100644 --- a/include/unotools/saveopt.hxx +++ b/include/unotools/saveopt.hxx @@ -32,7 +32,6 @@ public: enum class EOption { UseUserData, - Backup, OdfDefaultVersion }; @@ -82,9 +81,6 @@ public: void SetUseUserData( bool b ); bool IsUseUserData() const; - void SetBackup( bool b ); - bool IsBackup() const; - void SetLoadUserSettings(bool b); bool IsLoadUserSettings() const; diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index e36ffd2d60e5..5ed88bc71625 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -134,8 +134,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) case SID_ATTR_BACKUP : { bRet = true; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::Backup)) - if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BACKUP ),aSaveOptions.IsBackup()))) + if (!officecfg::Office::Common::Save::Document::CreateBackup::isReadOnly()) + if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BACKUP ), + officecfg::Office::Common::Save::Document::CreateBackup::get() ))) bRet = false; } break; @@ -434,7 +435,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BACKUP), true, &pItem) ) { DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); - aSaveOptions.SetBackup( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); + officecfg::Office::Common::Save::Document::CreateBackup::set( + static_cast<const SfxBoolItem*>(pItem)->GetValue(), + batch ); } // PrettyPrinting diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 4e3a66e51e20..3f92ffdea7b8 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1228,7 +1228,7 @@ bool SfxObjectShell::SaveTo_Impl // before we overwrite the original file, we will make a backup if there is a demand for that // if the backup is not created here it will be created internally and will be removed in case of successful saving - const bool bDoBackup = SvtSaveOptions().IsBackup(); + const bool bDoBackup = officecfg::Office::Common::Save::Document::CreateBackup::get(); if ( bDoBackup ) { rMedium.DoBackup_Impl(); diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 46fac1c81094..23632e4fcb62 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -60,13 +60,11 @@ class SvtSaveOptions_Impl : public utl::ConfigItem { sal_Int32 nAutoSaveTime; bool bUseUserData, - bBackup, bAutoSave; SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion; bool bROUseUserData, - bROBackup, bROODFDefaultVersion; virtual void ImplCommit() override; @@ -77,13 +75,11 @@ public: virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; bool IsUseUserData() const { return bUseUserData; } - bool IsBackup() const { return bBackup; } SvtSaveOptions::ODFDefaultVersion GetODFDefaultVersion() const { return eODFDefaultVersion; } void SetUseUserData( bool b ); - void SetBackup( bool b ); void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ); bool IsReadOnly( SvtSaveOptions::EOption eOption ) const; @@ -100,15 +96,6 @@ void SvtSaveOptions_Impl::SetUseUserData( bool b ) } } -void SvtSaveOptions_Impl::SetBackup( bool b ) -{ - if (!bROBackup && bBackup!=b) - { - bBackup = b; - SetModified(); - } -} - void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ) { if ( !bROODFDefaultVersion && eODFDefaultVersion != eNew ) @@ -126,9 +113,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const case SvtSaveOptions::EOption::UseUserData : bReadOnly = bROUseUserData; break; - case SvtSaveOptions::EOption::Backup : - bReadOnly = bROBackup; - break; case SvtSaveOptions::EOption::OdfDefaultVersion : bReadOnly = bROODFDefaultVersion; break; @@ -138,8 +122,7 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const #define FORMAT 0 #define USEUSERDATA 1 -#define CREATEBACKUP 2 -#define ODFDEFAULTVERSION 3 +#define ODFDEFAULTVERSION 2 static Sequence< OUString > GetPropertyNames() { @@ -147,7 +130,6 @@ static Sequence< OUString > GetPropertyNames() { "Graphic/Format", "Document/UseUserData", - "Document/CreateBackup", "ODF/DefaultVersion" }; @@ -164,10 +146,8 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() : ConfigItem( "Office.Common/Save" ) , nAutoSaveTime( 0 ) , bUseUserData( false ) - , bBackup( false ) , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) , bROUseUserData( CFG_READONLY_DEFAULT ) - , bROBackup( CFG_READONLY_DEFAULT ) , bROODFDefaultVersion( CFG_READONLY_DEFAULT ) { Sequence< OUString > aNames = GetPropertyNames(); @@ -218,10 +198,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() bUseUserData = bTemp; bROUseUserData = pROStates[nProp]; break; - case CREATEBACKUP : - bBackup = bTemp; - bROBackup = pROStates[nProp]; - break; default : SAL_WARN( "unotools.config", "invalid index to load a path" ); @@ -276,14 +252,6 @@ void SvtSaveOptions_Impl::ImplCommit() ++nRealCount; } break; - case CREATEBACKUP : - if (!bROBackup) - { - pValues[nRealCount] <<= bBackup; - pNames[nRealCount] = pOrgNames[i]; - ++nRealCount; - } - break; case ODFDEFAULTVERSION: if (!bROODFDefaultVersion) { @@ -404,16 +372,6 @@ bool SvtSaveOptions::IsUseUserData() const return pImp->pSaveOpt->IsUseUserData(); } -void SvtSaveOptions::SetBackup( bool b ) -{ - pImp->pSaveOpt->SetBackup( b ); -} - -bool SvtSaveOptions::IsBackup() const -{ - return pImp->pSaveOpt->IsBackup(); -} - void SvtSaveOptions::SetLoadUserSettings(bool b) { pImp->pLoadOpt->SetLoadUserSettings(b); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits