[Libreoffice-commits] core.git: sc/inc sc/qa sc/source sc/uiconfig sw/uiconfig

Caolán McNamara caolanm at redhat.com
Fri May 18 09:53:13 UTC 2018


 sc/inc/scabstdlg.hxx                      |    2 
 sc/qa/unit/screenshots/screenshots.cxx    |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx        |   25 +--
 sc/source/ui/attrdlg/scdlgfact.hxx        |   10 +
 sc/source/ui/inc/instbdlg.hxx             |   65 +++-----
 sc/source/ui/miscdlgs/instbdlg.cxx        |  235 ++++++++++++++----------------
 sc/source/ui/view/tabvwshf.cxx            |    2 
 sc/uiconfig/scalc/ui/insertsheet.ui       |   70 +++++---
 sw/uiconfig/swriter/ui/autoformattable.ui |    1 
 9 files changed, 206 insertions(+), 206 deletions(-)

New commits:
commit a0c15b39cb30736e04564420f55c50fefb51e41a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 18 09:09:30 2018 +0100

    weld ScInsertTableDlg
    
    Change-Id: Ia3e00ccdc89aaf7b5546a0b346d174814fcea97d
    Reviewed-on: https://gerrit.libreoffice.org/54518
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index cbdc8ea312f5..aaba06323367 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -447,7 +447,7 @@ public:
     virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent,
                                                                           const OUString* pStrTitle = nullptr) = 0;
 
-    virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData,
+    virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
         SCTAB nTabCount, bool bFromFile) = 0;
 
     virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg ( vcl::Window* pParent,
diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index 70d75047cbda..f3ddbbdbeeec 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -153,7 +153,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
             SCTAB nTabSelCount = rViewData.GetMarkData().GetSelectCount();
 
             pReturnDialog = mpFact->CreateScInsertTableDlg(
-                mpViewShell->GetDialogParent(), rViewData, nTabSelCount, false);
+                mpViewShell->GetFrameWeld(), rViewData, nTabSelCount, false);
 
             break;
         }
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 82f096e5b5bc..a810883911bf 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -116,7 +116,11 @@ short AbstractScInsertContentsDlg_Impl::Execute()
     return m_xDlg->run();
 }
 
-IMPL_ABSTDLG_BASE(AbstractScInsertTableDlg_Impl);
+short AbstractScInsertTableDlg_Impl::Execute()
+{
+    return m_xDlg->execute();
+}
+
 IMPL_ABSTDLG_BASE(AbstractScSelEntryDlg_Impl);
 
 short AbstractScMetricInputDlg_Impl::Execute()
@@ -396,37 +400,37 @@ InsCellCmd  AbstractScInsertContentsDlg_Impl::GetMoveMode()
 
 bool AbstractScInsertTableDlg_Impl::GetTablesFromFile()
 {
-    return pDlg->GetTablesFromFile();
+    return m_xDlg->GetTablesFromFile();
 }
 
 bool AbstractScInsertTableDlg_Impl::GetTablesAsLink()
 {
-    return pDlg->GetTablesAsLink();
+    return m_xDlg->GetTablesAsLink();
 }
 
 const OUString*  AbstractScInsertTableDlg_Impl::GetFirstTable( sal_uInt16* pN )
 {
-    return pDlg->GetFirstTable( pN );
+    return m_xDlg->GetFirstTable( pN );
 }
 
 ScDocShell* AbstractScInsertTableDlg_Impl::GetDocShellTables()
 {
-    return pDlg->GetDocShellTables();
+    return m_xDlg->GetDocShellTables();
 }
 
 bool AbstractScInsertTableDlg_Impl::IsTableBefore()
 {
-    return pDlg->IsTableBefore();
+    return m_xDlg->IsTableBefore();
 }
 
 sal_uInt16 AbstractScInsertTableDlg_Impl::GetTableCount()
 {
-    return pDlg->GetTableCount();
+    return m_xDlg->GetTableCount();
 }
 
 const OUString* AbstractScInsertTableDlg_Impl::GetNextTable( sal_uInt16* pN )
 {
-    return pDlg->GetNextTable( pN );
+    return m_xDlg->GetNextTable( pN );
 }
 
 OUString AbstractScSelEntryDlg_Impl::GetSelectedEntry() const
@@ -761,11 +765,10 @@ VclPtr<AbstractScInsertContentsDlg> ScAbstractDialogFactory_Impl::CreateScInsert
     return VclPtr<AbstractScInsertContentsDlg_Impl>::Create(new ScInsertContentsDlg(pParent, InsertDeleteFlags::NONE, pStrTitle));
 }
 
-VclPtr<AbstractScInsertTableDlg> ScAbstractDialogFactory_Impl::CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData,
+VclPtr<AbstractScInsertTableDlg> ScAbstractDialogFactory_Impl::CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
     SCTAB nTabCount, bool bFromFile)
 {
-    VclPtr<ScInsertTableDlg> pDlg = VclPtr<ScInsertTableDlg>::Create( pParent, rViewData,nTabCount, bFromFile );
-    return VclPtr<AbstractScInsertTableDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractScInsertTableDlg_Impl>::Create(new ScInsertTableDlg(pParent, rViewData,nTabCount, bFromFile));
 }
 
 VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg ( vcl::Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 4f3d55907e81..998bf0926eba 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -257,7 +257,13 @@ public:
 
 class AbstractScInsertTableDlg_Impl : public AbstractScInsertTableDlg
 {
-    DECL_ABSTDLG_BASE( AbstractScInsertTableDlg_Impl, ScInsertTableDlg)
+    std::unique_ptr<ScInsertTableDlg> m_xDlg;
+public:
+    explicit AbstractScInsertTableDlg_Impl(ScInsertTableDlg* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short           Execute() override;
     virtual bool            GetTablesFromFile() override;
     virtual bool            GetTablesAsLink() override;
     virtual const OUString* GetFirstTable( sal_uInt16* pN = nullptr ) override;
@@ -514,7 +520,7 @@ public:
     virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent,
                                                                           const OUString* pStrTitle = nullptr) override;
 
-    virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData,
+    virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
         SCTAB nTabCount, bool bFromFile) override;
 
     virtual VclPtr<AbstractScSelEntryDlg> CreateScSelEntryDlg ( vcl::Window* pParent,
diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx
index 05aa33b659b2..7e8e2b29eee9 100644
--- a/sc/source/ui/inc/instbdlg.hxx
+++ b/sc/source/ui/inc/instbdlg.hxx
@@ -20,17 +20,9 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_INSTBDLG_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_INSTBDLG_HXX
 
-#include <address.hxx>
-
-#include <vcl/button.hxx>
-#include <vcl/group.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/dialog.hxx>
-
 #include <sfx2/objsh.hxx>
-#include <vcl/field.hxx>
+#include <vcl/weld.hxx>
+#include <address.hxx>
 
 class ScViewData;
 class ScDocument;
@@ -39,39 +31,24 @@ class ScDocShell;
 namespace sfx2 { class DocumentInserter; }
 namespace sfx2 { class FileDialogHelper; }
 
-class ScInsertTableDlg : public ModalDialog
+class ScInsertTableDlg : public weld::GenericDialogController
 {
 public:
-            ScInsertTableDlg( vcl::Window* pParent, ScViewData& rViewData, SCTAB nTabCount, bool bFromFile );
-            virtual ~ScInsertTableDlg() override;
-    virtual void dispose() override;
+    ScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData, SCTAB nTabCount, bool bFromFile);
+    virtual ~ScInsertTableDlg() override;
 
-    virtual short   Execute() override; // override to set parent dialog
+    short       execute(); // override to set parent dialog
 
-    bool        GetTablesFromFile() const { return m_pBtnFromFile->IsChecked(); }
-    bool        GetTablesAsLink() const { return m_pBtnLink->IsChecked(); }
+    bool        GetTablesFromFile() const { return m_xBtnFromFile->get_active(); }
+    bool        GetTablesAsLink() const { return m_xBtnLink->get_active(); }
 
     const OUString* GetFirstTable( sal_uInt16* pN );
     const OUString* GetNextTable( sal_uInt16* pN );
     ScDocShell*     GetDocShellTables() { return pDocShTables; }
-    bool        IsTableBefore() const { return m_pBtnBefore->IsChecked(); }
+    bool        IsTableBefore() const { return m_xBtnBefore->get_active(); }
     SCTAB           GetTableCount() const { return nTableCount;}
 
 private:
-    VclPtr<RadioButton>            m_pBtnBefore;
-    VclPtr<RadioButton>            m_pBtnBehind;
-    VclPtr<RadioButton>            m_pBtnNew;
-    VclPtr<RadioButton>            m_pBtnFromFile;
-    VclPtr<FixedText>              m_pFtCount;
-    VclPtr<NumericField>           m_pNfCount;
-    VclPtr<FixedText>              m_pFtName;
-    VclPtr<Edit>                   m_pEdName;
-    VclPtr<ListBox>                m_pLbTables;
-    VclPtr<FixedText>              m_pFtPath;
-    VclPtr<PushButton>             m_pBtnBrowse;
-    VclPtr<CheckBox>               m_pBtnLink;
-    VclPtr<OKButton>               m_pBtnOk;
-
     Timer                   aBrowseTimer;
     ScViewData&             rViewData;
     ScDocument&             rDoc;
@@ -85,17 +62,31 @@ private:
     SCTAB               nTableCount;
     OUString            m_sSheetDotDotDot;
 
+    std::unique_ptr<weld::RadioButton> m_xBtnBefore;
+    std::unique_ptr<weld::RadioButton> m_xBtnBehind;
+    std::unique_ptr<weld::RadioButton> m_xBtnNew;
+    std::unique_ptr<weld::RadioButton> m_xBtnFromFile;
+    std::unique_ptr<weld::Label> m_xFtCount;
+    std::unique_ptr<weld::SpinButton> m_xNfCount;
+    std::unique_ptr<weld::Label> m_xFtName;
+    std::unique_ptr<weld::Entry> m_xEdName;
+    std::unique_ptr<weld::TreeView> m_xLbTables;
+    std::unique_ptr<weld::Label> m_xFtPath;
+    std::unique_ptr<weld::Button> m_xBtnBrowse;
+    std::unique_ptr<weld::CheckButton> m_xBtnLink;
+    std::unique_ptr<weld::Button> m_xBtnOk;
+
     void    Init_Impl( bool bFromFile );
     void    SetNewTable_Impl();
     void    SetFromTo_Impl();
     void    FillTables_Impl( const ScDocument* pSrcDoc );
     void    DoEnable_Impl();
 
-    DECL_LINK( BrowseHdl_Impl, Button*, void );
-    DECL_LINK( ChoiceHdl_Impl, Button*, void );
-    DECL_LINK( SelectHdl_Impl, ListBox&, void );
-    DECL_LINK( CountHdl_Impl, Edit&, void );
-    DECL_LINK( DoEnterHdl, Button*, void );
+    DECL_LINK( BrowseHdl_Impl, weld::Button&, void );
+    DECL_LINK( ChoiceHdl_Impl, weld::Button&, void );
+    DECL_LINK( SelectHdl_Impl, weld::TreeView&, void );
+    DECL_LINK( CountHdl_Impl, weld::SpinButton&, void );
+    DECL_LINK( DoEnterHdl, weld::Button&, void );
     DECL_LINK( BrowseTimeoutHdl, Timer *, void );
     DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void );
 };
diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx
index ea26de1491b3..3b6269622599 100644
--- a/sc/source/ui/miscdlgs/instbdlg.cxx
+++ b/sc/source/ui/miscdlgs/instbdlg.cxx
@@ -34,8 +34,8 @@
 #include <scresid.hxx>
 #include <instbdlg.hxx>
 
-ScInsertTableDlg::ScInsertTableDlg( vcl::Window* pParent, ScViewData& rData, SCTAB nTabCount, bool bFromFile )
-    : ModalDialog(pParent, "InsertSheetDialog", "modules/scalc/ui/insertsheet.ui")
+ScInsertTableDlg::ScInsertTableDlg(weld::Window* pParent, ScViewData& rData, SCTAB nTabCount, bool bFromFile)
+    : GenericDialogController(pParent, "modules/scalc/ui/insertsheet.ui", "InsertSheetDialog")
     , rViewData(rData)
     , rDoc(*rData.GetDocument())
     , pDocShTables(nullptr)
@@ -43,92 +43,73 @@ ScInsertTableDlg::ScInsertTableDlg( vcl::Window* pParent, ScViewData& rData, SCT
     , bMustClose(false)
     , nSelTabIndex(0)
     , nTableCount(nTabCount)
+    , m_xBtnBefore(m_xBuilder->weld_radio_button("before"))
+    , m_xBtnBehind(m_xBuilder->weld_radio_button("after"))
+    , m_xBtnNew(m_xBuilder->weld_radio_button("new"))
+    , m_xBtnFromFile(m_xBuilder->weld_radio_button("fromfile"))
+    , m_xFtCount(m_xBuilder->weld_label("countft"))
+    , m_xNfCount(m_xBuilder->weld_spin_button("countnf"))
+    , m_xFtName(m_xBuilder->weld_label("nameft"))
+    , m_xEdName(m_xBuilder->weld_entry("nameed"))
+    , m_xLbTables(m_xBuilder->weld_tree_view("tables"))
+    , m_xFtPath(m_xBuilder->weld_label("path"))
+    , m_xBtnBrowse(m_xBuilder->weld_button("browse"))
+    , m_xBtnLink(m_xBuilder->weld_check_button("link"))
+    , m_xBtnOk(m_xBuilder->weld_button("ok"))
 {
-    get(m_pBtnBefore, "before");
-    get(m_pBtnBehind, "after");
-    get(m_pBtnNew, "new");
-    get(m_pBtnFromFile, "fromfile");
-    get(m_pFtCount, "countft");
-    get(m_pNfCount, "countnf");
-    get(m_pFtName, "nameft");
-    get(m_pEdName, "nameed");
-    m_sSheetDotDotDot = m_pEdName->GetText();
-    get(m_pLbTables, "tables");
-    m_pLbTables->SetDropDownLineCount(8);
-    get(m_pFtPath, "path");
-    get(m_pBtnBrowse, "browse");
-    get(m_pBtnLink, "link");
-    get(m_pBtnOk, "ok");
-    Init_Impl( bFromFile );
+    m_sSheetDotDotDot = m_xEdName->get_text();
+    m_xLbTables->set_size_request(-1, m_xLbTables->get_height_rows(8));
+    Init_Impl(bFromFile);
 }
 
 ScInsertTableDlg::~ScInsertTableDlg()
 {
-    disposeOnce();
-}
-
-void ScInsertTableDlg::dispose()
-{
     if (pDocShTables)
         pDocShTables->DoClose();
     delete pDocInserter;
-    m_pBtnBefore.clear();
-    m_pBtnBehind.clear();
-    m_pBtnNew.clear();
-    m_pBtnFromFile.clear();
-    m_pFtCount.clear();
-    m_pNfCount.clear();
-    m_pFtName.clear();
-    m_pEdName.clear();
-    m_pLbTables.clear();
-    m_pFtPath.clear();
-    m_pBtnBrowse.clear();
-    m_pBtnLink.clear();
-    m_pBtnOk.clear();
-    ModalDialog::dispose();
 }
 
 void ScInsertTableDlg::Init_Impl( bool bFromFile )
 {
-    m_pLbTables->EnableMultiSelection(true);
-    m_pBtnBrowse->SetClickHdl( LINK( this, ScInsertTableDlg, BrowseHdl_Impl ) );
-    m_pBtnNew->SetClickHdl( LINK( this, ScInsertTableDlg, ChoiceHdl_Impl ) );
-    m_pBtnFromFile->SetClickHdl( LINK( this, ScInsertTableDlg, ChoiceHdl_Impl ) );
-    m_pLbTables->SetSelectHdl( LINK( this, ScInsertTableDlg, SelectHdl_Impl ) );
-    m_pNfCount->SetModifyHdl( LINK( this, ScInsertTableDlg, CountHdl_Impl));
-    m_pBtnOk->SetClickHdl( LINK( this, ScInsertTableDlg, DoEnterHdl ));
-    m_pBtnBefore->Check();
-
-    m_pNfCount->SetText( OUString::number(nTableCount) );
-    m_pNfCount->SetMax( MAXTAB - rDoc.GetTableCount() + 1 );
+    m_xLbTables->set_selection_mode(true);
+    m_xBtnBrowse->connect_clicked( LINK( this, ScInsertTableDlg, BrowseHdl_Impl ) );
+    m_xBtnNew->connect_clicked( LINK( this, ScInsertTableDlg, ChoiceHdl_Impl ) );
+    m_xBtnFromFile->connect_clicked( LINK( this, ScInsertTableDlg, ChoiceHdl_Impl ) );
+    m_xLbTables->connect_changed( LINK( this, ScInsertTableDlg, SelectHdl_Impl ) );
+    m_xNfCount->connect_value_changed( LINK( this, ScInsertTableDlg, CountHdl_Impl));
+    m_xBtnOk->connect_clicked( LINK( this, ScInsertTableDlg, DoEnterHdl ));
+    m_xBtnBefore->set_active(true);
+
+    m_xNfCount->set_max(MAXTAB - rDoc.GetTableCount() + 1);
+    m_xNfCount->set_value(nTableCount);
 
     if(nTableCount==1)
     {
         OUString aName;
         rDoc.CreateValidTabName( aName );
-        m_pEdName->SetText( aName );
+        m_xEdName->set_text( aName );
     }
     else
     {
-        m_pEdName->SetText(m_sSheetDotDotDot);
-        m_pFtName->Disable();
-        m_pEdName->Disable();
+        m_xEdName->set_text(m_sSheetDotDotDot);
+        m_xFtName->set_sensitive(false);
+        m_xEdName->set_sensitive(false);
     }
 
     bool bShared = rViewData.GetDocShell() && rViewData.GetDocShell()->IsDocShared();
 
     if ( !bFromFile || bShared )
     {
-        m_pBtnNew->Check();
+        m_xBtnNew->set_active(true);
         SetNewTable_Impl();
         if ( bShared )
         {
-            m_pBtnFromFile->Disable();
+            m_xBtnFromFile->set_sensitive(false);
         }
     }
     else
     {
-        m_pBtnFromFile->Check();
+        m_xBtnFromFile->set_active(true);
         SetFromTo_Impl();
 
         aBrowseTimer.SetInvokeHandler( LINK( this, ScInsertTableDlg, BrowseTimeoutHdl ) );
@@ -136,87 +117,91 @@ void ScInsertTableDlg::Init_Impl( bool bFromFile )
     }
 }
 
-short ScInsertTableDlg::Execute()
+short ScInsertTableDlg::execute()
 {
-    if ( m_pBtnFromFile->IsChecked() )
+    if (m_xBtnFromFile->get_active())
         aBrowseTimer.Start();
 
-    return ModalDialog::Execute();
+    return m_xDialog->run();
 }
 
 void ScInsertTableDlg::SetNewTable_Impl()
 {
-    if (m_pBtnNew->IsChecked() )
+    if (m_xBtnNew->get_active() )
     {
-        m_pNfCount->Enable();
-        m_pFtCount->Enable();
-        m_pLbTables->Disable();
-        m_pFtPath->Disable();
-        m_pBtnBrowse->Disable();
-        m_pBtnLink->Disable();
+        m_xNfCount->set_sensitive(true);
+        m_xFtCount->set_sensitive(true);
+        m_xLbTables->set_sensitive(false);
+        m_xFtPath->set_sensitive(false);
+        m_xBtnBrowse->set_sensitive(false);
+        m_xBtnLink->set_sensitive(false);
 
         if(nTableCount==1)
         {
-            m_pEdName->Enable();
-            m_pFtName->Enable();
+            m_xEdName->set_sensitive(true);
+            m_xFtName->set_sensitive(true);
         }
     }
 }
 
 void ScInsertTableDlg::SetFromTo_Impl()
 {
-    if (m_pBtnFromFile->IsChecked() )
+    if (m_xBtnFromFile->get_active() )
     {
-        m_pEdName->Disable();
-        m_pFtName->Disable();
-        m_pFtCount->Disable();
-        m_pNfCount->Disable();
-        m_pLbTables->Enable();
-        m_pFtPath->Enable();
-        m_pBtnBrowse->Enable();
-        m_pBtnLink->Enable();
+        m_xEdName->set_sensitive(false);
+        m_xFtName->set_sensitive(false);
+        m_xFtCount->set_sensitive(false);
+        m_xNfCount->set_sensitive(false);
+        m_xLbTables->set_sensitive(true);
+        m_xFtPath->set_sensitive(true);
+        m_xBtnBrowse->set_sensitive(true);
+        m_xBtnLink->set_sensitive(true);
     }
 }
 
 void ScInsertTableDlg::FillTables_Impl( const ScDocument* pSrcDoc )
 {
-    m_pLbTables->SetUpdateMode( false );
-    m_pLbTables->Clear();
+    m_xLbTables->freeze();
+    m_xLbTables->clear();
 
     if ( pSrcDoc )
     {
         SCTAB nCount = pSrcDoc->GetTableCount();
         OUString aName;
 
-        for ( SCTAB i=0; i<nCount; i++ )
+        for (SCTAB i=0; i<nCount; ++i)
         {
             pSrcDoc->GetName( i, aName );
-            m_pLbTables->InsertEntry( aName );
+            m_xLbTables->append_text(aName);
         }
     }
 
-    m_pLbTables->SetUpdateMode( true );
+    m_xLbTables->thaw();
 
-    if(m_pLbTables->GetEntryCount()==1)
-        m_pLbTables->SelectEntryPos(0);
+    if (m_xLbTables->n_children() == 1)
+        m_xLbTables->select(0);
 }
 
 const OUString* ScInsertTableDlg::GetFirstTable( sal_uInt16* pN )
 {
     const OUString* pStr = nullptr;
 
-    if ( m_pBtnNew->IsChecked() )
+    if ( m_xBtnNew->get_active() )
     {
-        aStrCurSelTable = m_pEdName->GetText();
+        aStrCurSelTable = m_xEdName->get_text();
         pStr = &aStrCurSelTable;
     }
-    else if ( nSelTabIndex < m_pLbTables->GetSelectedEntryCount() )
+    else
     {
-        aStrCurSelTable = m_pLbTables->GetSelectedEntry();
-        pStr = &aStrCurSelTable;
-        if ( pN )
-            *pN = m_pLbTables->GetSelectedEntryPos();
-        nSelTabIndex = 1;
+        std::vector<int> aRows(m_xLbTables->get_selected_rows());
+        if (nSelTabIndex < aRows.size())
+        {
+            aStrCurSelTable = m_xLbTables->get_text(aRows[0]);
+            pStr = &aStrCurSelTable;
+            if ( pN )
+                *pN = aRows[0];
+            nSelTabIndex = 1;
+        }
     }
 
     return pStr;
@@ -224,14 +209,18 @@ const OUString* ScInsertTableDlg::GetFirstTable( sal_uInt16* pN )
 
 const OUString* ScInsertTableDlg::GetNextTable( sal_uInt16* pN )
 {
-    const OUString* pStr = nullptr;
+    if (m_xBtnNew->get_active())
+        return nullptr;
+
+    std::vector<int> aRows(m_xLbTables->get_selected_rows());
 
-    if ( !m_pBtnNew->IsChecked() && nSelTabIndex < m_pLbTables->GetSelectedEntryCount() )
+    const OUString* pStr = nullptr;
+    if (nSelTabIndex < aRows.size())
     {
-        aStrCurSelTable = m_pLbTables->GetSelectedEntry( nSelTabIndex );
+        aStrCurSelTable = m_xLbTables->get_text(aRows[nSelTabIndex]);
         pStr = &aStrCurSelTable;
         if ( pN )
-            *pN = m_pLbTables->GetSelectedEntryPos( nSelTabIndex );
+            *pN = aRows[nSelTabIndex];
         nSelTabIndex++;
     }
 
@@ -240,30 +229,30 @@ const OUString* ScInsertTableDlg::GetNextTable( sal_uInt16* pN )
 
 // Handler:
 
-IMPL_LINK_NOARG(ScInsertTableDlg, CountHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(ScInsertTableDlg, CountHdl_Impl, weld::SpinButton&, void)
 {
-    nTableCount = static_cast<SCTAB>(m_pNfCount->GetValue());
+    nTableCount = static_cast<SCTAB>(m_xNfCount->get_value());
     if ( nTableCount==1)
     {
         OUString aName;
         rDoc.CreateValidTabName( aName );
-        m_pEdName->SetText( aName );
-        m_pFtName->Enable();
-        m_pEdName->Enable();
+        m_xEdName->set_text( aName );
+        m_xFtName->set_sensitive(true);
+        m_xEdName->set_sensitive(true);
     }
     else
     {
-        m_pEdName->SetText(m_sSheetDotDotDot);
-        m_pFtName->Disable();
-        m_pEdName->Disable();
+        m_xEdName->set_text(m_sSheetDotDotDot);
+        m_xFtName->set_sensitive(false);
+        m_xEdName->set_sensitive(false);
     }
 
     DoEnable_Impl();
 }
 
-IMPL_LINK_NOARG(ScInsertTableDlg, ChoiceHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(ScInsertTableDlg, ChoiceHdl_Impl, weld::Button&, void)
 {
-    if ( m_pBtnNew->IsChecked() )
+    if ( m_xBtnNew->get_active() )
         SetNewTable_Impl();
     else
         SetFromTo_Impl();
@@ -271,36 +260,36 @@ IMPL_LINK_NOARG(ScInsertTableDlg, ChoiceHdl_Impl, Button*, void)
     DoEnable_Impl();
 }
 
-IMPL_LINK_NOARG(ScInsertTableDlg, BrowseHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(ScInsertTableDlg, BrowseHdl_Impl, weld::Button&, void)
 {
     delete pDocInserter;
-    pDocInserter = new ::sfx2::DocumentInserter(GetFrameWeld(), ScDocShell::Factory().GetFactoryName());
+    pDocInserter = new ::sfx2::DocumentInserter(m_xDialog.get(), ScDocShell::Factory().GetFactoryName());
     pDocInserter->StartExecuteModal( LINK( this, ScInsertTableDlg, DialogClosedHdl ) );
 }
 
-IMPL_LINK_NOARG(ScInsertTableDlg, SelectHdl_Impl, ListBox&, void)
+IMPL_LINK_NOARG(ScInsertTableDlg, SelectHdl_Impl, weld::TreeView&, void)
 {
     DoEnable_Impl();
 }
 
 void ScInsertTableDlg::DoEnable_Impl()
 {
-    if ( m_pBtnNew->IsChecked() || ( pDocShTables && m_pLbTables->GetSelectedEntryCount() ) )
-        m_pBtnOk->Enable();
+    if ( m_xBtnNew->get_active() || ( pDocShTables && m_xLbTables->count_selected_rows() ) )
+        m_xBtnOk->set_sensitive(true);
     else
-        m_pBtnOk->Disable();
+        m_xBtnOk->set_sensitive(false);
 }
 
-IMPL_LINK_NOARG(ScInsertTableDlg, DoEnterHdl, Button*, void)
+IMPL_LINK_NOARG(ScInsertTableDlg, DoEnterHdl, weld::Button&, void)
 {
-    if(nTableCount > 1 || ScDocument::ValidTabName(m_pEdName->GetText()))
+    if (nTableCount > 1 || ScDocument::ValidTabName(m_xEdName->get_text()))
     {
-        EndDialog(RET_OK);
+        m_xDialog->response(RET_OK);
     }
     else
     {
         OUString aErrMsg ( ScResId( STR_INVALIDTABNAME ) );
-        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning,
+        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Warning,
                     VclButtonsType::Ok, aErrMsg));
         xBox->run();
     }
@@ -309,7 +298,7 @@ IMPL_LINK_NOARG(ScInsertTableDlg, DoEnterHdl, Button*, void)
 IMPL_LINK_NOARG(ScInsertTableDlg, BrowseTimeoutHdl, Timer *, void)
 {
     bMustClose = true;
-    BrowseHdl_Impl(m_pBtnBrowse);
+    BrowseHdl_Impl(*m_xBtnBrowse);
 }
 
 IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )
@@ -330,10 +319,10 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
             pDocShTables = new ScDocShell;
             aDocShTablesRef = pDocShTables;
 
-            Pointer aOldPtr( GetPointer() );
-            SetPointer( Pointer( PointerStyle::Wait ) );
-            pDocShTables->DoLoad( pMed );
-            SetPointer( aOldPtr );
+            {
+                weld::WaitObject aWait(m_xDialog.get());
+                pDocShTables->DoLoad(pMed);
+            }
 
             ErrCode nErr = pDocShTables->GetErrorCode();
             if ( nErr )
@@ -342,7 +331,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
             if ( !pDocShTables->GetError() )                    // errors only
             {
                 FillTables_Impl( &pDocShTables->GetDocument() );
-                m_pFtPath->SetText( pDocShTables->GetTitle( SFX_TITLE_FULLNAME ) );
+                m_xFtPath->set_label(pDocShTables->GetTitle(SFX_TITLE_FULLNAME));
             }
             else
             {
@@ -351,7 +340,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
                 pDocShTables = nullptr;
 
                 FillTables_Impl( nullptr );
-                m_pFtPath->SetText( EMPTY_OUSTRING );
+                m_xFtPath->set_label(EMPTY_OUSTRING);
             }
         }
 
@@ -359,7 +348,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
     }
     else if ( bMustClose )
         // execute slot FID_INS_TABLE_EXT and cancel file dialog
-        EndDialog();
+        m_xDialog->response(RET_CANCEL);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index fda0b5714504..20ee198565fe 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -218,7 +218,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                    ScopedVclPtr<AbstractScInsertTableDlg> pDlg(pFact->CreateScInsertTableDlg(GetDialogParent(), rViewData,
+                    ScopedVclPtr<AbstractScInsertTableDlg> pDlg(pFact->CreateScInsertTableDlg(GetFrameWeld(), rViewData,
                         nTabSelCount, nSlot == FID_INS_TABLE_EXT));
                     OSL_ENSURE(pDlg, "Dialog create fail!");
                     if ( RET_OK == pDlg->Execute() )
diff --git a/sc/uiconfig/scalc/ui/insertsheet.ui b/sc/uiconfig/scalc/ui/insertsheet.ui
index 670773437fe6..4f554c1fab94 100644
--- a/sc/uiconfig/scalc/ui/insertsheet.ui
+++ b/sc/uiconfig/scalc/ui/insertsheet.ui
@@ -1,7 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.18"/>
+  <object class="GtkListStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="lower">1</property>
     <property name="upper">256</property>
@@ -13,16 +21,22 @@
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="insertsheet|InsertSheetDialog">Insert Sheet</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="layout_style">start</property>
+            <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="ok">
                 <property name="label">gtk-ok</property>
@@ -65,6 +79,7 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -110,7 +125,6 @@
                             <property name="xalign">0</property>
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
-                            <property name="group">after</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -197,7 +211,6 @@
                                 <property name="xalign">0</property>
                                 <property name="active">True</property>
                                 <property name="draw_indicator">True</property>
-                                <property name="group">fromfile</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -222,32 +235,28 @@
                                       <object class="GtkLabel" id="countft">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
                                         <property name="label" translatable="yes" context="insertsheet|countft">N_o. of sheets:</property>
                                         <property name="use_underline">True</property>
                                         <property name="mnemonic_widget">countnf</property>
+                                        <property name="xalign">0</property>
                                       </object>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">0</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
                                       <object class="GtkLabel" id="nameft">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
                                         <property name="label" translatable="yes" context="insertsheet|nameft">Na_me:</property>
                                         <property name="use_underline">True</property>
                                         <property name="mnemonic_widget">nameed</property>
+                                        <property name="xalign">0</property>
                                       </object>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">1</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -255,13 +264,12 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="halign">start</property>
+                                        <property name="activates_default">True</property>
                                         <property name="adjustment">adjustment1</property>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">0</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -269,14 +277,13 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="hexpand">True</property>
+                                        <property name="activates_default">True</property>
                                         <property name="width_chars">52</property>
                                         <property name="text" translatable="yes" context="insertsheet|nameed">Sheet...</property>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">1</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                   </object>
@@ -343,29 +350,40 @@
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">1</property>
                                         <property name="width">2</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkScrolledWindow" id="scrolledwindow1">
+                                      <object class="GtkScrolledWindow">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="hexpand">True</property>
                                         <property name="vexpand">True</property>
                                         <property name="shadow_type">in</property>
                                         <child>
-                                          <object class="GtkTreeView" id="tables:border">
+                                          <object class="GtkTreeView" id="tables">
                                             <property name="visible">True</property>
                                             <property name="can_focus">True</property>
-                                            <property name="hexpand">True</property>
                                             <property name="vexpand">True</property>
+                                            <property name="model">liststore1</property>
+                                            <property name="headers_visible">False</property>
+                                            <property name="headers_clickable">False</property>
+                                            <property name="search_column">0</property>
+                                            <property name="show_expanders">False</property>
                                             <child internal-child="selection">
-                                              <object class="GtkTreeSelection" id="treeview-selection1">
-                                                <property name="mode">multiple</property>
+                                              <object class="GtkTreeSelection" id="treeview-selection1"/>
+                                            </child>
+                                            <child>
+                                              <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                                                <child>
+                                                  <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                                                  <attributes>
+                                                    <attribute name="text">0</attribute>
+                                                  </attributes>
+                                                </child>
                                               </object>
                                             </child>
                                             <child internal-child="accessible">
-                                              <object class="AtkObject" id="tables:border-atkobject">
+                                              <object class="AtkObject" id="tables-atkobject">
                                                 <property name="AtkObject::accessible-name" translatable="yes" context="insertsheet|tables-atkobject">Tables in file</property>
                                               </object>
                                             </child>
@@ -375,8 +393,6 @@
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">0</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -395,8 +411,6 @@
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">0</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -414,16 +428,12 @@
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">1</property>
-                                            <property name="width">1</property>
-                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">0</property>
-                                        <property name="width">1</property>
-                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                   </object>
diff --git a/sw/uiconfig/swriter/ui/autoformattable.ui b/sw/uiconfig/swriter/ui/autoformattable.ui
index 84539082ac5c..65e4b8896058 100644
--- a/sw/uiconfig/swriter/ui/autoformattable.ui
+++ b/sw/uiconfig/swriter/ui/autoformattable.ui
@@ -135,6 +135,7 @@
                                   <object class="GtkTreeView" id="formatlb">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
+                                    <property name="hexpand">True</property>
                                     <property name="vexpand">True</property>
                                     <property name="model">liststore1</property>
                                     <property name="headers_visible">False</property>


More information about the Libreoffice-commits mailing list