From db9f6c44cac246250e89ca4e9aa127dee912d7f5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 23 Apr 2018 10:50:29 +0100 Subject: set SfxTabPage parent dialog explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If7813f9f5e35694312b055cc92868638bc3773d5 Reviewed-on: https://gerrit.libreoffice.org/53326 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- include/sfx2/tabdlg.hxx | 1 + sfx2/source/dialog/tabdlg.cxx | 16 ++++++++++++---- sw/source/ui/envelp/labprt.hxx | 2 +- sw/source/ui/envelp/swuilabimp.hxx | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index e288e07cd8f7..9b0aa249c668 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -266,6 +266,7 @@ protected: return static_cast(GetOldItem(rSet, sal_uInt16(nSlot), bDeep)); } SfxTabDialog* GetTabDialog() const; + void SetTabDialog(SfxTabDialog* pDialog); void AddItemConnection( sfx::ItemConnectionBase* pConnection ); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index ff5c508efdf9..f31e12784316 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -52,6 +52,7 @@ struct TabPageImpl { bool mbStandard; sfx::ItemConnectionArray maItemConn; + VclPtr mxDialog; css::uno::Reference< css::frame::XFrame > mxFrame; TabPageImpl() : mbStandard( false ) {} @@ -307,13 +308,20 @@ void SfxTabPage::AddItemConnection( sfx::ItemConnectionBase* pConnection ) pImpl->maItemConn.AddConnection( pConnection ); } +void SfxTabPage::SetTabDialog(SfxTabDialog* pDialog) +{ + pImpl->mxDialog = pDialog; +} + SfxTabDialog* SfxTabPage::GetTabDialog() const { - return dynamic_cast(GetParentDialog()); + return pImpl->mxDialog; } OString SfxTabPage::GetConfigId() const { + if (m_xContainer) + return m_xContainer->get_help_id(); OString sId(GetHelpId()); if (sId.isEmpty() && isLayoutEnabled(this)) sId = GetWindow(GetWindowType::FirstChild)->GetHelpId(); @@ -1127,12 +1135,12 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl, void ) if ( !pTabPage ) { if ( m_pSet ) - pTabPage = (pDataObject->fnCreatePage)( static_cast(pTabCtrl), m_pSet ); + pTabPage = (pDataObject->fnCreatePage)(static_cast(pTabCtrl), m_pSet); else - pTabPage = (pDataObject->fnCreatePage) - ( pTabCtrl, CreateInputItemSet( nId ) ); + pTabPage = (pDataObject->fnCreatePage)(pTabCtrl, CreateInputItemSet(nId)); DBG_ASSERT( nullptr == pDataObject->pTabPage, "create TabPage more than once" ); pDataObject->pTabPage = pTabPage; + pTabPage->SetTabDialog(this); OUString sConfigId = OStringToOUString(pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); if (sConfigId.isEmpty()) diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx index e36ab980e1f4..500f2c40332c 100644 --- a/sw/source/ui/envelp/labprt.hxx +++ b/sw/source/ui/envelp/labprt.hxx @@ -45,7 +45,7 @@ class SwLabPrtPage : public SfxTabPage DECL_LINK( CountHdl, Button *, void ); - SwLabDlg* GetParentSwLabDlg() {return static_cast(GetParentDialog());} + SwLabDlg* GetParentSwLabDlg() {return static_cast(GetTabDialog());} using TabPage::ActivatePage; using TabPage::DeactivatePage; diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index 09e4dcc96b12..b63c30df324f 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -72,7 +72,7 @@ public: virtual bool FillItemSet(SfxItemSet* rSet) override; virtual void Reset(const SfxItemSet* rSet) override; - SwLabDlg* GetParentSwLabDlg() {return static_cast(GetParentDialog());} + SwLabDlg* GetParentSwLabDlg() {return static_cast(GetTabDialog());} void SetToBusinessCard(); -- cgit