[Libreoffice-commits] core.git: cui/source include/unotools sc/source sd/source sfx2/source sw/source unotools/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Jul 25 07:41:10 UTC 2021
cui/source/options/optsave.cxx | 4 +--
include/unotools/saveopt.hxx | 4 ---
sc/source/ui/unoobj/docuno.cxx | 4 ++-
sd/source/ui/unoidl/unomodel.cxx | 5 +++
sfx2/source/appl/appcfg.cxx | 9 ++++---
sfx2/source/dialog/alienwarn.cxx | 11 ++++++--
sfx2/source/doc/guisaveas.cxx | 2 -
sw/source/uibase/uno/unotxdoc.cxx | 4 ++-
unotools/source/config/saveopt.cxx | 47 +------------------------------------
9 files changed, 29 insertions(+), 61 deletions(-)
New commits:
commit be683ad84960cad35299ed06b6b47691d90e2554
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 24 09:21:23 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 25 09:40:36 2021 +0200
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 at collabora.co.uk>
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 40ea7c7502db..b6fb9e819682 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -442,8 +442,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
m_xUserAutoSaveCB->set_active(officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get());
m_xUserAutoSaveCB->set_sensitive(!officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly());
- m_xWarnAlienFormatCB->set_active(aSaveOpt.IsWarnAlienFormat());
- m_xWarnAlienFormatCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat));
+ m_xWarnAlienFormatCB->set_active(officecfg::Office::Common::Save::Document::WarnAlienFormat::get());
+ m_xWarnAlienFormatCB->set_sensitive(!officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly());
m_xAutoSaveEdit->set_value(officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get());
m_xAutoSaveEdit->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::isReadOnly());
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index ebc484d52d40..30c2f873b921 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -33,7 +33,6 @@ public:
{
UseUserData,
Backup,
- WarnAlienFormat,
LoadDocPrinter,
OdfDefaultVersion
};
@@ -90,9 +89,6 @@ public:
void SetLoadUserSettings(bool b);
bool IsLoadUserSettings() const;
- void SetWarnAlienFormat( bool _bEnable );
- bool IsWarnAlienFormat( ) const;
-
void SetLoadDocumentPrinter( bool _bEnable );
bool IsLoadDocumentPrinter( ) const;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 0836e0e7ed7f..b98ef8df38c5 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1200,7 +1200,9 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans
// be saved..." dialog appears, it is auto-cancelled with tiled rendering,
// causing 'Save' being disabled; so let's always save to the original
// format
- SvtSaveOptions().SetWarnAlienFormat(false);
+ auto xChanges = comphelper::ConfigurationChanges::create();
+ officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges);
+ xChanges->commit();
}
uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 006a9cad3347..91c9254eb39a 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/embed/Aspects.hpp>
+#include <officecfg/Office/Common.hxx>
#include <comphelper/lok.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
@@ -2470,7 +2471,9 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
// be saved..." dialog appears, it is auto-cancelled with tiled rendering,
// causing 'Save' being disabled; so let's always save to the original
// format
- SvtSaveOptions().SetWarnAlienFormat(false);
+ auto xChanges = comphelper::ConfigurationChanges::create();
+ officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges);
+ xChanges->commit();
if (!getenv("LO_TESTNAME"))
SvtSlideSorterBarOptions().SetVisibleImpressView(true);
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);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index f264c158df04..b8f81db2f58b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3492,7 +3492,9 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
// be saved..." dialog appears, it is auto-cancelled with tiled rendering,
// causing 'Save' being disabled; so let's always save to the original
// format
- SvtSaveOptions().SetWarnAlienFormat(false);
+ auto xChanges = comphelper::ConfigurationChanges::create();
+ officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges);
+ xChanges->commit();
// disable word auto-completion suggestions, the tooltips are not visible,
// and the editeng-like auto-completion is annoying
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 47534ecdcf1e..0900817e484e 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -62,14 +62,12 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
bool bUseUserData,
bBackup,
bAutoSave,
- bWarnAlienFormat,
bLoadDocPrinter;
SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion;
bool bROUseUserData,
bROBackup,
- bROWarnAlienFormat,
bROLoadDocPrinter,
bROODFDefaultVersion;
@@ -82,7 +80,6 @@ public:
bool IsUseUserData() const { return bUseUserData; }
bool IsBackup() const { return bBackup; }
- bool IsWarnAlienFormat() const { return bWarnAlienFormat; }
bool IsLoadDocPrinter() const { return bLoadDocPrinter; }
SvtSaveOptions::ODFDefaultVersion
@@ -90,7 +87,6 @@ public:
void SetUseUserData( bool b );
void SetBackup( bool b );
- void SetWarnAlienFormat( bool _bDoPP );
void SetLoadDocPrinter( bool bNew );
void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew );
@@ -117,15 +113,6 @@ void SvtSaveOptions_Impl::SetBackup( bool b )
}
}
-void SvtSaveOptions_Impl::SetWarnAlienFormat( bool _bDoPP )
-{
- if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP)
- {
- bWarnAlienFormat = _bDoPP;
- SetModified();
- }
-}
-
void SvtSaveOptions_Impl::SetLoadDocPrinter( bool bNew )
{
if ( !bROLoadDocPrinter && bLoadDocPrinter != bNew )
@@ -155,9 +142,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
case SvtSaveOptions::EOption::Backup :
bReadOnly = bROBackup;
break;
- case SvtSaveOptions::EOption::WarnAlienFormat :
- bReadOnly = bROWarnAlienFormat;
- break;
case SvtSaveOptions::EOption::LoadDocPrinter :
bReadOnly = bROLoadDocPrinter;
break;
@@ -171,9 +155,8 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
#define FORMAT 0
#define USEUSERDATA 1
#define CREATEBACKUP 2
-#define WARNALIENFORMAT 3
-#define LOADDOCPRINTER 4
-#define ODFDEFAULTVERSION 5
+#define LOADDOCPRINTER 3
+#define ODFDEFAULTVERSION 4
static Sequence< OUString > GetPropertyNames()
{
@@ -182,7 +165,6 @@ static Sequence< OUString > GetPropertyNames()
"Graphic/Format",
"Document/UseUserData",
"Document/CreateBackup",
- "Document/WarnAlienFormat",
"Document/LoadPrinter",
"ODF/DefaultVersion"
};
@@ -201,12 +183,10 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
, nAutoSaveTime( 0 )
, bUseUserData( false )
, bBackup( false )
- , bWarnAlienFormat( true )
, bLoadDocPrinter( true )
, eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
, bROUseUserData( CFG_READONLY_DEFAULT )
, bROBackup( CFG_READONLY_DEFAULT )
- , bROWarnAlienFormat( CFG_READONLY_DEFAULT )
, bROLoadDocPrinter( CFG_READONLY_DEFAULT )
, bROODFDefaultVersion( CFG_READONLY_DEFAULT )
{
@@ -263,11 +243,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
bROBackup = pROStates[nProp];
break;
- case WARNALIENFORMAT:
- bWarnAlienFormat = bTemp;
- bROWarnAlienFormat = pROStates[nProp];
- break;
-
case LOADDOCPRINTER:
bLoadDocPrinter = bTemp;
bROLoadDocPrinter = pROStates[nProp];
@@ -334,14 +309,6 @@ void SvtSaveOptions_Impl::ImplCommit()
++nRealCount;
}
break;
- case WARNALIENFORMAT:
- if (!bROWarnAlienFormat)
- {
- pValues[nRealCount] <<= bWarnAlienFormat;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
case LOADDOCPRINTER:
if (!bROLoadDocPrinter)
{
@@ -490,16 +457,6 @@ bool SvtSaveOptions::IsLoadUserSettings() const
return pImp->pLoadOpt->IsLoadUserSettings();
}
-void SvtSaveOptions::SetWarnAlienFormat( bool _bEnable )
-{
- pImp->pSaveOpt->SetWarnAlienFormat( _bEnable );
-}
-
-bool SvtSaveOptions::IsWarnAlienFormat() const
-{
- return pImp->pSaveOpt->IsWarnAlienFormat();
-}
-
void SvtSaveOptions::SetLoadDocumentPrinter( bool _bEnable )
{
pImp->pSaveOpt->SetLoadDocPrinter( _bEnable );
More information about the Libreoffice-commits
mailing list