summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2014-01-16 09:54:36 +0000
committerAndre Fischer <af@apache.org>2014-01-16 09:54:36 +0000
commit1ae5f9052eb3d60d644533a0581cd3db39218455 (patch)
treec41ce44853af5b80b3f6ba9f50a5c0950f1436a1 /sc
parent641aa4b583e27369b404584d094e0758a93ce5b5 (diff)
123166: Made the update of maRowManualBreaks more conservative.
Notes
Notes: ignore: fixed
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/table2.cxx26
1 files changed, 16 insertions, 10 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 114c384c5b98..544a2653b802 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -155,18 +155,24 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
if (!maRowManualBreaks.empty())
{
- std::set<SCROW>::reverse_iterator rit = maRowManualBreaks.rbegin();
- while (rit != maRowManualBreaks.rend())
+ std::vector<SCROW> aUpdatedBreaks;
+
+ while ( ! maRowManualBreaks.empty())
{
- SCROW nRow = *rit;
- if (nRow < nStartRow)
- break; // while
- else
- {
- maRowManualBreaks.erase( (++rit).base());
- maRowManualBreaks.insert( static_cast<SCROW>( nRow + nSize));
- }
+ std::set<SCROW>::iterator aLast (--maRowManualBreaks.end());
+
+ // Check if there are more entries that have to be processed.
+ if (*aLast < nStartRow)
+ break;
+
+ // Remember the updated break location and erase the entry.
+ aUpdatedBreaks.push_back(static_cast<SCROW>(*aLast + nSize));
+ maRowManualBreaks.erase(aLast);
}
+
+ // Insert the updated break locations.
+ if ( ! aUpdatedBreaks.empty())
+ maRowManualBreaks.insert(aUpdatedBreaks.begin(), aUpdatedBreaks.end());
}
}