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

Caolán McNamara caolanm at redhat.com
Fri May 4 07:54:25 UTC 2018


 sc/source/ui/inc/mergecellsdialog.hxx      |   15 +++++---------
 sc/source/ui/miscdlgs/mergecellsdialog.cxx |   30 ++++++++---------------------
 sc/source/ui/view/viewfun2.cxx             |    7 +++---
 sc/uiconfig/scalc/ui/mergecellsdialog.ui   |   25 ++++++++++++++----------
 4 files changed, 34 insertions(+), 43 deletions(-)

New commits:
commit 736cebb414af587e7ac82f1326b06ce4022badf4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 3 16:46:52 2018 +0100

    weld ScMergeCellsDialog
    
    Change-Id: I513f7e9b0c969706646821af508e41bb2331bbc2
    Reviewed-on: https://gerrit.libreoffice.org/53809
    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/source/ui/inc/mergecellsdialog.hxx b/sc/source/ui/inc/mergecellsdialog.hxx
index 49ef2da533b5..5fcbea926dda 100644
--- a/sc/source/ui/inc/mergecellsdialog.hxx
+++ b/sc/source/ui/inc/mergecellsdialog.hxx
@@ -11,9 +11,7 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_MERGECELLSDIALOG_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_MERGECELLSDIALOG_HXX
 
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/fixed.hxx>
+#include <vcl/weld.hxx>
 
 enum ScMergeCellsOption
 {
@@ -22,16 +20,15 @@ enum ScMergeCellsOption
     EmptyContentHiddenCells
 };
 
-class ScMergeCellsDialog : public ModalDialog
+class ScMergeCellsDialog : public weld::GenericDialogController
 {
-    VclPtr<RadioButton> mpRBMoveContent;
-    VclPtr<RadioButton> mpRBKeepContent;
-    VclPtr<RadioButton> mpRBEmptyContent;
+    std::unique_ptr<weld::RadioButton> m_xRBMoveContent;
+    std::unique_ptr<weld::RadioButton> m_xRBKeepContent;
+    std::unique_ptr<weld::RadioButton> m_xRBEmptyContent;
 
 public:
-    ScMergeCellsDialog( vcl::Window * pParent );
+    ScMergeCellsDialog(weld::Window* pParent);
     virtual ~ScMergeCellsDialog() override;
-    virtual void dispose() override;
 
     ScMergeCellsOption GetMergeCellsOption();
 };
diff --git a/sc/source/ui/miscdlgs/mergecellsdialog.cxx b/sc/source/ui/miscdlgs/mergecellsdialog.cxx
index aaff85bf8eaf..b936890437ab 100644
--- a/sc/source/ui/miscdlgs/mergecellsdialog.cxx
+++ b/sc/source/ui/miscdlgs/mergecellsdialog.cxx
@@ -10,41 +10,29 @@
 
 #include <mergecellsdialog.hxx>
 
-ScMergeCellsDialog::ScMergeCellsDialog( vcl::Window * pParent )
-            : ModalDialog( pParent, "MergeCellsDialog",
-               "modules/scalc/ui/mergecellsdialog.ui" )
+ScMergeCellsDialog::ScMergeCellsDialog(weld::Window * pParent)
+    : GenericDialogController(pParent, "modules/scalc/ui/mergecellsdialog.ui", "MergeCellsDialog")
+    , m_xRBMoveContent(m_xBuilder->weld_radio_button("move-cells-radio"))
+    , m_xRBKeepContent(m_xBuilder->weld_radio_button("keep-content-radio"))
+    , m_xRBEmptyContent(m_xBuilder->weld_radio_button("empty-cells-radio"))
 {
-    get(mpRBMoveContent, "move-cells-radio");
-    get(mpRBKeepContent, "keep-content-radio");
-    get(mpRBEmptyContent, "empty-cells-radio");
-
-    mpRBKeepContent->Check();
+    m_xRBKeepContent->set_active(true);
 }
 
 ScMergeCellsDialog::~ScMergeCellsDialog()
 {
-    disposeOnce();
-}
-
-void ScMergeCellsDialog::dispose()
-{
-    mpRBMoveContent.disposeAndClear();
-    mpRBKeepContent.disposeAndClear();
-    mpRBEmptyContent.disposeAndClear();
-    ModalDialog::dispose();
 }
 
 ScMergeCellsOption ScMergeCellsDialog::GetMergeCellsOption()
 {
-    if ( mpRBMoveContent->IsChecked() )
+    if ( m_xRBMoveContent->get_active() )
         return MoveContentHiddenCells;
-    if ( mpRBKeepContent->IsChecked() )
+    if ( m_xRBKeepContent->get_active() )
         return KeepContentHiddenCells;
-    if ( mpRBEmptyContent->IsChecked() )
+    if ( m_xRBEmptyContent->get_active() )
         return EmptyContentHiddenCells;
     assert(!"Unknown selection for merge cells.");
     return KeepContentHiddenCells; // default value
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 956593bfd234..29da9f810ff0 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1148,12 +1148,13 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter )
         bool bShowDialog = officecfg::Office::Calc::Compatibility::MergeCells::ShowDialog::get();
         if (!bApi && bShowDialog)
         {
-            ScopedVclPtr<ScMergeCellsDialog> aBox( VclPtr<ScMergeCellsDialog>::Create( GetViewData().GetDialogParent() ) );
-            sal_uInt16 nRetVal = aBox->Execute();
+            vcl::Window* pWin = GetViewData().GetDialogParent();
+            ScMergeCellsDialog aBox(pWin ? pWin->GetFrameWeld() : nullptr);
+            sal_uInt16 nRetVal = aBox.run();
 
             if ( nRetVal == RET_OK )
             {
-                switch ( aBox->GetMergeCellsOption() )
+                switch (aBox.GetMergeCellsOption())
                 {
                     case MoveContentHiddenCells:
                         rDoContents = true;
diff --git a/sc/uiconfig/scalc/ui/mergecellsdialog.ui b/sc/uiconfig/scalc/ui/mergecellsdialog.ui
index a7413ff396b5..028b56862846 100644
--- a/sc/uiconfig/scalc/ui/mergecellsdialog.ui
+++ b/sc/uiconfig/scalc/ui/mergecellsdialog.ui
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="MergeCellsDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="mergecellsdialog|MergeCellsDialog">Merge Cells</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>
@@ -105,7 +105,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
-                <property name="position">1</property>
               </packing>
             </child>
             <child>
@@ -122,7 +121,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">4</property>
-                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -139,7 +137,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">2</property>
-                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -150,7 +147,7 @@
                 <property name="margin_left">24</property>
                 <property name="margin_bottom">6</property>
                 <property name="hexpand">False</property>
-                <property name="pixbuf">vcl/res/MergeFirstCell.svg</property>
+                <property name="icon_name">vcl/res/MergeFirstCell.svg</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
@@ -165,7 +162,7 @@
                 <property name="margin_left">24</property>
                 <property name="margin_bottom">6</property>
                 <property name="hexpand">True</property>
-                <property name="pixbuf">vcl/res/MergeKeepHidden.svg</property>
+                <property name="icon_name">vcl/res/MergeKeepHidden.svg</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
@@ -179,7 +176,7 @@
                 <property name="halign">start</property>
                 <property name="margin_left">24</property>
                 <property name="hexpand">True</property>
-                <property name="pixbuf">vcl/res/MergeEmptyHidden.svg</property>
+                <property name="icon_name">vcl/res/MergeEmptyHidden.svg</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
@@ -195,5 +192,13 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget response="-5">ok</action-widget>
+      <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