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/namecrea.hxx             |   17 +++++--------
 sc/source/ui/miscdlgs/namecrea.cxx        |   38 +++++++++++-------------------
 sc/source/ui/view/cellsh1.cxx             |    2 -
 sc/uiconfig/scalc/ui/createnamesdialog.ui |   10 ++++++-
 8 files changed, 49 insertions(+), 46 deletions(-)

New commits:
commit 57f2882ae218e3500cc2f28ee27db7be606316d3
Author: Caolán McNamara <caol...@redhat.com>
Date:   Fri Apr 13 14:00:33 2018 +0100

    weld ScNameCreateDlg
    
    Change-Id: I8b75647a419020504adc2cdff7c6d046ef043491
    Reviewed-on: https://gerrit.libreoffice.org/52830
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index f624f343029d..c2d8d757127c 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -468,7 +468,7 @@ public:
     virtual VclPtr<AbstractScMoveTableDlg> CreateScMoveTableDlg(vcl::Window * 
pParent,
         const OUString& rDefault) = 0;
 
-    virtual VclPtr<AbstractScNameCreateDlg> CreateScNameCreateDlg(vcl::Window 
* pParent,
+    virtual VclPtr<AbstractScNameCreateDlg> CreateScNameCreateDlg(weld::Window 
* pParent,
         CreateNameFlags nFlags) = 0;
 
     virtual VclPtr<AbstractScNamePasteDlg> CreateScNamePasteDlg ( vcl::Window 
* pParent, ScDocShell* pShell ) = 0;
diff --git a/sc/qa/unit/screenshots/screenshots.cxx 
b/sc/qa/unit/screenshots/screenshots.cxx
index 6268c9f94cda..3822be9358e4 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -198,7 +198,7 @@ VclPtr<VclAbstractDialog> 
ScScreenshotTest::createDialogByID(sal_uInt32 nID)
         case 7: // "modules/scalc/ui/createnamesdialog.ui"
         {
             pReturnDialog = mpFact->CreateScNameCreateDlg(
-                mpViewShell->GetDialogParent(),
+                mpViewShell->GetFrameWeld(),
                 CreateNameFlags::Left | CreateNameFlags::Top);
                     // just fake some flags
             break;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index 37da3f4d980d..51cce4e6b8dd 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -104,7 +104,12 @@ IMPL_ABSTDLG_BASE(AbstractScInsertTableDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScSelEntryDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScMetricInputDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScMoveTableDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractScNameCreateDlg_Impl);
+
+short AbstractScNameCreateDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 IMPL_ABSTDLG_BASE(AbstractScNamePasteDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScPivotFilterDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDPFunctionDlg_Impl);
@@ -494,7 +499,7 @@ void    AbstractScMoveTableDlg_Impl::EnableRenameTable(bool 
bFlag)
 
 CreateNameFlags AbstractScNameCreateDlg_Impl::GetFlags() const
 {
-    return pDlg->GetFlags();
+    return m_xDlg->GetFlags();
 }
 
 std::vector<OUString> AbstractScNamePasteDlg_Impl::GetSelectedNames() const
@@ -777,10 +782,9 @@ VclPtr<AbstractScMoveTableDlg> 
ScAbstractDialogFactory_Impl::CreateScMoveTableDl
     return VclPtr<AbstractScMoveTableDlg_Impl>::Create( pDlg );
 }
 
-VclPtr<AbstractScNameCreateDlg> 
ScAbstractDialogFactory_Impl::CreateScNameCreateDlg(vcl::Window * pParent, 
CreateNameFlags nFlags)
+VclPtr<AbstractScNameCreateDlg> 
ScAbstractDialogFactory_Impl::CreateScNameCreateDlg(weld::Window * pParent, 
CreateNameFlags nFlags)
 {
-    VclPtr<ScNameCreateDlg> pDlg = VclPtr<ScNameCreateDlg>::Create( pParent, 
nFlags );
-    return VclPtr<AbstractScNameCreateDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractScNameCreateDlg_Impl>::Create(new 
ScNameCreateDlg(pParent, nFlags));
 }
 
 VclPtr<AbstractScNamePasteDlg> 
ScAbstractDialogFactory_Impl::CreateScNamePasteDlg ( vcl::Window * pParent, 
ScDocShell* pShell )
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index 46982a8a2b67..5ecd16122d38 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -290,7 +290,13 @@ class AbstractScMoveTableDlg_Impl : public 
AbstractScMoveTableDlg
 
 class AbstractScNameCreateDlg_Impl : public AbstractScNameCreateDlg
 {
-    DECL_ABSTDLG_BASE( AbstractScNameCreateDlg_Impl, ScNameCreateDlg)
+    std::unique_ptr<ScNameCreateDlg> m_xDlg;
+public:
+    explicit AbstractScNameCreateDlg_Impl(ScNameCreateDlg* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short           Execute() override;
     virtual CreateNameFlags GetFlags() const override;
 };
 
@@ -487,7 +493,7 @@ public:
     virtual VclPtr<AbstractScMoveTableDlg> CreateScMoveTableDlg(vcl::Window * 
pParent,
         const OUString& rDefault) override;
 
-    virtual VclPtr<AbstractScNameCreateDlg> CreateScNameCreateDlg(vcl::Window 
* pParent,
+    virtual VclPtr<AbstractScNameCreateDlg> CreateScNameCreateDlg(weld::Window 
* pParent,
         CreateNameFlags nFlags) override;
 
     virtual VclPtr<AbstractScNamePasteDlg> CreateScNamePasteDlg ( vcl::Window 
* pParent, ScDocShell* pShell ) override;
diff --git a/sc/source/ui/inc/namecrea.hxx b/sc/source/ui/inc/namecrea.hxx
index 0a530b2cb7ec..a2bcbe7f0394 100644
--- a/sc/source/ui/inc/namecrea.hxx
+++ b/sc/source/ui/inc/namecrea.hxx
@@ -20,21 +20,18 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_NAMECREA_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_NAMECREA_HXX
 
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
+#include <vcl/weld.hxx>
 #include "scui_def.hxx"
 
-class ScNameCreateDlg final : public ModalDialog
+class ScNameCreateDlg final : public weld::GenericDialogController
 {
-    VclPtr<CheckBox> m_pTopBox;
-    VclPtr<CheckBox> m_pLeftBox;
-    VclPtr<CheckBox> m_pBottomBox;
-    VclPtr<CheckBox> m_pRightBox;
+    std::unique_ptr<weld::CheckButton> m_xTopBox;
+    std::unique_ptr<weld::CheckButton> m_xLeftBox;
+    std::unique_ptr<weld::CheckButton> m_xBottomBox;
+    std::unique_ptr<weld::CheckButton> m_xRightBox;
 public:
-    ScNameCreateDlg( vcl::Window * pParent, CreateNameFlags nFlags );
+    ScNameCreateDlg(weld::Window * pParent, CreateNameFlags nFlags);
     virtual ~ScNameCreateDlg() override;
-    virtual void dispose() override;
     CreateNameFlags GetFlags() const;
 };
 
diff --git a/sc/source/ui/miscdlgs/namecrea.cxx 
b/sc/source/ui/miscdlgs/namecrea.cxx
index 6cd5f69535ee..9aa94d0d1d55 100644
--- a/sc/source/ui/miscdlgs/namecrea.cxx
+++ b/sc/source/ui/miscdlgs/namecrea.cxx
@@ -22,44 +22,34 @@
 #include <namecrea.hxx>
 #include <scresid.hxx>
 
-ScNameCreateDlg::ScNameCreateDlg( vcl::Window * pParent, CreateNameFlags 
nFlags )
-    : ModalDialog(pParent, "CreateNamesDialog", 
"modules/scalc/ui/createnamesdialog.ui")
+ScNameCreateDlg::ScNameCreateDlg(weld::Window * pParent, CreateNameFlags 
nFlags)
+    : GenericDialogController(pParent, 
"modules/scalc/ui/createnamesdialog.ui", "CreateNamesDialog")
+    , m_xTopBox(m_xBuilder->weld_check_button("top"))
+    , m_xLeftBox(m_xBuilder->weld_check_button("left"))
+    , m_xBottomBox(m_xBuilder->weld_check_button("bottom"))
+    , m_xRightBox(m_xBuilder->weld_check_button("right"))
 {
-    get(m_pTopBox, "top");
-    get(m_pLeftBox, "left");
-    get(m_pBottomBox, "bottom");
-    get(m_pRightBox, "right");
-    m_pTopBox->Check   ( bool(nFlags & CreateNameFlags::Top) );
-    m_pLeftBox->Check  ( bool(nFlags & CreateNameFlags::Left) );
-    m_pBottomBox->Check( bool(nFlags & CreateNameFlags::Bottom) );
-    m_pRightBox->Check ( bool(nFlags & CreateNameFlags::Right) );
+    m_xTopBox->set_active( bool(nFlags & CreateNameFlags::Top) );
+    m_xLeftBox->set_active( bool(nFlags & CreateNameFlags::Left) );
+    m_xBottomBox->set_active( bool(nFlags & CreateNameFlags::Bottom) );
+    m_xRightBox->set_active( bool(nFlags & CreateNameFlags::Right) );
 }
 
 ScNameCreateDlg::~ScNameCreateDlg()
 {
-    disposeOnce();
-}
-
-void ScNameCreateDlg::dispose()
-{
-    m_pTopBox.clear();
-    m_pLeftBox.clear();
-    m_pBottomBox.clear();
-    m_pRightBox.clear();
-    ModalDialog::dispose();
 }
 
 CreateNameFlags ScNameCreateDlg::GetFlags() const
 {
     CreateNameFlags nResult = CreateNameFlags::NONE;
 
-    if (m_pTopBox->IsChecked())
+    if (m_xTopBox->get_active())
         nResult |= CreateNameFlags::Top;
-    if (m_pLeftBox->IsChecked())
+    if (m_xLeftBox->get_active())
         nResult |= CreateNameFlags::Left;
-    if (m_pBottomBox->IsChecked())
+    if (m_xBottomBox->get_active())
         nResult |= CreateNameFlags::Bottom;
-    if (m_pRightBox->IsChecked())
+    if (m_xRightBox->get_active())
         nResult |= CreateNameFlags::Right;
 
     return nResult;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 93804259ec73..8f8b3900e260 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1830,7 +1830,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
                 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                ScopedVclPtr<AbstractScNameCreateDlg> 
pDlg(pFact->CreateScNameCreateDlg(pTabViewShell->GetDialogParent(), nFlags));
+                ScopedVclPtr<AbstractScNameCreateDlg> 
pDlg(pFact->CreateScNameCreateDlg(pTabViewShell->GetFrameWeld(), nFlags));
                 OSL_ENSURE(pDlg, "Dialog create fail!");
 
                 if( pDlg->Execute() )
diff --git a/sc/uiconfig/scalc/ui/createnamesdialog.ui 
b/sc/uiconfig/scalc/ui/createnamesdialog.ui
index 91561249b1da..7cadcae869fd 100644
--- a/sc/uiconfig/scalc/ui/createnamesdialog.ui
+++ b/sc/uiconfig/scalc/ui/createnamesdialog.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="CreateNamesDialog">
@@ -7,6 +7,9 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" 
context="createnamesdialog|CreateNamesDialog">Create Names</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">
@@ -165,8 +168,8 @@
               <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0.49000000953674316</property>
                 <property name="label" translatable="yes" 
context="createnamesdialog|label1">Create Names From</property>
+                <property name="xalign">0.49000000953674316</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -186,5 +189,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