cui/source/factory/dlgfact.cxx | 40 +--------------------------------- cui/source/factory/dlgfact.hxx | 16 ------------- include/svx/svxdlg.hxx | 2 - include/vcl/abstdlg.hxx | 9 ------- include/vcl/dialog.hxx | 3 -- svx/source/gallery2/galbrws1.cxx | 22 +++++++++--------- svx/source/gallery2/galbrws1.hxx | 10 ++++---- sw/inc/swabstdlg.hxx | 2 - sw/source/ui/dbui/mailmergewizard.cxx | 2 - sw/source/ui/dialog/swdlgfact.cxx | 20 +++++------------ sw/source/ui/dialog/swdlgfact.hxx | 6 +---- sw/source/uibase/app/apphdl.cxx | 10 ++++---- vcl/source/window/abstdlg.cxx | 5 ---- vcl/source/window/dialog.cxx | 5 ---- 14 files changed, 36 insertions(+), 116 deletions(-)
New commits: commit c86728655415ea507cb5f8d7f0588014db2d6098 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Oct 31 12:38:56 2018 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Nov 1 11:00:12 2018 +0100 replace VclAbstractDialog2 with VclAbstractDialog and drop Dialog::GetResult as a consequence Change-Id: Id80a9dc1eab1a23daf4489719b3bafec976bb048 Reviewed-on: https://gerrit.libreoffice.org/62700 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 067e91c7657b..ff95f66b2574 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -278,42 +278,6 @@ short AbstractSignSignatureLineDialog_Impl::Execute() IMPL_ABSTDLG_BASE(AbstractScreenshotAnnotationDlg_Impl); -// VclAbstractDialog2_Impl - - -// virtual -VclAbstractDialog2_Impl::~VclAbstractDialog2_Impl() -{ - disposeOnce(); -} - -void VclAbstractDialog2_Impl::dispose() -{ - m_pDlg.disposeAndClear(); - VclAbstractDialog2::dispose(); -} - -// virtual -void VclAbstractDialog2_Impl::StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) -{ - m_aEndDlgHdl = rEndDialogHdl; - m_pDlg->StartExecuteAsync([=](sal_Int32 nResult){ - EndDialogHdl(nResult); - }); -} - -// virtual -sal_Int32 VclAbstractDialog2_Impl::GetResult() -{ - return m_pDlg->GetResult(); -} - -void VclAbstractDialog2_Impl::EndDialogHdl(sal_Int32 /*nResult*/) -{ - m_aEndDlgHdl.Call( *m_pDlg ); - m_aEndDlgHdl = Link<Dialog&,void>(); -} - void CuiAbstractTabDialog_Impl::SetCurPageId( const OString& rName ) { pDlg->SetCurPageId( rName ); @@ -1154,12 +1118,12 @@ VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialo return VclPtr<AbstractGalleryIdDialog_Impl>::Create(o3tl::make_unique<GalleryIdDialog>(pParent, pThm)); } -VclPtr<VclAbstractDialog2> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(vcl::Window* pParent, +VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(vcl::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet) { VclPtrInstance<GalleryThemeProperties> pDlg(pParent, pData, pItemSet); - return VclPtr<VclAbstractDialog2_Impl>::Create( pDlg ); + return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg ); } VclPtr<AbstractURLDlg> AbstractDialogFactory_Impl::CreateURLDialog( vcl::Window* pParent, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index d780da073e28..a662aa09ee07 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -80,20 +80,6 @@ bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) \ return pDlg->StartExecuteAsync(rCtx); \ } -class VclAbstractDialog2_Impl : public VclAbstractDialog2 -{ - ScopedVclPtr<Dialog> m_pDlg; - Link<Dialog&,void> m_aEndDlgHdl; -public: - explicit VclAbstractDialog2_Impl( Dialog* p ) : m_pDlg( p ) {} - virtual ~VclAbstractDialog2_Impl() override; - virtual void dispose() override; - virtual void StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) override; - virtual sal_Int32 GetResult() override; -private: - void EndDialogHdl(sal_Int32 nResult); -}; - class CuiVclAbstractDialog_Impl : public VclAbstractDialog { DECL_ABSTDLG_BASE(CuiVclAbstractDialog_Impl,Dialog) @@ -756,7 +742,7 @@ public: virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) override; virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm) override; - virtual VclPtr<VclAbstractDialog2> CreateGalleryThemePropertiesDialog(vcl::Window* pParent, + virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(vcl::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet) override; virtual VclPtr<AbstractURLDlg> CreateURLDialog( vcl::Window* pParent, diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 5e34bf61d165..97030fefefa1 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -359,7 +359,7 @@ public: const OUString& rOldText) = 0; virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm) = 0; - virtual VclPtr<VclAbstractDialog2> CreateGalleryThemePropertiesDialog(vcl::Window* pParent, + virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(vcl::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet ) = 0; virtual VclPtr<AbstractURLDlg> CreateURLDialog( vcl::Window* pParent, diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index f05fe4c7de2b..53e553af4011 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -79,15 +79,6 @@ public: virtual OString GetScreenshotId() const { return OString(); }; }; -class VCL_DLLPUBLIC VclAbstractDialog2 : public virtual VclReferenceBase -{ -protected: - virtual ~VclAbstractDialog2() override; -public: - virtual void StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) = 0; - virtual sal_Int32 GetResult() = 0; -}; - class VCL_DLLPUBLIC VclAbstractTerminatedDialog : public VclAbstractDialog { protected: diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 8d4c2c6e0ee2..c5a3997566ff 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -138,9 +138,6 @@ public: virtual FactoryFunction GetUITestFactory() const override; - // Dialog::Execute replacement API -public: - long GetResult() const; private: bool ImplStartExecuteModal(); static void ImplEndExecuteModal(); diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index cfb835f2b0b5..e5349d31e02a 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -268,20 +268,20 @@ void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, b if ( bCreateNew ) { - mpThemePropertiesDialog->StartExecuteModal( - LINK( this, GalleryBrowser1, EndNewThemePropertiesDlgHdl ) ); + mpThemePropertiesDialog->StartExecuteAsync([=](sal_Int32 nResult){ + EndNewThemePropertiesDlgHdl(nResult); + }); } else { - mpThemePropertiesDialog->StartExecuteModal( - LINK( this, GalleryBrowser1, EndThemePropertiesDlgHdl ) ); + mpThemePropertiesDialog->StartExecuteAsync([=](sal_Int32 nResult){ + EndThemePropertiesDlgHdl(nResult); + }); } } -void GalleryBrowser1::ImplEndGalleryThemeProperties(bool bCreateNew) +void GalleryBrowser1::ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 nRet) { - long nRet = mpThemePropertiesDialog->GetResult(); - if( nRet == RET_OK ) { OUString aName( mpExchangeData->pTheme->GetName() ); @@ -318,14 +318,14 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties(bool bCreateNew) Application::PostUserEvent( LINK( this, GalleryBrowser1, DestroyThemePropertiesDlgHdl ), nullptr, true ); } -IMPL_LINK( GalleryBrowser1, EndNewThemePropertiesDlgHdl, Dialog&, /*rDialog*/, void ) +void GalleryBrowser1::EndNewThemePropertiesDlgHdl(sal_Int32 nResult) { - ImplEndGalleryThemeProperties(true); + ImplEndGalleryThemeProperties(true, nResult); } -IMPL_LINK( GalleryBrowser1, EndThemePropertiesDlgHdl, Dialog&, /*rDialog*/, void ) +void GalleryBrowser1::EndThemePropertiesDlgHdl(sal_Int32 nResult) { - ImplEndGalleryThemeProperties(false); + ImplEndGalleryThemeProperties(false, nResult); } IMPL_LINK( GalleryBrowser1, DestroyThemePropertiesDlgHdl, void*, /*p*/, void ) diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx index 22b35ef6633d..f0791453ca96 100644 --- a/svx/source/gallery2/galbrws1.hxx +++ b/svx/source/gallery2/galbrws1.hxx @@ -59,7 +59,7 @@ public: class Gallery; class GalleryThemeEntry; class GalleryTheme; -class VclAbstractDialog2; +class VclAbstractDialog; struct ExchangeData; class SfxItemSet; @@ -76,7 +76,7 @@ private: VclPtr<GalleryButton> maNewTheme; VclPtr<GalleryThemeListBox> mpThemes; - VclPtr<VclAbstractDialog2> mpThemePropertiesDialog; // to keep it alive during execution + VclPtr<VclAbstractDialog> mpThemePropertiesDialog; // to keep it alive during execution Gallery* mpGallery; std::unique_ptr<ExchangeData> mpExchangeData; std::unique_ptr<SfxItemSet> mpThemePropsDlgItemSet; @@ -94,7 +94,9 @@ private: void ImplGetExecuteVector(std::vector<OString>& o_aExec); void ImplExecute(const OString &rIdent); void ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew ); - void ImplEndGalleryThemeProperties(bool bCreateNew); + void EndNewThemePropertiesDlgHdl(sal_Int32 nResult); + void EndThemePropertiesDlgHdl(sal_Int32 nResult); + void ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 nResult); // Control virtual void Resize() override; @@ -107,8 +109,6 @@ private: DECL_LINK( SelectThemeHdl, ListBox&, void ); DECL_LINK( ShowContextMenuHdl, void*, void ); DECL_LINK( PopupMenuHdl, Menu*, bool ); - DECL_LINK( EndNewThemePropertiesDlgHdl, Dialog&, void ); - DECL_LINK( EndThemePropertiesDlgHdl, Dialog&, void ); DECL_LINK( DestroyThemePropertiesDlgHdl, void*, void ); public: diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index cf621ad6e89a..642218f530d8 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -344,7 +344,7 @@ public: class SwMailMergeConfigItem; -class AbstractMailMergeWizard : public VclAbstractDialog2 +class AbstractMailMergeWizard : public VclAbstractDialog { protected: virtual ~AbstractMailMergeWizard() override = default; diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx index 5883c910dce0..77535bf54f39 100644 --- a/sw/source/ui/dbui/mailmergewizard.cxx +++ b/sw/source/ui/dbui/mailmergewizard.cxx @@ -245,7 +245,7 @@ short SwMailMergeWizard::Execute() OSL_FAIL("SwMailMergeWizard cannot be executed via Dialog::Execute!\n" "It creates a thread (MailDispatcher instance) that will call" "back to VCL apartment => deadlock!\n" - "Use Dialog::StartExecuteModal to execute the dialog!" ); + "Use Dialog::StartExecuteAsync to execute the dialog!" ); return RET_CANCEL; } diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 39db3b0a1f10..c30b671d3b29 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -721,23 +721,17 @@ void AbstractMailMergeWizard_Impl::dispose() AbstractMailMergeWizard::dispose(); } -void AbstractMailMergeWizard_Impl::StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) +bool AbstractMailMergeWizard_Impl::StartExecuteAsync(AsyncContext &rCtx) { - aEndDlgHdl = rEndDialogHdl; - pDlg->StartExecuteAsync([=](sal_Int32 nResult){ - EndDialogHdl(nResult); - }); + // SwMailMergeWizardExecutor wants to run the lifecycle of this dialog + // so clear mxOwner here and leave it up to SwMailMergeWizardExecutor + rCtx.mxOwner.clear(); + return pDlg->StartExecuteAsync(rCtx); } -sal_Int32 AbstractMailMergeWizard_Impl::GetResult() +short AbstractMailMergeWizard_Impl::Execute() { - return pDlg->GetResult(); -} - -void AbstractMailMergeWizard_Impl::EndDialogHdl(sal_Int32 /*nResult*/) -{ - aEndDlgHdl.Call( *pDlg ); - aEndDlgHdl = Link<Dialog&,void>(); + return pDlg->Execute(); } OUString AbstractMailMergeWizard_Impl::GetReloadDocument() const diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 8f2cf77a04c3..103b04b35a02 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -570,17 +570,15 @@ class SwMailMergeWizard; class AbstractMailMergeWizard_Impl : public AbstractMailMergeWizard { VclPtr<SwMailMergeWizard> pDlg; - Link<Dialog&,void> aEndDlgHdl; - void EndDialogHdl(sal_Int32 nResult); public: explicit AbstractMailMergeWizard_Impl( SwMailMergeWizard* p ) : pDlg(p) {} virtual ~AbstractMailMergeWizard_Impl() override; virtual void dispose() override; - virtual void StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) override; - virtual sal_Int32 GetResult() override; + virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override; + virtual short Execute() override; virtual OUString GetReloadDocument() const override; virtual void ShowPage( sal_uInt16 nLevel ) override; diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 04255a9721c1..2b8520dc8a70 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -331,7 +331,7 @@ class SwMailMergeWizardExecutor : public salhelper::SimpleReferenceObject VclPtr<AbstractMailMergeWizard> m_pWizard; // always owner VclPtr<AbstractMailMergeWizard> m_pWizardToDestroyInCallback; - DECL_LINK( EndDialogHdl, Dialog&, void ); + void EndDialogHdl(sal_Int32 nResponse); DECL_LINK( DestroyDialogHdl, void*, void ); DECL_LINK( DestroyWizardHdl, void*, void ); DECL_LINK( CancelHdl, void*, void ); @@ -455,13 +455,13 @@ void SwMailMergeWizardExecutor::ExecutionFinished() void SwMailMergeWizardExecutor::ExecuteWizard() { - m_pWizard->StartExecuteModal( - LINK( this, SwMailMergeWizardExecutor, EndDialogHdl ) ); + m_pWizard->StartExecuteAsync([=](sal_Int32 nResult){ + EndDialogHdl(nResult); + }); } -IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, Dialog&, void ) +void SwMailMergeWizardExecutor::EndDialogHdl(sal_Int32 nRet) { - long nRet = m_pWizard->GetResult(); sal_uInt16 nRestartPage = m_pWizard->GetRestartPage(); switch ( nRet ) diff --git a/vcl/source/window/abstdlg.cxx b/vcl/source/window/abstdlg.cxx index 0483d789aecb..24ec49ea51d6 100644 --- a/vcl/source/window/abstdlg.cxx +++ b/vcl/source/window/abstdlg.cxx @@ -82,11 +82,6 @@ BitmapEx VclAbstractDialog::createScreenshot() const return BitmapEx(); } -// virtual -VclAbstractDialog2::~VclAbstractDialog2() -{ -} - VclAbstractDialogFactory::~VclAbstractDialogFactory() { } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index d1da54c5d3ed..53ebce93689b 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1130,11 +1130,6 @@ void Dialog::EndDialog( long nResult ) xOwnerDialog.reset(); } -long Dialog::GetResult() const -{ - return mpDialogImpl->mnResult; -} - void Dialog::EndAllDialogs( vcl::Window const * pParent ) { ImplSVData* pSVData = ImplGetSVData(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
