sw/inc/swabstdlg.hxx                 |    2 +-
 sw/source/ui/dialog/swdlgfact.cxx    |   11 +++++++----
 sw/source/ui/dialog/swdlgfact.hxx    |   11 +++++++++--
 sw/source/ui/table/splittbl.cxx      |   33 ++++++++++-----------------------
 sw/source/uibase/inc/splittbl.hxx    |   33 ++++++++++++++++++++-------------
 sw/source/uibase/shells/tabsh.cxx    |    3 ++-
 sw/uiconfig/swriter/ui/splittable.ui |   22 ++++++++++------------
 7 files changed, 59 insertions(+), 56 deletions(-)

New commits:
commit 6eb1affe21d98097c539619af617f0bbe5b8abd1
Author: Caolán McNamara <caol...@redhat.com>
Date:   Fri Mar 2 15:30:01 2018 +0000

    weld split table dialog
    
    Change-Id: I329a57fa09e6eb0fe75b93b0726d9b7718426693
    Reviewed-on: https://gerrit.libreoffice.org/50639
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 89e70bc4237b..dcdc6d408c8d 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -430,7 +430,7 @@ public:
     virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(vcl::Window * 
pParent, SwWrtShell &rSh) = 0;
     virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window 
*pParent, SwWrtShell &rSh) = 0;
     virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window 
*pParent, SwWrtShell &rSh) = 0;
-    virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog ( 
vcl::Window * pParent, SwWrtShell &rSh ) = 0;
+    virtual VclPtr<AbstractSplitTableDialog> 
CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) = 0;
 
     virtual VclPtr<AbstractSwAutoFormatDlg> 
CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell,
                                                                   bool 
bSetAutoFormat = true,
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index a2999ec607dd..96a4acb469c5 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -92,7 +92,10 @@ IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl);
 IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl);
 IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl);
 IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl);
-IMPL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl);
+short AbstractSplitTableDialog_Impl::Execute()
+{
+    return m_xDlg->run();
+}
 short AbstractSwBreakDlg_Impl::Execute()
 {
     return m_xDlg->run();
@@ -197,7 +200,7 @@ void AbstractSwAsciiFilterDlg_Impl::FillOptions( 
SwAsciiOptions& rOptions )
 
 SplitTable_HeadlineOption AbstractSplitTableDialog_Impl::GetSplitMode()
 {
-    return pDlg->GetSplitMode();
+    return m_xDlg->GetSplitMode();
 }
 
 OUString AbstractSwBreakDlg_Impl::GetTemplateName()
@@ -795,9 +798,9 @@ VclPtr<VclAbstractDialog> 
SwAbstractDialogFactory_Impl::CreateSwSortingDialog(vc
     return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
 }
 
-VclPtr<AbstractSplitTableDialog> 
SwAbstractDialogFactory_Impl::CreateSplitTableDialog ( vcl::Window *pParent, 
SwWrtShell &rSh )
+VclPtr<AbstractSplitTableDialog> 
SwAbstractDialogFactory_Impl::CreateSplitTableDialog(weld::Window *pParent, 
SwWrtShell &rSh)
 {
-    return VclPtr<AbstractSplitTableDialog_Impl>::Create( 
VclPtr<SwSplitTableDlg>::Create( pParent, rSh) );
+    return VclPtr<AbstractSplitTableDialog_Impl>::Create(new 
SwSplitTableDlg(pParent, rSh));
 }
 
 VclPtr<AbstractSwSelGlossaryDlg> 
SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(const OUString &rShortName)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 6c0418ecdf6d..13a25e8d9948 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -118,7 +118,14 @@ public:
 
 class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add 
for
 {
-    DECL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl, SwSplitTableDlg)
+protected:
+    std::unique_ptr<SwSplitTableDlg> m_xDlg;
+public:
+    explicit AbstractSplitTableDialog_Impl(SwSplitTableDlg* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short Execute() override;
     virtual SplitTable_HeadlineOption GetSplitMode() override;
 };
 
@@ -438,7 +445,7 @@ public:
     virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(vcl::Window * 
pParent, SwWrtShell &rSh) override;
     virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window 
*pParent, SwWrtShell &rSh) override;
     virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window 
*pParent, SwWrtShell &rSh) override;
-    virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog ( 
vcl::Window * pParent, SwWrtShell &rSh ) override;
+    virtual VclPtr<AbstractSplitTableDialog> 
CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) override;
 
     virtual VclPtr<AbstractSwAutoFormatDlg> 
CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell,
                                                                   bool 
bSetAutoFormat = true,
diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx
index 63dd08223447..f78041b06cfa 100644
--- a/sw/source/ui/table/splittbl.cxx
+++ b/sw/source/ui/table/splittbl.cxx
@@ -21,39 +21,26 @@
 #include <splittbl.hxx>
 #include <tblenum.hxx>
 
-SwSplitTableDlg::SwSplitTableDlg( vcl::Window *pParent, SwWrtShell &rSh )
-    : SvxStandardDialog( pParent, "SplitTableDialog", 
"modules/swriter/ui/splittable.ui" )
+SwSplitTableDlg::SwSplitTableDlg(weld::Window *pParent, SwWrtShell &rSh)
+    : m_xBuilder(Application::CreateBuilder(pParent, 
"modules/swriter/ui/splittable.ui"))
+    , m_xDialog(m_xBuilder->weld_dialog("SplitTableDialog"))
+    , m_xContentCopyRB(m_xBuilder->weld_radio_button("copyheading"))
+    , 
m_xBoxAttrCopyWithParaRB(m_xBuilder->weld_radio_button("customheadingapplystyle"))
+    , m_xBoxAttrCopyNoParaRB(m_xBuilder->weld_radio_button("customheading"))
+    , m_xBorderCopyRB(m_xBuilder->weld_radio_button("noheading"))
     , rShell(rSh)
     , m_nSplit(SplitTable_HeadlineOption::ContentCopy)
 {
-    get(mpContentCopyRB, "copyheading");
-    get(mpBoxAttrCopyWithParaRB, "customheadingapplystyle");
-    get(mpBoxAttrCopyNoParaRB, "customheading");
-    get(mpBorderCopyRB, "noheading");
-}
-
-SwSplitTableDlg::~SwSplitTableDlg()
-{
-    disposeOnce();
-}
-
-void SwSplitTableDlg::dispose()
-{
-    mpContentCopyRB.clear();
-    mpBoxAttrCopyWithParaRB.clear();
-    mpBoxAttrCopyNoParaRB.clear();
-    mpBorderCopyRB.clear();
-    SvxStandardDialog::dispose();
 }
 
 void SwSplitTableDlg::Apply()
 {
     m_nSplit = SplitTable_HeadlineOption::ContentCopy;
-    if(mpBoxAttrCopyWithParaRB->IsChecked())
+    if (m_xBoxAttrCopyWithParaRB->get_active())
         m_nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
-    else if(mpBoxAttrCopyNoParaRB->IsChecked())
+    else if (m_xBoxAttrCopyNoParaRB->get_active())
         m_nSplit = SplitTable_HeadlineOption::BoxAttrCopy;
-    else if(mpBorderCopyRB->IsChecked())
+    else if (m_xBorderCopyRB->get_active())
         m_nSplit = SplitTable_HeadlineOption::BorderCopy;
 
     rShell.SplitTable(m_nSplit);
diff --git a/sw/source/uibase/inc/splittbl.hxx 
b/sw/source/uibase/inc/splittbl.hxx
index dc30417b628a..62d4f4ba9de4 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -19,30 +19,37 @@
 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SPLITTBL_HXX
 #define INCLUDED_SW_SOURCE_UIBASE_INC_SPLITTBL_HXX
 
-#include <svx/stddlg.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
+#include <vcl/weld.hxx>
 #include <tblenum.hxx>
 
 class SwWrtShell;
 
-class SwSplitTableDlg : public SvxStandardDialog
+class SwSplitTableDlg
 {
-    VclPtr<RadioButton>    mpContentCopyRB;
-    VclPtr<RadioButton>    mpBoxAttrCopyWithParaRB ;
-    VclPtr<RadioButton>    mpBoxAttrCopyNoParaRB ;
-    VclPtr<RadioButton>    mpBorderCopyRB;
+private:
+    std::unique_ptr<weld::Builder> m_xBuilder;
+    std::unique_ptr<weld::Dialog> m_xDialog;
+    std::unique_ptr<weld::RadioButton> m_xHorzBox;
+    std::unique_ptr<weld::RadioButton> m_xContentCopyRB;
+    std::unique_ptr<weld::RadioButton> m_xBoxAttrCopyWithParaRB;
+    std::unique_ptr<weld::RadioButton> m_xBoxAttrCopyNoParaRB;
+    std::unique_ptr<weld::RadioButton> m_xBorderCopyRB;
 
     SwWrtShell            &rShell;
     SplitTable_HeadlineOption m_nSplit;
 
-protected:
-    virtual void Apply() override;
+    void Apply();
 
 public:
-    SwSplitTableDlg( vcl::Window *pParent, SwWrtShell &rSh );
-    virtual ~SwSplitTableDlg() override;
-    virtual void dispose() override;
+    SwSplitTableDlg(weld::Window *pParent, SwWrtShell &rSh);
+
+    short run()
+    {
+        short nRet = m_xDialog->run();
+        if (nRet == RET_OK)
+            Apply();
+        return nRet;
+    }
 
     SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; }
 };
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 5f7e15a2601a..ff6216d68d8b 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1036,7 +1036,8 @@ void SwTableShell::Execute(SfxRequest &rReq)
                 SwAbstractDialogFactory* pFact = 
SwAbstractDialogFactory::Create();
                 OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
 
-                ScopedVclPtr<AbstractSplitTableDialog> 
pDlg(pFact->CreateSplitTableDialog( GetView().GetWindow(), rSh ));
+                vcl::Window* pWin = GetView().GetWindow();
+                ScopedVclPtr<AbstractSplitTableDialog> 
pDlg(pFact->CreateSplitTableDialog(pWin ? pWin->GetFrameWeld() : nullptr, rSh));
                 OSL_ENSURE(pDlg, "Dialog creation failed!");
                 pDlg->Execute();
                 rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, 
static_cast<sal_uInt16>(pDlg->GetSplitMode()) ) );
diff --git a/sw/uiconfig/swriter/ui/splittable.ui 
b/sw/uiconfig/swriter/ui/splittable.ui
index dbdd2d304b4e..2b18fffa3b6d 100644
--- a/sw/uiconfig/swriter/ui/splittable.ui
+++ b/sw/uiconfig/swriter/ui/splittable.ui
@@ -1,10 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.2 -->
 <interface domain="sw">
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.20"/>
   <object class="GtkDialog" id="SplitTableDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" 
context="splittable|SplitTableDialog">Split 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">
@@ -94,13 +98,10 @@
                         <property name="xalign">0</property>
                         <property name="active">True</property>
                         <property name="draw_indicator">True</property>
-                        <property 
name="group">customheadingapplystyle</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>
@@ -111,13 +112,11 @@
                         <property name="receives_default">False</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">customheading</property>
+                        <property name="group">copyheading</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>
@@ -128,13 +127,11 @@
                         <property name="receives_default">False</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">noheading</property>
+                        <property name="group">copyheading</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -150,8 +147,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">3</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
@@ -182,5 +177,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to