summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docredln.cxx
diff options
context:
space:
mode:
authorAttila Szűcs <attila.szucs@collabora.com>2023-08-28 07:40:20 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-14 11:55:27 +0200
commit52fa7aed48632166e064e6a227e034f0981c4205 (patch)
tree7980950d1b52c59f142a8b6f23f378acba0c4c65 /sw/source/core/doc/docredln.cxx
parentc72d5d787f7a3024f2108d6d6e192b158fb144ed (diff)
tdf#157662 SW: redline: accept/reject done for all parts
Tracked changes divided into smaller parts when they are overlapping. But if the Author, and Change time, and some more is equal, then they can be combined into 1 change later.. Modified AcceptRedline / RejectRedline, to seek for all these parts that are neightbour to each other, and can be combined, and reject/accept them all at once. Even those that are deepen in the tree. i.e.: insert that have a delete redline too. when rejecting an insert redline, that have a delete redline too, the delete redline is accepted instead. (have the same result.) when accepting an insert redline, that have a delete redline too, The delete redline remains, while the insert is deleted. (=accepted) made some limitations to lessen the probability of regression: No anonym, No table, No seqNo, and dont use it in RejectAll/AcceptAll Added unittest to check that accept/reject handle more redlines at once, but not too many.. Change-Id: Ibd0a39f7847b22b279a797babb30ba162e70a513 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157950 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw/source/core/doc/docredln.cxx')
-rw-r--r--sw/source/core/doc/docredln.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 205e532712eb..50c259faee6b 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1109,6 +1109,20 @@ bool SwRedlineData::CanCombine(const SwRedlineData& rCmp) const
*m_pExtraData == *rCmp.m_pExtraData ));
}
+// Check if we could/should accept/reject the 2 redlineData at the same time.
+// No need to check its childs equality
+bool SwRedlineData::CanCombineForAcceptReject(const SwRedlineData& rCmp) const
+{
+ return m_nAuthor == rCmp.m_nAuthor &&
+ m_eType == rCmp.m_eType &&
+ m_sComment == rCmp.m_sComment &&
+ deltaOneMinute(GetTimeStamp(), rCmp.GetTimeStamp()) &&
+ m_bMoved == rCmp.m_bMoved &&
+ (( !m_pExtraData && !rCmp.m_pExtraData ) ||
+ ( m_pExtraData && rCmp.m_pExtraData &&
+ *m_pExtraData == *rCmp.m_pExtraData ));
+}
+
/// ExtraData is copied. The Pointer's ownership is thus NOT transferred
/// to the Redline Object!
void SwRedlineData::SetExtraData( const SwRedlineExtraData* pData )
@@ -1981,6 +1995,27 @@ bool SwRangeRedline::PopData()
return true;
}
+bool SwRangeRedline::PopAllDataAfter(int depth)
+{
+ assert(depth > 0);
+ SwRedlineData* pCur = m_pRedlineData;
+ while (depth > 1)
+ {
+ pCur = pCur->m_pNext;
+ if (!pCur)
+ return false;
+ depth--;
+ }
+
+ while (pCur->m_pNext)
+ {
+ SwRedlineData* pToDelete = pCur->m_pNext;
+ pCur->m_pNext = pToDelete->m_pNext;
+ delete pToDelete;
+ }
+ return true;
+}
+
sal_uInt16 SwRangeRedline::GetStackCount() const
{
sal_uInt16 nRet = 1;