From 966cc80a8f45816f727d4af036c2b58fb7d82d22 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 23 Jul 2021 18:49:40 +0200 Subject: use officecfg to retrieve DocInfoSave Change-Id: I0a9e8b21b0c5937567273155cd5b5f773fe26b8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119457 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/options/optsave.cxx | 4 ++-- include/unotools/saveopt.hxx | 4 ---- sfx2/source/appl/appcfg.cxx | 9 ++++--- sfx2/source/doc/guisaveas.cxx | 3 +-- unotools/source/config/saveopt.cxx | 48 +++----------------------------------- 5 files changed, 12 insertions(+), 56 deletions(-) diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 317d6c625b1e..b0a58b4743f6 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -429,8 +429,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* ) pImpl->bInitialized = true; } - m_xDocInfoCB->set_active(aSaveOpt.IsDocInfoSave()); - m_xDocInfoCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::DocInfSave)); + 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)); diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx index 4a7c21cac08a..b268d8397d59 100644 --- a/include/unotools/saveopt.hxx +++ b/include/unotools/saveopt.hxx @@ -36,7 +36,6 @@ public: Backup, AutoSave, AutoSavePrompt, - DocInfSave, WarnAlienFormat, LoadDocPrinter, OdfDefaultVersion, @@ -104,9 +103,6 @@ public: void SetUserAutoSave( bool b ); bool IsUserAutoSave() const; - void SetDocInfoSave(bool b); - bool IsDocInfoSave() const; - void SetLoadUserSettings(bool b); bool IsLoadUserSettings() const; diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index 68faf7d0e75f..00742402585c 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -192,8 +192,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) case SID_ATTR_DOCINFO : { bRet = true; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::DocInfSave)) - if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_DOCINFO ), aSaveOptions.IsDocInfoSave()))) + if (!officecfg::Office::Common::Save::Document::EditProperty::isReadOnly()) + if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_DOCINFO ), + officecfg::Office::Common::Save::Document::EditProperty::get()))) bRet = false; } break; @@ -481,7 +482,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_DOCINFO), true, &pItem)) { DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected"); - aSaveOptions.SetDocInfoSave(static_cast(pItem)->GetValue()); + officecfg::Office::Common::Save::Document::EditProperty::set( + static_cast(pItem)->GetValue(), + batch); } // Mark open Documents diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 9f1aeba44f02..d3640a43773a 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1633,12 +1633,11 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo aArgsSequence = aModelData.GetMediaDescr().getAsConstPropertyValueList(); // store the document and handle it's docinfo - SvtSaveOptions aOptions; DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), nStoreMode & EXPORT_REQUESTED ); OSL_ENSURE( aModelData.GetMediaDescr().find( OUString( "Password" ) ) == aModelData.GetMediaDescr().end(), "The Password property of MediaDescriptor should not be used here!" ); - if ( aOptions.IsDocInfoSave() + if ( officecfg::Office::Common::Save::Document::EditProperty::get() && ( !aModelData.GetStorable()->hasLocation() || INetURLObject( aModelData.GetStorable()->getLocation() ) != aURL ) ) { diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 55979f50e982..1d3f7253952a 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -64,7 +64,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem bAutoSave, bAutoSavePrompt, bUserAutoSave, - bDocInfSave, bWarnAlienFormat, bLoadDocPrinter; @@ -76,7 +75,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem bROAutoSave, bROAutoSavePrompt, bROUserAutoSave, - bRODocInfSave, bROWarnAlienFormat, bROLoadDocPrinter, bROODFDefaultVersion; @@ -94,7 +92,6 @@ public: bool IsAutoSave() const { return bAutoSave; } bool IsAutoSavePrompt() const { return bAutoSavePrompt; } bool IsUserAutoSave() const { return bUserAutoSave; } - bool IsDocInfoSave() const { return bDocInfSave; } bool IsWarnAlienFormat() const { return bWarnAlienFormat; } bool IsLoadDocPrinter() const { return bLoadDocPrinter; } @@ -107,7 +104,6 @@ public: void SetAutoSave( bool b ); void SetAutoSavePrompt( bool b ); void SetUserAutoSave( bool b ); - void SetDocInfoSave( bool b ); void SetWarnAlienFormat( bool _bDoPP ); void SetLoadDocPrinter( bool bNew ); void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ); @@ -174,15 +170,6 @@ void SvtSaveOptions_Impl::SetUserAutoSave( bool b ) } } -void SvtSaveOptions_Impl::SetDocInfoSave(bool b) -{ - if (!bRODocInfSave && bDocInfSave!=b) - { - bDocInfSave = b; - SetModified(); - } -} - void SvtSaveOptions_Impl::SetWarnAlienFormat( bool _bDoPP ) { if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP) @@ -233,9 +220,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const case SvtSaveOptions::EOption::UserAutoSave : bReadOnly = bROUserAutoSave; break; - case SvtSaveOptions::EOption::DocInfSave : - bReadOnly = bRODocInfSave; - break; case SvtSaveOptions::EOption::WarnAlienFormat : bReadOnly = bROWarnAlienFormat; break; @@ -255,10 +239,9 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const #define CREATEBACKUP 3 #define AUTOSAVE 4 #define PROMPT 5 -#define EDITPROPERTY 6 -#define WARNALIENFORMAT 7 -#define LOADDOCPRINTER 8 -#define ODFDEFAULTVERSION 9 +#define WARNALIENFORMAT 6 +#define LOADDOCPRINTER 7 +#define ODFDEFAULTVERSION 8 static Sequence< OUString > GetPropertyNames() { @@ -270,7 +253,6 @@ static Sequence< OUString > GetPropertyNames() "Document/CreateBackup", "Document/AutoSave", "Document/AutoSavePrompt", - "Document/EditProperty", "Document/WarnAlienFormat", "Document/LoadPrinter", "ODF/DefaultVersion" @@ -293,7 +275,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bAutoSave( false ) , bAutoSavePrompt( false ) , bUserAutoSave( false ) - , bDocInfSave( false ) , bWarnAlienFormat( true ) , bLoadDocPrinter( true ) , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) @@ -303,7 +284,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bROAutoSave( CFG_READONLY_DEFAULT ) , bROAutoSavePrompt( CFG_READONLY_DEFAULT ) , bROUserAutoSave( CFG_READONLY_DEFAULT ) - , bRODocInfSave( CFG_READONLY_DEFAULT ) , bROWarnAlienFormat( CFG_READONLY_DEFAULT ) , bROLoadDocPrinter( CFG_READONLY_DEFAULT ) , bROODFDefaultVersion( CFG_READONLY_DEFAULT ) @@ -378,10 +358,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() bAutoSavePrompt = bTemp; bROAutoSavePrompt = pROStates[nProp]; break; - case EDITPROPERTY : - bDocInfSave = bTemp; - bRODocInfSave = pROStates[nProp]; - break; case WARNALIENFORMAT: bWarnAlienFormat = bTemp; @@ -480,14 +456,6 @@ void SvtSaveOptions_Impl::ImplCommit() ++nRealCount; } break; - case EDITPROPERTY : - if (!bRODocInfSave) - { - pValues[nRealCount] <<= bDocInfSave; - pNames[nRealCount] = pOrgNames[i]; - ++nRealCount; - } - break; case WARNALIENFORMAT: if (!bROWarnAlienFormat) { @@ -675,16 +643,6 @@ bool SvtSaveOptions::IsUserAutoSave() const return pImp->pSaveOpt->IsUserAutoSave(); } -void SvtSaveOptions::SetDocInfoSave(bool b) -{ - pImp->pSaveOpt->SetDocInfoSave( b ); -} - -bool SvtSaveOptions::IsDocInfoSave() const -{ - return pImp->pSaveOpt->IsDocInfoSave(); -} - void SvtSaveOptions::SetLoadUserSettings(bool b) { pImp->pLoadOpt->SetLoadUserSettings(b); -- cgit