extensions/source/propctrlr/browserline.cxx | 1 extensions/source/propctrlr/browserline.hxx | 2 - extensions/source/propctrlr/browserlistbox.cxx | 1 extensions/source/propctrlr/browserlistbox.hxx | 2 - extensions/source/propctrlr/commoncontrol.cxx | 1 extensions/source/propctrlr/inspectorhelpwindow.hxx | 2 - extensions/source/propctrlr/standardcontrol.cxx | 3 -- extensions/source/propctrlr/usercontrol.hxx | 1 include/vcl/treelistbox.hxx | 2 + include/vcl/weld.hxx | 8 +++++++ vcl/source/app/salvtables.cxx | 19 +++++++++++++++++ vcl/source/treelist/treelistbox.cxx | 9 ++++++-- vcl/unx/gtk3/gtk3gtkinst.cxx | 22 ++++++++++++++++++++ 13 files changed, 58 insertions(+), 15 deletions(-)
New commits: commit 6303f8ac291233b1f6888a8d71e769debe0f9fb0 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Thu Dec 5 12:14:37 2019 -0900 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Dec 9 13:29:32 2019 +0100 tdf#108458 related: Add tooltip handling to TreeView Supports GtkInstanceTreeView and SalInstanceTreeView Change-Id: I33984f78c26135319531eace2a3e2e2e28712af1 Reviewed-on: https://gerrit.libreoffice.org/84587 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Tested-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx index cb4945a96717..ba088cee8c6f 100644 --- a/include/vcl/treelistbox.hxx +++ b/include/vcl/treelistbox.hxx @@ -200,6 +200,7 @@ class VCL_DLLPUBLIC SvTreeListBox Link<SvTreeListBox*,void> aSelectHdl; Link<SvTreeListBox*,void> aDeselectHdl; Link<const CommandEvent&, bool> aPopupMenuHdl; + Link<const HelpEvent&, void> aTooltipHdl; Image aPrevInsertedExpBmp; Image aPrevInsertedColBmp; @@ -433,6 +434,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&, void>& rLink) { aTooltipHdl = rLink; } virtual void ExpandedHdl(); virtual bool ExpandingHdl(); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index e68d46c420d6..54a72e80c32d 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -730,7 +730,15 @@ protected: return m_aEditingDoneHdl.Call(rIterText); } + Link<const TreeIter&, OUString> m_aQueryTooltipHdl; + OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); } + public: + void connect_query_tooltip(const Link<const TreeIter&, OUString>& rLink) + { + m_aQueryTooltipHdl = rLink; + } + virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface, const OUString* pExpanderName, bool bChildrenOnDemand, TreeIter* pRet) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 844281cb806e..e26a6a3713fe 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3469,6 +3469,7 @@ private: DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void); DECL_LINK(CompareHdl, const SvSortData&, sal_Int32); DECL_LINK(PopupMenuHdl, const CommandEvent&, bool); + DECL_LINK(TooltipHdl, const HelpEvent&, void); bool IsDummyEntry(SvTreeListEntry* pEntry) const { @@ -3490,6 +3491,7 @@ public: m_xTreeView->SetDoubleClickHdl(LINK(this, SalInstanceTreeView, DoubleClickHdl)); m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl)); m_xTreeView->SetPopupMenuHdl(LINK(this, SalInstanceTreeView, PopupMenuHdl)); + m_xTreeView->SetTooltipHdl(LINK(this, SalInstanceTreeView, TooltipHdl)); const long aTabPositions[] = { 0 }; m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions); LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()); @@ -4625,9 +4627,26 @@ public: m_xTreeView->SetSelectHdl(Link<SvTreeListBox*, void>()); m_xTreeView->SetDeselectHdl(Link<SvTreeListBox*, void>()); m_xTreeView->SetScrolledHdl(Link<SvTreeListBox*, void>()); + m_xTreeView->SetTooltipHdl(Link<const HelpEvent&, void>()); } }; +IMPL_LINK(SalInstanceTreeView, TooltipHdl, const HelpEvent&, rHEvt, void) +{ + if (notify_events_disabled()) + return; + Point aPos(m_xTreeView->ScreenToOutputPixel(rHEvt.GetMousePosPixel())); + SvTreeListEntry* pEntry = m_xTreeView->GetEntry(aPos); + if (pEntry) + { + SalInstanceTreeIter aIter(pEntry); + OUString aTooltip = signal_query_tooltip(aIter); + 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); + } +} + IMPL_LINK(SalInstanceTreeView, CompareHdl, const SvSortData&, rSortData, sal_Int32) { const SvTreeListEntry* pLHS = rSortData.pLeft; diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index fc73a389bfb2..a192fa7ddb03 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -3322,8 +3322,13 @@ void SvTreeListBox::GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos ) void SvTreeListBox::RequestHelp( const HelpEvent& rHEvt ) { - if( !pImpl->RequestHelp( rHEvt ) ) - Control::RequestHelp( rHEvt ); + if (aTooltipHdl.IsSet()) + aTooltipHdl.Call(rHEvt); + else + { + if( !pImpl->RequestHelp( rHEvt ) ) + Control::RequestHelp( rHEvt ); + } } sal_Int32 SvTreeListBox::DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 5c7b8ae9ac5c..504355c09189 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -8037,6 +8037,7 @@ private: gulong m_nDragDataDeleteignalId; gulong m_nDragGetSignalId; gulong m_nKeyPressSignalId; + gulong m_nQueryTooltipSignalId; ImplSVEvent* m_pChangeEvent; DECL_LINK(async_signal_changed, void*, void); @@ -8521,6 +8522,24 @@ private: return pThis->signal_key_press(pEvent); } + static gboolean signalQueryTooltip(GtkWidget* /*pGtkWidget*/, gint x, gint y, + gboolean keyboard_tip, GtkTooltip *tooltip, + gpointer widget) + { + GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget); + GtkTreeIter iter; + GtkTreeView *pTreeView = pThis->m_pTreeView; + GtkTreeModel *pModel = gtk_tree_view_get_model(pTreeView); + GtkTreePath *pPath = nullptr; + if (!gtk_tree_view_get_tooltip_context(pTreeView, &x, &y, keyboard_tip, &pModel, &pPath, &iter)) + return false; + OUString aTooltip = pThis->signal_query_tooltip(GtkInstanceTreeIter(iter)); + gtk_tooltip_set_text(tooltip, OUStringToOString(aTooltip, RTL_TEXTENCODING_UTF8).getStr()); + gtk_tree_view_set_tooltip_row(pTreeView, tooltip, pPath); + gtk_tree_path_free(pPath); + return true; + } + public: GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership) : GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, bTakeOwnership) @@ -8543,6 +8562,7 @@ public: , m_nDragDataDeleteignalId(0) , m_nDragGetSignalId(0) , m_nKeyPressSignalId(g_signal_connect(pTreeView, "key-press-event", G_CALLBACK(signalKeyPress), this)) + , m_nQueryTooltipSignalId(g_signal_connect(pTreeView, "query-tooltip", G_CALLBACK(signalQueryTooltip), this)) , m_pChangeEvent(nullptr) { m_pColumns = gtk_tree_view_get_columns(m_pTreeView); @@ -10007,6 +10027,8 @@ public: m_aColumnSignalIds.pop_back(); } g_list_free(m_pColumns); + + g_signal_handler_disconnect(m_pTreeView, m_nQueryTooltipSignalId); } }; commit 961c3dd1332901289ee6b67036657d6b8a87c59c Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Dec 8 20:53:12 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Dec 9 13:29:02 2019 +0100 drop some unnecessary includes Change-Id: I9f06ce16f6e40b3e0760469217c56cba2ae22f8d Reviewed-on: https://gerrit.libreoffice.org/84730 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index 6dcd483dc941..9d8d0360ba8e 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -28,7 +28,6 @@ #include <comphelper/string.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> -#include <toolkit/helper/vclunohelper.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx index fb841740ac48..0610f8220faa 100644 --- a/extensions/source/propctrlr/browserline.hxx +++ b/extensions/source/propctrlr/browserline.hxx @@ -21,8 +21,6 @@ #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERLINE_HXX #include <com/sun/star/inspection/XPropertyControl.hpp> -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> #include <vcl/weld.hxx> namespace com { namespace sun { namespace star { namespace inspection { namespace PropertyLineElement diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 11b6ecf178e6..e2b5f82999f6 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -34,7 +34,6 @@ #include <cppuhelper/implbase.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> -#include <vcl/lstbox.hxx> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index 8ebbee9c573f..a250816dd7fb 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -26,8 +26,6 @@ #include <com/sun/star/inspection/XPropertyControl.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> -#include <vcl/scrbar.hxx> -#include <vcl/button.hxx> #include <vcl/weld.hxx> #include <tools/link.hxx> #include <rtl/ref.hxx> diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx index f224349da8ea..b60ecdc8763f 100644 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ b/extensions/source/propctrlr/commoncontrol.cxx @@ -21,7 +21,6 @@ #include "pcrcommon.hxx" #include <tools/debug.hxx> #include <tools/diagnose_ex.h> -#include <vcl/combobox.hxx> namespace pcr diff --git a/extensions/source/propctrlr/inspectorhelpwindow.hxx b/extensions/source/propctrlr/inspectorhelpwindow.hxx index 5c2a672019fe..fb8d15290eff 100644 --- a/extensions/source/propctrlr/inspectorhelpwindow.hxx +++ b/extensions/source/propctrlr/inspectorhelpwindow.hxx @@ -19,9 +19,7 @@ #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_INSPECTORHELPWINDOW_HXX #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_INSPECTORHELPWINDOW_HXX -#include <vcl/fixed.hxx> #include <vcl/weld.hxx> -#include <svtools/svmedit.hxx> namespace pcr { diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 6d2cba9c2ac3..6b5b8519a01d 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -38,18 +38,15 @@ #include <svx/drawitem.hxx> #include <svx/xtable.hxx> -#include <vcl/floatwin.hxx> #include <svtools/svmedit.hxx> #include <svtools/colorcfg.hxx> #include <svl/zforlist.hxx> #include <unotools/syslocale.hxx> #include <unotools/datetime.hxx> #include <i18nlangtag/languagetag.hxx> -#include <vcl/button.hxx> #include <vcl/event.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <vcl/ptrstyle.hxx> #include <cstdlib> #include <limits> diff --git a/extensions/source/propctrlr/usercontrol.hxx b/extensions/source/propctrlr/usercontrol.hxx index a80127311c5a..b13766c1bc82 100644 --- a/extensions/source/propctrlr/usercontrol.hxx +++ b/extensions/source/propctrlr/usercontrol.hxx @@ -21,7 +21,6 @@ #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX #include "commoncontrol.hxx" -#include <vcl/fmtfield.hxx> #include <svtools/fileurlbox.hxx> #include <svl/zforlist.hxx> #include "standardcontrol.hxx" _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits