diff options
author | László Németh <nemeth@numbertext.org> | 2022-01-21 11:13:27 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-01-25 09:51:11 +0100 |
commit | 5a1c19624eda0c8b847af0dcee70b82502578ceb (patch) | |
tree | 54c062c982b950308c25dc047a1016ac29fedd66 /sw/source/uibase/dochdl | |
parent | cd7abd3e2c6bb28ecfeb1acef675280cfe438e3e (diff) |
tdf#146965 sw track changes: fix tracked table row moving
During track changes, drag & drop or Cut & Paste
a table row resulted a nested table in the first cell of
the newly inserted empty table row instead of moving
the original table row.
Test: select a table row by clicking on their left border,
and drag & drop or Cut & Paste it in a different
table row.
Note: This fixes crashing at Redo of tracked table row
insertion, too.
Regression from commit dbc82c02eb24ec1c97c6ee32069771d8deb394f9
"tdf#143358 sw: track insertion of empty table rows".
Change-Id: I9a31cae2c0e6e5e05450336a1e5b8d792035df35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128726
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.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index c70bd679c658..c3047586acd7 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -109,6 +109,7 @@ #include <svx/svditer.hxx> #include <editeng/eeitem.hxx> #include <editeng/fhgtitem.hxx> +#include <editeng/prntitem.hxx> #include <svx/svdpage.hxx> #include <avmedia/mediawindow.hxx> #include <swcrsr.hxx> @@ -1591,6 +1592,12 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt IDocumentMarkAccess::MarkType::UNO_BOOKMARK ); // add a new empty row/column before the actual table row/column and go there + // (without setting the rows to tracked table row insertion here, do that at the end + // to avoid layout problems and unnecessary insertion of dummy characters for empty rows) + RedlineFlags eOld = rSh.GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(); + if ( eOld & RedlineFlags::On ) + rSh.GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOld | RedlineFlags::Ignore ); + const sal_uInt16 nDispatchSlot = bRowMode ? FN_TABLE_INSERT_ROW_BEFORE : FN_TABLE_INSERT_COL_BEFORE; pDispatch->Execute(nDispatchSlot, SfxCallMode::SYNCHRON); pDispatch->Execute(bRowMode ? FN_LINE_UP : FN_CHAR_LEFT, SfxCallMode::SYNCHRON); @@ -1605,10 +1612,20 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt { &aCountItem, &aAfter }); } + if ( eOld & RedlineFlags::On ) + rSh.GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOld ); + // paste rows 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 ) + { + SvxPrintItem aTracked(RES_PRINT, false); + rSh.GetDoc()->SetRowNotTracked( *rSh.GetCursor(), aTracked ); + } + // restore cursor position if (pMark != nullptr) { |