[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl sc/source vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 30 17:25:10 UTC 2020
include/vcl/salvtables.hxx | 2 ++
include/vcl/weld.hxx | 1 +
sc/source/ui/cctrl/checklistmenu.cxx | 16 ++++++++--------
vcl/source/app/salvtables.cxx | 5 +++++
vcl/unx/gtk3/gtk3gtkinst.cxx | 20 ++++++++++++++++++++
5 files changed, 36 insertions(+), 8 deletions(-)
New commits:
commit 940469ebd970465e59a337c3d2747a7648ed7ce4
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jan 19 17:52:36 2020 +0000
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Nov 30 18:24:30 2020 +0100
add get_row_area for TreeView
Change-Id: I0fa8e3666f6731abb831d0ba62f128614eae261c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87048
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106885
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx
index 0b060ddf56a3..9673ef62c5b5 100644
--- a/include/vcl/salvtables.hxx
+++ b/include/vcl/salvtables.hxx
@@ -1402,6 +1402,8 @@ public:
virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) override;
+ virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override;
+
virtual TreeView* get_drag_source() const override;
void set_show_expanders(bool bShow) override;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 0d5b19aee983..248bbfcd80ed 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1024,6 +1024,7 @@ public:
// for dnd
virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) = 0;
+ virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
// for dragging and dropping between TreeViews, return the active source
virtual TreeView* get_drag_source() const = 0;
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index b905d5a7bba1..ad82d5f8618b 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -277,14 +277,14 @@ void ScCheckListMenuControl::launchSubMenu(bool bSetMenuPos)
if (!mxMenu->get_selected(mxScratchIter.get()))
return;
- // tools::Rectangle aRect = mxMenu->get_row_area(*mxScratchIter);
- // ScCheckListMenuControl& rSubMenuControl = pSubMenu->get_widget();
- // rSubMenuControl.StartPopupMode(aRect, (FloatWinPopupFlags::Right | FloatWinPopupFlags::GrabFocus));
- // if (bSetMenuPos)
- // rSubMenuControl.setSelectedMenuItem(0, false, false); // select menu item after the popup becomes fully visible.
-
- // mxMenu->select(*mxScratchIter);
- // rSubMenuControl.GrabFocus();
+ tools::Rectangle aRect = mxMenu->get_row_area(*mxScratchIter);
+ ScCheckListMenuControl& rSubMenuControl = pSubMenu->get_widget();
+ rSubMenuControl.StartPopupMode(aRect, (FloatWinPopupFlags::Right | FloatWinPopupFlags::GrabFocus));
+ if (bSetMenuPos)
+ rSubMenuControl.setSelectedMenuItem(0, false); // select menu item after the popup becomes fully visible.
+
+ mxMenu->select(*mxScratchIter);
+ rSubMenuControl.GrabFocus();
}
IMPL_LINK_NOARG(ScCheckListMenuControl, PostPopdownHdl, void*, void)
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 822871242a42..8e63bea9c344 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4527,6 +4527,11 @@ bool SalInstanceTreeView::get_dest_row_at_pos(const Point &rPos, weld::TreeIter*
return pTarget != nullptr;
}
+tools::Rectangle SalInstanceTreeView::get_row_area(const weld::TreeIter& rIter) const
+{
+ return m_xTreeView->GetBoundingRect(static_cast<const SalInstanceTreeIter&>(rIter).iter);
+}
+
weld::TreeView* SalInstanceTreeView::get_drag_source() const
{
return g_DragSource;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c3e019b1d048..7729d0ab082b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10232,6 +10232,26 @@ public:
return ret;
}
+ virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override
+ {
+ tools::Rectangle aRet;
+
+ const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
+ GtkTreePath* pPath = gtk_tree_model_get_path(m_pTreeModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
+
+ GdkRectangle aRect;
+ for (GList* pEntry = g_list_last(m_pColumns); pEntry; pEntry = g_list_previous(pEntry))
+ {
+ GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(pEntry->data);
+ gtk_tree_view_get_cell_area(m_pTreeView, pPath, pColumn, &aRect);
+ aRet.Union(tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height));
+ }
+
+ gtk_tree_path_free(pPath);
+
+ return aRet;
+ }
+
virtual void start_editing(const weld::TreeIter& rIter) override
{
GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, m_nTextView));
More information about the Libreoffice-commits
mailing list