summaryrefslogtreecommitdiff
path: root/sw/source/uibase/dochdl
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-01-24 17:37:09 +0100
committerLászló Németh <nemeth@numbertext.org>2022-01-25 12:18:23 +0100
commit5e8aa259e48d5602b932353bb146ebb523982cf2 (patch)
tree0549d07d7fa9785487272cf7a29e21b1b87ea187 /sw/source/uibase/dochdl
parent9446b3ccd1240dbd44cbe1f1ccdfca04b61c85af (diff)
tdf#146967 sw table: fix freezing in Hide Changes mode
During change tracking, drag & drop or Cut & Paste a table row resulted freezing in Hide Changes mode. Test: In Hide Changes mode, select a table row by clicking on their left border, and drag & drop or Cut & Paste it in a different table row. Regression from commit 5a1c19624eda0c8b847af0dcee70b82502578ceb. Follow-up to commit 5a1c19624eda0c8b847af0dcee70b82502578ceb tdf#146965 sw track changes: fix tracked table row moving Change-Id: Iab606ce036fedcc70e42638e3ccf804c9dbca064 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128875 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/uibase/dochdl')
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index c3047586acd7..883ada5147b8 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1619,8 +1619,8 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt
bool bResult = SwTransferable::PasteData( rData, rSh, nAction, nActionFlags, nFormat,
nDestination, false, false, nullptr, 0, false, nAnchorType, bIgnoreComments, &aPasteContext );
- // set tracked insertion
- if ( eOld & RedlineFlags::On )
+ // set tracked insertion, if it's not in a drag & drop action
+ if ( !rSh.ActionPend() && ( eOld & RedlineFlags::On) )
{
SvxPrintItem aTracked(RES_PRINT, false);
rSh.GetDoc()->SetRowNotTracked( *rSh.GetCursor(), aTracked );
@@ -3925,6 +3925,11 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
{
bool bTableCol(SelectionType::TableCol & nSelection);
+ ::sw::mark::IMark* pMarkMoveFrom = rSh.SetBookmark(
+ vcl::KeyCode(),
+ OUString(),
+ IDocumentMarkAccess::MarkType::UNO_BOOKMARK );
+
SwUndoId eUndoId = bMove ? SwUndoId::UI_DRAG_AND_MOVE : SwUndoId::UI_DRAG_AND_COPY;
SwRewriter aRewriter;
@@ -3951,11 +3956,27 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
OUString(),
IDocumentMarkAccess::MarkType::UNO_BOOKMARK );
+ // paste rows above/columns before
+ pDispatch->Execute(bTableCol ? FN_TABLE_PASTE_COL_BEFORE : FN_TABLE_PASTE_ROW_BEFORE, SfxCallMode::SYNCHRON);
+
+ // go to the previously inserted table row and set it to tracked insertion
+ rSh.Up(false);
+ SvxPrintItem aTracked(RES_PRINT, false);
+ rSh.GetDoc()->SetRowNotTracked( *rSh.GetCursor(), aTracked );
+
rSrcSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // restore selection...
// delete source rows/columns
if (bMove)
+ {
+ // restore cursor position
+ if (pMarkMoveFrom != nullptr)
+ {
+ rSh.GotoMark( pMarkMoveFrom );
+ rSh.getIDocumentMarkAccess()->deleteMark( pMarkMoveFrom );
+ }
pDispatch->Execute(bTableCol ? FN_TABLE_DELETE_COL : FN_TABLE_DELETE_ROW, SfxCallMode::SYNCHRON);
+ }
// restore cursor position
if (pMark != nullptr)
@@ -3964,12 +3985,6 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
rSh.getIDocumentMarkAccess()->deleteMark( pMark );
}
- // paste rows above/columns before
- pDispatch->Execute(bTableCol ? FN_TABLE_PASTE_COL_BEFORE : FN_TABLE_PASTE_ROW_BEFORE, SfxCallMode::SYNCHRON);
-
- if( rSrcSh.GetDoc() != rSh.GetDoc() )
- rSrcSh.EndUndo();
-
rSh.DestroyCursor();
rSh.EndUndo();
rSh.EndAction();