vcl/source/app/salvtables.cxx |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 2c3ec008b349b7fe046758c51152e451372ff89d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Mar 22 15:46:53 2021 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Mon Mar 22 22:08:08 2021 +0100

    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/+/112802
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 758473e5b69c..7a779b297eac 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6641,9 +6641,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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to