summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-08-10 13:05:45 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-08-11 10:43:42 +0200
commit0b92cf674cd44bdd2c2cdf8a5d597d4407e34002 (patch)
treecb005be8176b6a3d1ffde3b309d3d09eab31b4dc /vcl
parentcb34b8ad6fb5612411b5364bb0a0d673235c9770 (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')
-rw-r--r--vcl/inc/salvtables.hxx4
-rw-r--r--vcl/source/app/salvtables.cxx46
-rw-r--r--vcl/source/treelist/iconview.cxx3
-rw-r--r--vcl/source/treelist/treelistbox.cxx18
4 files changed, 32 insertions, 39 deletions
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 17084200955a..642eabd49990 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1396,7 +1396,7 @@ protected:
DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
- DECL_LINK(TooltipHdl, const HelpEvent&, bool);
+ DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString);
DECL_LINK(CustomRenderHdl, svtree_render_args, void);
DECL_LINK(CustomMeasureHdl, svtree_measure_args, Size);
@@ -1769,7 +1769,7 @@ private:
DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
DECL_LINK(CommandHdl, const CommandEvent&, bool);
- DECL_LINK(TooltipHdl, const HelpEvent&, bool);
+ DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString);
DECL_LINK(EntryAccessibleDescriptionHdl, SvTreeListEntry*, OUString);
public:
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 39713700bd20..3874e76ab79d 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5214,29 +5214,17 @@ SalInstanceTreeView::~SalInstanceTreeView()
m_xTreeView->SetSelectHdl(Link<SvTreeListBox*, void>());
m_xTreeView->SetDeselectHdl(Link<SvTreeListBox*, void>());
m_xTreeView->SetScrolledHdl(Link<SvTreeListBox*, void>());
- m_xTreeView->SetTooltipHdl(Link<const HelpEvent&, bool>());
+ m_xTreeView->SetTooltipHdl({});
m_xTreeView->SetCustomRenderHdl(Link<svtree_render_args, void>());
m_xTreeView->SetCustomMeasureHdl(Link<svtree_measure_args, Size>());
}
-IMPL_LINK(SalInstanceTreeView, TooltipHdl, const HelpEvent&, rHEvt, bool)
+IMPL_LINK(SalInstanceTreeView, TooltipHdl, SvTreeListEntry*, pEntry, OUString)
{
- if (notify_events_disabled())
- return false;
- Point aPos(m_xTreeView->ScreenToOutputPixel(rHEvt.GetMousePosPixel()));
- SvTreeListEntry* pEntry = m_xTreeView->GetEntry(aPos);
- if (pEntry)
- {
- SalInstanceTreeIter aIter(pEntry);
- OUString aTooltip = signal_query_tooltip(aIter);
- if (aTooltip.isEmpty())
- return false;
- Size aSize(m_xTreeView->GetOutputSizePixel().Width(), m_xTreeView->GetEntryHeight());
- tools::Rectangle aScreenRect(
- m_xTreeView->OutputToScreenPixel(m_xTreeView->GetEntryPosition(pEntry)), aSize);
- Help::ShowQuickHelp(m_xTreeView, aScreenRect, aTooltip);
- }
- return true;
+ if (pEntry && !notify_events_disabled())
+ return signal_query_tooltip(SalInstanceTreeIter(pEntry));
+
+ return {};
}
IMPL_LINK(SalInstanceTreeView, CustomRenderHdl, svtree_render_args, payload, void)
@@ -5590,24 +5578,12 @@ void SalInstanceIconView::insert_separator(int pos, const OUString* /* pId */)
pViewData->SetSelectable(false);
}
-IMPL_LINK(SalInstanceIconView, TooltipHdl, const HelpEvent&, rHEvt, bool)
+IMPL_LINK(SalInstanceIconView, TooltipHdl, SvTreeListEntry*, pEntry, OUString)
{
- if (notify_events_disabled())
- return false;
- Point aPos(m_xIconView->ScreenToOutputPixel(rHEvt.GetMousePosPixel()));
- SvTreeListEntry* pEntry = m_xIconView->GetEntry(aPos);
- if (pEntry)
- {
- SalInstanceTreeIter aIter(pEntry);
- OUString aTooltip = signal_query_tooltip(aIter);
- if (aTooltip.isEmpty())
- return false;
- Size aSize(m_xIconView->GetOutputSizePixel().Width(), m_xIconView->GetEntryHeight());
- tools::Rectangle aScreenRect(
- m_xIconView->OutputToScreenPixel(m_xIconView->GetEntryPosition(pEntry)), aSize);
- Help::ShowQuickHelp(m_xIconView, aScreenRect, aTooltip);
- }
- return true;
+ if (pEntry && !notify_events_disabled())
+ return signal_query_tooltip(SalInstanceTreeIter(pEntry));
+
+ return {};
}
IMPL_LINK(SalInstanceIconView, EntryAccessibleDescriptionHdl, SvTreeListEntry*, pEntry, OUString)
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 );