1 |
From 36e158ce7a0effb130936ba4598a193102faa6a1 Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Mon, 19 Jan 2015 12:09:17 +0000 |
4 |
Subject: [PATCH 1/2] if we change the keys we have to resort based on the new |
5 |
keys |
6 |
|
7 |
Change-Id: Ied95c2d1490554d9ba5402c936a9720c8a325771 |
8 |
--- |
9 |
sw/source/core/doc/docredln.cxx | 26 ++++++++++++++++++++++---- |
10 |
1 file changed, 22 insertions(+), 4 deletions(-) |
11 |
|
12 |
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx |
13 |
index 960a15d..b2f1eea 100644 |
14 |
--- a/sw/source/core/doc/docredln.cxx |
15 |
+++ b/sw/source/core/doc/docredln.cxx |
16 |
@@ -1336,6 +1336,8 @@ void SwRangeRedline::MoveFromSection() |
17 |
SwDoc* pDoc = GetDoc(); |
18 |
const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl(); |
19 |
std::vector<SwPosition*> aBeforeArr, aBehindArr; |
20 |
+ typedef std::map<sal_uInt16, SwRangeRedline*> IndexAndRange; |
21 |
+ IndexAndRange aIndexAndRangeMap; |
22 |
sal_uInt16 nMyPos = rTbl.GetPos( this ); |
23 |
OSL_ENSURE( this, "this is not in the array?" ); |
24 |
bool bBreak = false; |
25 |
@@ -1346,12 +1348,16 @@ void SwRangeRedline::MoveFromSection() |
26 |
bBreak = true; |
27 |
if( rTbl[ n ]->GetBound(true) == *GetPoint() ) |
28 |
{ |
29 |
- aBehindArr.push_back( &rTbl[ n ]->GetBound(true) ); |
30 |
+ SwRangeRedline* pRedl = rTbl[n]; |
31 |
+ aBehindArr.push_back(&pRedl->GetBound(true)); |
32 |
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl)); |
33 |
bBreak = false; |
34 |
} |
35 |
if( rTbl[ n ]->GetBound(false) == *GetPoint() ) |
36 |
{ |
37 |
- aBehindArr.push_back( &rTbl[ n ]->GetBound(false) ); |
38 |
+ SwRangeRedline* pRedl = rTbl[n]; |
39 |
+ aBehindArr.push_back(&pRedl->GetBound(false)); |
40 |
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl)); |
41 |
bBreak = false; |
42 |
} |
43 |
} |
44 |
@@ -1361,12 +1367,16 @@ void SwRangeRedline::MoveFromSection() |
45 |
bBreak = true; |
46 |
if( rTbl[ n ]->GetBound(true) == *GetPoint() ) |
47 |
{ |
48 |
- aBeforeArr.push_back( &rTbl[ n ]->GetBound(true) ); |
49 |
+ SwRangeRedline* pRedl = rTbl[n]; |
50 |
+ aBeforeArr.push_back(&pRedl->GetBound(true)); |
51 |
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl)); |
52 |
bBreak = false; |
53 |
} |
54 |
if( rTbl[ n ]->GetBound(false) == *GetPoint() ) |
55 |
{ |
56 |
- aBeforeArr.push_back( &rTbl[ n ]->GetBound(false) ); |
57 |
+ SwRangeRedline* pRedl = rTbl[n]; |
58 |
+ aBeforeArr.push_back(&pRedl->GetBound(false)); |
59 |
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl)); |
60 |
bBreak = false; |
61 |
} |
62 |
} |
63 |
@@ -1420,6 +1430,7 @@ void SwRangeRedline::MoveFromSection() |
64 |
if( pColl && pCNd ) |
65 |
pCNd->ChgFmtColl( pColl ); |
66 |
} |
67 |
+ |
68 |
// #i95771# |
69 |
// Under certain conditions the previous <SwDoc::Move(..)> has already |
70 |
// removed the change tracking section of this <SwRangeRedline> instance from |
71 |
@@ -1440,6 +1451,13 @@ void SwRangeRedline::MoveFromSection() |
72 |
*aBeforeArr[ n ] = *Start(); |
73 |
for( n = 0; n < aBehindArr.size(); ++n ) |
74 |
*aBehindArr[ n ] = *End(); |
75 |
+ SwRedlineTbl& rResortTbl = const_cast<SwRedlineTbl&>(rTbl); |
76 |
+ for (auto& a : aIndexAndRangeMap) |
77 |
+ { |
78 |
+ // re-insert |
79 |
+ rResortTbl.Remove(a.first); |
80 |
+ rResortTbl.Insert(a.second); |
81 |
+ } |
82 |
} |
83 |
else |
84 |
InvalidateRange(); |
85 |
-- |
86 |
1.9.3 |
87 |
|