diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-23 20:05:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-24 22:52:27 +0200 |
commit | 6f07012a344101f2afbf9c96dc7857127f39a25f (patch) | |
tree | f2ae2713ef5d1a6a244252e337c0ee849eb71c2f | |
parent | d904a21d5516ce2786f634d0bcc555c4b345e95d (diff) |
use officecfg to retrieve AutoSave
Change-Id: I613ca68123cfd316cd4e6384f743aa6756d9291d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119459
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | cui/source/options/optsave.cxx | 4 | ||||
-rw-r--r-- | include/unotools/saveopt.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/appl/appcfg.cxx | 9 | ||||
-rw-r--r-- | unotools/source/config/saveopt.cxx | 48 |
5 files changed, 13 insertions, 57 deletions
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index b0a58b4743f6..b13f88b10ab3 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -435,8 +435,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* ) m_xBackupCB->set_active(aSaveOpt.IsBackup()); m_xBackupCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::Backup)); - m_xAutoSaveCB->set_active(aSaveOpt.IsAutoSave()); - m_xAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSave)); + m_xAutoSaveCB->set_active(officecfg::Office::Common::Save::Document::AutoSave::get()); + m_xAutoSaveCB->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSave::isReadOnly()); m_xUserAutoSaveCB->set_active(aSaveOpt.IsUserAutoSave()); m_xUserAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UserAutoSave)); diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx index d50b8115885c..5a8abe03a22f 100644 --- a/include/unotools/saveopt.hxx +++ b/include/unotools/saveopt.hxx @@ -34,7 +34,6 @@ public: AutoSaveTime, UseUserData, Backup, - AutoSave, WarnAlienFormat, LoadDocPrinter, OdfDefaultVersion, @@ -93,9 +92,6 @@ public: void SetBackup( bool b ); bool IsBackup() const; - void SetAutoSave( bool b ); - bool IsAutoSave() const; - void SetUserAutoSave( bool b ); bool IsUserAutoSave() const; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 8751a7c6f212..dc3b3bef239a 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/presentation/SlideShow.hpp> #include <com/sun/star/media/XPlayer.hpp> +#include <officecfg/Office/Common.hxx> #include <svl/stritem.hxx> #include <svl/urihelper.hxx> #include <unotools/saveopt.hxx> @@ -531,10 +532,8 @@ SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, maInputFreezeTimer.SetInvokeHandler( LINK( this, SlideshowImpl, ReadyForNextInputHdl ) ); maInputFreezeTimer.SetTimeout( 20 ); - SvtSaveOptions aOptions; - // no autosave during show - if( aOptions.IsAutoSave() ) + if( officecfg::Office::Common::Save::Document::AutoSave::get() ) mbAutoSaveWasOn = true; Application::AddEventListener( LINK( this, SlideshowImpl, EventListenerHdl ) ); diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index fc4280e8df4b..7f2767107c94 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -160,8 +160,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) case SID_ATTR_AUTOSAVE : { bRet = true; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::AutoSave)) - if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVE ), aSaveOptions.IsAutoSave()))) + if (!officecfg::Office::Common::Save::Document::AutoSave::isReadOnly()) + if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVE ), + officecfg::Office::Common::Save::Document::AutoSave::get() ))) bRet = false; } break; @@ -455,7 +456,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVE), true, &pItem)) { DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); - aSaveOptions.SetAutoSave( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); + officecfg::Office::Common::Save::Document::AutoSave::set( + static_cast<const SfxBoolItem*>(pItem)->GetValue(), + batch); } // AutoSave-Prompt diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 5bb82488695a..f1ccc712e810 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -71,7 +71,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem bool bROAutoSaveTime, bROUseUserData, bROBackup, - bROAutoSave, bROUserAutoSave, bROWarnAlienFormat, bROLoadDocPrinter, @@ -87,7 +86,6 @@ public: sal_Int32 GetAutoSaveTime() const { return nAutoSaveTime; } bool IsUseUserData() const { return bUseUserData; } bool IsBackup() const { return bBackup; } - bool IsAutoSave() const { return bAutoSave; } bool IsUserAutoSave() const { return bUserAutoSave; } bool IsWarnAlienFormat() const { return bWarnAlienFormat; } bool IsLoadDocPrinter() const { return bLoadDocPrinter; } @@ -98,7 +96,6 @@ public: void SetAutoSaveTime( sal_Int32 n ); void SetUseUserData( bool b ); void SetBackup( bool b ); - void SetAutoSave( bool b ); void SetUserAutoSave( bool b ); void SetWarnAlienFormat( bool _bDoPP ); void SetLoadDocPrinter( bool bNew ); @@ -137,16 +134,6 @@ void SvtSaveOptions_Impl::SetBackup( bool b ) } } -void SvtSaveOptions_Impl::SetAutoSave( bool b ) -{ - if (!bROAutoSave && bAutoSave!=b) - { - bAutoSave = b; - SetModified(); - Commit(); - } -} - void SvtSaveOptions_Impl::SetUserAutoSave( bool b ) { if (!bROUserAutoSave && bUserAutoSave!=b) @@ -198,9 +185,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const case SvtSaveOptions::EOption::Backup : bReadOnly = bROBackup; break; - case SvtSaveOptions::EOption::AutoSave : - bReadOnly = bROAutoSave; - break; case SvtSaveOptions::EOption::UserAutoSave : bReadOnly = bROUserAutoSave; break; @@ -221,10 +205,9 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const #define TIMEINTERVALL 1 #define USEUSERDATA 2 #define CREATEBACKUP 3 -#define AUTOSAVE 4 -#define WARNALIENFORMAT 5 -#define LOADDOCPRINTER 6 -#define ODFDEFAULTVERSION 7 +#define WARNALIENFORMAT 4 +#define LOADDOCPRINTER 5 +#define ODFDEFAULTVERSION 6 static Sequence< OUString > GetPropertyNames() { @@ -234,7 +217,6 @@ static Sequence< OUString > GetPropertyNames() "Document/AutoSaveTimeIntervall", "Document/UseUserData", "Document/CreateBackup", - "Document/AutoSave", "Document/WarnAlienFormat", "Document/LoadPrinter", "ODF/DefaultVersion" @@ -254,7 +236,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , nAutoSaveTime( 0 ) , bUseUserData( false ) , bBackup( false ) - , bAutoSave( false ) , bUserAutoSave( false ) , bWarnAlienFormat( true ) , bLoadDocPrinter( true ) @@ -262,7 +243,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bROAutoSaveTime( CFG_READONLY_DEFAULT ) , bROUseUserData( CFG_READONLY_DEFAULT ) , bROBackup( CFG_READONLY_DEFAULT ) - , bROAutoSave( CFG_READONLY_DEFAULT ) , bROUserAutoSave( CFG_READONLY_DEFAULT ) , bROWarnAlienFormat( CFG_READONLY_DEFAULT ) , bROLoadDocPrinter( CFG_READONLY_DEFAULT ) @@ -330,10 +310,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() bBackup = bTemp; bROBackup = pROStates[nProp]; break; - case AUTOSAVE : - bAutoSave = bTemp; - bROAutoSave = pROStates[nProp]; - break; case WARNALIENFORMAT: bWarnAlienFormat = bTemp; @@ -416,14 +392,6 @@ void SvtSaveOptions_Impl::ImplCommit() ++nRealCount; } break; - case AUTOSAVE : - if (!bROAutoSave) - { - pValues[nRealCount] <<= bAutoSave; - pNames[nRealCount] = pOrgNames[i]; - ++nRealCount; - } - break; case WARNALIENFORMAT: if (!bROWarnAlienFormat) { @@ -581,16 +549,6 @@ bool SvtSaveOptions::IsBackup() const return pImp->pSaveOpt->IsBackup(); } -void SvtSaveOptions::SetAutoSave( bool b ) -{ - pImp->pSaveOpt->SetAutoSave( b ); -} - -bool SvtSaveOptions::IsAutoSave() const -{ - return pImp->pSaveOpt->IsAutoSave(); -} - void SvtSaveOptions::SetUserAutoSave( bool b ) { pImp->pSaveOpt->SetUserAutoSave( b ); |