diff options
author | László Németh <nemeth@numbertext.org> | 2021-12-21 11:50:19 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-12-22 10:12:16 +0100 |
commit | 631649f233bda500c627719b9e43df3fe08df7c5 (patch) | |
tree | 8cb089ed5dab764e52e751619fd7a5f3c96121ed /sw/source/core/doc | |
parent | 4d30c63bd0652c75cda9c57ef21c4cfe65df184f (diff) |
tdf#146243 sw: fix Undo of accepting table row insertion
Fix Undo of accepting table row insertion to get back
the "false" value of HasTextChangesOnly property and the
associated light blue table row background.
This fixes also the missing update of the table row
background at accepting the table row insertion.
Follow-up to commit 8c028b7e41e3d350d0e67005b16faf0159cc5c12
"tdf#146244 sw: update HasTextChangesOnly in modified rows".
Change-Id: I8e2436b6b7b67f06037481955ff22cdbc2b22dc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127228
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 1edaee2f03bce0efa409c592919458658d0aa751)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127186
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r-- | sw/source/core/doc/DocumentRedlineManager.cxx | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 32ab0a476f6a..69bbf3d7ac67 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -462,7 +462,8 @@ namespace } // at rejection of a deletion in a table, remove the tracking of the table row - void lcl_RemoveTrackingOfTableRow( const SwPosition* pPos ) + // (also at accepting the last redline insertion of a tracked table row insertion) + void lcl_RemoveTrackingOfTableRow( const SwPosition* pPos, bool bRejectDeletion ) { const SwTableBox* pBox = pPos->nNode.GetNode().GetTableBox(); if ( !pBox ) @@ -474,9 +475,21 @@ namespace // table row property "HasTextChangesOnly" is set and its value is false if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() ) { - SvxPrintItem aUnsetTracking(RES_PRINT, true); - SwCursor aCursor( *pPos, nullptr ); - pPos->GetDoc().SetRowNotTracked( aCursor, aUnsetTracking ); + bool bNoMoreInsertion = false; + if ( !bRejectDeletion ) + { + SwRedlineTable::size_type nPos = 0; + SwRedlineTable::size_type nInsert = pLine->UpdateTextChangesOnly(nPos, /*bUpdateProperty=*/false); + + if ( SwRedlineTable::npos == nInsert ) + bNoMoreInsertion = true; + } + if ( bRejectDeletion || bNoMoreInsertion ) + { + SvxPrintItem aUnsetTracking(RES_PRINT, true); + SwCursor aCursor( *pPos, nullptr ); + pPos->GetDoc().SetRowNotTracked( aCursor, aUnsetTracking ); + } } } @@ -535,7 +548,15 @@ namespace case SwComparePosition::Outside: case SwComparePosition::Equal: - rArr.DeleteAndDestroy( rPos-- ); + { + bool bInsert = RedlineType::Insert == pRedl->GetType(); + SwPosition aPos(pRedl->Start()->nNode); + rArr.DeleteAndDestroy( rPos-- ); + + // remove tracking of the table row, if needed + if ( bInsert ) + lcl_RemoveTrackingOfTableRow( &aPos, /*bRejectDelete=*/false ); + } break; default: @@ -766,7 +787,7 @@ namespace pRedl->GetExtraData()->Reject( *pRedl ); // remove tracking of the table row, if needed - lcl_RemoveTrackingOfTableRow( updatePaM.End() ); + lcl_RemoveTrackingOfTableRow( updatePaM.End(), /*bRejectDelete=*/true ); switch( eCmp ) { |