sc/source/ui/formdlg/dwfunctr.cxx |    8 ++++++++
 sc/source/ui/inc/dwfunctr.hxx     |    1 +
 2 files changed, 9 insertions(+)

New commits:
commit b21159a74f287acd07c94422eb5cb3375f06c6bc
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Wed Jul 19 15:07:20 2023 +0200
Commit:     Rafael Lima <rafael.palma.l...@gmail.com>
CommitDate: Thu Jul 20 18:29:50 2023 +0200

    tdf#156378 Open function help page on F1 in the Functions sidebar
    
    With this patch, when the user opens the Functions sidebar, select an entry 
and presses F1, the help page about the selected function will be shown.
    
    Change-Id: I37eecc4e325cee7f25ddb1cd81098ca318ce6518
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154617
    Tested-by: Jenkins
    Tested-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/sc/source/ui/formdlg/dwfunctr.cxx 
b/sc/source/ui/formdlg/dwfunctr.cxx
index 438f8fb70e24..8fde50549be1 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -57,6 +57,7 @@ ScFunctionWin::ScFunctionWin(weld::Widget* pParent)
     InitLRUList();
 
     nArgs=0;
+    m_aHelpId = xFuncList->get_help_id();
 
     // Description box has a height of 8 lines of text
     xFiFuncDesc->set_size_request(-1, 8 * xFiFuncDesc->get_text_height());
@@ -176,6 +177,13 @@ void ScFunctionWin::SetDescription()
             *pDesc->mxFuncDesc;
 
         xFiFuncDesc->set_text(aBuf);
+
+        // Update help ID for the selected entry
+        const OUString sHelpId = pDesc->getHelpId();
+        if (!sHelpId.isEmpty())
+            xFuncList->set_help_id(pDesc->getHelpId());
+        else
+            xFuncList->set_help_id(m_aHelpId);
     }
 }
 
diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx
index 9b984b918e11..b6d0d032a857 100644
--- a/sc/source/ui/inc/dwfunctr.hxx
+++ b/sc/source/ui/inc/dwfunctr.hxx
@@ -52,6 +52,7 @@ private:
     std::unique_ptr<EnglishFunctionNameChange> xConfigChange;
     const ScFuncDesc*   pFuncDesc;
     sal_uInt16          nArgs;
+    OUString m_aHelpId;
 
     ::std::vector< const formula::IFunctionDescription*> aLRUList;
 

Reply via email to