cui/source/options/optsave.cxx     |   10 +++++--
 include/unotools/saveopt.hxx       |    4 ---
 unotools/source/config/saveopt.cxx |   47 +------------------------------------
 3 files changed, 9 insertions(+), 52 deletions(-)

New commits:
commit 293c1a629a69822b4a9996d0522513bc2a0d78e1
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sat Jul 24 09:30:49 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jul 25 12:56:18 2021 +0200

    use officecfg to retrieve LoadDocumentPrinter
    
    Change-Id: Ie9c164fb9c95989035ef769d0dd539521400e38e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119463
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index b6fb9e819682..8b3d3f1b86fa 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -232,7 +232,11 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
     }
 
     if ( m_xLoadDocPrinterCB->get_state_changed_from_saved() )
-        aSaveOpt.SetLoadDocumentPrinter( m_xLoadDocPrinterCB->get_active() );
+    {
+        auto xChanges = comphelper::ConfigurationChanges::create();
+        
officecfg::Office::Common::Save::Document::LoadPrinter::set(m_xLoadDocPrinterCB->get_active(),
 xChanges);
+        xChanges->commit();
+    }
 
     if ( m_xODFVersionLB->get_value_changed_from_saved() )
     {
@@ -367,9 +371,9 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
     m_xLoadUserSettingsCB->set_active(aSaveOpt.IsLoadUserSettings());
     m_xLoadUserSettingsCB->save_state();
     
m_xLoadUserSettingsCB->set_sensitive(!officecfg::Office::Common::Load::UserDefinedSettings::isReadOnly());
-    m_xLoadDocPrinterCB->set_active( aSaveOpt.IsLoadDocumentPrinter() );
+    m_xLoadDocPrinterCB->set_active( 
officecfg::Office::Common::Save::Document::LoadPrinter::get() );
     m_xLoadDocPrinterCB->save_state();
-    
m_xLoadDocPrinterCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::LoadDocPrinter));
+    
m_xLoadDocPrinterCB->set_sensitive(!officecfg::Office::Common::Save::Document::LoadPrinter::isReadOnly());
 
     if ( !pImpl->bInitialized )
     {
diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index 30c2f873b921..fafab60f3568 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -33,7 +33,6 @@ public:
     {
         UseUserData,
         Backup,
-        LoadDocPrinter,
         OdfDefaultVersion
     };
 
@@ -89,9 +88,6 @@ public:
     void                    SetLoadUserSettings(bool b);
     bool                IsLoadUserSettings() const;
 
-    void                    SetLoadDocumentPrinter( bool _bEnable );
-    bool                IsLoadDocumentPrinter( ) const;
-
     void                    SetODFDefaultVersion( ODFDefaultVersion eVersion );
     ODFDefaultVersion       GetODFDefaultVersion() const;
     ODFSaneDefaultVersion   GetODFSaneDefaultVersion() const;
diff --git a/unotools/source/config/saveopt.cxx 
b/unotools/source/config/saveopt.cxx
index 0900817e484e..46fac1c81094 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -61,14 +61,12 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
     sal_Int32                           nAutoSaveTime;
     bool                            bUseUserData,
                                         bBackup,
-                                        bAutoSave,
-                                        bLoadDocPrinter;
+                                        bAutoSave;
 
     SvtSaveOptions::ODFDefaultVersion   eODFDefaultVersion;
 
     bool                            bROUseUserData,
                                         bROBackup,
-                                        bROLoadDocPrinter,
                                         bROODFDefaultVersion;
 
     virtual void            ImplCommit() override;
@@ -80,14 +78,12 @@ public:
 
     bool                    IsUseUserData() const               { return 
bUseUserData; }
     bool                    IsBackup() const                    { return 
bBackup; }
-    bool                IsLoadDocPrinter() const            { return 
bLoadDocPrinter; }
 
     SvtSaveOptions::ODFDefaultVersion
                             GetODFDefaultVersion() const        { return 
eODFDefaultVersion; }
 
     void                    SetUseUserData( bool b );
     void                    SetBackup( bool b );
-    void                    SetLoadDocPrinter( bool bNew );
     void                    SetODFDefaultVersion( 
SvtSaveOptions::ODFDefaultVersion eNew );
 
     bool                IsReadOnly( SvtSaveOptions::EOption eOption ) const;
@@ -113,15 +109,6 @@ void SvtSaveOptions_Impl::SetBackup( bool b )
     }
 }
 
-void SvtSaveOptions_Impl::SetLoadDocPrinter( bool bNew )
-{
-    if ( !bROLoadDocPrinter && bLoadDocPrinter != bNew )
-    {
-        bLoadDocPrinter = bNew;
-        SetModified();
-    }
-}
-
 void SvtSaveOptions_Impl::SetODFDefaultVersion( 
SvtSaveOptions::ODFDefaultVersion eNew )
 {
     if ( !bROODFDefaultVersion && eODFDefaultVersion != eNew )
@@ -142,9 +129,6 @@ bool SvtSaveOptions_Impl::IsReadOnly( 
SvtSaveOptions::EOption eOption ) const
         case SvtSaveOptions::EOption::Backup :
             bReadOnly = bROBackup;
             break;
-        case SvtSaveOptions::EOption::LoadDocPrinter :
-            bReadOnly = bROLoadDocPrinter;
-            break;
         case SvtSaveOptions::EOption::OdfDefaultVersion :
             bReadOnly = bROODFDefaultVersion;
             break;
@@ -155,8 +139,7 @@ bool SvtSaveOptions_Impl::IsReadOnly( 
SvtSaveOptions::EOption eOption ) const
 #define FORMAT              0
 #define USEUSERDATA         1
 #define CREATEBACKUP        2
-#define LOADDOCPRINTER      3
-#define ODFDEFAULTVERSION   4
+#define ODFDEFAULTVERSION   3
 
 static Sequence< OUString > GetPropertyNames()
 {
@@ -165,7 +148,6 @@ static Sequence< OUString > GetPropertyNames()
         "Graphic/Format",
         "Document/UseUserData",
         "Document/CreateBackup",
-        "Document/LoadPrinter",
         "ODF/DefaultVersion"
     };
 
@@ -183,11 +165,9 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
     , nAutoSaveTime( 0 )
     , bUseUserData( false )
     , bBackup( false )
-    , bLoadDocPrinter( true )
     , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
     , bROUseUserData( CFG_READONLY_DEFAULT )
     , bROBackup( CFG_READONLY_DEFAULT )
-    , bROLoadDocPrinter( CFG_READONLY_DEFAULT )
     , bROODFDefaultVersion( CFG_READONLY_DEFAULT )
 {
     Sequence< OUString > aNames = GetPropertyNames();
@@ -243,11 +223,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl()
                                     bROBackup = pROStates[nProp];
                                     break;
 
-                                case LOADDOCPRINTER:
-                                    bLoadDocPrinter = bTemp;
-                                    bROLoadDocPrinter = pROStates[nProp];
-                                    break;
-
                                 default :
                                     SAL_WARN( "unotools.config", "invalid 
index to load a path" );
                             }
@@ -309,14 +284,6 @@ void SvtSaveOptions_Impl::ImplCommit()
                     ++nRealCount;
                 }
                 break;
-            case LOADDOCPRINTER:
-                if (!bROLoadDocPrinter)
-                {
-                    pValues[nRealCount] <<= bLoadDocPrinter;
-                    pNames[nRealCount] = pOrgNames[i];
-                    ++nRealCount;
-                }
-                break;
             case ODFDEFAULTVERSION:
                 if (!bROODFDefaultVersion)
                 {
@@ -457,16 +424,6 @@ bool   SvtSaveOptions::IsLoadUserSettings() const
     return pImp->pLoadOpt->IsLoadUserSettings();
 }
 
-void SvtSaveOptions::SetLoadDocumentPrinter( bool _bEnable )
-{
-    pImp->pSaveOpt->SetLoadDocPrinter( _bEnable );
-}
-
-bool SvtSaveOptions::IsLoadDocumentPrinter() const
-{
-    return pImp->pSaveOpt->IsLoadDocPrinter();
-}
-
 void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion 
eVersion )
 {
     pImp->pSaveOpt->SetODFDefaultVersion( eVersion );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to