summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-22 15:46:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-23 11:22:09 +0100
commit259e17500748e2b43197bc3a96c6b0ede7e723b1 (patch)
treeef59d60da61e27c04240b17e73b7a8bf0b2a6649
parentd3f425c85d4664069f5b7e5d380a407631070da7 (diff)
tdf#141166 widget with id "tabcontrol" might not be a TabControl
it might be a VerticalTabControl or any other type Change-Id: I9f46f7e64a9be2487d400cc4a066575c0d45c19e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112801 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 24d11d2d0855eba28328bcefe71e923277b0aaf3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112808 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/app/salvtables.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index b6e808ac9cc2..317770c367c3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6877,9 +6877,21 @@ std::unique_ptr<weld::SizeGroup> SalInstanceBuilder::create_size_group()
OString SalInstanceBuilder::get_current_page_help_id() const
{
- TabControl* pCtrl = m_xBuilder->get<TabControl>("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<vcl::Window> xTabPage;
+ if (pCtrl->GetType() == WindowType::TABCONTROL)
+ {
+ TabControl* pTabCtrl = static_cast<TabControl*>(pCtrl);
+ xTabPage = pTabCtrl->GetTabPage(pTabCtrl->GetCurPageId());
+ }
+ else if (pCtrl->GetType() == WindowType::VERTICALTABCONTROL)
+ {
+ VerticalTabControl* pTabCtrl = static_cast<VerticalTabControl*>(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();