[Libreoffice-commits] core.git: chart2/qa cui/source dbaccess/source include/unotools sax/source sc/source sfx2/source sw/source unotools/source xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Jul 25 18:06:03 UTC 2021


 chart2/qa/extras/chart2geometry.cxx                  |    7 
 cui/source/options/optsave.cxx                       |    8 
 dbaccess/source/core/dataaccess/databasedocument.cxx |    2 
 include/unotools/saveopt.hxx                         |   35 --
 sax/source/tools/converter.cxx                       |    1 
 sc/source/filter/excel/xeroot.cxx                    |    1 
 sfx2/source/appl/appcfg.cxx                          |    2 
 sfx2/source/dialog/alienwarn.cxx                     |    1 
 sfx2/source/inc/appdata.hxx                          |    1 
 sw/source/filter/ww8/attributeoutputbase.hxx         |    2 
 unotools/source/config/saveopt.cxx                   |  298 ++-----------------
 xmloff/source/core/xmlexp.cxx                        |    5 
 xmloff/source/style/xmlexppr.cxx                     |    2 
 13 files changed, 58 insertions(+), 307 deletions(-)

New commits:
commit 134f40136a9bea265d8f2fedfdb41a1e65d81b49
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 24 16:56:15 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 25 20:05:30 2021 +0200

    use officecfg to retrieve OdfDefaultVersion
    
    Change-Id: Id54b98d978965e7ce304b83d5eff7d6c844a41d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119474
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx
index c1fe65fa927d..bcfa0d7276af 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -440,9 +440,8 @@ void Chart2GeometryTest::testTdf135366_CustomLabelText()
 {
     // Error was, that custom text in a data label was only exported in ODF extended,
     // although the used <chart:data-label> element exists since ODF 1.2.
-    SvtSaveOptions aSaveOpt;
-    const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(aSaveOpt.GetODFDefaultVersion());
-    aSaveOpt.SetODFDefaultVersion(SvtSaveOptions::ODFVER_012);
+    const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
+    SetODFDefaultVersion(SvtSaveOptions::ODFVER_012);
     load(u"/chart2/qa/extras/data/pptx/", "tdf135366_CustomLabelText.pptx");
     xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
     CPPUNIT_ASSERT(pXmlDoc);
@@ -457,7 +456,7 @@ void Chart2GeometryTest::testTdf135366_CustomLabelText()
     const OUString sOUTextContent = getXPathContent(pXmlDoc, sCustomTextPath);
     CPPUNIT_ASSERT_EQUAL(OUString("Custom"), sOUTextContent);
 
-    aSaveOpt.SetODFDefaultVersion(nCurrentODFVersion);
+    SetODFDefaultVersion(nCurrentODFVersion);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2GeometryTest);
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 208bf8289f2e..14194720b7c0 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -227,7 +227,6 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
     auto xChanges = comphelper::ConfigurationChanges::create();
     bool bModified = false;
-    SvtSaveOptions aSaveOpt;
     if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
         officecfg::Office::Common::Load::UserDefinedSettings::set(m_xLoadUserSettingsCB->get_active(), xChanges);
 
@@ -237,7 +236,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
     if ( m_xODFVersionLB->get_value_changed_from_saved() )
     {
         sal_Int32 nVersion = m_xODFVersionLB->get_active_id().toInt32();
-        aSaveOpt.SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ) );
+        SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ), xChanges );
     }
 
     if ( m_xDocInfoCB->get_state_changed_from_saved() )
@@ -364,7 +363,6 @@ static bool isODFFormat( const OUString& sFilter )
 
 void SvxSaveTabPage::Reset( const SfxItemSet* )
 {
-    SvtSaveOptions aSaveOpt;
     m_xLoadUserSettingsCB->set_active(officecfg::Office::Common::Load::UserDefinedSettings::get());
     m_xLoadUserSettingsCB->save_state();
     m_xLoadUserSettingsCB->set_sensitive(!officecfg::Office::Common::Load::UserDefinedSettings::isReadOnly());
@@ -456,9 +454,9 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
     m_xRelativeInetCB->set_active(officecfg::Office::Common::Save::URL::Internet::get());
     m_xRelativeInetCB->set_sensitive(!officecfg::Office::Common::Save::URL::Internet::isReadOnly());
 
-    sal_Int32 nDefaultVersion = aSaveOpt.GetODFDefaultVersion();
+    sal_Int32 nDefaultVersion = GetODFDefaultVersion();
     m_xODFVersionLB->set_active_id(OUString::number(nDefaultVersion));
-    m_xODFVersionLB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::OdfDefaultVersion));
+    m_xODFVersionLB->set_sensitive(!officecfg::Office::Common::Save::ODF::DefaultVersion::isReadOnly());
 
     AutoClickHdl_Impl(*m_xAutoSaveCB);
     ODFVersionHdl_Impl(*m_xODFVersionLB);
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index c8a75c1e725d..f9f99ef8ef9a 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1653,7 +1653,7 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
 
     OUString aVersion;
     SvtSaveOptions::ODFSaneDefaultVersion const nDefVersion =
-        SvtSaveOptions().GetODFSaneDefaultVersion();
+        GetODFSaneDefaultVersion();
     // older versions can not have this property set,
     // it exists only starting from ODF1.2
     if (nDefVersion >= SvtSaveOptions::ODFSVER_013)
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index 2793187ec621..9cd6367615bd 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -20,20 +20,12 @@
 #define INCLUDED_UNOTOOLS_SAVEOPT_HXX
 
 #include <unotools/unotoolsdllapi.h>
-#include <unotools/options.hxx>
+#include <memory>
 
-struct SvtLoadSaveOptions_Impl;
-class UNOTOOLS_DLLPUBLIC SvtSaveOptions final : public utl::detail::Options
-{
-    SvtLoadSaveOptions_Impl*    pImp;
-
-public:
-
-    enum class EOption
-    {
-        OdfDefaultVersion
-    };
+namespace comphelper { class ConfigurationChanges; }
 
+namespace SvtSaveOptions
+{
     /** Keep enum values sorted that a less or greater compare maps to older
         and newer versions.
         Do not change values, they are stored in the configuration.
@@ -74,21 +66,16 @@ public:
         ODFSVER_LATEST_EXTENDED = ODFSVER_013_EXTENDED  ///< @internal DO NOT USE in comparisons
     };
 
-    SvtSaveOptions();
-    virtual ~SvtSaveOptions() override;
-
-    void                    SetODFDefaultVersion( ODFDefaultVersion eVersion );
-    ODFDefaultVersion       GetODFDefaultVersion() const;
-    ODFSaneDefaultVersion   GetODFSaneDefaultVersion() const;
+};
 
-    bool                IsReadOnly( EOption eOption ) const;
+UNOTOOLS_DLLPUBLIC void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion );
+UNOTOOLS_DLLPUBLIC void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion, const std::shared_ptr<comphelper::ConfigurationChanges>& );
 
-    /** gets a sane default from the currently configured default */
-    static ODFSaneDefaultVersion  GetODFSaneDefaultVersion(ODFDefaultVersion eDefaultVersion);
-};
+UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFDefaultVersion       GetODFDefaultVersion();
+UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFSaneDefaultVersion   GetODFSaneDefaultVersion();
 
-/** lighter-weight version of the same method in SvtSaveOptions */
-UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion();
+/** gets a sane default from the currently configured default */
+UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFSaneDefaultVersion  GetODFSaneDefaultVersion(SvtSaveOptions::ODFDefaultVersion eDefaultVersion);
 
 #endif
 
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 01657ddf30db..69fbc8104cfb 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -30,6 +30,7 @@
 #include <rtl/math.hxx>
 #include <rtl/character.hxx>
 #include <sal/log.hxx>
+#include <o3tl/typed_flags_set.hxx>
 #include <o3tl/unit_conversion.hxx>
 #include <osl/diagnose.h>
 #include <tools/long.hxx>
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 88fbe1297c9f..b0ac71643674 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -58,7 +58,6 @@ XclExpRootData::XclExpRootData( XclBiff eBiff, SfxMedium& rMedium,
         const tools::SvRef<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) :
     XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, true )
 {
-    SvtSaveOptions aSaveOpt;
     mbRelUrl = mrMedium.IsRemote()
         ? officecfg::Office::Common::Save::URL::Internet::get()
         : officecfg::Office::Common::Save::URL::FileSystem::get();
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 5ed88bc71625..e2435ce2f43b 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -115,7 +115,6 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
     SfxItemPool &rPool = GetPool();
 
     const WhichRangesContainer& pRanges = rSet.GetRanges();
-    SvtSaveOptions aSaveOptions;
     SvtSecurityOptions  aSecurityOptions;
     SvtMiscOptions aMiscOptions;
 
@@ -409,7 +408,6 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
     const SfxPoolItem *pItem = nullptr;
     SfxItemPool &rPool = GetPool();
 
-    SvtSaveOptions aSaveOptions;
     SvtSecurityOptions aSecurityOptions;
     SvtMiscOptions aMiscOptions;
     std::shared_ptr< comphelper::ConfigurationChanges > batch(
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index a09469179cbc..8d27ef81d412 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -64,7 +64,6 @@ SfxAlienWarningDialog::~SfxAlienWarningDialog()
     try
     {
         // save value of "warning off" checkbox, if necessary
-        SvtSaveOptions aSaveOpt;
         bool bChecked = m_xWarningOnBox->get_active();
         if (officecfg::Office::Common::Save::Document::WarnAlienFormat::get() != bChecked)
         {
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 8bea6e44b6a2..3228321c66c3 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -45,7 +45,6 @@ class SfxStatusDispatcher;
 class SfxDdeTriggerTopic_Impl;
 class SfxDocumentTemplates;
 class SfxFrame;
-class SvtSaveOptions;
 class SfxViewFrame;
 class SfxSlotPool;
 class SfxDispatcher;
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 34920374537c..dc86307b40b5 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -31,7 +31,6 @@
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
 #include <swtypes.hxx>
 #include <fldbas.hxx>
-#include <unotools/saveopt.hxx>
 
 class Point;
 class SvxCaseMapItem;
@@ -143,7 +142,6 @@ enum StyleType
 class AttributeOutputBase
 {
 private:
-    SvtSaveOptions m_aSaveOpt;
     OUString m_sBaseURL; // To be used in ConvertURL
 
     OUString ConvertURL( const OUString& rUrl, bool bAbsoluteOut );
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index aa7e875e1d97..6bac9ea28d04 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -21,7 +21,6 @@
 
 #include <sal/log.hxx>
 #include <unotools/saveopt.hxx>
-#include <rtl/instance.hxx>
 #include <unotools/configmgr.hxx>
 #include <unotools/configitem.hxx>
 #include <tools/debug.hxx>
@@ -36,292 +35,67 @@
 using namespace utl;
 using namespace com::sun::star::uno;
 
-namespace {
-
-class SvtSaveOptions_Impl;
-class SvtLoadOptions_Impl;
-
-}
-
-#define CFG_READONLY_DEFAULT    false
-
-struct SvtLoadSaveOptions_Impl
-{
-    std::unique_ptr<SvtSaveOptions_Impl> pSaveOpt;
-};
-
-static std::unique_ptr<SvtLoadSaveOptions_Impl> pOptions;
-static sal_Int32           nRefCount = 0;
-
-namespace {
-
-class SvtSaveOptions_Impl : public utl::ConfigItem
-{
-    sal_Int32                           nAutoSaveTime;
-    bool                            bAutoSave;
-
-    SvtSaveOptions::ODFDefaultVersion   eODFDefaultVersion;
-
-    bool                            bROODFDefaultVersion;
-
-    virtual void            ImplCommit() override;
-
-public:
-                            SvtSaveOptions_Impl();
-
-    virtual void            Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
-
-    SvtSaveOptions::ODFDefaultVersion
-                            GetODFDefaultVersion() const        { return eODFDefaultVersion; }
-
-    void                    SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew );
-
-    bool                IsReadOnly( SvtSaveOptions::EOption eOption ) const;
-};
-
-}
-
-void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew )
+void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion, const std::shared_ptr<comphelper::ConfigurationChanges>& xChanges )
 {
-    if ( !bROODFDefaultVersion && eODFDefaultVersion != eNew )
-    {
-        eODFDefaultVersion = eNew;
-        SetModified();
-    }
+    sal_Int16 nTmp = (eVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eVersion );
+    officecfg::Office::Common::Save::ODF::DefaultVersion::set(nTmp, xChanges);
 }
 
-bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
+void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion )
 {
-    bool bReadOnly = CFG_READONLY_DEFAULT;
-    switch(eOption)
-    {
-        case SvtSaveOptions::EOption::OdfDefaultVersion :
-            bReadOnly = bROODFDefaultVersion;
-            break;
-    }
-    return bReadOnly;
+    auto xChanges = comphelper::ConfigurationChanges::create();
+    SetODFDefaultVersion(eVersion, xChanges);
+    xChanges->commit();
 }
 
-#define FORMAT              0
-#define ODFDEFAULTVERSION   1
-
-static Sequence< OUString > GetPropertyNames()
+SvtSaveOptions::ODFDefaultVersion GetODFDefaultVersion()
 {
-    static const char* aPropNames[] =
-    {
-        "Graphic/Format",
-        "ODF/DefaultVersion"
-    };
-
-    const int nCount = SAL_N_ELEMENTS( aPropNames );
-    Sequence< OUString > aNames( nCount );
-    OUString* pNames = aNames.getArray();
-    for ( int i = 0; i < nCount; i++ )
-        pNames[i] = OUString::createFromAscii( aPropNames[i] );
-
-    return aNames;
-}
-
-SvtSaveOptions_Impl::SvtSaveOptions_Impl()
-    : ConfigItem( "Office.Common/Save" )
-    , nAutoSaveTime( 0 )
-    , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
-    , bROODFDefaultVersion( CFG_READONLY_DEFAULT )
-{
-    Sequence< OUString > aNames = GetPropertyNames();
-    Sequence< Any > aValues = GetProperties( aNames );
-    Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames );
-    EnableNotification( aNames );
-    const Any* pValues = aValues.getConstArray();
-    const sal_Bool* pROStates = aROStates.getConstArray();
-    DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
-    DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" );
-    if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() )
-    {
-        for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
-        {
-            if ( pValues[nProp].hasValue() )
-            {
-                switch ( nProp )
-                {
-                    case FORMAT:
-                        // not supported anymore
-                        break;
-
-                    case ODFDEFAULTVERSION :
-                    {
-                        sal_Int16 nTmp = 0;
-                        if ( pValues[nProp] >>= nTmp )
-                        {
-                            if( nTmp == 3 )
-                                eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST;
-                            else
-                                eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp );
-                        }
-                        else {
-                            SAL_WARN( "unotools.config", "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" );
-                        };
-                        bROODFDefaultVersion = pROStates[nProp];
-                        break;
-                    }
-
-                    default:
-                        OSL_FAIL( "Wrong Type!" );
-                }
-            }
-        }
-    }
-
-    if (!utl::ConfigManager::IsFuzzing())
-    {
-        bAutoSave = officecfg::Office::Recovery::AutoSave::Enabled::get();
-        nAutoSaveTime = officecfg::Office::Recovery::AutoSave::TimeIntervall::get();
-    }
+    SvtSaveOptions::ODFDefaultVersion nRet;
+    sal_Int16 nTmp = officecfg::Office::Common::Save::ODF::DefaultVersion::get();
+    if( nTmp == 3 )
+        nRet = SvtSaveOptions::ODFVER_LATEST;
     else
-    {
-        bAutoSave = false;
-        nAutoSaveTime = 0;
-    }
-}
-
-void SvtSaveOptions_Impl::ImplCommit()
-{
-    Sequence< OUString > aOrgNames = GetPropertyNames();
-    OUString* pOrgNames = aOrgNames.getArray();
-    sal_Int32 nOrgCount = aOrgNames.getLength();
-
-    Sequence< OUString > aNames( nOrgCount );
-    Sequence< Any > aValues( nOrgCount );
-    OUString* pNames = aNames.getArray();
-    Any* pValues = aValues.getArray();
-    sal_Int32 nRealCount = 0;
-
-    for (sal_Int32 i=0; i<nOrgCount; ++i)
-    {
-        switch (i)
-        {
-            case FORMAT:
-                // not supported anymore
-                break;
-            case ODFDEFAULTVERSION:
-                if (!bROODFDefaultVersion)
-                {
-                    pValues[nRealCount] <<= (eODFDefaultVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion );
-                    pNames[nRealCount] = pOrgNames[i];
-                    ++nRealCount;
-                }
-                break;
-
-            default:
-                SAL_WARN( "unotools.config", "invalid index to save a path" );
-        }
-    }
-
-    aNames.realloc(nRealCount);
-    aValues.realloc(nRealCount);
-    PutProperties( aNames, aValues );
-
-    std::shared_ptr< comphelper::ConfigurationChanges > batch(
-    comphelper::ConfigurationChanges::create());
-    officecfg::Office::Recovery::AutoSave::TimeIntervall::set(nAutoSaveTime, batch);
-    officecfg::Office::Recovery::AutoSave::Enabled::set(bAutoSave, batch);
-    batch->commit();
-}
-
-void SvtSaveOptions_Impl::Notify( const Sequence<OUString>& )
-{
-}
-
-namespace
-{
-    class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
-    {
-    };
-}
-
-SvtSaveOptions::SvtSaveOptions()
-{
-    // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( LocalSingleton::get() );
-    if ( !pOptions )
-    {
-        pOptions.reset(new SvtLoadSaveOptions_Impl);
-        pOptions->pSaveOpt.reset(new SvtSaveOptions_Impl);
-    }
-    ++nRefCount;
-    pImp = pOptions.get();
-}
-
-SvtSaveOptions::~SvtSaveOptions()
-{
-    // Global access, must be guarded (multithreading)
-    ::osl::MutexGuard aGuard( LocalSingleton::get() );
-    if ( !--nRefCount )
-    {
-        if ( pOptions->pSaveOpt->IsModified() )
-            pOptions->pSaveOpt->Commit();
-
-        pOptions.reset();
-    }
-}
-
-void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion )
-{
-    pImp->pSaveOpt->SetODFDefaultVersion( eVersion );
-}
-
-SvtSaveOptions::ODFDefaultVersion SvtSaveOptions::GetODFDefaultVersion() const
-{
-    auto const nRet = pImp->pSaveOpt->GetODFDefaultVersion();
-    SAL_WARN_IF(nRet == ODFVER_UNKNOWN, "unotools.config", "DefaultVersion is ODFVER_UNKNOWN?");
-    return (nRet == ODFVER_UNKNOWN) ? ODFVER_LATEST : nRet;
+        nRet = SvtSaveOptions::ODFDefaultVersion( nTmp );
+    SAL_WARN_IF(nRet == SvtSaveOptions::ODFVER_UNKNOWN, "unotools.config", "DefaultVersion is ODFVER_UNKNOWN?");
+    return (nRet == SvtSaveOptions::ODFVER_UNKNOWN) ? SvtSaveOptions::ODFVER_LATEST : nRet;
 }
 
 SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion()
 {
+    SvtSaveOptions::ODFDefaultVersion nRet;
     sal_Int16 nTmp = officecfg::Office::Common::Save::ODF::DefaultVersion::get();
-    SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion;
     if( nTmp == 3 )
-        eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST;
+        nRet = SvtSaveOptions::ODFVER_LATEST;
     else
-        eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp );
-    return SvtSaveOptions::GetODFSaneDefaultVersion(eODFDefaultVersion);
-}
+        nRet = SvtSaveOptions::ODFDefaultVersion( nTmp );
 
-SvtSaveOptions::ODFSaneDefaultVersion SvtSaveOptions::GetODFSaneDefaultVersion() const
-{
-    return GetODFSaneDefaultVersion(pImp->pSaveOpt->GetODFDefaultVersion());
+    return GetODFSaneDefaultVersion(nRet);
 }
 
-SvtSaveOptions::ODFSaneDefaultVersion SvtSaveOptions::GetODFSaneDefaultVersion(ODFDefaultVersion eODFDefaultVersion)
+SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion(SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion)
 {
     switch (eODFDefaultVersion)
     {
         default:
             assert(!"map new ODFDefaultVersion to ODFSaneDefaultVersion");
             break;
-        case ODFVER_UNKNOWN:
-        case ODFVER_LATEST:
-            return ODFSVER_LATEST_EXTENDED;
-        case ODFVER_010:
-            return ODFSVER_010;
-        case ODFVER_011:
-            return ODFSVER_011;
-        case ODFVER_012:
-            return ODFSVER_012;
-        case ODFVER_012_EXT_COMPAT:
-            return ODFSVER_012_EXT_COMPAT;
-        case ODFVER_012_EXTENDED:
-            return ODFSVER_012_EXTENDED;
-        case ODFVER_013:
-            return ODFSVER_013;
+        case SvtSaveOptions::ODFVER_UNKNOWN:
+        case SvtSaveOptions::ODFVER_LATEST:
+            return SvtSaveOptions::ODFSVER_LATEST_EXTENDED;
+        case SvtSaveOptions::ODFVER_010:
+            return SvtSaveOptions::ODFSVER_010;
+        case SvtSaveOptions::ODFVER_011:
+            return SvtSaveOptions::ODFSVER_011;
+        case SvtSaveOptions::ODFVER_012:
+            return SvtSaveOptions::ODFSVER_012;
+        case SvtSaveOptions::ODFVER_012_EXT_COMPAT:
+            return SvtSaveOptions::ODFSVER_012_EXT_COMPAT;
+        case SvtSaveOptions::ODFVER_012_EXTENDED:
+            return SvtSaveOptions::ODFSVER_012_EXTENDED;
+        case SvtSaveOptions::ODFVER_013:
+            return SvtSaveOptions::ODFSVER_013;
     }
-    return ODFSVER_LATEST_EXTENDED;
-}
-
-bool SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption ) const
-{
-    return pImp->pSaveOpt->IsReadOnly(eOption);
+    return SvtSaveOptions::ODFSVER_LATEST_EXTENDED;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index d73783994271..3159aa44e683 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -261,7 +261,6 @@ public:
 
     uno::Reference< embed::XStorage >                   mxTargetStorage;
 
-    SvtSaveOptions                                      maSaveOptions;
     std::optional<SvtSaveOptions::ODFSaneDefaultVersion> m_oOverrideODFVersion;
 
     /// name of stream in package, e.g., "content.xml"
@@ -430,7 +429,7 @@ void SvXMLExport::DetermineModelType_()
                 xModule->getIdentifier() == "com.sun.star.sdb.FormDesign");
             if (isBaseForm)
             {
-                switch (mpImpl->maSaveOptions.GetODFSaneDefaultVersion())
+                switch (GetODFSaneDefaultVersion())
                 {
                     case SvtSaveOptions::ODFSVER_013_EXTENDED:
                         SAL_INFO("xmloff.core", "tdf#138209 force form export to ODF 1.2");
@@ -2327,7 +2326,7 @@ SvtSaveOptions::ODFSaneDefaultVersion SvXMLExport::getSaneDefaultVersion() const
     {
         return *mpImpl->m_oOverrideODFVersion;
     }
-    return mpImpl->maSaveOptions.GetODFSaneDefaultVersion();
+    return GetODFSaneDefaultVersion();
 }
 
 void
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 44bab345afe2..a2d9aa546190 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -548,7 +548,7 @@ vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter_(
     bool bDelInfo = false;
     if( !pFilterInfo )
     {
-        assert(SvtSaveOptions().GetODFDefaultVersion() != SvtSaveOptions::ODFVER_UNKNOWN);
+        assert(GetODFDefaultVersion() != SvtSaveOptions::ODFVER_UNKNOWN);
         const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(rExport.getSaneDefaultVersion());
         pFilterInfo = new FilterPropertiesInfo_Impl;
         for( sal_Int32 i=0; i < nProps; i++ )


More information about the Libreoffice-commits mailing list