sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 2 - sw/source/core/doc/DocumentRedlineManager.cxx | 30 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
New commits: commit 5c82700800503bfc0e87aa10d64b94c1ac68c393 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Feb 24 16:02:33 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Apr 16 08:48:25 2025 +0200 tdf#165322 sw: GetRedline() binary search doesn't work with overlaps Change-Id: I6d7a271eb96f55abdd6d53a153b277083868109b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182117 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit c5f7619d6eebe478332ae4dcb27fde85df6278a9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182152 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> (cherry picked from commit ea0e5148d0b6f9365ed74b4b8547e5171d7fad43) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184235 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 9a32067ce0d6..3ed622761c5f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1615,7 +1615,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125546) loadAndSave("tdf125546.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // compress redlines (it was 15) - assertXPath(pXmlDoc, "//w:rPrChange"_ostr, 2); + assertXPath(pXmlDoc, "//w:rPrChange"_ostr, 3); } CPPUNIT_TEST_FIXTURE(Test, testLabelWidthAndPosition_Left_FirstLineIndent) diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 2c3a1bb8600c..79410f700ee7 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -3042,6 +3042,36 @@ bool DocumentRedlineManager::HasRedline( const SwPaM& rPam, RedlineType nType, b const SwRangeRedline* DocumentRedlineManager::GetRedline( const SwPosition& rPos, SwRedlineTable::size_type* pFndPos ) const { + if (maRedlineTable.HasOverlappingElements()) + { + for (auto it = maRedlineTable.begin(), itEnd = maRedlineTable.end(); it != itEnd; ++it) + { + auto [pStart, pEnd] = (**it).StartEnd(); + if (rPos < *pStart) + { + if (pFndPos) + { + *pFndPos = std::distance(maRedlineTable.begin(), it); + } + return nullptr; + } + if (pEnd == pStart + ? *pStart == rPos + : (*pStart <= rPos && rPos < *pEnd)) + { + if (pFndPos) + { + *pFndPos = std::distance(maRedlineTable.begin(), it); + } + return *it; + } + } + if (pFndPos) + { + *pFndPos = maRedlineTable.size(); + } + return nullptr; + } SwRedlineTable::size_type nO = maRedlineTable.size(), nM, nU = 0; if( nO > 0 ) {