summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2014-01-20 14:11:17 +0000
committerAndre Fischer <af@apache.org>2014-01-20 14:11:17 +0000
commit3551c988e2757394dadce776515fccdef78f0214 (patch)
treeaea2b57baa9746346fda2ed7caf84d4a27b25e81 /sc
parent5c6ef989906c6aa51b2e3702bac0323ef97e9f2d (diff)
124033: Made the update of maColManualBreaks 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 544a2653b802..5b96472f44b6 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -267,18 +267,24 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
if (!maColManualBreaks.empty())
{
- std::set<SCCOL>::reverse_iterator rit = maColManualBreaks.rbegin();
- while (rit != maColManualBreaks.rend())
+ std::vector<SCCOL> aUpdatedBreaks;
+
+ while ( ! maColManualBreaks.empty())
{
- SCCOL nCol = *rit;
- if (nCol < nStartCol)
- break; // while
- else
- {
- maColManualBreaks.erase( (++rit).base());
- maColManualBreaks.insert( static_cast<SCCOL>( nCol + nSize));
- }
+ std::set<SCCOL>::iterator aLast (--maColManualBreaks.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<SCCOL>(*aLast + nSize));
+ maColManualBreaks.erase(aLast);
}
+
+ // Insert the updated break locations.
+ if ( ! aUpdatedBreaks.empty())
+ maColManualBreaks.insert(aUpdatedBreaks.begin(), aUpdatedBreaks.end());
}
}