summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-19 16:47:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-19 19:04:43 +0200
commitbfe3479e99b5f94e5afefb3af88726786857fcb5 (patch)
tree27396b7cc0e7f5e67733117698fe11fb606b772b /sw
parent4701d17bfe785f00958ad58a63dc0ece4c5c3281 (diff)
tdf#119840 reduce lines we need to scan in CompressRedlines
.. to start at the point we modified things. Reduces load time by approx 10% Change-Id: I37214247f0cb7b1246c498aba6c2085bf12a21aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137233 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/IDocumentRedlineAccess.hxx2
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx9
-rw-r--r--sw/source/core/inc/DocumentRedlineManager.hxx2
3 files changed, 8 insertions, 5 deletions
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx
index c627b3508850..24073b25930c 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -174,7 +174,7 @@ public:
/*[in]*/RedlineType nType,
/*[in]*/bool bStartOrEndInRange) const = 0;
- virtual void CompressRedlines() = 0;
+ virtual void CompressRedlines(size_t nStartIndex = 0) = 0;
virtual const SwRangeRedline* GetRedline(
/*[in]*/const SwPosition& rPos,
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 0be71a74c841..a50de37c9738 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1342,6 +1342,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
// look up the first Redline for the starting position
if( !GetRedline( *pStt, &n ) && n )
--n;
+ const SwRedlineTable::size_type nStartPos = n;
bool bDec = false;
for( ; pNewRedl && n < maRedlineTable.size(); bDec ? n : ++n )
@@ -2353,7 +2354,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
}
if( bCompress )
- CompressRedlines();
+ CompressRedlines(nStartPos);
CHECK_REDLINE( *this )
@@ -2446,7 +2447,7 @@ bool DocumentRedlineManager::AppendTableCellRedline( SwTableCellRedline* pNewRed
return nullptr != pNewRedl;
}
-void DocumentRedlineManager::CompressRedlines()
+void DocumentRedlineManager::CompressRedlines(size_t nStartIndex)
{
CHECK_REDLINE( *this )
@@ -2458,7 +2459,9 @@ void DocumentRedlineManager::CompressRedlines()
pFnc = &SwRangeRedline::Hide;
// Try to merge identical ones
- for( SwRedlineTable::size_type n = 1; n < maRedlineTable.size(); ++n )
+ if (nStartIndex == 0)
+ nStartIndex = 1;
+ for( SwRedlineTable::size_type n = nStartIndex; n < maRedlineTable.size(); ++n )
{
SwRangeRedline* pPrev = maRedlineTable[ n-1 ],
* pCur = maRedlineTable[ n ];
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx
index 478332bbd8ef..a3644f4aea9e 100644
--- a/sw/source/core/inc/DocumentRedlineManager.hxx
+++ b/sw/source/core/inc/DocumentRedlineManager.hxx
@@ -79,7 +79,7 @@ public:
/*[in]*/RedlineType nType,
/*[in]*/bool bStartOrEndInRange) const override;
- virtual void CompressRedlines() override;
+ virtual void CompressRedlines(size_t nStartIdx = 0) override;
virtual const SwRangeRedline* GetRedline(
/*[in]*/const SwPosition& rPos,