[Libreoffice-commits] core.git: cui/source cui/uiconfig include/svx sd/source

Caolán McNamara caolanm at redhat.com
Mon Apr 30 13:18:11 UTC 2018


 cui/source/dialogs/newtabledlg.cxx   |   22 +++++++---------------
 cui/source/factory/dlgfact.cxx       |    4 ++--
 cui/source/factory/dlgfact.hxx       |    2 +-
 cui/source/inc/newtabledlg.hxx       |   15 +++++----------
 cui/uiconfig/ui/newtabledialog.ui    |   21 ++++++++++-----------
 include/svx/svxdlg.hxx               |    2 +-
 sd/source/ui/table/tablefunction.cxx |    2 +-
 7 files changed, 27 insertions(+), 41 deletions(-)

New commits:
commit 5fb3b6b925db2989ce61bb954d7156f2a3b84b4c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 30 10:41:16 2018 +0100

    weld SvxNewTableDialog
    
    Change-Id: I33189708a2f1b63080cbafc94fe288f8abe60830
    Reviewed-on: https://gerrit.libreoffice.org/53652
    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/newtabledlg.cxx b/cui/source/dialogs/newtabledlg.cxx
index bf5d320c9627..af4d91f1b1c5 100644
--- a/cui/source/dialogs/newtabledlg.cxx
+++ b/cui/source/dialogs/newtabledlg.cxx
@@ -19,11 +19,11 @@
 
 #include <newtabledlg.hxx>
 
-SvxNewTableDialog::SvxNewTableDialog()
-    : m_pDialog( VclPtr<ModalDialog>::Create( nullptr, "NewTableDialog", "cui/ui/newtabledialog.ui" ) )
+SvxNewTableDialog::SvxNewTableDialog(weld::Window* pWindow)
+    : GenericDialogController(pWindow, "cui/ui/newtabledialog.ui", "NewTableDialog")
+    , mxNumColumns(m_xBuilder->weld_spin_button("columns"))
+    , mxNumRows(m_xBuilder->weld_spin_button("rows"))
 {
-    m_pDialog->get(mpNumRows, "rows");
-    m_pDialog->get(mpNumColumns, "columns");
 }
 
 SvxNewTableDialog::~SvxNewTableDialog()
@@ -31,27 +31,19 @@ SvxNewTableDialog::~SvxNewTableDialog()
     disposeOnce();
 }
 
-void SvxNewTableDialog::dispose()
-{
-    mpNumColumns.clear();
-    mpNumRows.clear();
-    m_pDialog.disposeAndClear();
-    SvxAbstractNewTableDialog::dispose();
-}
-
 short SvxNewTableDialog::Execute()
 {
-    return m_pDialog->Execute();
+    return m_xDialog->run();
 }
 
 sal_Int32 SvxNewTableDialog::getRows() const
 {
-    return sal::static_int_cast< sal_Int32 >( mpNumRows->GetValue() );
+    return sal::static_int_cast< sal_Int32 >( mxNumRows->get_value() );
 }
 
 sal_Int32 SvxNewTableDialog::getColumns() const
 {
-    return sal::static_int_cast< sal_Int32 >( mpNumColumns->GetValue() );
+    return sal::static_int_cast< sal_Int32 >( mxNumColumns->get_value() );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index e5a3cfac7114..85b2d1504c37 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1545,9 +1545,9 @@ VclPtr<SvxAbstractSplitTableDialog> AbstractDialogFactory_Impl::CreateSvxSplitTa
     return VclPtr<SvxSplitTableDlg>::Create( pParent, bIsTableVertical, nMaxVertical, 99 );
 }
 
-VclPtr<SvxAbstractNewTableDialog> AbstractDialogFactory_Impl::CreateSvxNewTableDialog()
+VclPtr<SvxAbstractNewTableDialog> AbstractDialogFactory_Impl::CreateSvxNewTableDialog(weld::Window* pParent)
 {
-    return VclPtr<SvxNewTableDialog>::Create();
+    return VclPtr<SvxNewTableDialog>::Create(pParent);
 }
 
 VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateOptionsDialog(
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 2012658cbc9a..9de13861ee17 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -732,7 +732,7 @@ public:
 
     virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) override;
 
-    virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog() override ;
+    virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog(weld::Window* pParent) override ;
 
     virtual VclPtr<VclAbstractDialog>          CreateOptionsDialog(
         vcl::Window* pParent, const OUString& rExtensionId ) override;
diff --git a/cui/source/inc/newtabledlg.hxx b/cui/source/inc/newtabledlg.hxx
index 91de08ff6f23..88b7f61c5ec9 100644
--- a/cui/source/inc/newtabledlg.hxx
+++ b/cui/source/inc/newtabledlg.hxx
@@ -19,24 +19,19 @@
 #ifndef INCLUDED_CUI_SOURCE_INC_NEWTABLEDLG_HXX
 #define INCLUDED_CUI_SOURCE_INC_NEWTABLEDLG_HXX
 
-#include <vcl/fixed.hxx>
-#include <vcl/field.hxx>
-#include <vcl/button.hxx>
-
 #include <svx/stddlg.hxx>
 #include <svx/svxdlg.hxx>
+#include <vcl/weld.hxx>
 
-class SvxNewTableDialog : public SvxAbstractNewTableDialog
+class SvxNewTableDialog : public SvxAbstractNewTableDialog, public weld::GenericDialogController
 {
 private:
-    VclPtr<ModalDialog>  m_pDialog;
-    VclPtr<NumericField> mpNumColumns;
-    VclPtr<NumericField> mpNumRows;
+    std::unique_ptr<weld::SpinButton> mxNumColumns;
+    std::unique_ptr<weld::SpinButton> mxNumRows;
 
 public:
-    SvxNewTableDialog();
+    SvxNewTableDialog(weld::Window* pParent);
     virtual ~SvxNewTableDialog() override;
-    virtual void dispose() override;
 
     virtual short Execute() override;
 
diff --git a/cui/uiconfig/ui/newtabledialog.ui b/cui/uiconfig/ui/newtabledialog.ui
index d9814256f856..d44a22aa470e 100644
--- a/cui/uiconfig/ui/newtabledialog.ui
+++ b/cui/uiconfig/ui/newtabledialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="columns_value">
@@ -20,6 +20,9 @@
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="newtabledialog|NewTableDialog">Insert Table</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">
@@ -95,16 +98,14 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="newtabledialog|columns_label">_Number of columns:</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">columns</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>
@@ -112,16 +113,14 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="newtabledialog|rows_label">_Number of rows:</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">rows</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>
@@ -137,14 +136,13 @@
               <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>
               <object class="GtkSpinButton" id="rows">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="activates_default">True</property>
                 <property name="adjustment">rows_value</property>
                 <property name="snap_to_ticks">True</property>
                 <property name="numeric">True</property>
@@ -152,8 +150,6 @@
               <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>
@@ -170,5 +166,8 @@
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 9603739f8807..3d60ad7de275 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -469,7 +469,7 @@ public:
 
     virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) = 0;
 
-    virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog() = 0;
+    virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog(weld::Window* pParent) = 0;
 
     virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) = 0;
 };
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index e85d27a810fb..4a998e0dc8ad 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -124,7 +124,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
         if( (nColumns == 0) || (nRows == 0) )
         {
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-            ScopedVclPtr<SvxAbstractNewTableDialog> pDlg( pFact ? pFact->CreateSvxNewTableDialog() : nullptr);
+            ScopedVclPtr<SvxAbstractNewTableDialog> pDlg( pFact ? pFact->CreateSvxNewTableDialog(rReq.GetFrameWeld()) : nullptr);
 
             if( !pDlg.get() || (pDlg->Execute() != RET_OK) )
                 break;


More information about the Libreoffice-commits mailing list