From 92220638362755f0e776e222fa4e8b79377e75eb Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 22 Mar 2021 15:46:53 +0000 Subject: tdf#141166 widget with id "tabcontrol" might not be a TabControl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it might be a VerticalTabControl or any other type Change-Id: I9f46f7e64a9be2487d400cc4a066575c0d45c19e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112920 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/app/salvtables.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'vcl/source/app/salvtables.cxx') diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9d47a3ec14a2..95de139a53bc 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -7008,9 +7008,21 @@ std::unique_ptr SalInstanceBuilder::create_size_group() OString SalInstanceBuilder::get_current_page_help_id() const { - TabControl* pCtrl = m_xBuilder->get("tabcontrol"); - TabPage* pTabPage = pCtrl ? pCtrl->GetTabPage(pCtrl->GetCurPageId()) : nullptr; - vcl::Window* pTabChild = pTabPage ? pTabPage->GetWindow(GetWindowType::FirstChild) : nullptr; + vcl::Window* pCtrl = m_xBuilder->get("tabcontrol"); + if (!pCtrl) + return OString(); + VclPtr xTabPage; + if (pCtrl->GetType() == WindowType::TABCONTROL) + { + TabControl* pTabCtrl = static_cast(pCtrl); + xTabPage = pTabCtrl->GetTabPage(pTabCtrl->GetCurPageId()); + } + else if (pCtrl->GetType() == WindowType::VERTICALTABCONTROL) + { + VerticalTabControl* pTabCtrl = static_cast(pCtrl); + xTabPage = pTabCtrl->GetPage(pTabCtrl->GetCurPageId()); + } + vcl::Window* pTabChild = xTabPage ? xTabPage->GetWindow(GetWindowType::FirstChild) : nullptr; pTabChild = pTabChild ? pTabChild->GetWindow(GetWindowType::FirstChild) : nullptr; if (pTabChild) return pTabChild->GetHelpId(); -- cgit