sw/inc/swabstdlg.hxx | 1 sw/source/ui/dialog/swdlgfact.cxx | 1 sw/source/ui/fldui/fldtdlg.cxx | 38 ------------------------------------- sw/source/uibase/app/docsh2.cxx | 4 +-- sw/source/uibase/fldui/fldwrap.cxx | 38 +------------------------------------ sw/source/uibase/inc/chldwrap.hxx | 2 - sw/source/uibase/inc/fldwrap.hxx | 2 - sw/source/uibase/inc/redlndlg.hxx | 2 - sw/source/uibase/misc/redlndlg.cxx | 10 --------- sw/source/uibase/uiview/view1.cxx | 4 +-- sw/source/uibase/uiview/view2.cxx | 4 +-- 11 files changed, 9 insertions(+), 97 deletions(-)
New commits: commit 82572ef097e78afd254136f617ae19748b7b409a Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Apr 28 10:29:30 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Apr 29 12:51:44 2025 +0200 SwChildWinWrapper: simplify code Since SwChildWinWrapper::ReInitDlg doesn't have any parameter, the condition m_pDocSh != GetOldDocShell() is always false. Since commit 9f2a362ed67451cda56f89ad57bcaf2bc809b408 Author: Jens-Heiner Rechtien <h...@openoffice.org> Date: Thu Sep 27 10:49:33 2007 +0000 INTEGRATION: CWS swwarnings (1.4.222); FILE MERGED Change-Id: I2c42e813dce3a9cee067d00b81c488cf61569123 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184707 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 3f4e1cd5b10d..2ae70bae381e 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -337,7 +337,6 @@ protected: virtual ~AbstractSwFieldDlg() override = default; public: virtual void Initialize(SfxChildWinInfo *pInfo) = 0; - virtual void ReInitDlg() = 0; virtual void ActivateDatabasePage() = 0; virtual void ShowReferencePage() = 0; virtual std::shared_ptr<SfxDialogController> GetController() = 0; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 66608b9427b1..772cb26bdd0f 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -699,7 +699,6 @@ public: void SetText(const OUString& rStr) override { m_pDlg->set_title(rStr); } void ShowReferencePage() override { m_pDlg->ShowReferencePage(); } void Initialize(SfxChildWinInfo* pInfo) override { m_pDlg->Initialize(pInfo); } - void ReInitDlg() override { m_pDlg->ReInitDlg(); } void ActivateDatabasePage() override { m_pDlg->ActivateDatabasePage(); } std::shared_ptr<SfxDialogController> GetController() override { return m_pDlg; } }; diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index 8b0d334f19fd..c13f0ab2b6e2 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -171,44 +171,6 @@ IMPL_LINK_NOARG(SwFieldDlg, CancelHdl, weld::Button&, void) Close(); } -// newly initialise dialog after Doc-Switch -void SwFieldDlg::ReInitDlg() -{ - SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current()); - bool bNewMode = (::GetHtmlMode(pDocSh) & HTMLMODE_ON) != 0; - - if (bNewMode != m_bHtmlMode) - { - if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) - { - pViewFrm->GetDispatcher()-> - Execute(FN_INSERT_FIELD, SfxCallMode::ASYNCHRON|SfxCallMode::RECORD); - } - Close(); - } - - SwView* pActiveView = ::GetActiveView(); - if(!pActiveView) - return; - const SwWrtShell& rSh = pActiveView->GetWrtShell(); - GetOKButton().set_sensitive(( !rSh.IsReadOnlyAvailable() - || !rSh.HasReadonlySel()) - && !SwCursorShell::PosInsideInputField(*rSh.GetCursor()->GetPoint())); - - ReInitTabPage(u"document"); - ReInitTabPage(u"variables"); - ReInitTabPage(u"docinfo"); - - if (!m_bHtmlMode) - { - ReInitTabPage(u"ref"); - ReInitTabPage(u"functions"); - ReInitTabPage(u"database"); - } - - m_pChildWin->SetOldDocShell(pDocSh); -} - // newly initialise TabPage after Doc-Switch void SwFieldDlg::ReInitTabPage(std::u16string_view rPageId, bool bOnlyActivate) { diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 5ff3cf8e5c2b..88f54ffcf072 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1474,13 +1474,13 @@ void SwDocShell::UpdateChildWindows() SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(rVFrame. GetChildWindow( SwFieldDlgWrapper::GetChildWindowId() )); if( pWrp ) - pWrp->ReInitDlg( this ); + pWrp->ReInitDlg(); // if necessary newly initialize RedlineDlg SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>(rVFrame. GetChildWindow( SwRedlineAcceptChild::GetChildWindowId() )); if( pRed ) - pRed->ReInitDlg( this ); + pRed->ReInitDlg(); } namespace { diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx index 7ee3078a23fa..cf11acb651d2 100644 --- a/sw/source/uibase/fldui/fldwrap.cxx +++ b/sw/source/uibase/fldui/fldwrap.cxx @@ -43,19 +43,9 @@ IMPL_LINK_NOARG(SwChildWinWrapper, UpdateHdl, Timer *, void) } // newly initialise dialog after Doc switch -bool SwChildWinWrapper::ReInitDlg(SwDocShell *) +void SwChildWinWrapper::ReInitDlg() { - bool bRet = false; - - if (m_pDocSh != GetOldDocShell()) - { - m_aUpdateTimer.Stop(); - bRet = true; // immediate Update - } - else - m_aUpdateTimer.Start(); - - return bRet; + m_aUpdateTimer.Start(); } SfxChildWinInfo SwFieldDlgWrapper::GetInfo() const @@ -75,18 +65,6 @@ SwFieldDlgWrapper::SwFieldDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, m_pDlgInterface->StartExecuteAsync(nullptr); } -// newly initialise dialog after Doc switch -bool SwFieldDlgWrapper::ReInitDlg(SwDocShell *pDocSh) -{ - bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh); - if (bRet) // update immediately, Doc switch - { - m_pDlgInterface->ReInitDlg(); - } - - return bRet; -} - void SwFieldDlgWrapper::ShowReferencePage() { m_pDlgInterface->ShowReferencePage(); @@ -117,16 +95,4 @@ SwFieldDataOnlyDlgWrapper::SwFieldDataOnlyDlgWrapper( vcl::Window* _pParent, sal m_pDlgInterface->Initialize( pInfo ); } -// re-init after doc activation -bool SwFieldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh) -{ - bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh); - if (bRet) // update immediately, Doc switch - { - m_pDlgInterface->ReInitDlg(); - } - - return bRet; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/chldwrap.hxx b/sw/source/uibase/inc/chldwrap.hxx index 7253d7702f83..45323550ac12 100644 --- a/sw/source/uibase/inc/chldwrap.hxx +++ b/sw/source/uibase/inc/chldwrap.hxx @@ -36,7 +36,7 @@ protected: SwChildWinWrapper(vcl::Window *pParentWindow, sal_uInt16 nId); public: - virtual bool ReInitDlg(SwDocShell *pDocSh); + void ReInitDlg(); SwDocShell* GetOldDocShell() { return m_pDocSh; } void SetOldDocShell(SwDocShell *pDcSh) { m_pDocSh = pDcSh; } diff --git a/sw/source/uibase/inc/fldwrap.hxx b/sw/source/uibase/inc/fldwrap.hxx index b696d306113e..3f0621396e54 100644 --- a/sw/source/uibase/inc/fldwrap.hxx +++ b/sw/source/uibase/inc/fldwrap.hxx @@ -35,7 +35,6 @@ public: SFX_DECL_CHILDWINDOW_WITHID(SwFieldDlgWrapper); - virtual bool ReInitDlg(SwDocShell *pDocSh) override; void ShowReferencePage(); }; @@ -49,7 +48,6 @@ public: SFX_DECL_CHILDWINDOW(SwFieldDataOnlyDlgWrapper); - virtual bool ReInitDlg(SwDocShell *pDocSh) override; }; #endif diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index 0d9df16f3b57..2fa697f5630b 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -157,8 +157,6 @@ public: SfxChildWinInfo*); SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild ); - - virtual bool ReInitDlg(SwDocShell *pDocSh) override; }; /// Redline (Manage Changes) panel for the sidebar. diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 3340b4a0444e..2ad441d1c5e7 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -68,16 +68,6 @@ SwRedlineAcceptChild::SwRedlineAcceptChild(vcl::Window* _pParent, xDlg->Initialize(pInfo); } -// newly initialise dialog after document switch -bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh) -{ - bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh); - if (bRet) // update immediately, doc switch! - static_cast<SwModelessRedlineAcceptDlg*>(GetController().get())->Activate(); - - return bRet; -} - SwModelessRedlineAcceptDlg::SwModelessRedlineAcceptDlg( SfxBindings* _pBindings, SwChildWinWrapper* pChild, weld::Window *pParent) : SfxModelessDialogController(_pBindings, pChild, pParent, diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx index e18de9600d58..5d6926941a01 100644 --- a/sw/source/uibase/uiview/view1.cxx +++ b/sw/source/uibase/uiview/view1.cxx @@ -105,13 +105,13 @@ void SwView::Activate(bool bMDIActivate) SfxViewFrame& rVFrame = GetViewFrame(); SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(rVFrame.GetChildWindow(nId)); if (pWrp) - pWrp->ReInitDlg(GetDocShell()); + pWrp->ReInitDlg(); // Initialize RedlineDlg newly if necessary nId = SwRedlineAcceptChild::GetChildWindowId(); SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>(rVFrame.GetChildWindow(nId)); if (pRed) - pRed->ReInitDlg(GetDocShell()); + pRed->ReInitDlg(); // reinit IdxMarkDlg nId = SwInsertIdxMarkWrapper::GetChildWindowId(); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index e9a4a4c0ffe1..f3130d93fb3e 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1202,7 +1202,7 @@ void SwView::Execute(SfxRequest &rReq) SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>( rVFrame.GetChildWindow(nId)); if (pRed) - pRed->ReInitDlg(GetDocShell()); + pRed->ReInitDlg(); } } else @@ -3182,7 +3182,7 @@ IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void ) sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId(); SwRedlineAcceptChild* pRed = static_cast<SwRedlineAcceptChild*>(rVFrame.GetChildWindow( nId )); if ( pRed ) - pRed->ReInitDlg( GetDocShell() ); + pRed->ReInitDlg(); } } }