[Libreoffice-commits] core.git: cui/source include/unotools unotools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Jul 25 13:31:57 UTC 2021


 cui/source/options/optgenrl.cxx    |   10 +++--
 cui/source/options/optsave.cxx     |    1 
 include/unotools/saveopt.hxx       |    4 --
 unotools/source/config/saveopt.cxx |   66 ++-----------------------------------
 4 files changed, 11 insertions(+), 70 deletions(-)

New commits:
commit 60fc68e547cf70f82e681c9a17b4f3e5c124aa39
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 24 13:38:46 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 25 15:31:25 2021 +0200

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

diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 66c734af1194..df31ee10522d 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -34,6 +34,7 @@
 #include <svl/intitem.hxx>
 #include <vcl/settings.hxx>
 
+#include <officecfg/Office/Common.hxx>
 #include <unotools/useroptions.hxx>
 #include <cuioptgenrl.hxx>
 #include <svx/svxids.hrc>
@@ -349,10 +350,11 @@ bool SvxGeneralTabPage::FillItemSet( SfxItemSet* )
 
     bool bModified = false;
     bModified |= GetData_Impl();
-    SvtSaveOptions aSaveOpt;
-    if (m_xUseDataCB->get_active() != aSaveOpt.IsUseUserData())
+    if (m_xUseDataCB->get_active() != officecfg::Office::Common::Save::Document::UseUserData::get())
     {
-        aSaveOpt.SetUseUserData(m_xUseDataCB->get_active());
+        auto xChanges = comphelper::ConfigurationChanges::create();
+        officecfg::Office::Common::Save::Document::UseUserData::set(m_xUseDataCB->get_active(), xChanges);
+        xChanges->commit();
         bModified = true;
     }
     return bModified;
@@ -377,7 +379,7 @@ void SvxGeneralTabPage::Reset( const SfxItemSet* rSet )
             vFields.front()->xEdit->grab_focus();
     }
 
-    m_xUseDataCB->set_active(SvtSaveOptions().IsUseUserData());
+    m_xUseDataCB->set_active(officecfg::Office::Common::Save::Document::UseUserData::get());
 }
 
 
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 8748f55f4a7d..3ac609d8e64f 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -41,6 +41,7 @@
 #include <tools/diagnose_ex.h>
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Office/Recovery.hxx>
+#include <officecfg/Office/Common.hxx>
 
 #include <sfx2/fcontnr.hxx>
 
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index 008c139a5ff6..17fcf3affdfd 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -31,7 +31,6 @@ public:
 
     enum class EOption
     {
-        UseUserData,
         OdfDefaultVersion
     };
 
@@ -78,9 +77,6 @@ public:
     SvtSaveOptions();
     virtual ~SvtSaveOptions() override;
 
-    void                    SetUseUserData( bool b );
-    bool                IsUseUserData() const;
-
     void                    SetLoadUserSettings(bool b);
     bool                IsLoadUserSettings() const;
 
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx
index 23632e4fcb62..615cc033acd3 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -59,13 +59,11 @@ namespace {
 class SvtSaveOptions_Impl : public utl::ConfigItem
 {
     sal_Int32                           nAutoSaveTime;
-    bool                            bUseUserData,
-                                        bAutoSave;
+    bool                            bAutoSave;
 
     SvtSaveOptions::ODFDefaultVersion   eODFDefaultVersion;
 
-    bool                            bROUseUserData,
-                                        bROODFDefaultVersion;
+    bool                            bROODFDefaultVersion;
 
     virtual void            ImplCommit() override;
 
@@ -74,12 +72,9 @@ public:
 
     virtual void            Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
 
-    bool                    IsUseUserData() const               { return bUseUserData; }
-
     SvtSaveOptions::ODFDefaultVersion
                             GetODFDefaultVersion() const        { return eODFDefaultVersion; }
 
-    void                    SetUseUserData( bool b );
     void                    SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew );
 
     bool                IsReadOnly( SvtSaveOptions::EOption eOption ) const;
@@ -87,15 +82,6 @@ public:
 
 }
 
-void SvtSaveOptions_Impl::SetUseUserData( bool b )
-{
-    if (!bROUseUserData && bUseUserData!=b)
-    {
-        bUseUserData = b;
-        SetModified();
-    }
-}
-
 void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew )
 {
     if ( !bROODFDefaultVersion && eODFDefaultVersion != eNew )
@@ -110,9 +96,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
     bool bReadOnly = CFG_READONLY_DEFAULT;
     switch(eOption)
     {
-        case SvtSaveOptions::EOption::UseUserData :
-            bReadOnly = bROUseUserData;
-            break;
         case SvtSaveOptions::EOption::OdfDefaultVersion :
             bReadOnly = bROODFDefaultVersion;
             break;
@@ -121,15 +104,13 @@ bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
 }
 
 #define FORMAT              0
-#define USEUSERDATA         1
-#define ODFDEFAULTVERSION   2
+#define ODFDEFAULTVERSION   1
 
 static Sequence< OUString > GetPropertyNames()
 {
     static const char* aPropNames[] =
     {
         "Graphic/Format",
-        "Document/UseUserData",
         "ODF/DefaultVersion"
     };
 
@@ -145,9 +126,7 @@ static Sequence< OUString > GetPropertyNames()
 SvtSaveOptions_Impl::SvtSaveOptions_Impl()
     : ConfigItem( "Office.Common/Save" )
     , nAutoSaveTime( 0 )
-    , bUseUserData( false )
     , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
-    , bROUseUserData( CFG_READONLY_DEFAULT )
     , bROODFDefaultVersion( CFG_READONLY_DEFAULT )
 {
     Sequence< OUString > aNames = GetPropertyNames();
@@ -188,26 +167,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
                     }
 
                     default:
-                    {
-                        bool bTemp = bool();
-                        if ( pValues[nProp] >>= bTemp )
-                        {
-                            switch ( nProp )
-                            {
-                                case USEUSERDATA :
-                                    bUseUserData = bTemp;
-                                    bROUseUserData = pROStates[nProp];
-                                    break;
-
-                                default :
-                                    SAL_WARN( "unotools.config", "invalid index to load a path" );
-                            }
-                        }
-                        else
-                        {
-                            OSL_FAIL( "Wrong Type!" );
-                        }
-                    }
+                        OSL_FAIL( "Wrong Type!" );
                 }
             }
         }
@@ -244,14 +204,6 @@ void SvtSaveOptions_Impl::ImplCommit()
             case FORMAT:
                 // not supported anymore
                 break;
-            case USEUSERDATA :
-                if (!bROUseUserData)
-                {
-                    pValues[nRealCount] <<= bUseUserData;
-                    pNames[nRealCount] = pOrgNames[i];
-                    ++nRealCount;
-                }
-                break;
             case ODFDEFAULTVERSION:
                 if (!bROODFDefaultVersion)
                 {
@@ -362,16 +314,6 @@ SvtSaveOptions::~SvtSaveOptions()
     }
 }
 
-void SvtSaveOptions::SetUseUserData( bool b )
-{
-    pImp->pSaveOpt->SetUseUserData( b );
-}
-
-bool SvtSaveOptions::IsUseUserData() const
-{
-    return pImp->pSaveOpt->IsUseUserData();
-}
-
 void SvtSaveOptions::SetLoadUserSettings(bool b)
 {
     pImp->pLoadOpt->SetLoadUserSettings(b);


More information about the Libreoffice-commits mailing list