include/vcl/toolkit/treelistbox.hxx |    6 +++-
 vcl/inc/salvtables.hxx              |    4 +--
 vcl/source/app/salvtables.cxx       |   46 ++++++++----------------------------
 vcl/source/treelist/iconview.cxx    |    4 +++
 vcl/source/treelist/treelistbox.cxx |   18 ++++++++++++--
 5 files changed, 37 insertions(+), 41 deletions(-)

New commits:
commit a44cc9c1e4020b841a8f0009449add916c85a194
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Aug 10 13:05:45 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Aug 12 07:37:23 2022 +0200

    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.kagan...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138109
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 0fdf8a0e469c..38b81e438a65 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -198,7 +198,7 @@ class VCL_DLLPUBLIC SvTreeListBox
     Link<SvTreeListBox*,void>  aSelectHdl;
     Link<SvTreeListBox*,void>  aDeselectHdl;
     Link<const CommandEvent&, bool> aPopupMenuHdl;
-    Link<const HelpEvent&, bool> aTooltipHdl;
+    Link<SvTreeListEntry*, OUString> aTooltipHdl;
     Link<svtree_render_args, void> aCustomRenderHdl;
     Link<svtree_measure_args, Size> aCustomMeasureHdl;
 
@@ -395,6 +395,8 @@ public:
     SvViewDataItem*  GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const 
*);
     const SvViewDataItem*  GetViewDataItem(const SvTreeListEntry*, const 
SvLBoxItem*) const;
 
+    OUString GetEntryTooltip(SvTreeListEntry* pEntry) const { return 
aTooltipHdl.Call(pEntry); }
+
     bool IsInplaceEditingEnabled() const { return bool(nImpFlags & 
SvTreeListBoxFlags::EDT_ENABLED); }
     bool IsEditingActive() const { return bool(nImpFlags & 
SvTreeListBoxFlags::IN_EDT); }
     void EndEditing( bool bCancel = false );
@@ -409,7 +411,7 @@ public:
     void            SetExpandingHdl(const Link<SvTreeListBox*,bool>& 
rNewHdl){aExpandingHdl=rNewHdl;}
     void            SetExpandedHdl(const Link<SvTreeListBox*,void>& 
rNewHdl){aExpandedHdl=rNewHdl;}
     void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { 
aPopupMenuHdl = rLink; }
-    void SetTooltipHdl(const Link<const HelpEvent&, bool>& rLink) { 
aTooltipHdl = rLink; }
+    void SetTooltipHdl(const Link<SvTreeListEntry*, OUString>& rLink) { 
aTooltipHdl = rLink; }
     void SetCustomRenderHdl(const Link<svtree_render_args, void>& rLink) { 
aCustomRenderHdl = rLink; }
     void SetCustomMeasureHdl(const Link<svtree_measure_args, Size>& rLink) { 
aCustomMeasureHdl = rLink; }
 
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 705564665374..46937c161f24 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1385,7 +1385,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);
 
@@ -1749,7 +1749,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 46d51c2c2cee..fccf9a0205f2 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4943,29 +4943,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)
@@ -5319,24 +5307,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 56f41a7bcaff..af245b58fd49 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>
@@ -3309,8 +3310,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 );
commit 570e9316e4f570b4f615da31d7717023dd37e1e1
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Aug 9 20:54:15 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Aug 12 07:37:13 2022 +0200

    jsdialog: dump IconView::GetActivateOnSingleClick
    
    Change-Id: I426c3148ee9ba92f10411ff88fc6a6fad8f0da53
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138064
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 6aa61dc78640113060889ffe69464ef2e8aab5c4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138032
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index 7814810cb7dd..df9dde3ddd87 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -308,6 +308,7 @@ void IconView::DumpAsPropertyTree(tools::JsonWriter& 
rJsonWriter)
 {
     SvTreeListBox::DumpAsPropertyTree(rJsonWriter);
     rJsonWriter.put("type", "iconview");
+    rJsonWriter.put("singleclickactivate", GetActivateOnSingleClick());
     auto aNode = rJsonWriter.startArray("entries");
     lcl_DumpEntryAndSiblings(rJsonWriter, First(), this);
 }

Reply via email to