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

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


 sc/inc/scabstdlg.hxx                |    3 --
 sc/source/ui/attrdlg/scdlgfact.cxx  |   14 ++++++-----
 sc/source/ui/attrdlg/scdlgfact.hxx  |   11 ++++++---
 sc/source/ui/inc/lbseldlg.hxx       |   16 ++++---------
 sc/source/ui/miscdlgs/lbseldlg.cxx  |   34 ++++++++++-----------------
 sc/source/ui/view/cellsh2.cxx       |    3 --
 sc/uiconfig/scalc/ui/selectrange.ui |   44 ++++++++++++++++++++++++++++++++----
 7 files changed, 76 insertions(+), 49 deletions(-)

New commits:
commit c8e50e5d407eb0957d8b49683dd45d50d715929a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 18 11:49:27 2018 +0100

    weld ScSelEntryDlg
    
    Change-Id: I1bc78b61a50f909ceb4c79e9dc9425306d41e617
    Reviewed-on: https://gerrit.libreoffice.org/54534
    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 979876d88c77..1815e2680802 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -450,8 +450,7 @@ public:
     virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
         SCTAB nTabCount, bool bFromFile) = 0;
 
-    virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg ( vcl::Window* pParent,
-                                                          const std::vector<OUString> &rEntryList ) = 0;
+    virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg(weld::Window* pParent, const std::vector<OUString> &rEntryList) = 0;
     virtual VclPtr<AbstractScLinkedAreaDlg> CreateScLinkedAreaDlg(weld::Window* pParent) = 0;
 
     virtual VclPtr<AbstractScMetricInputDlg> CreateScMetricInputDlg(weld::Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index b5a434272149..d0d098d1fb45 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -129,7 +129,10 @@ short AbstractScInsertTableDlg_Impl::Execute()
     return m_xDlg->execute();
 }
 
-IMPL_ABSTDLG_BASE(AbstractScSelEntryDlg_Impl);
+short AbstractScSelEntryDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
 
 short AbstractScMetricInputDlg_Impl::Execute()
 {
@@ -443,7 +446,7 @@ const OUString* AbstractScInsertTableDlg_Impl::GetNextTable( sal_uInt16* pN )
 
 OUString AbstractScSelEntryDlg_Impl::GetSelectedEntry() const
 {
-    return pDlg->GetSelectedEntry();
+    return m_xDlg->GetSelectedEntry();
 }
 
 void AbstractScLinkedAreaDlg_Impl::InitFromOldLink( const OUString& rFile, const OUString& rFilter,
@@ -777,11 +780,10 @@ VclPtr<AbstractScInsertTableDlg> ScAbstractDialogFactory_Impl::CreateScInsertTab
     return VclPtr<AbstractScInsertTableDlg_Impl>::Create(new ScInsertTableDlg(pParent, rViewData,nTabCount, bFromFile));
 }
 
-VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg ( vcl::Window* pParent,
-                                                        const std::vector<OUString> &rEntryList )
+VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg(weld::Window* pParent,
+                                                                                const std::vector<OUString> &rEntryList)
 {
-    VclPtr<ScSelEntryDlg> pDlg = VclPtr<ScSelEntryDlg>::Create( pParent, rEntryList );
-    return VclPtr<AbstractScSelEntryDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractScSelEntryDlg_Impl>::Create(new ScSelEntryDlg(pParent, rEntryList));
 }
 
 VclPtr<AbstractScLinkedAreaDlg> ScAbstractDialogFactory_Impl::CreateScLinkedAreaDlg(weld::Window* pParent)
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index d2a1a694c6aa..a62239af8a87 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -288,7 +288,13 @@ public:
 
 class AbstractScSelEntryDlg_Impl : public AbstractScSelEntryDlg
 {
-    DECL_ABSTDLG_BASE( AbstractScSelEntryDlg_Impl, ScSelEntryDlg )
+    std::unique_ptr<ScSelEntryDlg> m_xDlg;
+public:
+    explicit AbstractScSelEntryDlg_Impl(ScSelEntryDlg* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short    Execute() override;
     virtual OUString GetSelectedEntry() const override;
 };
 
@@ -535,8 +541,7 @@ public:
     virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
         SCTAB nTabCount, bool bFromFile) override;
 
-    virtual VclPtr<AbstractScSelEntryDlg> CreateScSelEntryDlg ( vcl::Window* pParent,
-                                                          const std::vector<OUString> &rEntryList ) override;
+    virtual VclPtr<AbstractScSelEntryDlg> CreateScSelEntryDlg(weld::Window* pParent, const std::vector<OUString> &rEntryList) override;
 
     virtual VclPtr<AbstractScLinkedAreaDlg> CreateScLinkedAreaDlg(weld::Window* pParent) override;
 
diff --git a/sc/source/ui/inc/lbseldlg.hxx b/sc/source/ui/inc/lbseldlg.hxx
index 0b45c70e8fa1..fc78c8a77367 100644
--- a/sc/source/ui/inc/lbseldlg.hxx
+++ b/sc/source/ui/inc/lbseldlg.hxx
@@ -20,24 +20,18 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_LBSELDLG_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_LBSELDLG_HXX
 
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
 
-#include <vcl/button.hxx>
-
-#include <vcl/dialog.hxx>
-
-class ScSelEntryDlg : public ModalDialog
+class ScSelEntryDlg : public weld::GenericDialogController
 {
 private:
-    VclPtr<ListBox> m_pLb;
+    std::unique_ptr<weld::TreeView> m_xLb;
 
-    DECL_LINK( DblClkHdl, ListBox&, void );
+    DECL_LINK(DblClkHdl, weld::TreeView&, void);
 
 public:
-    ScSelEntryDlg(vcl::Window* pParent, const std::vector<OUString> &rEntryList);
+    ScSelEntryDlg(weld::Window* pParent, const std::vector<OUString> &rEntryList);
     virtual ~ScSelEntryDlg() override;
-    virtual void dispose() override;
 
     OUString GetSelectedEntry() const;
 };
diff --git a/sc/source/ui/miscdlgs/lbseldlg.cxx b/sc/source/ui/miscdlgs/lbseldlg.cxx
index ec5df0895c31..d01864afd8e2 100644
--- a/sc/source/ui/miscdlgs/lbseldlg.cxx
+++ b/sc/source/ui/miscdlgs/lbseldlg.cxx
@@ -21,42 +21,34 @@
 
 #include <lbseldlg.hxx>
 
-ScSelEntryDlg::ScSelEntryDlg(vcl::Window*  pParent, const std::vector<OUString> &rEntryList)
-    : ModalDialog(pParent, "SelectRangeDialog", "modules/scalc/ui/selectrange.ui")
+ScSelEntryDlg::ScSelEntryDlg(weld::Window* pParent, const std::vector<OUString> &rEntryList)
+    : GenericDialogController(pParent, "modules/scalc/ui/selectrange.ui", "SelectRangeDialog")
+    , m_xLb(m_xBuilder->weld_tree_view("treeview"))
 {
-    get(m_pLb, "treeview");
-    m_pLb->SetDropDownLineCount(8);
-    m_pLb->set_width_request(m_pLb->approximate_char_width() * 32);
-    m_pLb->SetDoubleClickHdl( LINK( this, ScSelEntryDlg, DblClkHdl ) );
+    m_xLb->set_size_request(m_xLb->get_approximate_digit_width() * 32,
+                            m_xLb->get_height_rows(8));
+    m_xLb->connect_row_activated(LINK(this, ScSelEntryDlg, DblClkHdl));
 
     std::vector<OUString>::const_iterator pIter;
-    for ( pIter = rEntryList.begin(); pIter != rEntryList.end(); ++pIter )
-        m_pLb->InsertEntry(*pIter);
+    for (pIter = rEntryList.begin(); pIter != rEntryList.end(); ++pIter)
+        m_xLb->append_text(*pIter);
 
-    if ( m_pLb->GetEntryCount() > 0 )
-        m_pLb->SelectEntryPos( 0 );
+    if (m_xLb->n_children() > 0)
+        m_xLb->select(0);
 }
 
 ScSelEntryDlg::~ScSelEntryDlg()
 {
-    disposeOnce();
 }
 
-void ScSelEntryDlg::dispose()
-{
-    m_pLb.clear();
-    ModalDialog::dispose();
-}
-
-
 OUString ScSelEntryDlg::GetSelectedEntry() const
 {
-    return m_pLb->GetSelectedEntry();
+    return m_xLb->get_selected_text();
 }
 
-IMPL_LINK_NOARG(ScSelEntryDlg, DblClkHdl, ListBox&, void)
+IMPL_LINK_NOARG(ScSelEntryDlg, 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/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index df6497bcc660..72f9f405c994 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -740,8 +740,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                         OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                        ScopedVclPtr<AbstractScSelEntryDlg> pDlg(pFact->CreateScSelEntryDlg( pTabViewShell->GetDialogParent(),
-                                                                                                  aList ));
+                        ScopedVclPtr<AbstractScSelEntryDlg> pDlg(pFact->CreateScSelEntryDlg(pTabViewShell->GetFrameWeld(), aList));
                         OSL_ENSURE(pDlg, "Dialog create fail!");
                         if ( pDlg->Execute() == RET_OK )
                         {
diff --git a/sc/uiconfig/scalc/ui/selectrange.ui b/sc/uiconfig/scalc/ui/selectrange.ui
index c31d24d2a4c7..d409c4c9df59 100644
--- a/sc/uiconfig/scalc/ui/selectrange.ui
+++ b/sc/uiconfig/scalc/ui/selectrange.ui
@@ -1,20 +1,35 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
+  <object class="GtkListStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkDialog" id="SelectRangeDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="selectrange|SelectRangeDialog">Select Database Range</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="SelectRange">
         <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">12</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>
@@ -57,6 +72,7 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -84,7 +100,7 @@
                 <property name="top_padding">6</property>
                 <property name="left_padding">12</property>
                 <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>
@@ -94,6 +110,26 @@
                       <object class="GtkTreeView" id="treeview">
                         <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"/>
+                        </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>


More information about the Libreoffice-commits mailing list