diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-10 13:05:45 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-11 10:43:42 +0200 |
commit | 0b92cf674cd44bdd2c2cdf8a5d597d4407e34002 (patch) | |
tree | cb005be8176b6a3d1ffde3b309d3d09eab31b4dc /vcl/source/treelist | |
parent | cb34b8ad6fb5612411b5364bb0a0d673235c9770 (diff) |
jsdialog: dump tooltips for IconView entries
This required to move the code calling Help::ShowQuickHelp from
weld objects into SvTreeListBox::RequestHelp, and have it only
request the tooltip text from those objects.
Change-Id: I25c97360bbaac4705830a13aa06e0992b68fffff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138084
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source/treelist')
-rw-r--r-- | vcl/source/treelist/iconview.cxx | 3 | ||||
-rw-r--r-- | vcl/source/treelist/treelistbox.cxx | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index df9dde3ddd87..a997009a0296 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -294,6 +294,9 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, SvTreeListE rJsonWriter.put("image", extractPngString(pBmpItem)); } + if (const OUString tooltip = pTabListBox->GetEntryTooltip(pEntry); !tooltip.isEmpty()) + rJsonWriter.put("alt", tooltip); + if (pTabListBox->IsSelected(pEntry)) rJsonWriter.put("selected", "true"); diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index e799de53ff31..e2f54e56a6f7 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -26,6 +26,7 @@ #include <vcl/toolkit/treelistbox.hxx> #include <vcl/accessiblefactory.hxx> #include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <vcl/help.hxx> #include <vcl/svapp.hxx> #include <vcl/builder.hxx> #include <vcl/toolkit/edit.hxx> @@ -3318,8 +3319,21 @@ void SvTreeListBox::GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos ) void SvTreeListBox::RequestHelp( const HelpEvent& rHEvt ) { - if (aTooltipHdl.IsSet() && aTooltipHdl.Call(rHEvt)) - return; + if (aTooltipHdl.IsSet()) + { + const Point pos(ScreenToOutputPixel(rHEvt.GetMousePosPixel())); + if (SvTreeListEntry* entry = GetEntry(pos)) + { + const OUString tooltip = aTooltipHdl.Call(entry); + if (!tooltip.isEmpty()) + { + const Size size(GetOutputSizePixel().Width(), GetEntryHeight()); + tools::Rectangle screenRect(OutputToScreenPixel(GetEntryPosition(entry)), size); + Help::ShowQuickHelp(this, screenRect, tooltip); + return; + } + } + } if( !pImpl->RequestHelp( rHEvt ) ) Control::RequestHelp( rHEvt ); |