sd/inc/sdabstdlg.hxx                |    2 
 sd/source/ui/dlg/brkdlg.cxx         |  106 +++++++++++++-----------------------
 sd/source/ui/dlg/sddlgfact.cxx      |   14 ++++
 sd/source/ui/dlg/sddlgfact.hxx      |   11 +++
 sd/source/ui/inc/BreakDlg.hxx       |   53 ++++++------------
 sd/source/ui/view/drviews2.cxx      |    2 
 sd/uiconfig/sdraw/ui/breakdialog.ui |   33 ++++-------
 7 files changed, 97 insertions(+), 124 deletions(-)

New commits:
commit 50d9f1508709e0849e8ecabfe04ac9281160d9e0
Author: Caolán McNamara <caol...@redhat.com>
Date:   Mon Apr 2 12:29:05 2018 +0100

    weld Break dialog
    
    Change-Id: I1657a02c775cf08e0888ba4cc9f9ae3b06550020
    Reviewed-on: https://gerrit.libreoffice.org/52256
    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/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index 9582ea377530..35b7233eea73 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -178,7 +178,7 @@ class SdAbstractDialogFactory
 public:
     SD_DLLPUBLIC static SdAbstractDialogFactory*     Create();
 
-    virtual VclPtr<VclAbstractDialog>          CreateBreakDlg(vcl::Window* 
pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong 
nSumActionCount, sal_uLong nObjCount ) = 0;
+    virtual VclPtr<VclAbstractDialog>          CreateBreakDlg(weld::Window* 
pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong 
nSumActionCount, sal_uLong nObjCount ) = 0;
     virtual VclPtr<AbstractCopyDlg>            CreateCopyDlg(vcl::Window* 
pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView ) = 0;
     virtual VclPtr<AbstractSdCustomShowDlg>    
CreateSdCustomShowDlg(vcl::Window* pWindow, SdDrawDocument& rDrawDoc) = 0;
     virtual VclPtr<SfxAbstractTabDialog>       
CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, 
SfxObjectShell* pDocShell) = 0;
diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx
index 724df7d201cb..80e8fb8f6a8f 100644
--- a/sd/source/ui/dlg/brkdlg.cxx
+++ b/sd/source/ui/dlg/brkdlg.cxx
@@ -38,59 +38,34 @@ namespace sd {
  * dialog to split metafiles
  */
 
-BreakDlg::BreakDlg(
-    vcl::Window* pWindow,
-    DrawView* _pDrView,
-    DrawDocShell* pShell,
-    sal_uLong nSumActionCount,
-    sal_uLong nObjCount )
-    : SfxModalDialog(pWindow, "BreakDialog", "modules/sdraw/ui/breakdialog.ui")
-    , mpProgress( nullptr )
+BreakDlg::BreakDlg(weld::Window* pWindow, DrawView* pDrView, DrawDocShell* 
pShell,
+    sal_uLong nSumActionCount, sal_uLong nObjCount)
+    : GenericDialogController(pWindow, "modules/sdraw/ui/breakdialog.ui", 
"BreakDialog")
+    , m_xFiObjInfo(m_xBuilder->weld_label("metafiles"))
+    , m_xFiActInfo(m_xBuilder->weld_label("metaobjects"))
+    , m_xFiInsInfo(m_xBuilder->weld_label("drawingobjects"))
+    , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
+    , m_pDrView(pDrView)
+    , m_bCancel(false)
 {
     m_aUpdateIdle.SetPriority( TaskPriority::REPAINT );
     m_aUpdateIdle.SetInvokeHandler( LINK( this, BreakDlg, InitialUpdate ) );
     m_aUpdateIdle.SetDebugName( "sd::BreakDlg m_aUpdateIdle" );
 
-    get(m_pFiObjInfo, "metafiles");
-    get(m_pFiActInfo, "metaobjects");
-    get(m_pFiInsInfo, "drawingobjects");
-    get(m_pBtnCancel, "cancel");
+    m_xBtnCancel->connect_clicked(LINK(this, BreakDlg, CancelButtonHdl));
 
-    m_pBtnCancel->SetClickHdl( LINK( this, BreakDlg, CancelButtonHdl));
+    m_xProgress.reset(new SfxProgress(pShell, SdResId(STR_BREAK_METAFILE), 
nSumActionCount*3));
 
-    mpProgress = new SfxProgress( pShell, SdResId(STR_BREAK_METAFILE), 
nSumActionCount*3 );
-
-    pProgrInfo = new SvdProgressInfo( LINK(this, BreakDlg, UpDate) );
+    m_xProgrInfo.reset(new SvdProgressInfo(LINK(this, BreakDlg, UpDate)));
     // every action is edited 3 times in DoImport()
-    pProgrInfo->Init( nObjCount );
-
-    pDrView = _pDrView;
-    bCancel = false;
-}
-
-BreakDlg::~BreakDlg()
-{
-    disposeOnce();
-}
-
-void BreakDlg::dispose()
-{
-    delete mpProgress;
-    mpProgress = nullptr;
-    delete pProgrInfo;
-    pProgrInfo = nullptr;
-    m_pFiObjInfo.clear();
-    m_pFiActInfo.clear();
-    m_pFiInsInfo.clear();
-    m_pBtnCancel.clear();
-    SfxModalDialog::dispose();
+    m_xProgrInfo->Init( nObjCount );
 }
 
 // Control-Handler for cancel button
-IMPL_LINK_NOARG(BreakDlg, CancelButtonHdl, Button*, void)
+IMPL_LINK_NOARG(BreakDlg, CancelButtonHdl, weld::Button&, void)
 {
-    bCancel = true;
-    m_pBtnCancel->Disable();
+    m_bCancel = true;
+    m_xBtnCancel->set_sensitive(false);
 }
 
 /**
@@ -101,73 +76,72 @@ IMPL_LINK_NOARG(BreakDlg, CancelButtonHdl, Button*, void)
  */
 IMPL_LINK( BreakDlg, UpDate, void*, nInit, bool )
 {
-    if(pProgrInfo == nullptr)
+    if (!m_xProgrInfo)
       return true;
 
     // update status bar or show a error message?
     if(nInit == reinterpret_cast<void*>(1))
     {
-        std::unique_ptr<weld::MessageDialog> 
xErrBox(Application::CreateMessageDialog(GetFrameWeld(),
+        std::unique_ptr<weld::MessageDialog> 
xErrBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                      VclMessageType::Warning, 
VclButtonsType::Ok,
                                                      SdResId(STR_BREAK_FAIL)));
         xErrBox->run();
     }
     else
     {
-        if(mpProgress)
-            mpProgress->SetState( pProgrInfo->GetSumCurAction() );
+        if (m_xProgress)
+            m_xProgress->SetState(m_xProgrInfo->GetSumCurAction());
     }
 
     // which object is shown at the moment?
-    OUString info = OUString::number( pProgrInfo->GetCurObj() )
+    OUString info = OUString::number(m_xProgrInfo->GetCurObj())
             + "/"
-            + OUString::number( pProgrInfo->GetObjCount() );
-    m_pFiObjInfo->SetText(info);
+            + OUString::number(m_xProgrInfo->GetObjCount());
+    m_xFiObjInfo->set_label(info);
 
     // how many actions are started?
-    if(pProgrInfo->GetActionCount() == 0)
+    if (m_xProgrInfo->GetActionCount() == 0)
     {
-        m_pFiActInfo->SetText( OUString() );
+        m_xFiActInfo->set_label( OUString() );
     }
     else
     {
-        info = OUString::number( pProgrInfo->GetCurAction() )
+        info = OUString::number(m_xProgrInfo->GetCurAction())
             + "/"
-            + OUString::number( pProgrInfo->GetActionCount() );
-        m_pFiActInfo->SetText(info);
+            + OUString::number(m_xProgrInfo->GetActionCount());
+        m_xFiActInfo->set_label(info);
     }
 
     // and inserted????
-    if(pProgrInfo->GetInsertCount() == 0)
+    if (m_xProgrInfo->GetInsertCount() == 0)
     {
-        m_pFiInsInfo->SetText( OUString() );
+        m_xFiInsInfo->set_label( OUString() );
     }
     else
     {
-        info = OUString::number( pProgrInfo->GetCurInsert() )
+        info = OUString::number(m_xProgrInfo->GetCurInsert())
             + "/"
-            + OUString::number( pProgrInfo->GetInsertCount() );
-        m_pFiInsInfo->SetText(info);
+            + OUString::number(m_xProgrInfo->GetInsertCount());
+        m_xFiInsInfo->set_label(info);
     }
 
     // make sure dialog gets painted, it is intended to
     // show the progress to the user. Also necessary to
     // provide a clickable cancel button
-    ensureRepaint();
+    Application::Reschedule(true);
 
     // return okay-value (-> !cancel)
-    return !bCancel;
+    return !m_bCancel;
 }
 
 /**
  * open a modal dialog and start a timer which calls the working function after
  * the opening of the dialog
  */
-short BreakDlg::Execute()
+short BreakDlg::execute()
 {
-  m_aUpdateIdle.Start();
-
-  return SfxModalDialog::Execute();
+    m_aUpdateIdle.Start();
+    return run();
 }
 
 /**
@@ -175,8 +149,8 @@ short BreakDlg::Execute()
  */
 IMPL_LINK_NOARG(BreakDlg, InitialUpdate, Timer *, void)
 {
-    pDrView->DoImportMarkedMtf(pProgrInfo);
-    EndDialog(RET_OK);
+    m_pDrView->DoImportMarkedMtf(m_xProgrInfo.get());
+    m_xDialog->response(RET_OK);
 }
 
 } // end of namespace sd
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index f64679846ccf..a1872faad60e 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -65,6 +65,16 @@ IMPL_ABSTDLG_BASE(AbstractSdPublishingDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractHeaderFooterDialog_Impl);
 IMPL_ABSTDLG_BASE(AbstractBulletDialog_Impl);
 
+AbstractBreakDlg_Impl::AbstractBreakDlg_Impl(::sd::BreakDlg* pDlg)
+    : m_xDlg(pDlg)
+{
+}
+
+short AbstractBreakDlg_Impl::Execute()
+{
+    return m_xDlg->execute();
+}
+
 void AbstractCopyDlg_Impl::GetAttr( SfxItemSet& rOutAttrs )
 {
     pDlg->GetAttr( rOutAttrs );
@@ -284,13 +294,13 @@ void AbstractSdPublishingDlg_Impl::GetParameterSequence( 
css::uno::Sequence< css
 //-------------- SdAbstractDialogFactory implementation--------------
 
 VclPtr<VclAbstractDialog> SdAbstractDialogFactory_Impl::CreateBreakDlg(
-                                            vcl::Window* pParent,
+                                            weld::Window* pParent,
                                             ::sd::DrawView* pDrView,
                                             ::sd::DrawDocShell* pShell,
                                             sal_uLong nSumActionCount,
                                             sal_uLong nObjCount )
 {
-    return VclPtr<SdVclAbstractDialog_Impl>::Create( 
VclPtr<::sd::BreakDlg>::Create( pParent, pDrView, pShell, nSumActionCount, 
nObjCount ) );
+    return VclPtr<AbstractBreakDlg_Impl>::Create(new ::sd::BreakDlg(pParent, 
pDrView, pShell, nSumActionCount, nObjCount));
 }
 
 VclPtr<AbstractCopyDlg> 
SdAbstractDialogFactory_Impl::CreateCopyDlg(vcl::Window* pParent,
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index dc88ed893bb2..bb8586386467 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -63,6 +63,15 @@ class SdVclAbstractDialog_Impl : public VclAbstractDialog
     DECL_ABSTDLG_BASE(SdVclAbstractDialog_Impl,Dialog)
 };
 
+class AbstractBreakDlg_Impl : public VclAbstractDialog
+{
+private:
+    std::unique_ptr<sd::BreakDlg> m_xDlg;
+public:
+    AbstractBreakDlg_Impl(::sd::BreakDlg* pDlg);
+    virtual short Execute() override;
+};
+
 class AbstractCopyDlg_Impl : public AbstractCopyDlg
 {
     DECL_ABSTDLG_BASE(AbstractCopyDlg_Impl,::sd::CopyDlg)
@@ -209,7 +218,7 @@ class SdAbstractDialogFactory_Impl : public 
SdAbstractDialogFactory
 public:
     virtual ~SdAbstractDialogFactory_Impl() {}
 
-    virtual VclPtr<VclAbstractDialog>          CreateBreakDlg(vcl::Window* 
pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong 
nSumActionCount, sal_uLong nObjCount) override;
+    virtual VclPtr<VclAbstractDialog>          CreateBreakDlg(weld::Window* 
pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong 
nSumActionCount, sal_uLong nObjCount) override;
     virtual VclPtr<AbstractCopyDlg>            CreateCopyDlg(vcl::Window* 
pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override;
     virtual VclPtr<AbstractSdCustomShowDlg>    
CreateSdCustomShowDlg(vcl::Window* pParent, SdDrawDocument& rDrawDoc) override;
     virtual VclPtr<SfxAbstractTabDialog>       
CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, 
SfxObjectShell* pDocShell) override;
diff --git a/sd/source/ui/inc/BreakDlg.hxx b/sd/source/ui/inc/BreakDlg.hxx
index 55faf6cb2d32..02d7a3081aed 100644
--- a/sd/source/ui/inc/BreakDlg.hxx
+++ b/sd/source/ui/inc/BreakDlg.hxx
@@ -20,18 +20,10 @@
 #ifndef INCLUDED_SD_SOURCE_UI_INC_BREAKDLG_HXX
 #define INCLUDED_SD_SOURCE_UI_INC_BREAKDLG_HXX
 
-#include <vcl/group.hxx>
-#include <vcl/button.hxx>
-#include <svx/dlgctrl.hxx>
-#include <vcl/field.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/prgsbar.hxx>
-#include <vcl/edit.hxx>
-#include <sfx2/basedlgs.hxx>
+#include <sfx2/progress.hxx>
+#include <svx/svdetc.hxx>
 #include <vcl/idle.hxx>
-
-class SvdProgressInfo;
-class SfxProgress;
+#include <vcl/weld.hxx>
 
 namespace sd {
 
@@ -41,38 +33,31 @@ class DrawView;
 /**
  * dialog to break meta files
  */
-class BreakDlg
-    : public SfxModalDialog
+class BreakDlg : public weld::GenericDialogController
 {
 public:
-    BreakDlg (
-        vcl::Window* pWindow,
-        DrawView* pDrView,
-        DrawDocShell* pShell,
-        sal_uLong nSumActionCount,
-        sal_uLong nObjCount);
-    virtual ~BreakDlg() override;
-    virtual void dispose() override;
+    BreakDlg(weld::Window* pWindow, DrawView* pDrView, DrawDocShell* pShell,
+             sal_uLong nSumActionCount, sal_uLong nObjCount);
 
-    short Execute() override;
+    short execute();
 
 private:
-    VclPtr<FixedText>      m_pFiObjInfo;
-    VclPtr<FixedText>      m_pFiActInfo;
-    VclPtr<FixedText>      m_pFiInsInfo;
-    VclPtr<CancelButton>   m_pBtnCancel;
+    std::unique_ptr<weld::Label> m_xFiObjInfo;
+    std::unique_ptr<weld::Label> m_xFiActInfo;
+    std::unique_ptr<weld::Label> m_xFiInsInfo;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
 
-    DrawView*   pDrView;
+    DrawView* m_pDrView;
 
-    bool            bCancel;
+    bool      m_bCancel;
 
-    Idle            m_aUpdateIdle;
-    SvdProgressInfo *pProgrInfo;
-    SfxProgress     *mpProgress;
+    Idle      m_aUpdateIdle;
+    std::unique_ptr<SvdProgressInfo> m_xProgrInfo;
+    std::unique_ptr<SfxProgress> m_xProgress;
 
-    DECL_LINK( CancelButtonHdl, Button*, void );
-    DECL_LINK( UpDate, void*, bool );
-    DECL_LINK( InitialUpdate, Timer*, void );
+    DECL_LINK(CancelButtonHdl, weld::Button&, void);
+    DECL_LINK(UpDate, void*, bool);
+    DECL_LINK(InitialUpdate, Timer*, void);
 };
 
 } // end of namespace sd
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 35d290692da6..65ffb4268311 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2790,7 +2790,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                     SdAbstractDialogFactory* pFact = 
SdAbstractDialogFactory::Create();
                     if( pFact )
                     {
-                        ScopedVclPtr<VclAbstractDialog> 
pDlg(pFact->CreateBreakDlg(GetActiveWindow(), mpDrawView.get(), GetDocSh(), 
nCount, static_cast<sal_uLong>(nCnt) ));
+                        ScopedVclPtr<VclAbstractDialog> 
pDlg(pFact->CreateBreakDlg(GetFrameWeld(), mpDrawView.get(), GetDocSh(), 
nCount, static_cast<sal_uLong>(nCnt) ));
                         if( pDlg )
                         {
                             pDlg->Execute();
diff --git a/sd/uiconfig/sdraw/ui/breakdialog.ui 
b/sd/uiconfig/sdraw/ui/breakdialog.ui
index 17d1a5efdddf..2ad865c9a9bc 100644
--- a/sd/uiconfig/sdraw/ui/breakdialog.ui
+++ b/sd/uiconfig/sdraw/ui/breakdialog.ui
@@ -1,10 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
 <interface domain="sd">
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkDialog" id="BreakDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" 
context="breakdialog|BreakDialog">Break</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">
@@ -47,84 +51,72 @@
               <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" 
context="breakdialog|label1">Processing metafile:</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>
               <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" 
context="breakdialog|label2">Broken down metaobjects:</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>
               <object class="GtkLabel" id="label3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" 
context="breakdialog|label3">Inserted drawing objects:</property>
+                <property name="xalign">0</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>
               <object class="GtkLabel" id="metafiles">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label">                    </property>
+                <property name="xalign">0</property>
               </object>
               <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="GtkLabel" id="metaobjects">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label">                    </property>
+                <property name="xalign">0</property>
               </object>
               <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>
             <child>
               <object class="GtkLabel" id="drawingobjects">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label">                    </property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
           </object>
@@ -139,5 +131,8 @@
     <action-widgets>
       <action-widget response="-6">cancel</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