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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 29 11:55:00 UTC 2018


 cui/source/dialogs/cuigaldlg.cxx |   53 +++++++++++----------------------------
 cui/source/factory/dlgfact.cxx   |   21 +++++++++------
 cui/source/factory/dlgfact.hxx   |   19 +++++++++++--
 cui/source/inc/cuigaldlg.hxx     |   19 ++++++-------
 include/svx/svxdlg.hxx           |    4 +-
 svx/source/gallery2/galbrws1.cxx |    3 --
 6 files changed, 55 insertions(+), 64 deletions(-)

New commits:
commit f73cdd5680505523e0eb20f828f1a294f342b93c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Nov 29 09:20:28 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Nov 29 12:54:27 2018 +0100

    weld ActualizeProgress
    
    Change-Id: I35c486ac2dcf9818e331816f554a5c414bdb2386
    Reviewed-on: https://gerrit.libreoffice.org/64214
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index e9a12d98582a..49ae1aa8657b 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -374,78 +374,55 @@ void TakeProgress::LaunchThread()
     maTakeThread->launch();
 }
 
-ActualizeProgress::ActualizeProgress(vcl::Window* pWindow, GalleryTheme* pThm)
-    : ModalDialog(pWindow, "GalleryUpdateProgress",
-        "cui/ui/galleryupdateprogress.ui")
+ActualizeProgress::ActualizeProgress(weld::Window* pWindow, GalleryTheme* pThm)
+    : GenericDialogController(pWindow, "cui/ui/galleryupdateprogress.ui",
+                              "GalleryUpdateProgress")
     , pIdle(nullptr)
     , pTheme(pThm)
+    , m_xFtActualizeFile(m_xBuilder->weld_label("file"))
+    , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
 {
-    get(m_pFtActualizeFile, "file");
-    get(m_pBtnCancel, "cancel");
-    m_pBtnCancel->SetClickHdl( LINK( this, ActualizeProgress, ClickCancelBtn ) );
+    m_xBtnCancel->connect_clicked(LINK(this, ActualizeProgress, ClickCancelBtn));
 }
 
-
 ActualizeProgress::~ActualizeProgress()
 {
-    disposeOnce();
 }
 
-
-void ActualizeProgress::dispose()
+short ActualizeProgress::run()
 {
-    m_pFtActualizeFile.clear();
-    m_pBtnCancel.clear();
-    ModalDialog::dispose();
-}
-
-
-short ActualizeProgress::Execute()
-{
-    short nRet;
-
     pIdle = new Idle("ActualizeProgressTimeout");
     pIdle->SetInvokeHandler( LINK( this, ActualizeProgress, TimeoutHdl ) );
     pIdle->SetPriority( TaskPriority::LOWEST );
     pIdle->Start();
 
-    nRet = ModalDialog::Execute();
-
-    return nRet;
+    return GenericDialogController::run();
 }
 
-
-IMPL_LINK_NOARG(ActualizeProgress, ClickCancelBtn, Button*, void)
+IMPL_LINK_NOARG(ActualizeProgress, ClickCancelBtn, weld::Button&, void)
 {
     pTheme->AbortActualize();
-    EndDialog( RET_OK );
+    m_xDialog->response(RET_OK);
 }
 
-
 IMPL_LINK( ActualizeProgress, TimeoutHdl, Timer*, _pTimer, void)
 {
-    if ( _pTimer )
+    if (_pTimer)
     {
         _pTimer->Stop();
         delete _pTimer;
     }
 
-    pTheme->Actualize( LINK( this, ActualizeProgress, ActualizeHdl ), &aStatusProgress );
-    ClickCancelBtn( nullptr );
+    pTheme->Actualize(LINK(this, ActualizeProgress, ActualizeHdl), &aStatusProgress);
+    ClickCancelBtn(*m_xBtnCancel);
 }
 
-
 IMPL_LINK( ActualizeProgress, ActualizeHdl, const INetURLObject&, rURL, void )
 {
-    Application::Reschedule( true );
-
-    Flush();
-
-    m_pFtActualizeFile->SetText( GetReducedString( rURL, 30 ) );
-    m_pFtActualizeFile->Flush();
+    Application::Reschedule(true);
+    m_xFtActualizeFile->set_label(GetReducedString(rURL, 30));
 }
 
-
 TitleDialog::TitleDialog(weld::Window* pParent, const OUString& rOldTitle)
     : GenericDialogController(pParent, "cui/ui/gallerytitledialog.ui", "GalleryTitleDialog")
     , m_xEdit(m_xBuilder->weld_entry("entry"))
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index d1fa040adece..206d4a13cca9 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -104,6 +104,11 @@ short CuiAbstractController_Impl::Execute()
     return m_xDlg->run();
 }
 
+short CuiAbstractSingleTabController_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 IMPL_ABSTDLG_BASE(CuiVclAbstractDialog_Impl)
 IMPL_ABSTDLG_BASE(VclAbstractRefreshableDialog_Impl);
 IMPL_ABSTDLG_BASE(CuiAbstractTabDialog_Impl);
@@ -339,12 +344,12 @@ void CuiAbstractTabController_Impl::SetText( const OUString& rStr )
     m_xDlg->set_title(rStr);
 }
 
-const SfxItemSet* CuiAbstractController_Impl::GetOutputItemSet() const
+const SfxItemSet* CuiAbstractSingleTabController_Impl::GetOutputItemSet() const
 {
     return m_xDlg->GetOutputItemSet();
 }
 
-void CuiAbstractController_Impl::SetText(const OUString& rStr)
+void CuiAbstractSingleTabController_Impl::SetText(const OUString& rStr)
 {
     m_xDlg->set_title(rStr);
 }
@@ -1068,10 +1073,10 @@ VclPtr<AbstractSpellDialog> AbstractDialogFactory_Impl::CreateSvxSpellDialog(
     return VclPtr<AbstractSpellDialog_Impl>::Create(pDlg);
 }
 
-VclPtr<VclAbstractRefreshableDialog> AbstractDialogFactory_Impl::CreateActualizeProgressDialog( vcl::Window* pParent, GalleryTheme* pThm )
+VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateActualizeProgressDialog(weld::Window* pParent,
+                                                                                               GalleryTheme* pThm)
 {
-   VclPtrInstance<ActualizeProgress> pDlg(pParent, pThm);
-   return VclPtr<VclAbstractRefreshableDialog_Impl>::Create( pDlg );
+   return VclPtr<CuiAbstractController_Impl>::Create(o3tl::make_unique<ActualizeProgress>(pParent, pThm));
 }
 
 VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateScriptErrorDialog(const css::uno::Any& rException)
@@ -1322,7 +1327,7 @@ VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog(we
                                                                               const SfxItemSet& rAttr,
                                                                               const Reference< XFrame >& _rxDocumentFrame)
 {
-    return VclPtr<CuiAbstractController_Impl>::Create(o3tl::make_unique<SfxMacroAssignDlg>(pParent, _rxDocumentFrame, rAttr));
+    return VclPtr<CuiAbstractSingleTabController_Impl>::Create(o3tl::make_unique<SfxMacroAssignDlg>(pParent, _rxDocumentFrame, rAttr));
 }
 
 VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateSfxDialog(vcl::Window* pParent,
@@ -1335,10 +1340,10 @@ VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateSfxDialog(vcl::Windo
     {
         case RID_SVXPAGE_MEASURE :
         {
-            return VclPtr<CuiAbstractController_Impl>::Create(o3tl::make_unique<SvxMeasureDialog>(pParent ? pParent->GetFrameWeld() : nullptr, rAttr, pView));
+            return VclPtr<CuiAbstractSingleTabController_Impl>::Create(o3tl::make_unique<SvxMeasureDialog>(pParent ? pParent->GetFrameWeld() : nullptr, rAttr, pView));
         }
         case RID_SVXPAGE_CONNECTION :
-            return VclPtr<CuiAbstractController_Impl>::Create(o3tl::make_unique<SvxConnectionDialog>(pParent ? pParent->GetFrameWeld() : nullptr, rAttr, pView));
+            return VclPtr<CuiAbstractSingleTabController_Impl>::Create(o3tl::make_unique<SvxConnectionDialog>(pParent ? pParent->GetFrameWeld() : nullptr, rAttr, pView));
 
         case RID_SFXPAGE_DBREGISTER :
             pDlg = VclPtr<DatabaseRegistrationDialog>::Create( pParent, rAttr );
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index e672ea16ef5b..40f51fb6c681 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -85,6 +85,18 @@ class CuiVclAbstractDialog_Impl : public VclAbstractDialog
     DECL_ABSTDLG_BASE(CuiVclAbstractDialog_Impl,Dialog)
 };
 
+class CuiAbstractController_Impl : public VclAbstractDialog
+{
+protected:
+    std::unique_ptr<weld::DialogController> m_xDlg;
+public:
+    explicit CuiAbstractController_Impl(std::unique_ptr<weld::DialogController> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
+};
+
 class VclAbstractRefreshableDialog_Impl : public VclAbstractRefreshableDialog
 {
     DECL_ABSTDLG_BASE(VclAbstractRefreshableDialog_Impl,Dialog)
@@ -100,12 +112,12 @@ class CuiAbstractSfxDialog_Impl : public SfxAbstractDialog
     virtual void          SetText( const OUString& rStr ) override;
 };
 
-class CuiAbstractController_Impl : public SfxAbstractDialog
+class CuiAbstractSingleTabController_Impl : public SfxAbstractDialog
 {
 protected:
     std::unique_ptr<SfxSingleTabDialogController> m_xDlg;
 public:
-    explicit CuiAbstractController_Impl(std::unique_ptr<SfxSingleTabDialogController> p)
+    explicit CuiAbstractSingleTabController_Impl(std::unique_ptr<SfxSingleTabDialogController> p)
         : m_xDlg(std::move(p))
     {
     }
@@ -116,7 +128,6 @@ public:
     virtual void          SetText( const OUString& rStr ) override;
 };
 
-
 class CuiAbstractTabDialog_Impl : public SfxAbstractTabDialog
 {
     DECL_ABSTDLG_BASE(CuiAbstractTabDialog_Impl,SfxTabDialog)
@@ -737,7 +748,7 @@ public:
                             SfxBindings* pBindings,
                             svx::SpellDialogChildWindow* pSpellChildWindow ) override;
 
-    virtual VclPtr<VclAbstractRefreshableDialog> CreateActualizeProgressDialog( vcl::Window* pParent, GalleryTheme* pThm ) override;
+    virtual VclPtr<VclAbstractDialog> CreateActualizeProgressDialog(weld::Window* pParent, GalleryTheme* pThm) override;
     virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) override;
     virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent,
                                             GalleryTheme* pThm) override;
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index cc959a38d2c8..861ade55e9a2 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -143,25 +143,24 @@ public:
     void                SetFile( const INetURLObject& rURL ) { m_xFtTakeFile->set_label(GetReducedString(rURL, 30)); }
 };
 
-class ActualizeProgress : public ModalDialog
+class ActualizeProgress : public weld::GenericDialogController
 {
 private:
-    VclPtr<FixedText>          m_pFtActualizeFile;
-    VclPtr<CancelButton>       m_pBtnCancel;
     Idle*               pIdle;
     GalleryTheme*       pTheme;
     GalleryProgress     aStatusProgress;
+    std::unique_ptr<weld::Label> m_xFtActualizeFile;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
 
-                        DECL_LINK( ClickCancelBtn, Button*, void );
-                        DECL_LINK( TimeoutHdl, Timer*, void );
-                        DECL_LINK( ActualizeHdl, const INetURLObject&, void );
+    DECL_LINK(ClickCancelBtn, weld::Button&, void);
+    DECL_LINK(TimeoutHdl, Timer*, void);
+    DECL_LINK(ActualizeHdl, const INetURLObject&, void);
 
 public:
-                        ActualizeProgress( vcl::Window* pWindow, GalleryTheme* pThm );
-    virtual             ~ActualizeProgress() override;
-    virtual void        dispose() override;
+    ActualizeProgress(weld::Window* pWindow, GalleryTheme* pThm);
+    virtual ~ActualizeProgress() override;
 
-    virtual short       Execute() override;
+    virtual short run() override;
 };
 
 class TitleDialog : public weld::GenericDialogController
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 5ef8b27646f2..206ae24022c8 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -347,8 +347,8 @@ public:
                                             SfxBindings* pBindings,
                                             svx::SpellDialogChildWindow* pSpellChildWindow )=0;
 
-    virtual VclPtr<VclAbstractRefreshableDialog> CreateActualizeProgressDialog( vcl::Window* pParent,
-                                            GalleryTheme* pThm ) = 0;
+    virtual VclPtr<VclAbstractDialog> CreateActualizeProgressDialog(weld::Window* pParent,
+                                            GalleryTheme* pThm) = 0;
     virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent,
                                              const OUString& rOldText) = 0;
     virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent,
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 8da52c30d499..69964a31bbf4 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -341,9 +341,8 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent)
         GalleryTheme*       pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-        ScopedVclPtr<VclAbstractRefreshableDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog( this, pTheme ));
+        ScopedVclPtr<VclAbstractDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog(GetFrameWeld(), pTheme));
 
-        aActualizeProgress->Update();
         aActualizeProgress->Execute();
         mpGallery->ReleaseTheme( pTheme, *this );
     }


More information about the Libreoffice-commits mailing list