[Libreoffice-commits] core.git: include/sfx2 sfx2/source sw/source

Caolán McNamara caolanm at redhat.com
Mon Apr 23 19:45:34 UTC 2018


 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(-)

New commits:
commit db9f6c44cac246250e89ca4e9aa127dee912d7f5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 23 10:50:29 2018 +0100

    set SfxTabPage parent dialog explicitly
    
    Change-Id: If7813f9f5e35694312b055cc92868638bc3773d5
    Reviewed-on: https://gerrit.libreoffice.org/53326
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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<const T*>(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<SfxTabDialog>        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<SfxTabDialog*>(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<vcl::Window*>(pTabCtrl), m_pSet );
+            pTabPage = (pDataObject->fnCreatePage)(static_cast<vcl::Window*>(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<SwLabDlg*>(GetParentDialog());}
+    SwLabDlg* GetParentSwLabDlg() {return static_cast<SwLabDlg*>(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<SwLabDlg*>(GetParentDialog());}
+    SwLabDlg* GetParentSwLabDlg() {return static_cast<SwLabDlg*>(GetTabDialog());}
 
     void    SetToBusinessCard();
 


More information about the Libreoffice-commits mailing list