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

Caolán McNamara caolanm at redhat.com
Fri Apr 13 14:37:07 UTC 2018


 sc/inc/scabstdlg.hxx                   |    2 
 sc/qa/unit/screenshots/screenshots.cxx |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx     |   14 ++++--
 sc/source/ui/attrdlg/scdlgfact.hxx     |   10 +++-
 sc/source/ui/inc/delcldlg.hxx          |   17 +++-----
 sc/source/ui/miscdlgs/delcldlg.cxx     |   68 ++++++++++++++++-----------------
 sc/source/ui/view/cellsh1.cxx          |    2 
 sc/uiconfig/scalc/ui/deletecells.ui    |   18 +++++---
 8 files changed, 74 insertions(+), 59 deletions(-)

New commits:
commit 1f5c0cf78d1dcc7420e93ae7c24d838931aba88d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 13 13:46:51 2018 +0100

    weld ScDeleteCellDlg
    
    Change-Id: Ie85c51c019f892f647c2a13f67f47080ffa414b1
    Reviewed-on: https://gerrit.libreoffice.org/52829
    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 d970cac36827..f624f343029d 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -423,7 +423,7 @@ public:
     virtual VclPtr<AbstractScDataPilotServiceDlg> CreateScDataPilotServiceDlg( vcl::Window* pParent,
                                                                         const std::vector<OUString>& rServices ) = 0;
 
-    virtual VclPtr<AbstractScDeleteCellDlg> CreateScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove) = 0 ;
+    virtual VclPtr<AbstractScDeleteCellDlg> CreateScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove) = 0 ;
 
     //for dataform
     virtual VclPtr<AbstractScDataFormDlg> CreateScDataFormDlg(vcl::Window* pParent,
diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index 3735ea54b123..6268c9f94cda 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -162,7 +162,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
 
         case 1: // "modules/scalc/ui/deletecells.ui"
         {
-            pReturnDialog = mpFact->CreateScDeleteCellDlg(mpViewShell->GetDialogParent(), false);
+            pReturnDialog = mpFact->CreateScDeleteCellDlg(mpViewShell->GetFrameWeld(), false);
             break;
         }
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 2c7c7eb2ebba..37da3f4d980d 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -82,7 +82,12 @@ IMPL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDataPilotServiceDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractScDeleteCellDlg_Impl);
+
+short AbstractScDeleteCellDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 //for dataform
 IMPL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDeleteContentsDlg_Impl);
@@ -242,7 +247,7 @@ OUString AbstractScDataPilotServiceDlg_Impl::GetParPass() const
 
 DelCellCmd AbstractScDeleteCellDlg_Impl::GetDelCellCmd() const
 {
-    return pDlg->GetDelCellCmd();
+    return m_xDlg->GetDelCellCmd();
 }
 
 void AbstractScDeleteContentsDlg_Impl::DisableObjects()
@@ -679,11 +684,10 @@ VclPtr<AbstractScDataPilotServiceDlg> ScAbstractDialogFactory_Impl::CreateScData
     return VclPtr<AbstractScDataPilotServiceDlg_Impl>::Create( pDlg );
 }
 
-VclPtr<AbstractScDeleteCellDlg> ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg(vcl::Window* pParent,
+VclPtr<AbstractScDeleteCellDlg> ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg(weld::Window* pParent,
     bool bDisallowCellMove)
 {
-    VclPtr<ScDeleteCellDlg> pDlg = VclPtr<ScDeleteCellDlg>::Create(pParent, bDisallowCellMove);
-    return VclPtr<AbstractScDeleteCellDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractScDeleteCellDlg_Impl>::Create(new ScDeleteCellDlg(pParent, bDisallowCellMove));
 }
 
 VclPtr<AbstractScDataFormDlg> ScAbstractDialogFactory_Impl::CreateScDataFormDlg(vcl::Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 1f2bcee38bce..46982a8a2b67 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -162,7 +162,13 @@ class AbstractScDataPilotServiceDlg_Impl : public AbstractScDataPilotServiceDlg
 
 class AbstractScDeleteCellDlg_Impl : public AbstractScDeleteCellDlg
 {
-    DECL_ABSTDLG_BASE(AbstractScDeleteCellDlg_Impl,ScDeleteCellDlg)
+    std::unique_ptr<ScDeleteCellDlg> m_xDlg;
+public:
+    explicit AbstractScDeleteCellDlg_Impl(ScDeleteCellDlg* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short           Execute() override;
     virtual DelCellCmd GetDelCellCmd() const override;
 };
 
@@ -435,7 +441,7 @@ public:
 
     virtual VclPtr<AbstractScDataPilotServiceDlg> CreateScDataPilotServiceDlg( vcl::Window* pParent,
                                                                         const std::vector<OUString>& rServices ) override;
-    virtual VclPtr<AbstractScDeleteCellDlg> CreateScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove ) override;
+    virtual VclPtr<AbstractScDeleteCellDlg> CreateScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove ) override;
 
     //for dataform
     virtual VclPtr<AbstractScDataFormDlg> CreateScDataFormDlg(vcl::Window* pParent,
diff --git a/sc/source/ui/inc/delcldlg.hxx b/sc/source/ui/inc/delcldlg.hxx
index cdf57f5a9373..3a140bfe6dca 100644
--- a/sc/source/ui/inc/delcldlg.hxx
+++ b/sc/source/ui/inc/delcldlg.hxx
@@ -20,24 +20,21 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_DELCLDLG_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_DELCLDLG_HXX
 
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
+#include <vcl/weld.hxx>
 
 #include <global.hxx>
 
-class ScDeleteCellDlg : public ModalDialog
+class ScDeleteCellDlg : public weld::GenericDialogController
 {
 private:
-    VclPtr<RadioButton> m_pBtnCellsUp;
-    VclPtr<RadioButton> m_pBtnCellsLeft;
-    VclPtr<RadioButton> m_pBtnDelRows;
-    VclPtr<RadioButton> m_pBtnDelCols;
+    std::unique_ptr<weld::RadioButton> m_xBtnCellsUp;
+    std::unique_ptr<weld::RadioButton> m_xBtnCellsLeft;
+    std::unique_ptr<weld::RadioButton> m_xBtnDelRows;
+    std::unique_ptr<weld::RadioButton> m_xBtnDelCols;
 
 public:
-    ScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove);
+    ScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove);
     virtual ~ScDeleteCellDlg() override;
-    virtual void dispose() override;
 
     DelCellCmd GetDelCellCmd() const;
 };
diff --git a/sc/source/ui/miscdlgs/delcldlg.cxx b/sc/source/ui/miscdlgs/delcldlg.cxx
index 14f7cc8aa5bd..f4991d4e2225 100644
--- a/sc/source/ui/miscdlgs/delcldlg.cxx
+++ b/sc/source/ui/miscdlgs/delcldlg.cxx
@@ -25,73 +25,75 @@
 
 static sal_uInt8 nDelItemChecked=0;
 
-ScDeleteCellDlg::ScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove)
-    : ModalDialog(pParent, "DeleteCellsDialog", "modules/scalc/ui/deletecells.ui")
+ScDeleteCellDlg::ScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove)
+    : GenericDialogController(pParent, "modules/scalc/ui/deletecells.ui", "DeleteCellsDialog")
+    , m_xBtnCellsUp(m_xBuilder->weld_radio_button("up"))
+    , m_xBtnCellsLeft(m_xBuilder->weld_radio_button("left"))
+    , m_xBtnDelRows(m_xBuilder->weld_radio_button("rows"))
+    , m_xBtnDelCols(m_xBuilder->weld_radio_button("cols"))
 {
-    get(m_pBtnCellsUp, "up");
-    get(m_pBtnCellsLeft, "left");
-    get(m_pBtnDelRows, "rows");
-    get(m_pBtnDelCols, "cols");
-
     if (bDisallowCellMove)
     {
-        m_pBtnCellsUp->Disable();
-        m_pBtnCellsLeft->Disable();
+        m_xBtnCellsUp->set_sensitive(false);
+        m_xBtnCellsLeft->set_sensitive(false);
 
-        switch(nDelItemChecked)
+        switch (nDelItemChecked)
         {
-            case 2: m_pBtnDelRows->Check();break;
-            case 3: m_pBtnDelCols->Check();break;
-            default:m_pBtnDelRows->Check();break;
+            case 2:
+                m_xBtnDelRows->set_active(true);
+                break;
+            case 3:
+                m_xBtnDelCols->set_active(true);
+                break;
+            default:
+                m_xBtnDelRows->set_active(true);
+                break;
         }
     }
     else
     {
-        switch(nDelItemChecked)
+        switch (nDelItemChecked)
         {
-            case 0: m_pBtnCellsUp->Check();break;
-            case 1: m_pBtnCellsLeft->Check();break;
-            case 2: m_pBtnDelRows->Check();break;
-            case 3: m_pBtnDelCols->Check();break;
+            case 0:
+                m_xBtnCellsUp->set_active(true);
+                break;
+            case 1:
+                m_xBtnCellsLeft->set_active(true);
+                break;
+            case 2:
+                m_xBtnDelRows->set_active(true);
+                break;
+            case 3:
+                m_xBtnDelCols->set_active(true);
+                break;
         }
     }
 }
 
 ScDeleteCellDlg::~ScDeleteCellDlg()
 {
-    disposeOnce();
 }
 
-void ScDeleteCellDlg::dispose()
-{
-    m_pBtnCellsUp.clear();
-    m_pBtnCellsLeft.clear();
-    m_pBtnDelRows.clear();
-    m_pBtnDelCols.clear();
-    ModalDialog::dispose();
-}
-
-
 DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const
 {
     DelCellCmd nReturn = DEL_NONE;
 
-    if ( m_pBtnCellsUp->IsChecked()   )
+    if ( m_xBtnCellsUp->get_active()   )
     {
         nDelItemChecked=0;
         nReturn = DEL_CELLSUP;
     }
-    else if ( m_pBtnCellsLeft->IsChecked() )
+    else if ( m_xBtnCellsLeft->get_active() )
     {
         nDelItemChecked=1;
         nReturn = DEL_CELLSLEFT;
     }
-    else if ( m_pBtnDelRows->IsChecked()   )
+    else if ( m_xBtnDelRows->get_active()   )
     {
         nDelItemChecked=2;
         nReturn = DEL_DELROWS;
     }
-    else if ( m_pBtnDelCols->IsChecked()   )
+    else if ( m_xBtnDelCols->get_active()   )
     {
         nDelItemChecked=3;
         nReturn = DEL_DELCOLS;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 0593574a9891..93804259ec73 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -365,7 +365,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                         OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                        ScopedVclPtr<AbstractScDeleteCellDlg> pDlg(pFact->CreateScDeleteCellDlg( pTabViewShell->GetDialogParent(), bTheFlag ));
+                        ScopedVclPtr<AbstractScDeleteCellDlg> pDlg(pFact->CreateScDeleteCellDlg( pTabViewShell->GetFrameWeld(), bTheFlag ));
                         OSL_ENSURE(pDlg, "Dialog create fail!");
 
                         if (pDlg->Execute() == RET_OK)
diff --git a/sc/uiconfig/scalc/ui/deletecells.ui b/sc/uiconfig/scalc/ui/deletecells.ui
index 959dd6d5811f..3883d27e4a09 100644
--- a/sc/uiconfig/scalc/ui/deletecells.ui
+++ b/sc/uiconfig/scalc/ui/deletecells.ui
@@ -1,5 +1,5 @@
 <?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="GtkDialog" id="DeleteCellsDialog">
@@ -7,16 +7,19 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="deletecells|DeleteCellsDialog">Delete Cells</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">
         <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>
@@ -60,6 +63,7 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -98,7 +102,6 @@
                         <property name="xalign">0</property>
                         <property name="active">True</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">left</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -115,7 +118,7 @@
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">rows</property>
+                        <property name="group">up</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -132,7 +135,7 @@
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">cols</property>
+                        <property name="group">up</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -185,5 +188,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list