[Libreoffice-commits] core.git: cui/source include/vcl sc/inc sc/source sc/uiconfig sfx2/source sw/source vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Tue May 1 15:27:40 UTC 2018


 cui/source/dialogs/insdlg.cxx              |    2 -
 include/vcl/weld.hxx                       |   44 ++++++++++++++--------
 sc/inc/scabstdlg.hxx                       |    9 ++--
 sc/source/ui/attrdlg/scdlgfact.cxx         |   34 +++++++++--------
 sc/source/ui/attrdlg/scdlgfact.hxx         |   21 +++++++---
 sc/source/ui/inc/shtabdlg.hxx              |   23 ++++-------
 sc/source/ui/miscdlgs/linkarea.cxx         |    4 +-
 sc/source/ui/miscdlgs/shtabdlg.cxx         |   58 +++++++++++------------------
 sc/source/ui/view/tabvwsh3.cxx             |    6 +--
 sc/source/ui/view/tabvwshf.cxx             |   10 ++---
 sc/uiconfig/scalc/ui/showsheetdialog.ui    |   45 ++++++++++++++++++++--
 sfx2/source/doc/new.cxx                    |    4 +-
 sfx2/source/doc/saveastemplatedlg.cxx      |    2 -
 sfx2/source/doc/templatedlg.cxx            |    2 -
 sw/source/ui/fldui/DropDownFieldDialog.cxx |    4 +-
 sw/source/ui/misc/outline.cxx              |    2 -
 sw/source/ui/table/tautofmt.cxx            |    4 +-
 vcl/source/app/salvtables.cxx              |   15 +++----
 vcl/unx/gtk3/gtk3gtkinst.cxx               |   25 ++----------
 19 files changed, 165 insertions(+), 149 deletions(-)

New commits:
commit dbb4df8568726173f69297611936976ff354c2cf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 30 14:43:29 2018 +0100

    weld ScShowTabDlg
    
    Change-Id: Ice5da193d0efbf8e4a61d68c0fcef90f6c6d8e78
    Reviewed-on: https://gerrit.libreoffice.org/53665
    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/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 8e3532aa84f9..ac5e7f096773 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -183,7 +183,7 @@ short SvInsertOleDlg::execute()
         if ( bCreateNew )
         {
             // create and insert new embedded object
-            OUString aServerName = m_xLbObjecttype->get_selected();
+            OUString aServerName = m_xLbObjecttype->get_selected_text();
             const SvObjectServer* pS = m_pServers->Get( aServerName );
             if ( pS )
             {
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 77f985965c90..702b0cf415c7 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -266,7 +266,6 @@ protected:
     Link<TreeView&, void> m_aRowActivatedHdl;
 
     void signal_changed() { m_aChangeHdl.Call(*this); }
-
     void signal_row_activated() { m_aRowActivatedHdl.Call(*this); }
 
 public:
@@ -278,19 +277,9 @@ public:
     {
         insert(-1, rId, rStr, rImage);
     }
+
     virtual int n_children() const = 0;
-    virtual void select(int pos) = 0;
-    virtual void remove(int pos) = 0;
-    virtual int find(const OUString& rText) const = 0;
-    virtual int find_id(const OUString& rId) const = 0;
-    virtual void set_top_entry(int pos) = 0;
     virtual void clear() = 0;
-    virtual OUString get_selected() const = 0;
-    virtual std::vector<OUString> get_selected_rows() const = 0;
-    OUString get_selected_id() const { return get_id(get_selected_index()); }
-    virtual int get_selected_index() const = 0;
-    virtual OUString get(int pos) const = 0;
-    virtual OUString get_id(int pos) const = 0;
     virtual int get_height_rows(int nRows) const = 0;
 
     virtual void freeze() = 0;
@@ -300,13 +289,36 @@ public:
     virtual int count_selected_rows() const = 0;
 
     void connect_changed(const Link<TreeView&, void>& rLink) { m_aChangeHdl = rLink; }
-
     void connect_row_activated(const Link<TreeView&, void>& rLink) { m_aRowActivatedHdl = rLink; }
 
-    void select(const OUString& rText) { select(find(rText)); }
-    void select_id(const OUString& rId) { select(find_id(rId)); }
+    //by index
+    virtual int get_selected_index() const = 0;
+    virtual void select(int pos) = 0;
+    virtual void remove(int pos) = 0;
+    virtual void set_top_entry(int pos) = 0;
+    virtual std::vector<int> get_selected_rows() const = 0;
 
-    void remove(const OUString& rText) { remove(find(rText)); }
+    //by text
+    virtual OUString get(int pos) const = 0;
+    virtual int find(const OUString& rText) const = 0;
+    OUString get_selected_text() const { return get(get_selected_index()); }
+    void select_text(const OUString& rText) { select(find(rText)); }
+    void remove_text(const OUString& rText) { remove(find(rText)); }
+    std::vector<OUString> get_selected_rows_text() const
+    {
+        std::vector<int> aRows(get_selected_rows());
+        std::vector<OUString> aRet;
+        aRet.reserve(aRows.size());
+        for (auto a : aRows)
+            aRet.push_back(get(a));
+        return aRet;
+    }
+
+    //by id
+    virtual OUString get_id(int pos) const = 0;
+    virtual int find_id(const OUString& rId) const = 0;
+    OUString get_selected_id() const { return get_id(get_selected_index()); }
+    void select_id(const OUString& rId) { select(find_id(rId)); }
 };
 
 class VCL_DLLPUBLIC Button : virtual public Container
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index cbe1d45f8d61..247cf444e813 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -345,11 +345,10 @@ class AbstractScShowTabDlg : public VclAbstractDialog
 protected:
     virtual             ~AbstractScShowTabDlg() override = default;
 public:
-    virtual void    Insert( const OUString& rString, bool bSelected ) = 0;
-    virtual sal_Int32 GetSelectedEntryCount() const = 0;
+    virtual void Insert( const OUString& rString, bool bSelected ) = 0;
     virtual void SetDescription(const OUString& rTitle, const OUString& rFixedText, const OString& nDlgHelpId, const OString& nLbHelpId ) = 0;
-    virtual OUString  GetSelectedEntry(sal_Int32 nPos) const = 0;
-    virtual sal_Int32 GetSelectedEntryPos(sal_Int32 nPos) const = 0;
+    virtual std::vector<sal_Int32> GetSelectedRows() const = 0;
+    virtual OUString GetEntry(sal_Int32 nPos) const = 0;
 };
 
 class AbstractScSortWarningDlg : public VclAbstractDialog
@@ -500,7 +499,7 @@ public:
 
     virtual VclPtr<AbstractScNewScenarioDlg> CreateScNewScenarioDlg ( vcl::Window* pParent, const OUString& rName,
                                                                 bool bEdit, bool bSheetProtected ) = 0;
-    virtual VclPtr<AbstractScShowTabDlg> CreateScShowTabDlg(vcl::Window* pParent) = 0;
+    virtual VclPtr<AbstractScShowTabDlg> CreateScShowTabDlg(weld::Window* pParent) = 0;
 
     virtual VclPtr<AbstractScStringInputDlg> CreateScStringInputDlg(weld::Window* pParent,
                                                                     const OUString& rTitle,
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index e7eb20d213f2..956bde11296d 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -132,7 +132,17 @@ IMPL_ABSTDLG_BASE(AbstractScDPNumGroupDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDPDateGroupDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDPShowDetailDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl);
+
+short AbstractScShowTabDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
+bool AbstractScShowTabDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
+{
+    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 IMPL_ABSTDLG_BASE(AbstractScSortWarningDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
@@ -575,29 +585,24 @@ void AbstractScNewScenarioDlg_Impl::GetScenarioData(
 
 void AbstractScShowTabDlg_Impl::Insert( const OUString& rString, bool bSelected )
 {
-    pDlg->Insert( rString, bSelected);
-}
-
-sal_Int32 AbstractScShowTabDlg_Impl::GetSelectedEntryCount() const
-{
-    return pDlg->GetSelectedEntryCount();
+    m_xDlg->Insert(rString, bSelected);
 }
 
 void    AbstractScShowTabDlg_Impl::SetDescription(
                 const OUString& rTitle, const OUString& rFixedText,
                 const OString& sDlgHelpId, const OString& sLbHelpId )
 {
-    pDlg->SetDescription( rTitle, rFixedText, sDlgHelpId, sLbHelpId );
+    m_xDlg->SetDescription( rTitle, rFixedText, sDlgHelpId, sLbHelpId );
 }
 
-sal_Int32 AbstractScShowTabDlg_Impl::GetSelectedEntryPos(sal_Int32 nPos) const
+std::vector<sal_Int32> AbstractScShowTabDlg_Impl::GetSelectedRows() const
 {
-    return pDlg->GetSelectedEntryPos( nPos);
+    return m_xDlg->GetSelectedRows();
 }
 
-OUString AbstractScShowTabDlg_Impl::GetSelectedEntry(sal_Int32 nPos) const
+OUString AbstractScShowTabDlg_Impl::GetEntry(sal_Int32 nPos) const
 {
-    return pDlg->GetSelectedEntry(nPos);
+    return m_xDlg->GetEntry(nPos);
 }
 
 short AbstractScStringInputDlg_Impl::Execute()
@@ -850,10 +855,9 @@ VclPtr<AbstractScNewScenarioDlg> ScAbstractDialogFactory_Impl::CreateScNewScenar
     return VclPtr<AbstractScNewScenarioDlg_Impl>::Create( pDlg );
 }
 
-VclPtr<AbstractScShowTabDlg> ScAbstractDialogFactory_Impl::CreateScShowTabDlg(vcl::Window* pParent)
+VclPtr<AbstractScShowTabDlg> ScAbstractDialogFactory_Impl::CreateScShowTabDlg(weld::Window* pParent)
 {
-    VclPtr<ScShowTabDlg> pDlg = VclPtr<ScShowTabDlg>::Create( pParent);
-    return VclPtr<AbstractScShowTabDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractScShowTabDlg_Impl>::Create(new ScShowTabDlg(pParent));
 }
 
 VclPtr<AbstractScStringInputDlg> ScAbstractDialogFactory_Impl::CreateScStringInputDlg(weld::Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 8eee3568f978..37fbb79a6034 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -375,12 +375,19 @@ class AbstractScNewScenarioDlg_Impl : public AbstractScNewScenarioDlg
 
 class AbstractScShowTabDlg_Impl : public AbstractScShowTabDlg
 {
-    DECL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl,ScShowTabDlg)
-    virtual void    Insert( const OUString& rString, bool bSelected ) override;
-    virtual sal_Int32 GetSelectedEntryCount() const override;
-    virtual void SetDescription(const OUString& rTitle, const OUString& rFixedText, const OString& sDlgHelpId, const OString& sLbHelpId ) override;
-    virtual OUString  GetSelectedEntry(sal_Int32 nPos) const override;
-    virtual sal_Int32 GetSelectedEntryPos(sal_Int32 nPos) const override;
+protected:
+    std::shared_ptr<ScShowTabDlg> m_xDlg;
+public:
+    explicit AbstractScShowTabDlg_Impl(ScShowTabDlg* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short Execute() override;
+    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
+    virtual void Insert( const OUString& rString, bool bSelected ) override;
+    virtual void SetDescription(const OUString& rTitle, const OUString& rFixedText, const OString& sDlgHelpId, const OString& sLbHelpId) override;
+    virtual OUString GetEntry(sal_Int32 nPos) const override;
+    virtual std::vector<sal_Int32> GetSelectedRows() const override;
 };
 
 class AbstractScSortWarningDlg_Impl : public AbstractScSortWarningDlg
@@ -542,7 +549,7 @@ public:
 
     virtual VclPtr<AbstractScNewScenarioDlg> CreateScNewScenarioDlg ( vcl::Window* pParent, const OUString& rName,
                                                                 bool bEdit, bool bSheetProtected ) override;
-    virtual VclPtr<AbstractScShowTabDlg> CreateScShowTabDlg(vcl::Window* pParent) override;
+    virtual VclPtr<AbstractScShowTabDlg> CreateScShowTabDlg(weld::Window* pParent) override;
 
     virtual VclPtr<AbstractScStringInputDlg> CreateScStringInputDlg(weld::Window* pParent,
                                                                     const OUString& rTitle,
diff --git a/sc/source/ui/inc/shtabdlg.hxx b/sc/source/ui/inc/shtabdlg.hxx
index 1d7ac26a7f7c..37d69ba07a36 100644
--- a/sc/source/ui/inc/shtabdlg.hxx
+++ b/sc/source/ui/inc/shtabdlg.hxx
@@ -20,35 +20,30 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_SHTABDLG_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_SHTABDLG_HXX
 
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/layout.hxx>
-#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
 
-class ScShowTabDlg : public ModalDialog
+class ScShowTabDlg : public weld::GenericDialogController
 {
 private:
-    VclPtr<VclFrame> m_pFrame;
-    VclPtr<ListBox> m_pLb;
+    std::unique_ptr<weld::Frame> m_xFrame;
+    std::unique_ptr<weld::TreeView> m_xLb;
 
-    DECL_LINK( DblClkHdl, ListBox&, void );
+    DECL_LINK( DblClkHdl, weld::TreeView&, void );
 
 public:
-    ScShowTabDlg( vcl::Window* pParent );
+    ScShowTabDlg(weld::Window* pParent);
     virtual ~ScShowTabDlg() override;
-    virtual void dispose() override;
 
     /** Sets dialog title, fixed text for listbox and help IDs. */
     void    SetDescription(
                 const OUString& rTitle, const OUString& rFixedText,
                 const OString& nDlgHelpId, const OString& nLbHelpId );
 
-    /** Inserts a string into the ListBox. */
+    /** Inserts a string into the weld::TreeView. */
     void    Insert( const OUString& rString, bool bSelected );
 
-    sal_Int32 GetSelectedEntryCount() const;
-    OUString    GetSelectedEntry(sal_Int32 nPos) const;
-    sal_Int32 GetSelectedEntryPos(sal_Int32 nPos) const;
+    std::vector<sal_Int32> GetSelectedRows() const;
+    OUString GetEntry(sal_Int32 nPos) const;
 };
 
 #endif
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx
index 65f69fa37462..002bf482fd7e 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -153,7 +153,7 @@ void ScLinkedAreaDlg::InitFromOldLink( const OUString& rFile, const OUString& rF
     for ( sal_Int32 i=0; i<nRangeCount; i++ )
     {
         OUString aRange = rSource.getToken(i,';');
-        m_xLbRanges->select(aRange);
+        m_xLbRanges->select_text(aRange);
     }
 
     bool bDoRefresh = (nRefresh != 0);
@@ -304,7 +304,7 @@ OUString ScLinkedAreaDlg::GetOptions()
 OUString ScLinkedAreaDlg::GetSource()
 {
     OUStringBuffer aBuf;
-    std::vector<OUString> aSelection = m_xLbRanges->get_selected_rows();
+    std::vector<OUString> aSelection = m_xLbRanges->get_selected_rows_text();
     for (size_t i = 0; i < aSelection.size(); ++i)
     {
         if (i > 0)
diff --git a/sc/source/ui/miscdlgs/shtabdlg.cxx b/sc/source/ui/miscdlgs/shtabdlg.cxx
index 008a1909ce10..31877686bb0a 100644
--- a/sc/source/ui/miscdlgs/shtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/shtabdlg.cxx
@@ -21,65 +21,51 @@
 
 #include <shtabdlg.hxx>
 
-ScShowTabDlg::ScShowTabDlg(vcl::Window* pParent)
-    : ModalDialog(pParent, "ShowSheetDialog", "modules/scalc/ui/showsheetdialog.ui")
+ScShowTabDlg::ScShowTabDlg(weld::Window* pParent)
+    : GenericDialogController(pParent, "modules/scalc/ui/showsheetdialog.ui", "ShowSheetDialog")
+    , m_xFrame(m_xBuilder->weld_frame("frame"))
+    , m_xLb(m_xBuilder->weld_tree_view("treeview"))
 {
-    get(m_pFrame, "frame");
-    get(m_pLb, "treeview");
-
-    m_pLb->Clear();
-    m_pLb->EnableMultiSelection(true);
-    m_pLb->set_height_request(m_pLb->GetTextHeight() * 10);
-    m_pLb->SetDoubleClickHdl( LINK( this, ScShowTabDlg, DblClkHdl ) );
+    m_xLb->set_selection_mode(true);
+    m_xLb->set_size_request(-1, m_xLb->get_height_rows(10));
+    m_xLb->connect_row_activated(LINK(this, ScShowTabDlg, DblClkHdl));
 }
 
 ScShowTabDlg::~ScShowTabDlg()
 {
-    disposeOnce();
-}
-
-void ScShowTabDlg::dispose()
-{
-    m_pFrame.clear();
-    m_pLb.clear();
-    ModalDialog::dispose();
 }
 
 void ScShowTabDlg::SetDescription(
         const OUString& rTitle, const OUString& rFixedText,
         const OString& rDlgHelpId, const OString& sLbHelpId )
 {
-    SetText(rTitle);
-    m_pFrame->set_label(rFixedText);
-    SetHelpId( rDlgHelpId );
-    m_pLb->SetHelpId( sLbHelpId );
-}
-
-void ScShowTabDlg::Insert( const OUString& rString, bool bSelected )
-{
-    m_pLb->InsertEntry( rString );
-    if( bSelected )
-        m_pLb->SelectEntryPos( m_pLb->GetEntryCount() - 1 );
+    m_xDialog->set_title(rTitle);
+    m_xFrame->set_label(rFixedText);
+    m_xDialog->set_help_id(rDlgHelpId);
+    m_xLb->set_help_id(sLbHelpId);
 }
 
-sal_Int32 ScShowTabDlg::GetSelectedEntryCount() const
+void ScShowTabDlg::Insert(const OUString& rString, bool bSelected)
 {
-    return m_pLb->GetSelectedEntryCount();
+    m_xLb->append_text(rString);
+    if (bSelected)
+        m_xLb->select(m_xLb->n_children() - 1);
 }
 
-OUString ScShowTabDlg::GetSelectedEntry(sal_Int32 nPos) const
+std::vector<sal_Int32> ScShowTabDlg::GetSelectedRows() const
 {
-    return m_pLb->GetSelectedEntry(nPos);
+    auto aTmp = m_xLb->get_selected_rows();
+    return std::vector<sal_Int32>(aTmp.begin(), aTmp.end());
 }
 
-sal_Int32 ScShowTabDlg::GetSelectedEntryPos(sal_Int32 nPos) const
+OUString ScShowTabDlg::GetEntry(sal_Int32 nIndex) const
 {
-    return m_pLb->GetSelectedEntryPos(nPos);
+    return m_xLb->get(nIndex);
 }
 
-IMPL_LINK_NOARG(ScShowTabDlg, DblClkHdl, ListBox&, void)
+IMPL_LINK_NOARG(ScShowTabDlg, DblClkHdl, weld::TreeView&, void)
 {
-    EndDialog( RET_OK );
+    m_xDialog->response(RET_OK);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index a65d878dc4e4..5e5932bad002 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -850,7 +850,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                ScopedVclPtr<AbstractScShowTabDlg> pDlg(pFact->CreateScShowTabDlg(GetDialogParent()));
+                ScopedVclPtr<AbstractScShowTabDlg> pDlg(pFact->CreateScShowTabDlg(GetFrameWeld()));
                 OSL_ENSURE(pDlg, "Dialog create fail!");
                 pDlg->SetDescription(
                     ScResId( STR_DLG_SELECTTABLES_TITLE ),
@@ -867,9 +867,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
 
                 if( pDlg->Execute() == RET_OK )
                 {
-                    const sal_Int32 nSelCount = pDlg->GetSelectedEntryCount();
-                    for( sal_Int32 nSelIx = 0; nSelIx < nSelCount; ++nSelIx )
-                        aIndexList.insert( aIndexList.begin()+nSelIx, pDlg->GetSelectedEntryPos( nSelIx ) );
+                    aIndexList = pDlg->GetSelectedRows();
                     pDlg.disposeAndClear();
                     rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, aIndexList ) );
                 }
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 6d5197b6333e..9d1af77fa0f2 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -136,7 +136,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                    VclPtr<AbstractScShowTabDlg> pDlg(pFact->CreateScShowTabDlg(GetDialogParent()));
+                    VclPtr<AbstractScShowTabDlg> pDlg(pFact->CreateScShowTabDlg(GetFrameWeld()));
                     OSL_ENSURE(pDlg, "Dialog create fail!");
 
                     OUString aTabName;
@@ -153,20 +153,20 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 
                     std::shared_ptr<SfxRequest> pReq = std::make_shared<SfxRequest>(rReq);
                     pDlg->StartExecuteAsync([this, pDlg, pReq](sal_Int32 nResult){
-                        OUString sTable;
                         std::vector<OUString> sTables;
                         if (RET_OK == nResult)
                         {
-                            const sal_Int32 nCount = pDlg->GetSelectedEntryCount();
-                            for (sal_Int32 nPos=0; nPos<nCount; ++nPos)
+                            std::vector<sal_Int32> aSelectedRows = pDlg->GetSelectedRows();
+                            for (auto a : aSelectedRows)
                             {
-                                sTable = pDlg->GetSelectedEntry(nPos);
+                                OUString sTable = pDlg->GetEntry(a);
                                 pReq->AppendItem( SfxStringItem( FID_TABLE_SHOW, sTable ) );
                                 sTables.push_back(sTable);
                             }
                             ShowTable( sTables );
                             pReq->Done();
                         }
+                        pDlg->disposeOnce();
                     });
                     rReq.Ignore();
                 }
diff --git a/sc/uiconfig/scalc/ui/showsheetdialog.ui b/sc/uiconfig/scalc/ui/showsheetdialog.ui
index 8df033ccd4db..a88105542580 100644
--- a/sc/uiconfig/scalc/ui/showsheetdialog.ui
+++ b/sc/uiconfig/scalc/ui/showsheetdialog.ui
@@ -1,12 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
 <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="GtkDialog" id="ShowSheetDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="showsheetdialog|ShowSheetDialog">Show Sheet</property>
     <property name="resizable">False</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 internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -87,14 +98,35 @@
                 <property name="top_padding">6</property>
                 <property name="left_padding">12</property>
                 <child>
-                  <object class="GtkTreeView" id="treeview:border">
+                  <object class="GtkScrolledWindow">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <child internal-child="selection">
-                      <object class="GtkTreeSelection" id="treeview-selection1">
-                        <property name="mode">multiple</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkTreeView" id="treeview">
+                        <property name="visible">True</property>
+                        <property name="can_focus">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"/>
+                        </child>
+                        <child>
+                          <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                            <child>
+                              <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                              <attributes>
+                                <attribute name="text">0</attribute>
+                              </attributes>
+                            </child>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>
@@ -125,5 +157,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index 136911e2cb13..cc88976587f1 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -182,7 +182,7 @@ IMPL_LINK( SfxNewFileDialog, RegionSelect, weld::TreeView&, rBox, void )
     const sal_uInt16 nCount = m_aTemplates.GetRegionCount() ? m_aTemplates.GetCount(nRegion): 0;
     m_xTemplateLb->freeze();
     m_xTemplateLb->clear();
-    OUString aSel = m_xRegionLb->get_selected();
+    OUString aSel = m_xRegionLb->get_selected_text();
     sal_Int32 nc = aSel.indexOf('(');
     if (nc != -1 && nc != 0)
         aSel = aSel.replaceAt(nc-1, 1, "");
@@ -227,7 +227,7 @@ sal_uInt16  SfxNewFileDialog::GetSelectedTemplatePos() const
     int nEntry = m_xTemplateLb->get_selected_index();
     if (nEntry == -1)
         return 0;
-    OUString aSel = m_xRegionLb->get_selected();
+    OUString aSel = m_xRegionLb->get_selected_text();
     sal_Int32 nc = aSel.indexOf('(');
     if (nc != -1 && nc != 0)
         aSel = aSel.replaceAt(nc-1, 1, "");
diff --git a/sfx2/source/doc/saveastemplatedlg.cxx b/sfx2/source/doc/saveastemplatedlg.cxx
index 16295a606d09..85eee202541e 100644
--- a/sfx2/source/doc/saveastemplatedlg.cxx
+++ b/sfx2/source/doc/saveastemplatedlg.cxx
@@ -97,7 +97,7 @@ IMPL_LINK_NOARG(SfxSaveAsTemplateDialog, SelectCategoryHdl, weld::TreeView&, voi
     }
     else
     {
-        msSelectedCategory = m_xLBCategory->get_selected();
+        msSelectedCategory = m_xLBCategory->get_selected_text();
         m_xOKButton->set_sensitive(!msTemplateName.isEmpty());
     }
 }
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 8317b8c139f3..403bc50fe41a 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1364,7 +1364,7 @@ IMPL_LINK_NOARG(SfxTemplateCategoryDialog, SelectCategoryHdl, weld::TreeView&, v
     }
     else
     {
-        msSelectedCategory = mxLBCategory->get_selected();
+        msSelectedCategory = mxLBCategory->get_selected_text();
         mxNewCategoryEdit->set_sensitive(false);
         mxOKButton->set_sensitive(true);
     }
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
index d21758e062dc..d467cfa3470e 100644
--- a/sw/source/ui/fldui/DropDownFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -70,7 +70,7 @@ sw::DropDownFieldDialog::DropDownFieldDialog(weld::Window *pParent, SwWrtShell &
         const OUString* pArray = aItems.getConstArray();
         for (sal_Int32 i = 0; i < aItems.getLength(); ++i)
             m_xListItemsLB->append_text(pArray[i]);
-        m_xListItemsLB->select(m_pDropField->GetSelectedItem());
+        m_xListItemsLB->select_text(m_pDropField->GetSelectedItem());
     }
 
     bool bEnable = !m_rSh.IsCursorReadonly();
@@ -87,7 +87,7 @@ void sw::DropDownFieldDialog::Apply()
 {
     if (m_pDropField)
     {
-        OUString sSelect = m_xListItemsLB->get_selected();
+        OUString sSelect = m_xListItemsLB->get_selected_text();
         if (m_pDropField->GetPar1() != sSelect)
         {
             m_rSh.StartAllAction();
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 7fb4fd8a9d95..c76b640226dd 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -75,7 +75,7 @@ public:
 // remember selected entry
 IMPL_LINK( SwNumNamesDlg, SelectHdl, weld::TreeView&, rBox, void )
 {
-    m_xFormEdit->set_text(rBox.get_selected());
+    m_xFormEdit->set_text(rBox.get_selected_text());
     m_xFormEdit->select_region(0, -1);
 }
 
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index a66761b483d4..c8d8b0fd2395 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -265,7 +265,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl, weld::Button&, void)
 {
     OUString aMessage = m_aStrDelMsg;
     aMessage += "\n\n";
-    aMessage += m_xLbFormat->get_selected();
+    aMessage += m_xLbFormat->get_selected_text();
     aMessage += "\n";
 
     std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Question,
@@ -303,7 +303,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl, weld::Button&, void)
     bool bOk = false;
     while( !bOk )
     {
-        SwStringInputDlg aDlg(m_xDialog.get(), m_aStrRenameTitle, m_aStrLabel, m_xLbFormat->get_selected());
+        SwStringInputDlg aDlg(m_xDialog.get(), m_aStrRenameTitle, m_aStrLabel, m_xLbFormat->get_selected_text());
         if (aDlg.run() == RET_OK)
         {
             bool bFormatRenamed = false;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c2f4312aa371..1805559ee3ad 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1260,17 +1260,14 @@ public:
             m_xTreeView->SelectEntryPos(pos);
     }
 
-    virtual OUString get_selected() const override
+    virtual std::vector<int> get_selected_rows() const override
     {
-        return m_xTreeView->GetSelectedEntry();
-    }
-
-    virtual std::vector<OUString> get_selected_rows() const override
-    {
-        std::vector<OUString> aRows;
+        std::vector<int> aRows;
 
-        for (sal_Int32 i = 0; i < m_xTreeView->GetSelectedEntryCount(); ++i)
-            aRows.push_back(m_xTreeView->GetSelectedEntry(i));
+        sal_Int32 nCount = m_xTreeView->GetSelectedEntryCount();
+        aRows.reserve(nCount);
+        for (sal_Int32 i = 0; i < nCount; ++i)
+            aRows.push_back(m_xTreeView->GetSelectedEntryPos(i));
 
         return aRows;
     }
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e961a9c6f041..62ba6f6590f6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1944,6 +1944,7 @@ private:
 
         hide();
         m_aFunc(GtkToVcl(ret));
+        m_aFunc = nullptr;
         m_xDialogController.reset();
     }
 public:
@@ -3103,34 +3104,16 @@ public:
         enable_notify_events();
     }
 
-    virtual OUString get_selected() const override
+    virtual std::vector<int> get_selected_rows() const override
     {
-        assert(gtk_tree_selection_get_mode(gtk_tree_view_get_selection(m_pTreeView)) == GTK_SELECTION_SINGLE);
-
-        OUString sRet;
-        GtkTreeIter iter;
-        GtkTreeModel* pModel;
-        if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(m_pTreeView), &pModel, &iter))
-        {
-            gchar *pStr = nullptr;
-            gtk_tree_model_get(pModel, &iter, 0, &pStr, -1);
-            sRet = OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
-            g_free(pStr);
-        }
-        return sRet;
-    }
-
-    virtual std::vector<OUString> get_selected_rows() const override
-    {
-        std::vector<OUString> aRows;
+        std::vector<int> aRows;
 
         GtkTreeModel* pModel;
         GList* pList = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(m_pTreeView), &pModel);
         for (GList* pItem = g_list_first(pList); pItem; pItem = g_list_next(pItem))
         {
             GtkTreePath* path = static_cast<GtkTreePath*>(pItem->data);
-            int nRow = gtk_tree_path_get_indices(path)[0];
-            aRows.push_back(get(nRow));
+            aRows.push_back(gtk_tree_path_get_indices(path)[0]);
         }
         g_list_free_full(pList, reinterpret_cast<GDestroyNotify>(gtk_tree_path_free));
 


More information about the Libreoffice-commits mailing list