sw/inc/helpids.h                   |    6 ++++
 sw/source/uibase/utlui/content.cxx |   49 ++++++++++++++++++++++++++++++-------
 2 files changed, 46 insertions(+), 9 deletions(-)

New commits:
commit 490cf5393d30dd2e9ab201286ef863b3c266a8b4
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Tue Aug 1 02:42:15 2023 +0200
Commit:     Rafael Lima <rafael.palma.l...@gmail.com>
CommitDate: Thu Aug 3 18:15:52 2023 +0200

    tdf#154210 Add help IDs for the Navigator context menu
    
    This patch adds the missing HIDs for all entries in submenus of the context 
menu in the Navigator. The entries in the main level already work.
    
    For this patch to work, the related patch in the "help" repo needs to be 
accepted to create the target HIDs.
    
    Change-Id: Ic5917ce16a1430c6f7031ea6b9eb71a09f52624a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155049
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Rafael Lima <rafael.palma.l...@gmail.com>

diff --git a/sw/inc/helpids.h b/sw/inc/helpids.h
index 6bf90929ab00..cc3b2d791613 100644
--- a/sw/inc/helpids.h
+++ b/sw/inc/helpids.h
@@ -116,6 +116,12 @@ inline constexpr OUStringLiteral HID_TBX_FORMULA_CALC = 
u"SW_HID_TBX_FORMULA_CAL
 inline constexpr OUStringLiteral HID_TBX_FORMULA_CANCEL = 
u"SW_HID_TBX_FORMULA_CANCEL";
 inline constexpr OUStringLiteral HID_TBX_FORMULA_APPLY = 
u"SW_HID_TBX_FORMULA_APPLY";
 
+// Navigator context menu
+inline constexpr OUStringLiteral HID_NAV_OUTLINE_TRACKING = 
u"SW_HID_NAV_OUTLINE_TRACKING";
+inline constexpr OUStringLiteral HID_NAV_OUTLINE_LEVEL = 
u"SW_HID_NAV_OUTLINE_LEVEL";
+inline constexpr OUStringLiteral HID_NAV_DRAG_MODE = u"SW_HID_NAV_DRAG_MODE";
+inline constexpr OUStringLiteral HID_NAV_DISPLAY = u"SW_HID_NAV_DISPLAY";
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index a57df3fd0630..5238dde260b6 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1575,19 +1575,42 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
     
xSubPopOutlineContent->append(OUString::number(SHOW_OUTLINE_CONTENT_VISIBILITY),
                                   
SwResId(STR_OUTLINE_CONTENT_VISIBILITY_SHOW_ALL));
 
+    
xSubPopOutlineContent->set_item_help_id(OUString::number(TOGGLE_OUTLINE_CONTENT_VISIBILITY),
+                                            HID_NAVIGATOR_TREELIST);
+    
xSubPopOutlineContent->set_item_help_id(OUString::number(HIDE_OUTLINE_CONTENT_VISIBILITY),
+                                            HID_NAVIGATOR_TREELIST);
+    
xSubPopOutlineContent->set_item_help_id(OUString::number(SHOW_OUTLINE_CONTENT_VISIBILITY),
+                                            HID_NAVIGATOR_TREELIST);
+
+    // Add entries to the Outline Tracking submenu
+    OUString sId;
     for(int i = 1; i <= 3; ++i)
-        xSubPopOutlineTracking->append_radio(OUString::number(i + 10), 
m_aContextStrings[IDX_STR_OUTLINE_TRACKING + i]);
+    {
+        sId = OUString::number(i + 10);
+        xSubPopOutlineTracking->append_radio(sId, 
m_aContextStrings[IDX_STR_OUTLINE_TRACKING + i]);
+        xSubPopOutlineTracking->set_item_help_id(sId, 
HID_NAV_OUTLINE_TRACKING);
+    }
     xSubPopOutlineTracking->set_active(OUString::number(10 + 
m_nOutlineTracking), true);
 
+    // Add entries to the Outline Level submenu
     for (int i = 1; i <= MAXLEVEL; ++i)
-        xSubPop1->append_radio(OUString::number(i + 100), OUString::number(i));
+    {
+        sId = OUString::number(i + 100);
+        xSubPop1->append_radio(sId, OUString::number(i));
+        xSubPop1->set_item_help_id(sId, HID_NAV_OUTLINE_LEVEL);
+    }
     xSubPop1->set_active(OUString::number(100 + m_nOutlineLevel), true);
 
+    // Add entries to the Drag Mode submenu
     for (int i=0; i < 3; ++i)
-        xSubPop2->append_radio(OUString::number(i + 201), 
m_aContextStrings[IDX_STR_HYPERLINK + i]);
+    {
+        sId = OUString::number(i + 201);
+        xSubPop2->append_radio(sId, m_aContextStrings[IDX_STR_HYPERLINK + i]);
+        xSubPop2->set_item_help_id(sId, HID_NAV_DRAG_MODE);
+    }
     xSubPop2->set_active(OUString::number(201 + 
static_cast<int>(GetParentWindow()->GetRegionDropMode())), true);
 
-    // Insert the list of the open files
+    // Insert the list of the open files in the Display submenu
     {
     sal_uInt16 nId = 301;
     SwView *pView = SwModule::GetFirstView();
@@ -1596,20 +1619,28 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
         OUString sInsert = pView->GetDocShell()->GetTitle() + " (" +
                 m_aContextStrings[pView == GetActiveView() ? IDX_STR_ACTIVE :
                                                              IDX_STR_INACTIVE] 
+ ")";
-        xSubPop3->append_radio(OUString::number(nId), sInsert);
+        sId = OUString::number(nId);
+        xSubPop3->append_radio(sId, sInsert);
+        xSubPop3->set_item_help_id(sId, HID_NAV_DISPLAY);
         if (State::CONSTANT == m_eState && m_pActiveShell == 
&pView->GetWrtShell())
-            xSubPop3->set_active(OUString::number(nId), true);
+            xSubPop3->set_active(sId, true);
         pView = SwModule::GetNextView(pView);
         nId++;
     }
-    xSubPop3->append_radio(OUString::number(nId++), 
m_aContextStrings[IDX_STR_ACTIVE_VIEW]);
-    if (m_pHiddenShell) // can have only one hidden shell
+    // Active Window
+    sId = OUString::number(nId++);
+    xSubPop3->append_radio(sId, m_aContextStrings[IDX_STR_ACTIVE_VIEW]);
+    xSubPop3->set_item_help_id(sId, HID_NAV_DISPLAY);
+    // There can be only one hidden shell
+    if (m_pHiddenShell)
     {
         OUString sHiddenEntry = 
m_pHiddenShell->GetView().GetDocShell()->GetTitle() +
             " (" +
             m_aContextStrings[IDX_STR_HIDDEN] +
             ")";
-        xSubPop3->append_radio(OUString::number(nId), sHiddenEntry);
+        sId = OUString::number(nId);
+        xSubPop3->append_radio(sId, sHiddenEntry);
+        xSubPop3->set_item_help_id(sId, HID_NAV_DISPLAY);
     }
     if (State::ACTIVE == m_eState)
         xSubPop3->set_active(OUString::number(--nId), true);

Reply via email to