cui/source/options/optsave.cxx |  348 ++++++++++++++++++-----------------------
 cui/source/options/optsave.hxx |   47 ++---
 cui/uiconfig/ui/optsavepage.ui |   13 -
 3 files changed, 188 insertions(+), 220 deletions(-)

New commits:
commit 5d78e7dc8ece62c731ee81f5dc60a0309121dcff
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Jul 27 15:12:06 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Jul 27 17:09:10 2019 +0200

    weld SvxSaveTabPage
    
    Change-Id: I89b81ff408d2dc855fe7b780a62e85f3a2a06215
    Reviewed-on: https://gerrit.libreoffice.org/76472
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index eb86ee50a908..64faac98f389 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -70,52 +70,47 @@ SvxSaveTabPage_Impl::SvxSaveTabPage_Impl() : bInitialized( 
false )
 
 // class SvxSaveTabPage --------------------------------------------------
 
-SvxSaveTabPage::SvxSaveTabPage( vcl::Window* pParent, const SfxItemSet& 
rCoreSet ) :
-    SfxTabPage( pParent, "OptSavePage", "cui/ui/optsavepage.ui", &rCoreSet ),
-    pImpl( new SvxSaveTabPage_Impl )
+SvxSaveTabPage::SvxSaveTabPage(TabPageParent pParent, const SfxItemSet& 
rCoreSet)
+    : SfxTabPage( pParent, "cui/ui/optsavepage.ui", "OptSavePage", &rCoreSet )
+    , pImpl(new SvxSaveTabPage_Impl)
+    , m_xLoadUserSettingsCB(m_xBuilder->weld_check_button("load_settings"))
+    , m_xLoadDocPrinterCB(m_xBuilder->weld_check_button("load_docprinter"))
+    , m_xDocInfoCB(m_xBuilder->weld_check_button("docinfo"))
+    , m_xBackupCB(m_xBuilder->weld_check_button("backup"))
+    , m_xAutoSaveCB(m_xBuilder->weld_check_button("autosave"))
+    , m_xAutoSaveEdit(m_xBuilder->weld_spin_button("autosave_spin"))
+    , m_xMinuteFT(m_xBuilder->weld_label("autosave_mins"))
+    , m_xUserAutoSaveCB(m_xBuilder->weld_check_button("userautosave"))
+    , m_xRelativeFsysCB(m_xBuilder->weld_check_button("relative_fsys"))
+    , m_xRelativeInetCB(m_xBuilder->weld_check_button("relative_inet"))
+    , m_xODFVersionLB(m_xBuilder->weld_combo_box("odfversion"))
+    , m_xWarnAlienFormatCB(m_xBuilder->weld_check_button("warnalienformat"))
+    , m_xDocTypeLB(m_xBuilder->weld_combo_box("doctype"))
+    , m_xSaveAsFT(m_xBuilder->weld_label("saveas_label"))
+    , m_xSaveAsLB(m_xBuilder->weld_combo_box("saveas"))
+    , m_xODFWarningFI(m_xBuilder->weld_widget("odfwarning_image"))
+    , m_xODFWarningFT(m_xBuilder->weld_label("odfwarning_label"))
 {
-    get(aLoadUserSettingsCB, "load_settings");
-    get(aLoadDocPrinterCB,  "load_docprinter");
-
-    get(aDocInfoCB, "docinfo");
-    get(aBackupCB, "backup");
-    get(aAutoSaveCB, "autosave");
-    get(aAutoSaveEdit, "autosave_spin");
-    get(aMinuteFT, "autosave_mins");
-    get(aUserAutoSaveCB, "userautosave");
-    get(aRelativeFsysCB, "relative_fsys");
-    get(aRelativeInetCB, "relative_inet");
-
-    get(aODFVersionLB, "odfversion");
-    get(aWarnAlienFormatCB, "warnalienformat");
-    get(aDocTypeLB, "doctype");
-    get(aSaveAsFT, "saveas_label");
-    get(aSaveAsLB, "saveas");
-    get(aODFWarningFI, "odfwarning_image");
-    get(aODFWarningFT, "odfwarning_label");
-
-
-    aODFVersionLB->SetEntryData(0, reinterpret_cast<void*>(2         )); // 
1.0/1.1
-    aODFVersionLB->SetEntryData(1, reinterpret_cast<void*>(4         )); // 1.2
-    aODFVersionLB->SetEntryData(2, reinterpret_cast<void*>(8         )); // 
1.2 Extended (compatibility mode)
-    aODFVersionLB->SetEntryData(3, reinterpret_cast<void*>(0x7fffffff)); // 
1.2 Extended (recommended)
-
-    aDocTypeLB->SetEntryData(0, reinterpret_cast<void*>(APP_WRITER)       );
-    aDocTypeLB->SetEntryData(1, reinterpret_cast<void*>(APP_WRITER_WEB)   );
-    aDocTypeLB->SetEntryData(2, reinterpret_cast<void*>(APP_WRITER_GLOBAL));
-    aDocTypeLB->SetEntryData(3, reinterpret_cast<void*>(APP_CALC)         );
-    aDocTypeLB->SetEntryData(4, reinterpret_cast<void*>(APP_IMPRESS)      );
-    aDocTypeLB->SetEntryData(5, reinterpret_cast<void*>(APP_DRAW)         );
-    aDocTypeLB->SetEntryData(6, reinterpret_cast<void*>(APP_MATH)         );
-
-    aAutoSaveCB->SetClickHdl( LINK( this, SvxSaveTabPage, AutoClickHdl_Impl ) 
);
-    aAutoSaveEdit->SetMaxTextLen( 2 );
+    m_xODFVersionLB->set_id(0, OUString::number(2         )); // 1.0/1.1
+    m_xODFVersionLB->set_id(1, OUString::number(4         )); // 1.2
+    m_xODFVersionLB->set_id(2, OUString::number(8         )); // 1.2 Extended 
(compatibility mode)
+    m_xODFVersionLB->set_id(3, OUString::number(0x7fffffff)); // 1.2 Extended 
(recommended)
+
+    m_xDocTypeLB->set_id(0, OUString::number(APP_WRITER)       );
+    m_xDocTypeLB->set_id(1, OUString::number(APP_WRITER_WEB)   );
+    m_xDocTypeLB->set_id(2, OUString::number(APP_WRITER_GLOBAL));
+    m_xDocTypeLB->set_id(3, OUString::number(APP_CALC)         );
+    m_xDocTypeLB->set_id(4, OUString::number(APP_IMPRESS)      );
+    m_xDocTypeLB->set_id(5, OUString::number(APP_DRAW)         );
+    m_xDocTypeLB->set_id(6, OUString::number(APP_MATH)         );
+
+    m_xAutoSaveCB->connect_clicked( LINK( this, SvxSaveTabPage, 
AutoClickHdl_Impl ) );
 
     SvtModuleOptions aModuleOpt;
     if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
     {
-        aSaveAsLB->RemoveEntry(aSaveAsLB->GetEntryPos( 
reinterpret_cast<void*>(APP_MATH) ));
-        aDocTypeLB->RemoveEntry(aDocTypeLB->GetEntryPos( 
reinterpret_cast<void*>(APP_MATH) ));
+        m_xSaveAsLB->remove_id(OUString::number(APP_MATH));
+        m_xDocTypeLB->remove_id(OUString::number(APP_MATH));
     }
     else
     {
@@ -125,8 +120,8 @@ SvxSaveTabPage::SvxSaveTabPage( vcl::Window* pParent, const 
SfxItemSet& rCoreSet
 
     if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) )
     {
-        aSaveAsLB->RemoveEntry(aSaveAsLB->GetEntryPos( 
reinterpret_cast<void*>(APP_DRAW) ));
-        aDocTypeLB->RemoveEntry(aDocTypeLB->GetEntryPos( 
reinterpret_cast<void*>(APP_DRAW) ));
+        m_xSaveAsLB->remove_id(OUString::number(APP_DRAW));
+        m_xDocTypeLB->remove_id(OUString::number(APP_DRAW));
     }
     else
     {
@@ -136,8 +131,8 @@ SvxSaveTabPage::SvxSaveTabPage( vcl::Window* pParent, const 
SfxItemSet& rCoreSet
 
     if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) )
     {
-        aSaveAsLB->RemoveEntry(aSaveAsLB->GetEntryPos( 
reinterpret_cast<void*>(APP_IMPRESS) ));
-        aDocTypeLB->RemoveEntry(aDocTypeLB->GetEntryPos( 
reinterpret_cast<void*>(APP_IMPRESS) ));
+        m_xSaveAsLB->remove_id(OUString::number(APP_IMPRESS));
+        m_xDocTypeLB->remove_id(OUString::number(APP_IMPRESS));
     }
     else
     {
@@ -147,8 +142,8 @@ SvxSaveTabPage::SvxSaveTabPage( vcl::Window* pParent, const 
SfxItemSet& rCoreSet
 
     if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) )
     {
-        aSaveAsLB->RemoveEntry(aSaveAsLB->GetEntryPos( 
reinterpret_cast<void*>(APP_CALC) ));
-        aDocTypeLB->RemoveEntry(aDocTypeLB->GetEntryPos( 
reinterpret_cast<void*>(APP_CALC) ));
+        m_xSaveAsLB->remove_id(OUString::number(APP_CALC));
+        m_xDocTypeLB->remove_id(OUString::number(APP_CALC));
     }
     else
     {
@@ -158,12 +153,12 @@ SvxSaveTabPage::SvxSaveTabPage( vcl::Window* pParent, 
const SfxItemSet& rCoreSet
 
     if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
     {
-        aSaveAsLB->RemoveEntry(aSaveAsLB->GetEntryPos( 
reinterpret_cast<void*>(APP_WRITER) ));
-        aSaveAsLB->RemoveEntry(aSaveAsLB->GetEntryPos( 
reinterpret_cast<void*>(APP_WRITER_WEB) ));
-        aSaveAsLB->RemoveEntry(aSaveAsLB->GetEntryPos( 
reinterpret_cast<void*>(APP_WRITER_GLOBAL) ));
-        aDocTypeLB->RemoveEntry(aDocTypeLB->GetEntryPos( 
reinterpret_cast<void*>(APP_WRITER) ));
-        aDocTypeLB->RemoveEntry(aDocTypeLB->GetEntryPos( 
reinterpret_cast<void*>(APP_WRITER_WEB) ));
-        aDocTypeLB->RemoveEntry(aDocTypeLB->GetEntryPos( 
reinterpret_cast<void*>(APP_WRITER_GLOBAL) ));
+        m_xSaveAsLB->remove_id(OUString::number(APP_WRITER));
+        m_xSaveAsLB->remove_id(OUString::number(APP_WRITER_WEB));
+        m_xSaveAsLB->remove_id(OUString::number(APP_WRITER_GLOBAL));
+        m_xDocTypeLB->remove_id(OUString::number(APP_WRITER));
+        m_xDocTypeLB->remove_id(OUString::number(APP_WRITER_WEB));
+        m_xDocTypeLB->remove_id(OUString::number(APP_WRITER_GLOBAL));
     }
     else
     {
@@ -175,48 +170,23 @@ SvxSaveTabPage::SvxSaveTabPage( vcl::Window* pParent, 
const SfxItemSet& rCoreSet
         pImpl->aDefaultReadonlyArr[APP_WRITER_GLOBAL] = 
aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::WRITERGLOBAL);
     }
 
-    Link<ListBox&,void> aLink = LINK( this, SvxSaveTabPage, ODFVersionHdl_Impl 
);
-    aODFVersionLB->SetSelectHdl( aLink );
+    Link<weld::ComboBox&,void> aLink = LINK( this, SvxSaveTabPage, 
ODFVersionHdl_Impl );
+    m_xODFVersionLB->connect_changed( aLink );
     aLink = LINK( this, SvxSaveTabPage, FilterHdl_Impl );
-    aDocTypeLB->SetSelectHdl( aLink );
-    aSaveAsLB->SetSelectHdl( aLink );
+    m_xDocTypeLB->connect_changed( aLink );
+    m_xSaveAsLB->connect_changed( aLink );
 
     DetectHiddenControls();
 }
 
-
 SvxSaveTabPage::~SvxSaveTabPage()
 {
-    disposeOnce();
 }
 
-void SvxSaveTabPage::dispose()
+VclPtr<SfxTabPage> SvxSaveTabPage::Create(TabPageParent pParent,
+                                          const SfxItemSet* rAttrSet)
 {
-    pImpl.reset();
-    aLoadUserSettingsCB.clear();
-    aLoadDocPrinterCB.clear();
-    aDocInfoCB.clear();
-    aBackupCB.clear();
-    aAutoSaveCB.clear();
-    aAutoSaveEdit.clear();
-    aMinuteFT.clear();
-    aUserAutoSaveCB.clear();
-    aRelativeFsysCB.clear();
-    aRelativeInetCB.clear();
-    aODFVersionLB.clear();
-    aWarnAlienFormatCB.clear();
-    aDocTypeLB.clear();
-    aSaveAsFT.clear();
-    aSaveAsLB.clear();
-    aODFWarningFI.clear();
-    aODFWarningFT.clear();
-    SfxTabPage::dispose();
-}
-
-VclPtr<SfxTabPage> SvxSaveTabPage::Create( TabPageParent pParent,
-                                           const SfxItemSet* rAttrSet )
-{
-    return VclPtr<SvxSaveTabPage>::Create( pParent.pParent, *rAttrSet );
+    return VclPtr<SvxSaveTabPage>::Create(pParent, *rAttrSet);
 }
 
 void SvxSaveTabPage::DetectHiddenControls()
@@ -226,21 +196,21 @@ void SvxSaveTabPage::DetectHiddenControls()
     if ( aOptionsDlgOpt.IsOptionHidden( "Backup", CFG_PAGE_AND_GROUP ) )
     {
         // hide controls of "Backup"
-        aBackupCB->Hide();
+        m_xBackupCB->hide();
     }
 
     if ( aOptionsDlgOpt.IsOptionHidden( "AutoSave", CFG_PAGE_AND_GROUP ) )
     {
         // hide controls of "AutoSave"
-        aAutoSaveCB->Hide();
-        aAutoSaveEdit->Hide();
-        aMinuteFT->Hide();
+        m_xAutoSaveCB->hide();
+        m_xAutoSaveEdit->hide();
+        m_xMinuteFT->hide();
     }
 
     if ( aOptionsDlgOpt.IsOptionHidden( "UserAutoSave", CFG_PAGE_AND_GROUP ) )
     {
         // hide controls of "UserAutoSave"
-        aUserAutoSaveCB->Hide();
+        m_xUserAutoSaveCB->hide();
     }
 
 }
@@ -249,72 +219,72 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
     bool bModified = false;
     SvtSaveOptions aSaveOpt;
-    if(aLoadUserSettingsCB->IsValueChangedFromSaved())
+    if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
     {
-        aSaveOpt.SetLoadUserSettings(aLoadUserSettingsCB->IsChecked());
+        aSaveOpt.SetLoadUserSettings(m_xLoadUserSettingsCB->get_active());
     }
 
-    if ( aLoadDocPrinterCB->IsValueChangedFromSaved() )
-        aSaveOpt.SetLoadDocumentPrinter( aLoadDocPrinterCB->IsChecked() );
+    if ( m_xLoadDocPrinterCB->get_state_changed_from_saved() )
+        aSaveOpt.SetLoadDocumentPrinter( m_xLoadDocPrinterCB->get_active() );
 
-    if ( aODFVersionLB->IsValueChangedFromSaved() )
+    if ( m_xODFVersionLB->get_value_changed_from_saved() )
     {
-        sal_IntPtr nVersion = sal_IntPtr( 
aODFVersionLB->GetSelectedEntryData() );
+        sal_Int32 nVersion = m_xODFVersionLB->get_active_id().toInt32();
         aSaveOpt.SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( 
nVersion ) );
     }
 
-    if ( aDocInfoCB->IsValueChangedFromSaved() )
+    if ( m_xDocInfoCB->get_state_changed_from_saved() )
     {
         rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_DOCINFO ),
-                               aDocInfoCB->IsChecked() ) );
+                               m_xDocInfoCB->get_active() ) );
         bModified = true;
     }
 
-    if ( aBackupCB->IsEnabled() && aBackupCB->IsValueChangedFromSaved() )
+    if ( m_xBackupCB->get_sensitive() && 
m_xBackupCB->get_state_changed_from_saved() )
     {
         rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_BACKUP ),
-                               aBackupCB->IsChecked() ) );
+                               m_xBackupCB->get_active() ) );
         bModified = true;
     }
 
-    if ( aAutoSaveCB->IsValueChangedFromSaved() )
+    if ( m_xAutoSaveCB->get_state_changed_from_saved() )
     {
         rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_AUTOSAVE ),
-                               aAutoSaveCB->IsChecked() ) );
+                               m_xAutoSaveCB->get_active() ) );
         bModified = true;
     }
-    if ( aWarnAlienFormatCB->IsValueChangedFromSaved() )
+    if ( m_xWarnAlienFormatCB->get_state_changed_from_saved() )
     {
         rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_WARNALIENFORMAT ),
-                               aWarnAlienFormatCB->IsChecked() ) );
+                               m_xWarnAlienFormatCB->get_active() ) );
         bModified = true;
     }
 
-    if ( aAutoSaveEdit->IsValueChangedFromSaved() )
+    if ( m_xAutoSaveEdit->get_value_changed_from_saved() )
     {
         rSet->Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ),
-                                 
static_cast<sal_uInt16>(aAutoSaveEdit->GetValue()) ) );
+                                 
static_cast<sal_uInt16>(m_xAutoSaveEdit->get_value()) ) );
         bModified = true;
     }
 
-    if ( aUserAutoSaveCB->IsValueChangedFromSaved() )
+    if ( m_xUserAutoSaveCB->get_state_changed_from_saved() )
     {
         rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_USERAUTOSAVE ),
-                               aUserAutoSaveCB->IsChecked() ) );
+                               m_xUserAutoSaveCB->get_active() ) );
         bModified = true;
     }
     // save relatively
-    if ( aRelativeFsysCB->IsValueChangedFromSaved() )
+    if ( m_xRelativeFsysCB->get_state_changed_from_saved() )
     {
         rSet->Put( SfxBoolItem( GetWhich( SID_SAVEREL_FSYS ),
-                               aRelativeFsysCB->IsChecked() ) );
+                               m_xRelativeFsysCB->get_active() ) );
         bModified = true;
     }
 
-    if ( aRelativeInetCB->IsValueChangedFromSaved() )
+    if ( m_xRelativeInetCB->get_state_changed_from_saved() )
     {
         rSet->Put( SfxBoolItem( GetWhich( SID_SAVEREL_INET ),
-                               aRelativeInetCB->IsChecked() ) );
+                               m_xRelativeInetCB->get_active() ) );
         bModified = true;
     }
 
@@ -387,12 +357,12 @@ static bool isODFFormat( const OUString& sFilter )
 void SvxSaveTabPage::Reset( const SfxItemSet* )
 {
     SvtSaveOptions aSaveOpt;
-    aLoadUserSettingsCB->Check(aSaveOpt.IsLoadUserSettings());
-    aLoadUserSettingsCB->SaveValue();
-    
aLoadUserSettingsCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UseUserData));
-    aLoadDocPrinterCB->Check( aSaveOpt.IsLoadDocumentPrinter() );
-    aLoadDocPrinterCB->SaveValue();
-    
aLoadDocPrinterCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::LoadDocPrinter));
+    m_xLoadUserSettingsCB->set_active(aSaveOpt.IsLoadUserSettings());
+    m_xLoadUserSettingsCB->save_state();
+    
m_xLoadUserSettingsCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UseUserData));
+    m_xLoadDocPrinterCB->set_active( aSaveOpt.IsLoadDocumentPrinter() );
+    m_xLoadDocPrinterCB->save_state();
+    
m_xLoadDocPrinterCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::LoadDocPrinter));
 
     if ( !pImpl->bInitialized )
     {
@@ -405,9 +375,9 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
             Reference< XContainerQuery > xQuery(pImpl->xFact, UNO_QUERY);
             if(xQuery.is())
             {
-                for(sal_Int32 n = 0; n < aDocTypeLB->GetEntryCount(); n++)
+                for (sal_Int32 n = 0, nEntryCount = m_xDocTypeLB->get_count(); 
n < nEntryCount; ++n)
                 {
-                    sal_IntPtr nData = 
reinterpret_cast<sal_IntPtr>(aDocTypeLB->GetEntryData(n));
+                    int nData = m_xDocTypeLB->get_id(n).toInt32();
                     OUString sCommand = 
"getSortedFilterList():module=%1:iflags=" +
                                
OUString::number(static_cast<int>(SfxFilterFlags::IMPORT|SfxFilterFlags::EXPORT))
 +
                                ":eflags=" +
@@ -442,8 +412,8 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
                     pImpl->aODFArr[nData] = lODFList;
                 }
             }
-            aDocTypeLB->SelectEntryPos(0);
-            FilterHdl_Impl(*aDocTypeLB);
+            m_xDocTypeLB->set_active(0);
+            FilterHdl_Impl(*m_xDocTypeLB);
         }
         catch(Exception const &)
         {
@@ -454,67 +424,66 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
         pImpl->bInitialized = true;
     }
 
-    aDocInfoCB->Check(aSaveOpt.IsDocInfoSave());
-    
aDocInfoCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::DocInfSave));
+    m_xDocInfoCB->set_active(aSaveOpt.IsDocInfoSave());
+    
m_xDocInfoCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::DocInfSave));
 
-    aBackupCB->Check(aSaveOpt.IsBackup());
-    aBackupCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::Backup));
+    m_xBackupCB->set_active(aSaveOpt.IsBackup());
+    
m_xBackupCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::Backup));
 
-    aAutoSaveCB->Check(aSaveOpt.IsAutoSave());
-    
aAutoSaveCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSave));
+    m_xAutoSaveCB->set_active(aSaveOpt.IsAutoSave());
+    
m_xAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSave));
 
-    aUserAutoSaveCB->Check(aSaveOpt.IsUserAutoSave());
-    
aUserAutoSaveCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UserAutoSave));
+    m_xUserAutoSaveCB->set_active(aSaveOpt.IsUserAutoSave());
+    
m_xUserAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UserAutoSave));
 
-    aWarnAlienFormatCB->Check(aSaveOpt.IsWarnAlienFormat());
-    
aWarnAlienFormatCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat));
+    m_xWarnAlienFormatCB->set_active(aSaveOpt.IsWarnAlienFormat());
+    
m_xWarnAlienFormatCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat));
 
-    aAutoSaveEdit->SetValue(aSaveOpt.GetAutoSaveTime());
-    
aAutoSaveEdit->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime));
+    m_xAutoSaveEdit->set_value(aSaveOpt.GetAutoSaveTime());
+    
m_xAutoSaveEdit->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime));
 
     // save relatively
-    aRelativeFsysCB->Check(aSaveOpt.IsSaveRelFSys());
-    
aRelativeFsysCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelFsys));
+    m_xRelativeFsysCB->set_active(aSaveOpt.IsSaveRelFSys());
+    
m_xRelativeFsysCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelFsys));
 
-    aRelativeInetCB->Check(aSaveOpt.IsSaveRelINet());
-    
aRelativeInetCB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelInet));
+    m_xRelativeInetCB->set_active(aSaveOpt.IsSaveRelINet());
+    
m_xRelativeInetCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelInet));
 
-    void* pDefaultVersion = reinterpret_cast<void*>( 
aSaveOpt.GetODFDefaultVersion() );
-    aODFVersionLB->SelectEntryPos( aODFVersionLB->GetEntryPos( pDefaultVersion 
) );
-    
aODFVersionLB->Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::OdfDefaultVersion));
+    sal_Int32 nDefaultVersion = aSaveOpt.GetODFDefaultVersion();
+    m_xODFVersionLB->set_active_id(OUString::number(nDefaultVersion));
+    
m_xODFVersionLB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::OdfDefaultVersion));
 
-    AutoClickHdl_Impl( aAutoSaveCB );
-    ODFVersionHdl_Impl( *aODFVersionLB );
+    AutoClickHdl_Impl(*m_xAutoSaveCB);
+    ODFVersionHdl_Impl(*m_xODFVersionLB);
 
-    aDocInfoCB->SaveValue();
-    aBackupCB->SaveValue();
-    aWarnAlienFormatCB->SaveValue();
-    aAutoSaveCB->SaveValue();
-    aAutoSaveEdit->SaveValue();
+    m_xDocInfoCB->save_state();
+    m_xBackupCB->save_state();
+    m_xWarnAlienFormatCB->save_state();
+    m_xAutoSaveCB->save_state();
+    m_xAutoSaveEdit->save_value();
 
-    aUserAutoSaveCB->SaveValue();
+    m_xUserAutoSaveCB->save_state();
 
-    aRelativeFsysCB->SaveValue();
-    aRelativeInetCB->SaveValue();
-    aODFVersionLB->SaveValue();
+    m_xRelativeFsysCB->save_state();
+    m_xRelativeInetCB->save_state();
+    m_xODFVersionLB->save_value();
 }
 
-
-IMPL_LINK( SvxSaveTabPage, AutoClickHdl_Impl, Button*, pBox, void )
+IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Button&, rBox, void)
 {
-    if ( pBox == aAutoSaveCB )
+    if (&rBox == m_xAutoSaveCB.get())
     {
-        if ( aAutoSaveCB->IsChecked() )
+        if (m_xAutoSaveCB->get_active())
         {
-            aAutoSaveEdit->Enable();
-            aMinuteFT->Enable();
-            aUserAutoSaveCB->Enable();
+            m_xAutoSaveEdit->set_sensitive(true);
+            m_xMinuteFT->set_sensitive(true);
+            m_xUserAutoSaveCB->set_sensitive(true);
         }
         else
         {
-            aAutoSaveEdit->Disable();
-            aMinuteFT->Disable();
-            aUserAutoSaveCB->Disable();
+            m_xAutoSaveEdit->set_sensitive(false);
+            m_xMinuteFT->set_sensitive(false);
+            m_xUserAutoSaveCB->set_sensitive(false);
         }
     }
 }
@@ -553,19 +522,19 @@ static OUString lcl_ExtracUIName(const 
Sequence<PropertyValue> &rProperties, con
     return sName;
 }
 
-IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, ListBox&, rBox, void )
+IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, weld::ComboBox&, rBox, void )
 {
-    const sal_Int32 nCurPos = aDocTypeLB->GetSelectedEntryPos();
+    const int nCurPos = m_xDocTypeLB->get_active();
 
-    sal_IntPtr nData = -1;
-    if(nCurPos < APP_COUNT)
-        nData = reinterpret_cast<sal_IntPtr>( 
aDocTypeLB->GetEntryData(nCurPos) );
+    int nData = -1;
+    if (nCurPos < APP_COUNT)
+        nData = m_xDocTypeLB->get_id(nCurPos).toInt32();
 
     if ( nData >= 0 && nData < APP_COUNT )
     {
-        if(aDocTypeLB == &rBox)
+        if(m_xDocTypeLB.get() == &rBox)
         {
-            aSaveAsLB->Clear();
+            m_xSaveAsLB->clear();
             auto & rFilters = pImpl->aFilterArr[nData];
             if(pImpl->aUIFilterArr[nData].empty())
             {
@@ -591,23 +560,24 @@ IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, ListBox&, 
rBox, void )
             OUString sSelect;
             for(size_t i = 0; i < pImpl->aUIFilterArr[nData].size(); i++)
             {
-                const sal_Int32 nEntryPos = 
aSaveAsLB->InsertEntry(rUIFilters[i]);
-                if ( pImpl->aODFArr[nData][i] )
-                    aSaveAsLB->SetEntryData( nEntryPos, 
static_cast<void*>(pImpl.get()) );
-                if(rFilters[i] == pImpl->aDefaultArr[nData])
+                OUString sId;
+                if (pImpl->aODFArr[nData][i])
+                    sId = 
OUString::number(reinterpret_cast<sal_Int64>(pImpl.get()));
+                m_xSaveAsLB->append(sId, rUIFilters[i]);
+                if (rFilters[i] == pImpl->aDefaultArr[nData])
                     sSelect = rUIFilters[i];
             }
-            if(!sSelect.isEmpty())
+            if (!sSelect.isEmpty())
             {
-                aSaveAsLB->SelectEntry(sSelect);
+                m_xSaveAsLB->set_active_text(sSelect);
             }
 
-            aSaveAsFT->Enable(!pImpl->aDefaultReadonlyArr[nData]);
-            aSaveAsLB->Enable(!pImpl->aDefaultReadonlyArr[nData]);
+            m_xSaveAsFT->set_sensitive(!pImpl->aDefaultReadonlyArr[nData]);
+            m_xSaveAsLB->set_sensitive(!pImpl->aDefaultReadonlyArr[nData]);
         }
         else
         {
-            OUString sSelect = rBox.GetSelectedEntry();
+            OUString sSelect = rBox.get_active_text();
             auto const & rFilters = pImpl->aFilterArr[nData];
             auto const & rUIFilters = pImpl->aUIFilterArr[nData];
             for(size_t i = 0; i < pImpl->aUIFilterArr[nData].size(); i++)
@@ -621,20 +591,20 @@ IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, ListBox&, 
rBox, void )
         }
     }
 
-    ODFVersionHdl_Impl( *aSaveAsLB );
-};
+    ODFVersionHdl_Impl( *m_xSaveAsLB );
+}
 
-IMPL_LINK_NOARG(SvxSaveTabPage, ODFVersionHdl_Impl, ListBox&, void)
+IMPL_LINK_NOARG(SvxSaveTabPage, ODFVersionHdl_Impl, weld::ComboBox&, void)
 {
-    sal_IntPtr nVersion = sal_IntPtr( aODFVersionLB->GetSelectedEntryData() );
-    bool bShown = SvtSaveOptions::ODFDefaultVersion( nVersion ) != 
SvtSaveOptions::ODFVER_LATEST;
+    sal_Int32 nVersion = m_xODFVersionLB->get_active_id().toInt32();
+    bool bShown = SvtSaveOptions::ODFDefaultVersion(nVersion) != 
SvtSaveOptions::ODFVER_LATEST;
     if ( bShown )
     {
         bool bHasODFFormat = false;
-        const sal_Int32 nCount = aSaveAsLB->GetEntryCount();
-        for ( sal_Int32 i = 0; i < nCount; ++i )
+        const int nCount = m_xSaveAsLB->get_count();
+        for (int i = 0; i < nCount; ++i )
         {
-            if ( aSaveAsLB->GetEntryData(i) != nullptr )
+            if ( m_xSaveAsLB->get_id(i).toInt64() != 0 )
             {
                 bHasODFFormat = true;
                 break;
@@ -642,11 +612,11 @@ IMPL_LINK_NOARG(SvxSaveTabPage, ODFVersionHdl_Impl, 
ListBox&, void)
         }
 
         bShown = !bHasODFFormat
-                || ( aSaveAsLB->GetSelectedEntryData() != nullptr );
+                || ( m_xSaveAsLB->get_active_id().toInt64() != 0);
     }
 
-    aODFWarningFI->Show( bShown );
-    aODFWarningFT->Show( bShown );
+    m_xODFWarningFI->set_visible(bShown);
+    m_xODFWarningFT->set_visible(bShown);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx
index a6b7579f16f5..2a5b19cf2ba6 100644
--- a/cui/source/options/optsave.hxx
+++ b/cui/source/options/optsave.hxx
@@ -47,38 +47,35 @@ struct SvxSaveTabPage_Impl;
 class SvxSaveTabPage : public SfxTabPage
 {
 private:
-    VclPtr<CheckBox>               aLoadUserSettingsCB;
-    VclPtr<CheckBox>               aLoadDocPrinterCB;
-
-    VclPtr<CheckBox>               aDocInfoCB;
-    VclPtr<CheckBox>               aBackupCB;
-    VclPtr<CheckBox>               aAutoSaveCB;
-    VclPtr<NumericField>           aAutoSaveEdit;
-    VclPtr<FixedText>              aMinuteFT;
-    VclPtr<CheckBox>               aUserAutoSaveCB;
-    VclPtr<CheckBox>               aRelativeFsysCB;
-    VclPtr<CheckBox>               aRelativeInetCB;
-
-    VclPtr<ListBox>                aODFVersionLB;
-    VclPtr<CheckBox>               aWarnAlienFormatCB;
-    VclPtr<ListBox>                aDocTypeLB;
-    VclPtr<FixedText>              aSaveAsFT;
-    VclPtr<ListBox>                aSaveAsLB;
-    VclPtr<FixedImage>             aODFWarningFI;
-    VclPtr<FixedText>              aODFWarningFT;
-
     std::unique_ptr<SvxSaveTabPage_Impl>    pImpl;
 
-    DECL_LINK( AutoClickHdl_Impl, Button*, void );
-    DECL_LINK( FilterHdl_Impl, ListBox&, void );
-    DECL_LINK(ODFVersionHdl_Impl, ListBox&, void );
+    std::unique_ptr<weld::CheckButton> m_xLoadUserSettingsCB;
+    std::unique_ptr<weld::CheckButton> m_xLoadDocPrinterCB;
+    std::unique_ptr<weld::CheckButton> m_xDocInfoCB;
+    std::unique_ptr<weld::CheckButton> m_xBackupCB;
+    std::unique_ptr<weld::CheckButton> m_xAutoSaveCB;
+    std::unique_ptr<weld::SpinButton> m_xAutoSaveEdit;
+    std::unique_ptr<weld::Label> m_xMinuteFT;
+    std::unique_ptr<weld::CheckButton> m_xUserAutoSaveCB;
+    std::unique_ptr<weld::CheckButton> m_xRelativeFsysCB;
+    std::unique_ptr<weld::CheckButton> m_xRelativeInetCB;
+    std::unique_ptr<weld::ComboBox> m_xODFVersionLB;
+    std::unique_ptr<weld::CheckButton> m_xWarnAlienFormatCB;
+    std::unique_ptr<weld::ComboBox> m_xDocTypeLB;
+    std::unique_ptr<weld::Label> m_xSaveAsFT;
+    std::unique_ptr<weld::ComboBox> m_xSaveAsLB;
+    std::unique_ptr<weld::Widget> m_xODFWarningFI;
+    std::unique_ptr<weld::Label> m_xODFWarningFT;
+
+    DECL_LINK( AutoClickHdl_Impl, weld::Button&, void );
+    DECL_LINK( FilterHdl_Impl, weld::ComboBox&, void );
+    DECL_LINK(ODFVersionHdl_Impl, weld::ComboBox&, void );
 
     void    DetectHiddenControls();
 
 public:
-    SvxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
+    SvxSaveTabPage(TabPageParent pParent, const SfxItemSet& rSet);
     virtual ~SvxSaveTabPage() override;
-    virtual void        dispose() override;
 
     static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const 
SfxItemSet* rAttrSet );
 
diff --git a/cui/uiconfig/ui/optsavepage.ui b/cui/uiconfig/ui/optsavepage.ui
index ae6308ecb2c6..61e38e2d5563 100644
--- a/cui/uiconfig/ui/optsavepage.ui
+++ b/cui/uiconfig/ui/optsavepage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -125,6 +125,8 @@
                       <object class="GtkSpinButton" id="autosave_spin">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="max_length">2</property>
+                        <property name="activates_default">True</property>
                         <property name="adjustment">adjustment1</property>
                       </object>
                       <packing>
@@ -152,7 +154,6 @@
                 <child>
                   <object class="GtkCheckButton" id="userautosave">
                     <property name="label" translatable="yes" 
context="optsavepage|userautosave">Automatically save the document 
too</property>
-                    <property name="visible">False</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="margin_left">12</property>
@@ -300,7 +301,7 @@
                       <object class="GtkImage" id="odfwarning_image">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property 
name="pixbuf">svx/res/caution_11x16.png</property>
+                        <property 
name="icon_name">svx/res/caution_11x16.png</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -334,10 +335,10 @@
                   <object class="GtkLabel" id="label5">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" 
context="optsavepage|label5">ODF format version:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">odfversion</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -348,10 +349,10 @@
                   <object class="GtkLabel" id="saveas_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" 
context="optsavepage|saveas_label">Always sa_ve as:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">saveas</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -391,10 +392,10 @@
                   <object class="GtkLabel" id="label6">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" 
context="optsavepage|label6">D_ocument type:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">doctype</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to