[Libreoffice-commits] core.git: basctl/source cui/source include/vcl sc/source sd/source sfx2/source sw/source vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 18 14:06:21 UTC 2020


 basctl/source/basicide/moduldlg.cxx             |    4 ++--
 cui/source/customize/SvxToolbarConfigPage.cxx   |    4 ++--
 cui/source/customize/cfg.cxx                    |    4 ++--
 include/vcl/weld.hxx                            |   14 ++++++++++----
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx  |    4 ++--
 sd/source/ui/animations/CustomAnimationList.cxx |    4 ++--
 sd/source/ui/dlg/sdtreelb.cxx                   |    4 ++--
 sfx2/source/dialog/templdlg.cxx                 |    4 ++--
 sw/source/uibase/utlui/content.cxx              |    4 ++--
 sw/source/uibase/utlui/glbltree.cxx             |    4 ++--
 vcl/source/app/salvtables.cxx                   |    4 ++--
 vcl/unx/gtk3/gtk3gtkinst.cxx                    |    6 +++---
 12 files changed, 33 insertions(+), 27 deletions(-)

New commits:
commit 573138efec7fa28a98ba3b0301f6e0a97dac7978
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jun 18 11:53:02 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jun 18 16:05:42 2020 +0200

    distinguish active dnd-operation case from simple query case
    
    Change-Id: I1d8e95e46b45c71c0c83316ab4f19ba85eddcf75
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96598
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 7aeae822a7bb..92c3ee9654ff 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -240,7 +240,7 @@ private:
     {
         // to enable the autoscroll when we're close to the edges
         weld::TreeView& rWidget = m_rTreeView.get_widget();
-        rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+        rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
 
         weld::TreeView* pSource = rWidget.get_drag_source();
         if (!pSource)
@@ -291,7 +291,7 @@ private:
             return DND_ACTION_NONE;
 
         std::unique_ptr<weld::TreeIter> xEntry(rWidget.make_iterator());
-        bool bEntry = rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xEntry.get());
+        bool bEntry = rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xEntry.get(), true);
 
         // don't drop on a BasicManager (nDepth == 0)
         sal_uInt16 nDepth = bEntry ? m_rTreeView.get_iter_depth(*xEntry) : 0;
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 87f0b5eb952d..57d1baa0268b 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -877,7 +877,7 @@ IMPL_LINK( SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCE
 
     // Select clicked entry
     std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
-    rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get());
+    rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false);
     rTreeView.select(*xIter);
     SelectToolbarEntry( rTreeView );
 
@@ -922,7 +922,7 @@ IMPL_LINK( SvxToolbarConfigPage, FunctionContextMenuHdl, const CommandEvent&, rC
 
     // Select clicked entry
     std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
-    rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get());
+    rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false);
     rTreeView.select(*xIter);
     SelectFunctionHdl( rTreeView );
     std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) );
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 05fc63f442d6..94ed598c1bf3 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3172,7 +3172,7 @@ SvxConfigPageFunctionDropTarget::SvxConfigPageFunctionDropTarget(SvxConfigPage&r
 sal_Int8 SvxConfigPageFunctionDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
 {
     // to enable the autoscroll when we're close to the edges
-    m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+    m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
     return DND_ACTION_MOVE;
 }
 
@@ -3189,7 +3189,7 @@ sal_Int8 SvxConfigPageFunctionDropTarget::ExecuteDrop( const ExecuteDropEvent& r
 
     std::unique_ptr<weld::TreeIter> xTarget(m_rTreeView.make_iterator());
     int nTargetPos = -1;
-    if (m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
+    if (m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get(), true))
         nTargetPos = m_rTreeView.get_iter_index_in_parent(*xTarget);
     m_rTreeView.move_subtree(*xSource, nullptr, nTargetPos);
 
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index f3fc52a9db3a..dc73addd0c10 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1178,10 +1178,16 @@ public:
     // call set_column_custom_renderer after setting custom callbacks
     virtual void set_column_custom_renderer(int nColumn, bool bEnable) = 0;
 
-    // for dnd
-    virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult,
-                                     bool bHighLightTarget = true)
-        = 0;
+    /* with bDnDMode false simply return the row under the point
+     *
+     * with bDnDMode true:
+     * a) return the row which should be dropped on, which may
+     *    be different from the row the mouse is over in some backends where
+     *    positioning the mouse on the bottom half of a row indicates to drop
+     *    after the row
+     * b) dnd highlight the dest row
+     */
+    virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode) = 0;
     virtual void unset_drag_dest_row() = 0;
     virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
     // for dragging and dropping between TreeViews, return the active source
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index c80b64b4a5c6..6cc8efc6d5be 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -42,7 +42,7 @@ sal_Int8 ScPivotLayoutTreeDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
 {
     // to enable the autoscroll when we're close to the edges
     weld::TreeView& rWidget = m_rTreeView.get_widget();
-    rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+    rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
     return DND_ACTION_MOVE;
 }
 
@@ -55,7 +55,7 @@ sal_Int8 ScPivotLayoutTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt
 
     std::unique_ptr<weld::TreeIter> xTarget(rWidget.make_iterator());
     int nTargetPos = -1;
-    if (rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
+    if (rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get(), true))
         nTargetPos = rWidget.get_iter_index_in_parent(*xTarget);
     m_rTreeView.InsertEntryForSourceTarget(*pSource, nTargetPos);
     rWidget.unset_drag_dest_row();
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 0e2762ce762e..66a8f3cad4df 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -455,7 +455,7 @@ sal_Int8 CustomAnimationListDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
     {
         // to enable the autoscroll when we're close to the edges
         weld::TreeView& rWidget = m_rTreeView.get_widget();
-        rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+        rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
     }
 
     return nAccept;
@@ -504,7 +504,7 @@ sal_Int8 CustomAnimationList::AcceptDrop( const AcceptDropEvent& rEvt )
 sal_Int8 CustomAnimationList::ExecuteDrop(const ExecuteDropEvent& rEvt)
 {
     std::unique_ptr<weld::TreeIter> xDndEffectInsertBefore(mxTreeView->make_iterator());
-    if (!mxTreeView->get_dest_row_at_pos(rEvt.maPosPixel, xDndEffectInsertBefore.get()))
+    if (!mxTreeView->get_dest_row_at_pos(rEvt.maPosPixel, xDndEffectInsertBefore.get(), true))
         xDndEffectInsertBefore.reset();
 
     const bool bMovingEffect = ( mxDndEffectDragging != nullptr );
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 7bb5f06e5c6f..a9670d472b25 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -470,7 +470,7 @@ sal_Int8 SdPageObjsTLVDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
         return DND_ACTION_NONE;
 
     std::unique_ptr<weld::TreeIter> xTarget(m_rTreeView.make_iterator());
-    if (!m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
+    if (!m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get(), true))
         return DND_ACTION_NONE;
 
     std::unique_ptr<weld::TreeIter> xSource(m_rTreeView.make_iterator());
@@ -507,7 +507,7 @@ sal_Int8 SdPageObjsTLVDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
         return DND_ACTION_NONE;
 
     std::unique_ptr<weld::TreeIter> xTarget(m_rTreeView.make_iterator());
-    if (!m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
+    if (!m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get(), true))
         return DND_ACTION_NONE;
     int nTargetPos = m_rTreeView.get_iter_index_in_parent(*xTarget) + 1;
 
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index a6d88a2ffade..e706d9de3c21 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -131,7 +131,7 @@ sal_Int8 SfxCommonTemplateDialog_Impl::AcceptDrop(const AcceptDropEvent& rEvt, c
 
     // to enable the autoscroll when we're close to the edges
     weld::TreeView* pTreeView = mxTreeBox->get_visible() ? mxTreeBox.get() : mxFmtLb.get();
-    pTreeView->get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+    pTreeView->get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
     return DND_ACTION_MOVE;
 }
 
@@ -187,7 +187,7 @@ sal_Int8 SfxCommonTemplateDialog_Impl::ExecuteDrop(const ExecuteDropEvent& rEvt)
         return DND_ACTION_NONE;
 
     std::unique_ptr<weld::TreeIter> xTarget(mxTreeBox->make_iterator());
-    if (!mxTreeBox->get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
+    if (!mxTreeBox->get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get(), true))
     {
         // if nothing under the mouse, use the last row
         int nChildren = mxTreeBox->n_children();
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index cf8959e687a8..3e1f7bab5d39 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -987,7 +987,7 @@ sal_Int8 SwContentTreeDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
     {
         // to enable the autoscroll when we're close to the edges
         weld::TreeView& rWidget = m_rTreeView.get_widget();
-        rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+        rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
     }
 
     return nAccept;
@@ -1034,7 +1034,7 @@ sal_Int8 SwContentTreeDropTarget::ExecuteDrop(const ExecuteDropEvent& rEvt)
 sal_Int8 SwContentTree::ExecuteDrop(const ExecuteDropEvent& rEvt)
 {
     std::unique_ptr<weld::TreeIter> xDropEntry(m_xTreeView->make_iterator());
-    if (!m_xTreeView->get_dest_row_at_pos(rEvt.maPosPixel, xDropEntry.get()))
+    if (!m_xTreeView->get_dest_row_at_pos(rEvt.maPosPixel, xDropEntry.get(), true))
         xDropEntry.reset();
 
     if (m_nRootType == ContentTypeId::OUTLINE)
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 3261050f3a6c..e1d640caa3f9 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -170,7 +170,7 @@ sal_Int8 SwGlobalTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
 
     weld::TreeView& rWidget = m_rTreeView.get_widget();
     std::unique_ptr<weld::TreeIter> xDropEntry(rWidget.make_iterator());
-    if (!rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xDropEntry.get()))
+    if (!rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xDropEntry.get(), true))
         xDropEntry.reset();
 
     if (rWidget.get_drag_source() == &rWidget)  // internal drag
@@ -234,7 +234,7 @@ sal_Int8 SwGlobalTreeDropTarget::AcceptDrop( const AcceptDropEvent& rEvt )
 {
     // to enable the autoscroll when we're close to the edges
     weld::TreeView& rWidget = m_rTreeView.get_widget();
-    rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+    rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
 
     sal_Int8 nRet = rEvt.mnAction;
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 8b3677da1c86..18a7bcd246d3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4597,9 +4597,9 @@ public:
 
     SvTabListBox& getTreeView() { return *m_xTreeView; }
 
-    virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bHighLightTarget) override
+    virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode) override
     {
-        LclTabListBox* pTreeView = !bHighLightTarget ? dynamic_cast<LclTabListBox*>(m_xTreeView.get()) : nullptr;
+        LclTabListBox* pTreeView = !bDnDMode ? dynamic_cast<LclTabListBox*>(m_xTreeView.get()) : nullptr;
         SvTreeListEntry* pTarget = pTreeView ? pTreeView->GetTargetAtPoint(rPos, false) : m_xTreeView->GetDropTarget(rPos);
 
         if (pTarget && pResult)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e1c7aa4e7260..01390a5d1fd7 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -11231,7 +11231,7 @@ public:
         weld::TreeView::connect_popup_menu(rLink);
     }
 
-    virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult, bool bHighLightTarget) override
+    virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult, bool bDnDMode) override
     {
         if (rPos.X() < 0 || rPos.Y() < 0)
         {
@@ -11267,7 +11267,7 @@ public:
             path = gtk_tree_path_copy(lastpath);
             pos = GTK_TREE_VIEW_DROP_AFTER;
         }
-        else if (gtk_tree_path_compare(path, lastpath) == 0)
+        else if (bDnDMode && gtk_tree_path_compare(path, lastpath) == 0)
         {
             // if we're on the last entry, see if gtk thinks
             // the drop should be before or after it, and if
@@ -11287,7 +11287,7 @@ public:
             gtk_tree_model_get_iter(pModel, &rGtkIter.iter, path);
         }
 
-        if (m_bInDrag && bHighLightTarget) // bHighLightTarget alone might be sufficient
+        if (m_bInDrag && bDnDMode)
         {
             // highlight the row
             gtk_tree_view_set_drag_dest_row(m_pTreeView, path, pos);


More information about the Libreoffice-commits mailing list