diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-24 09:21:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-25 09:40:36 +0200 |
commit | be683ad84960cad35299ed06b6b47691d90e2554 (patch) | |
tree | 872899209151be13a6b1e960ab57ec8df42c5c2d /sfx2 | |
parent | 9117fb44bc7bd6b8764911c731c84a9e5dcc37f0 (diff) |
use officecfg to retrieve WarnAlienFormat
Change-Id: Id7ca2ffa237cb8fda58af60ee5d296f492c5a47e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119462
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appcfg.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/dialog/alienwarn.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index 2b95176869d5..e36ffd2d60e5 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -151,8 +151,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet ) case SID_ATTR_WARNALIENFORMAT: { bRet = true; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat)) - if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), aSaveOptions.IsWarnAlienFormat()))) + if (!officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly()) + if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), + officecfg::Office::Common::Save::Document::WarnAlienFormat::get() ))) bRet = false; } break; @@ -449,7 +450,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), true, &pItem ) ) { DBG_ASSERT( dynamic_cast< const SfxBoolItem *>( pItem ) != nullptr, "BoolItem expected" ); - aSaveOptions.SetWarnAlienFormat( static_cast< const SfxBoolItem*> ( pItem )->GetValue() ); + officecfg::Office::Common::Save::Document::WarnAlienFormat::set( + static_cast< const SfxBoolItem*> ( pItem )->GetValue(), + batch); } // AutoSave diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index b889887fce02..a09469179cbc 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -19,6 +19,7 @@ #include <unotools/saveopt.hxx> #include <alienwarn.hxx> +#include <officecfg/Office/Common.hxx> SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, std::u16string_view _rFormatName, @@ -55,7 +56,7 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, m_xUseDefaultFormatBtn->set_label(sInfoText); // load value of "warning on" checkbox from save options - m_xWarningOnBox->set_active(SvtSaveOptions().IsWarnAlienFormat()); + m_xWarningOnBox->set_active(officecfg::Office::Common::Save::Document::WarnAlienFormat::get()); } SfxAlienWarningDialog::~SfxAlienWarningDialog() @@ -65,8 +66,12 @@ SfxAlienWarningDialog::~SfxAlienWarningDialog() // save value of "warning off" checkbox, if necessary SvtSaveOptions aSaveOpt; bool bChecked = m_xWarningOnBox->get_active(); - if (aSaveOpt.IsWarnAlienFormat() != bChecked) - aSaveOpt.SetWarnAlienFormat(bChecked); + if (officecfg::Office::Common::Save::Document::WarnAlienFormat::get() != bChecked) + { + auto xChanges = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Save::Document::WarnAlienFormat::set(bChecked, xChanges); + xChanges->commit(); + } } catch (...) { diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index d3640a43773a..57865df82b43 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1818,7 +1818,7 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod const OUString& aDefExtension, bool bDefIsAlien ) { - if ( !SvtSaveOptions().IsWarnAlienFormat() ) + if ( !officecfg::Office::Common::Save::Document::WarnAlienFormat::get() ) return true; weld::Window* pWin = SfxStoringHelper::GetModelWindow(xModel); |