summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-03-05 17:09:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-03-06 09:54:33 +0100
commit5e76c9c02a9991a4a89f43975607f58b36b4d663 (patch)
tree93cf3977ab38d8d8943d4aaf459428d262c6419c /sc
parentddbad5612e4322665bc70f4a026e5b052bcaf344 (diff)
tdf#131157 problems dragging and dropping from calc navigator
Change-Id: I40f05704248c43c30d479d42932adfd594391a60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90052 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/navipi/content.cxx21
-rw-r--r--sc/uiconfig/scalc/ui/navigatorpanel.ui1
2 files changed, 14 insertions, 8 deletions
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index d1b66b8f6f34..49558c8c19b1 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1117,7 +1117,7 @@ static bool lcl_GetRange( const ScDocument* pDoc, ScContentId nType, const OUStr
return bFound;
}
-static bool lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScContentId nType, vcl::Window* pWin )
+static bool lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScContentId nType, weld::TreeView& rTreeView )
{
bool bDisallow = true;
@@ -1150,7 +1150,9 @@ static bool lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo
pTransferObj->SetDragSourceFlags(ScDragSrc::Navigator);
SC_MOD()->SetDragObject( nullptr, pTransferObj.get() );
- pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
+
+ rtl::Reference<TransferDataContainer> xHelper(pTransferObj.get());
+ rTreeView.enable_drag_source(xHelper, DND_ACTION_COPYMOVE | DND_ACTION_LINK);
bDisallow = false;
}
@@ -1159,7 +1161,7 @@ static bool lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo
return bDisallow;
}
-static bool lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDragSrc nFlags, vcl::Window* pWin )
+static bool lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDragSrc nFlags, weld::TreeView& rTreeView )
{
bool bDisallow = true;
@@ -1188,7 +1190,9 @@ static bool lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDra
pTransferObj->SetDragSourceFlags( nFlags );
SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
- pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
+
+ rtl::Reference<TransferDataContainer> xHelper(pTransferObj.get());
+ rTreeView.enable_drag_source(xHelper, DND_ACTION_COPYMOVE | DND_ACTION_LINK);
bDisallow = false;
}
@@ -1312,7 +1316,7 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool)
ScRange aRange;
if ( lcl_GetRange( &rSrcDoc, nType, aText, aRange ) )
{
- bDisallow = lcl_DoDragCells( pSrcShell, aRange, ScDragSrc::Navigator, pParentWindow );
+ bDisallow = lcl_DoDragCells( pSrcShell, aRange, ScDragSrc::Navigator, *m_xTreeView );
}
}
else if ( nType == ScContentId::TABLE )
@@ -1321,13 +1325,13 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool)
if ( rSrcDoc.GetTable( aText, nTab ) )
{
ScRange aRange(0, 0, nTab, rSrcDoc.MaxCol(), rSrcDoc.MaxRow(), nTab);
- bDisallow = lcl_DoDragCells( pSrcShell, aRange, (ScDragSrc::Navigator | ScDragSrc::Table), pParentWindow );
+ bDisallow = lcl_DoDragCells( pSrcShell, aRange, (ScDragSrc::Navigator | ScDragSrc::Table), *m_xTreeView );
}
}
else if ( nType == ScContentId::GRAPHIC || nType == ScContentId::OLEOBJECT ||
nType == ScContentId::DRAWING )
{
- bDisallow = lcl_DoDragObject( pSrcShell, aText, nType, pParentWindow );
+ bDisallow = lcl_DoDragObject( pSrcShell, aText, nType, *m_xTreeView );
// during ExecuteDrag the navigator can be deleted
// -> don't access member anymore !!!
@@ -1342,7 +1346,8 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool)
if (!aLinkURL.isEmpty())
m_xTransferObj->SetLinkURL(aLinkURL, aLinkText);
- m_xTransferObj->StartDrag(pParentWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK);
+ rtl::Reference<TransferDataContainer> xHelper(m_xTransferObj.get());
+ m_xTreeView->enable_drag_source(xHelper, DND_ACTION_COPYMOVE | DND_ACTION_LINK);
bDisallow = false;
}
diff --git a/sc/uiconfig/scalc/ui/navigatorpanel.ui b/sc/uiconfig/scalc/ui/navigatorpanel.ui
index 86e9a999682b..2e95d1b29ba3 100644
--- a/sc/uiconfig/scalc/ui/navigatorpanel.ui
+++ b/sc/uiconfig/scalc/ui/navigatorpanel.ui
@@ -292,6 +292,7 @@
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
+ <property name="reorderable">True</property>
<property name="search_column">1</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection1"/>