cui/source/customize/cfgutil.cxx     |    2 -
 include/sfx2/sfxhelp.hxx             |    3 -
 include/vcl/help.hxx                 |    3 -
 sfx2/source/appl/sfxhelp.cxx         |   67 -----------------------------------
 sfx2/source/dialog/filedlghelper.cxx |    2 -
 svtools/source/control/tabbar.cxx    |    2 -
 vcl/source/app/help.cxx              |    7 ---
 vcl/source/treelist/headbar.cxx      |    2 -
 vcl/source/window/menu.cxx           |    4 +-
 vcl/source/window/status.cxx         |    4 +-
 vcl/source/window/toolbox.cxx        |    4 +-
 11 files changed, 14 insertions(+), 86 deletions(-)

New commits:
commit 33111d134b0703f682687d144a38acdb48717f3b
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Jun 6 20:17:47 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Jun 6 22:34:57 2024 +0200

    the remaining Help::GetHelpText calls don't want their parent as fallback
    
    so we can drop the hierarchical search
    
    these probably do nothing in the absence of the classic help. fpicker
    case might benefit from moving some a11y translations out of help into
    core.
    
    Change-Id: I01b8d0c7cc1a1b3697d3332e330c6b4654e76af1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168507
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index b6873b014396..8646e5146cc5 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -251,7 +251,7 @@ OUString CuiConfigFunctionListBox::GetCommandHelpText()
     {
         if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
         {
-            return Application::GetHelp()->GetHelpText(pData->sCommand, 
static_cast<weld::Widget*>(nullptr));
+            return Application::GetHelp()->GetHelpText(pData->sCommand);
         }
         else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
         {
diff --git a/include/sfx2/sfxhelp.hxx b/include/sfx2/sfxhelp.hxx
index 212188063c53..e9b412fd4ea4 100644
--- a/include/sfx2/sfxhelp.hxx
+++ b/include/sfx2/sfxhelp.hxx
@@ -47,8 +47,7 @@ public:
     SfxHelp();
     virtual ~SfxHelp() override;
 
-    virtual OUString        GetHelpText(const OUString&, const vcl::Window* 
pWindow) override;
-    virtual OUString        GetHelpText(const OUString&, const weld::Widget* 
pWindow) override;
+    virtual OUString        GetHelpText(const OUString&) override;
 
     static OUString         CreateHelpURL( const OUString& aCommandURL, const 
OUString& rModuleName );
     static OUString         GetDefaultHelpModule();
diff --git a/include/vcl/help.hxx b/include/vcl/help.hxx
index 7dc848a42e0c..b4bacc9a476f 100644
--- a/include/vcl/help.hxx
+++ b/include/vcl/help.hxx
@@ -65,10 +65,9 @@ public:
 
     virtual bool        Start(const OUString& rHelpId, weld::Widget* pWidget = 
nullptr);
     virtual void        SearchKeyword( const OUString& rKeyWord );
-    virtual OUString    GetHelpText(const OUString& aHelpURL, const 
weld::Widget* pWidget);
 
     virtual bool        Start(const OUString& rHelpId, const vcl::Window* 
pWindow);
-    virtual OUString    GetHelpText(const OUString& aHelpURL, const 
vcl::Window* pWindow);
+    virtual OUString    GetHelpText(const OUString& aHelpURL);
 
     static void         EnableContextHelp();
     static void         DisableContextHelp();
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index a0babdee399a..f7612c6da0cd 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -580,83 +580,18 @@ static SfxHelpWindow_Impl* impl_createHelp(Reference< 
XFrame2 >& rHelpTask   ,
     return pHelpWindow;
 }
 
-OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* 
pWindow )
+OUString SfxHelp::GetHelpText(const OUString& aCommandURL)
 {
     OUString sModuleName = GetHelpModuleName_Impl(aCommandURL);
     auto aProperties = 
vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, 
getCurrentModuleIdentifier_Impl());
     OUString sRealCommand = 
vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties);
     OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? 
aCommandURL : sRealCommand, sModuleName );
 
-    OUString aNewHelpId;
-
-    if (pWindow && sHelpText.isEmpty())
-    {
-        // no help text found -> try with parent help id.
-        vcl::Window* pParent = pWindow->GetParent();
-        while ( pParent )
-        {
-            aNewHelpId = pParent->GetHelpId();
-            sHelpText = SfxHelp_Impl::GetHelpText( aNewHelpId, sModuleName );
-            if (!sHelpText.isEmpty())
-                pParent = nullptr;
-            else
-                pParent = pParent->GetParent();
-        }
-
-        if (bIsDebug && sHelpText.isEmpty())
-            aNewHelpId.clear();
-    }
-
-    // add some debug information?
-    if ( bIsDebug )
-    {
-        sHelpText += "
-------------
" +
-            sModuleName + ": " + aCommandURL;
-        if ( !aNewHelpId.isEmpty() )
-        {
-            sHelpText += " - " + aNewHelpId;
-        }
-    }
-
-    return sHelpText;
-}
-
-OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* 
pWidget)
-{
-    OUString sModuleName = GetHelpModuleName_Impl(aCommandURL);
-    auto aProperties = 
vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, 
getCurrentModuleIdentifier_Impl());
-    OUString sRealCommand = 
vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties);
-    OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? 
aCommandURL : sRealCommand, sModuleName );
-
-    OUString aNewHelpId;
-
-    if (pWidget && sHelpText.isEmpty())
-    {
-        // no help text found -> try with parent help id.
-        std::unique_ptr<weld::Widget> xParent(pWidget->weld_parent());
-        while (xParent)
-        {
-            aNewHelpId = xParent->get_help_id();
-            sHelpText = SfxHelp_Impl::GetHelpText( aNewHelpId, sModuleName );
-            if (!sHelpText.isEmpty())
-                xParent.reset();
-            else
-                xParent = xParent->weld_parent();
-        }
-
-        if (bIsDebug && sHelpText.isEmpty())
-            aNewHelpId.clear();
-    }
-
     // add some debug information?
     if ( bIsDebug )
     {
         sHelpText += "
-------------
" +
             sModuleName + ": " + aCommandURL;
-        if ( !aNewHelpId.isEmpty() )
-        {
-            sHelpText += " - " + aNewHelpId;
-        }
     }
 
     return sHelpText;
diff --git a/sfx2/source/dialog/filedlghelper.cxx 
b/sfx2/source/dialog/filedlghelper.cxx
index 3fa8768b637c..8afdd2f17727 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -274,7 +274,7 @@ OUString FileDialogHelper_Impl::handleHelpRequested( const 
FilePickerEvent& aEve
     OUString aHelpText;
     Help* pHelp = Application::GetHelp();
     if ( pHelp )
-        aHelpText = pHelp->GetHelpText(sHelpId, 
static_cast<weld::Widget*>(nullptr));
+        aHelpText = pHelp->GetHelpText(sHelpId);
     return aHelpText;
 }
 
diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index 2aabd9be3d89..de5d0d4afaf6 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -2251,7 +2251,7 @@ OUString TabBar::GetHelpText(sal_uInt16 nPageId) const
         {
             Help* pHelp = Application::GetHelp();
             if (pHelp)
-                rItem.maHelpText = 
pHelp->GetHelpText(OStringToOUString(rItem.maHelpId, RTL_TEXTENCODING_UTF8), 
this);
+                rItem.maHelpText = 
pHelp->GetHelpText(OStringToOUString(rItem.maHelpId, RTL_TEXTENCODING_UTF8));
         }
 
         return rItem.maHelpText;
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 8788b449bb2d..de5ef8bb0c15 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -64,12 +64,7 @@ void Help::SearchKeyword( const OUString& )
 {
 }
 
-OUString Help::GetHelpText( const OUString&, const vcl::Window* )
-{
-    return OUString();
-}
-
-OUString Help::GetHelpText( const OUString&, const weld::Widget* )
+OUString Help::GetHelpText( const OUString& )
 {
     return OUString();
 }
diff --git a/vcl/source/treelist/headbar.cxx b/vcl/source/treelist/headbar.cxx
index fa17e69ff25d..78b508258e1f 100644
--- a/vcl/source/treelist/headbar.cxx
+++ b/vcl/source/treelist/headbar.cxx
@@ -1240,7 +1240,7 @@ OUString HeaderBar::GetHelpText( sal_uInt16 nItemId ) 
const
         {
             Help* pHelp = Application::GetHelp();
             if ( pHelp )
-                pItem->maHelpText = pHelp->GetHelpText( OStringToOUString( 
pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this );
+                pItem->maHelpText = pHelp->GetHelpText( OStringToOUString( 
pItem->maHelpId, RTL_TEXTENCODING_UTF8 ) );
         }
 
         return pItem->maHelpText;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 3fedfb936bc3..4ce56eb5af4c 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1123,9 +1123,9 @@ OUString Menu::ImplGetHelpText( sal_uInt16 nItemId ) const
         if ( pHelp )
         {
             if (!pData->aCommandStr.isEmpty())
-                pData->aHelpText = pHelp->GetHelpText( pData->aCommandStr, 
static_cast<weld::Widget*>(nullptr) );
+                pData->aHelpText = pHelp->GetHelpText( pData->aCommandStr );
             if (pData->aHelpText.isEmpty() && !pData->aHelpId.isEmpty())
-                pData->aHelpText = pHelp->GetHelpText( pData->aHelpId, 
static_cast<weld::Widget*>(nullptr) );
+                pData->aHelpText = pHelp->GetHelpText( pData->aHelpId );
         }
     }
 
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index b79f58766461..5df8df387bdf 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1304,9 +1304,9 @@ const OUString& StatusBar::GetHelpText( sal_uInt16 
nItemId ) const
         if ( pHelp )
         {
             if ( !pItem->maCommand.isEmpty() )
-                pItem->maHelpText = pHelp->GetHelpText( pItem->maCommand, this 
);
+                pItem->maHelpText = pHelp->GetHelpText( pItem->maCommand );
             if ( pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty() )
-                pItem->maHelpText = pHelp->GetHelpText( pItem->maHelpId, this 
);
+                pItem->maHelpText = pHelp->GetHelpText( pItem->maHelpId );
         }
     }
 
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 272263072a36..61245bf2fdbe 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3601,9 +3601,9 @@ const OUString& ToolBox::ImplGetHelpText( ToolBoxItemId 
nItemId ) const
         if ( pHelp )
         {
             if (DispatchableCommand(pItem->maCommandStr))
-                pItem->maHelpText = pHelp->GetHelpText( pItem->maCommandStr, 
this );
+                pItem->maHelpText = pHelp->GetHelpText( pItem->maCommandStr );
             if ( pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty() )
-                pItem->maHelpText = pHelp->GetHelpText( pItem->maHelpId, this 
);
+                pItem->maHelpText = pHelp->GetHelpText( pItem->maHelpId );
         }
     }
 

Reply via email to